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 "#".

  1. is wat pass parameters?
  2. 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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -