감동, 마음이 움직이는 것
[R] 본문
script실행하기
https://stackoverflow.com/questions/18306362/run-r-script-from-command-line
Rscript test.R
combining string
https://stackoverflow.com/questions/7201341/how-can-two-strings-be-concatenated
name <- paste("apple", "banana", sep="")
getting argument
https://www.vscentrum.be/cluster-doc/software/r-cla-in-scripts
args <- commandArgs(TRUE)
r <- as.double(args[1])
========== This is my first R script ==========
#library(package) acts like "import" in python and "include" in c
library(ggmuller)
#getting argument
args <- commandArgs(TRUE)
fidx <- args[1]
#read files
fname <- paste("pop", fidx, ".d", sep="")
pop = read.table(fname)
names(pop)[1]<-paste("Generation") //change the name of the data column
names(pop)[2]<-paste("Identity")
names(pop)[3]<-paste("Population")
fname <- paste("tree", fidx, ".d", sep="")
tree = read.table(fname)
names(tree)[1]<-paste("Parent")
names(tree)[2]<-paste("Identity")
#making ggmuller
Muller_df <- get_Muller_df(tree, pop)
Muller_pop_plot(Muller_df)
Important functions:
read.table(fname) : read a file named fname
names(arr) : list of data cols' names
paste(str1, str2, sep="") : return a string connecting str1 and str2 with seperator
'Tips (Utility, Computer Language, and etc.)' 카테고리의 다른 글
[gnuplot] key legend inverse order: set key invert (0) | 2018.09.17 |
---|---|
[R ggmuller package] (0) | 2018.08.23 |
[c++] vector of vector (0) | 2018.08.23 |
[tips for presentation] especially for introduction (0) | 2018.07.18 |
[Latex] table에서 vertical space를 늘리는 방법 (0) | 2018.06.27 |