简体   繁体   中英

Subsetting data frames in a list in R

I am new to R and I am working with ecological data. I have a list with 10 data frames (ten different Taxa), each of which have 36 columns(id, species,taxa,weight, etc.). I need to apply a filter to all of the data frames within my list, to separate by a certain character(herbicide, insecticide, etc.) in one of the columns, but I keep getting this error.

 
     

<\/blockquote>

Here are two ways to do this -

  1. <\/li><\/ol>
     (Similar to yours) <\/li><\/ol>
     data2 <- split(data0, f = data0$TAXA) herb <- lapply(data2, function(x) subset(x, USEPATTERN == "Herbicide"))<\/code><\/pre>"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM