Skip to content
Prev 215905 / 398498 Next

Odp: Using a string as a variable name - revisited

Hi

Without some insight about foo, list or counts it is impossible to say 
what is wrong.

mat<-matrix(1:12, 3,4)
colnames(mat)<-letters[1:4]
DF<-as.data.frame(mat)
fac<-factor(names(DF))
[1] a b c d
Levels: a b c d
[1] c
Levels: a b c d
[1] 7 8 9
[1] 1 2 3

As you can see with DF as data frame and ff extracted from vector of name 
as a factor everything seems to work OK.

When anybody except you wont to do

foo <- list$taxon[match(5,list$item)]

he gets

Error in list$taxon : object of type 'builtin' is not subsettable

So provide some toy example or at least structure of objects you use and 
you probably get solution.

Regards
Petr
r-help-bounces at r-project.org napsal dne 01.04.2010 23:24:55:
http://www.R-project.org/posting-guide.html