[R] Assigning Data a name from within another variable?
Kenny Larsen
k.larsen at sheffield.ac.uk
Mon Jun 15 17:50:31 CEST 2009
Hi All,
I have hunted high and low and tried dozens of things but have yet to
achieve the result I require. Below is my code (taken mostly from another
thread on here) thus far:
files<-list.files()
files<-files[grep('.wm4', files)]
labels<-gsub('.wm4', '',files)
for(i in 1:length(files)){
X<-read.table(files[i])
<My problem is here!>
What I am trying to do now is assign the first item in labels in place of X
so the table name will effectively be whatever is written in labels[1]. The
files simply consist of two columns of real numbers. I have tried several
things, such like replacing X with labels[1], but this simply writes the
data in one long column to the first place of labels(which makes sense). How
do I extract what is in labels[1] and set it as the table name?
As always any help is greatly appreciated.
Kenny Larsen
--
View this message in context: http://www.nabble.com/Assigning-Data-a-name-from-within-another-variable--tp24037279p24037279.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list