John -
Try
infert[,toolong] = sapply(infert[,toolong],cut2,g=10,levels.mean=TRUE)
- Phil Spector
Statistical Computing Facility
Department of Statistics
You need to use get() so that you are acting on the dataframe,
and not the string that names the dataframe.
Sarah
On Wed, May 25, 2011 at 12:02 PM, Sparks, John James wrote:
> Dear R Helpers,
>
> I am having trouble combining some pieces of programming that work fine
> individually, but fall dow
Hi John,
The issue is that:
"infert$age" != infert$age
One is a text string, the other references the information stored in
the age variable of the infert object. If you need to pass the names
as a string, use "[" instead:
## for a data frame
infert[, "age"]
## for a list
infert[["age"]]
It l
Dear R Helpers,
I am having trouble combining some pieces of programming that work fine
individually, but fall down when I try to get them to work together.
The end goal is to take a data frame, and if any of the variables has more
than 10 values, then use cut2 to reduce the number of (effective)
4 matches
Mail list logo