Hi everybody,
I have just thought that it might help if I would provide a sample data
set. I have attached it as a txt file (tab separated).
Here is the modified code to fit this data set.
library(WRS)
file - read.table(file=file.choose(), header=T, sep=\t)
seq.num- c(4,5)#column
For adding the 'names', put the data in a temporary first:
for(i in 1:length(seq.num)) {
k- seq.num[i]
name.num- names(file)[k]
temp - fac2list(file[,k], file[3])
names(temp) - levels(factor(file[[3]]))
assign(paste(names(file)[3], name.num, sep=_), temp)
}
Great, thanks a lot!
But I feel stupid... I didn't think about that easy solution. I wanted
to change the names after...
Anyway, it now works!
Regards, Ivan
Le 2/3/2010 14:22, jim holtman a écrit :
For adding the 'names', put the data in a temporary first:
for(i in 1:length(seq.num)) {
3 matches
Mail list logo