How can I use loops in R -
I am a new user of loops in R, so hopefully someone helps me in disrupting the problem in which I have data in the frame, there are 20 types of the following types of population:
Sample population R1 Bari 1_062-1 Bariya 94.52303 2 Bariya 1_062-2 Bari 1 98.27683 3 Bari 1_062-3 Bari 1 100.53170 4 Bariya 1_062-4 Bariya 96.65940 5 Bariya 1_062-5 BRI 1 117.62474 6 Bariya 1_063-1 Baria 144.39547
Use the R column There is a need to calculate the meaning and difference of each population [I want to dissolve that issue by using RIL in the ROO] Thanks
or
))or
do.call (RB
or
Code> do.call (Rbind, Leply (Partition (DF, Df $ population), function (x) c (mean (x $ R), var (x $ R)))< P> orLibrary (set for data) DT (DF) [, list (war = warr (r), mean = mean (r)), = by population
or
Library (dplyr) df% & gt;% group_by (population)% & gt;% abbreviation (var = var (r), mean = Mean (R))
If you have a loop solution If you urge to get the
, here goes
the result of the data set (because it is a poor practice within the loops increasing objects)
Res & lt; - data.frame (population = unique (df $ population), Pisces = delegate (NA, length (unique (DF $ population)), var = representative (NA, length (unique (population $ DF)))
For loop execution
(unique in df $ population) i DF $ R [DF $ Population == i] $ $ [RAP $ Population == i] & var; (var = df $ R [df $ Population == i])) Res # Population Means Mean # 1 Baria 108.6685 375.0275
Comments
Post a Comment