I am using cars and this has two variables: speed and dist. I am trying to create groups based on speed - so all observations with speed==4 becomes an object, all observations with speed==7 is an object, all observations with speed==10 is an object and so on.
I've tried:
> apply(subset(cars,cars$speed))
Error in match.fun(FUN) : argument "FUN" is missing, with no default
> apply(subset(by=cars$speed))
Error in match.fun(FUN) : argument "FUN" is missing, with no default
> sapply(subset(by=cars$speed))
Error in match.fun(FUN) : argument "FUN" is missing, with no default
> sapply(subset(cars,cars$speed))
Error in match.fun(FUN) : argument "FUN" is missing, with no default
and they all don't work. Please help!