r - Passing code parameters through a file "parameters.txt" -
i want make code usable other users. in order want provide file "parameters.txt" in user can change values. i'd insert comments in (such make clearer). has like:
# file of parameters # # here put year want analyze. # can choose: # 1) 2000 # 2) 2001 # 3) 2002 # 4) 2003 year 2004 # here put team want analyze # choose between # 1) "lazio" # 2) "juventus" # 3) "inter" team lazio
when read files don't want take comment. in other words, i'd read lines except ones starting "#".
- is wat pass parameters?
- do know how can take lines i'm interested to?
following advices of mrflick have found solution read.table
:
parameters <- read.table("./parametri.txt", header = false, blank.lines.skip = true, comment.char="#", skip = 12 , skipnul = true , fill=true)
supposing parameters file in current folder.
Comments
Post a Comment