Skip to content
Prev 273390 / 398506 Next

How to subset() from data frame using specific rows

I
the
database
re-read
Hm. I seldom use such approach. In your original request you said you want 
split your data to smaller data frames based on sites 

-----
   I need to create subsets (as data frames) based on sites, but including
all sites on each stream. For example, using the initial site factor shown
------
in site variable. If it is organised like

XY-N

you can simply make new variable from first two letters

sites <- substr(chemdata$site,1,2)

then you can split your data frame according to sites

chem.spl <- split(chemdata, sites)

and do anything with your splitted data frames organised in list

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