Skip to content

nesting multiple for loops

3 messages · PIKAL Petr, Ben Hunter

#
Hi

r-help-bounces at r-project.org napsal dne 15.04.2011 01:34:22:
within
'for'
quite
factor
we'll
and
length(vec2)),
I can not provide solution as I can not decipher what you want to do but 
here are few comments.

Do not use names of functions for naming objects e.g. table, it can be 
quite confusing.
What is cats??
Are you sure that mydf values are numbers?

What does str(mydf) say?

Do I understand that you want summarise all values in columns of data 
frame that have some common name?


lapply(f2, grep, names(mydf))

will give you list of indices of columns in mydf matching particular f2 
item. From this you can continue. Maybe plyr package can also be used.

Regards

Petr
http://www.R-project.org/posting-guide.html