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

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -