Skip to content
Prev 292257 / 398498 Next

Splitting a dataframe by character vector

On 21/04/12 13:52, Ben Neal wrote:
What about a ***reproducible*** example?

What isn't working?  What (if any) error message did you get?

I am at least 99% confident that numeric versus character values in 
Cover$Site
is completely irrelevant.

My ***guess*** (and it can only be a guess, given the vagueness and
lack of detail in your question) is that you need a double ("logical")
equals sign.  I.e. I suspect that

Site1<- subset(Cover, Site == "PtaCaracol")

will work.

That being said --- since you want to *split* your  data frame by "Site" ---
why the <expletive deleted> don't you use split()???

E.g.:

     Splitz <- split(Cover,Cover$Site)

     cheers,

         Rolf Turner