[R] variable-substitution / command-substitution
Haroldo Stenger
haroldo.stenger at gmail.com
Tue Apr 11 13:52:35 CEST 2006
I don't know wether R does variable substitution. In order to help
solve the problem, I suggest:
- you might use cat in order to concatenate the files (if this fits in
the problem)
- you might write a shell or perl script which would write an .R file
by doing the required looping, given the three variables are pretty
external to the statistical data. The shell or perl procedure would
generate something useful from R language, be it a list of filnames,
over which a R loop could iterate in turn, be it an extensive list of
'read.table("filename_xyz.data")' for every xyz tuple.
Hope this helps
Haroldo
2006/4/11, Damaris Zurell <damaris at zurell.de>:
> Hello,
>
> I have about 2000 data files which I want to analyse.
> The file names are all very similar =>
> p"variable1"_t"variable2"_c"variable3".txt
> There aren´t so much different variables (about 70) , just different
> combinations of them.
> To allow an easy way of handling those data files I was wondering
> whether R is able to do variable-substitution /command-substitution
> similar to shell-programming, so that I could imbed the read.table
> option (and further commands) in 3 loops (one for every variable in the
> filenames) .
>
> e.g.:
> for var1 in (varlist1)
> for var2 in (varlist2)
> for var3 in (varlist3)
> read.table("..../p$var1_t$var2_c$var3.txt")
> ....statistics......
> done
> done
> done
>
>
> Cheers,
> Damaris
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
--
b l o g http://reenunciadosrenunciados.blogspot.com/ b l o g
More information about the R-help
mailing list