Split: Divide Into Groups And Reassemble - RDocumentation
Maybe your like
base (version 3.6.2)
Description
Usage
Arguments
Value
Details
References
See Also
Examples
Run this code# NOT RUN {require(stats); require(graphics) n <- 10; nn <- 100 g <- factor(round(n * runif(n * nn))) x <- rnorm(n * nn) + sqrt(as.numeric(g)) xg <- split(x, g) boxplot(xg, col = "lavender", notch = TRUE, varwidth = TRUE) sapply(xg, length) sapply(xg, mean) ### Calculate 'z-scores' by group (standardize to mean zero, variance one)z <- unsplit(lapply(split(x, g), scale), g) # or zz <- x split(zz, g) <- lapply(split(x, g), scale) # and check that the within-group std dev is indeed onetapply(z, g, sd) tapply(zz, g, sd) ### data frame variation ## Notice that assignment form is not used since a variable is being added g <- airquality$Month l <- split(airquality, g) l <- lapply(l, transform, Oz.Z = scale(Ozone)) aq2 <- unsplit(l, g) head(aq2) with(aq2, tapply(Oz.Z, Month, sd, na.rm = TRUE)) ### Split a matrix into a list by columnsma <- cbind(x = 1:10, y = (-4:5)^2) split(ma, col(ma)) split(1:10, 1:2) # }Run the code above in your browser using DataLab
Tag » How To Split In R
-
How To Split Vector And Data Frame In R - R-bloggers
-
SPLIT In R With Split() Function [Learn How To Split Data With Examples]
-
Split In R: How To Split Vector And Data Frame In R - R-Lang
-
How To Use Split() Function In R To Split Data - Statology
-
Divide The Data Into Groups In R Programming - Split() Function
-
How To Split Data Into Training/testing Sets Using Sample Function
-
Split Up A String Into Pieces. — Str_split • Stringr
-
How To Use Strsplit() Function In R? - DigitalOcean
-
Split Data Frame In R (3 Examples) | Divide (Randomly) By Row ...
-
Split - MAKE ME ANALYST
-
R: Split The Strings In A Vector - UCLA Math
-
Split & Unsplit Functions In R (2 Examples) - Statistics Globe
-
Split The Elements Of A Character Vector - R
-
How To Split Text Strings In Displayr Using R