[R] for loop
David Winsemius
dwinsemius at comcast.net
Sat Oct 30 20:24:13 CEST 2010
On Oct 30, 2010, at 2:07 PM, Matevž Pavlič wrote:
> Hi,
>
> I know this is probalby a very trivial thing to do for most of the R
> users, but since I just strated using it I have some problems....
>
> I have a data.frame with a field called "razred". This field has
> values from 1 up to 15.
>
> Is it possible to create a for loop that would create a new data
> frame for each of the "razred" values.
The R-way would be to use the split function and leave the result in a
list to which the same operation could be also repeatedly performed
using lapply.
?split
And take a look at the fourth example applying split to the builtin
airquality dataframe.
The plyr package also provides functions on dataframes.
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list