Convert Matrix to List of Column-Vectors in R (2 Examples) | Split & Divide | lapply() & seq_len()

  Рет қаралды 1,374

Statistics Globe

Statistics Globe

Күн бұрын

How to divide a matrix into a list of column-vectors in the R programming language. More details: statisticsglob...
R code of this video:
data <- matrix(1:15, ncol = 3) # Create example matrix
my_list1 <- split(data, # Split matrix into list
rep(1:ncol(data),
each = nrow(data)))
my_list1 # Print list of column-vectors
my_list2 <- lapply(seq_len(ncol(data)), # Split matrix into list
function(x) data[ , x])
my_list2 # Print list of column-vectors
Follow me on Social Media:
Facebook: / statisticsglobecom
LinkedIn: / statisticsglobe
Twitter: / joachimschork

Пікірлер: 2
@razorscythe7258
@razorscythe7258 3 жыл бұрын
cool.. It would be even better if you can try to explain how these functions work. Thank you
@StatisticsGlobe
@StatisticsGlobe 3 жыл бұрын
Thanks Aman, glad you like it!
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
Splitting columns in R with the separate() command
5:02
Equitable Equations
Рет қаралды 12 М.
Working with lists in R
7:29
Equitable Equations
Рет қаралды 8 М.
Removing & Adding Variable Names in R
15:26
David Caughlin
Рет қаралды 6 М.
Teach me STATISTICS in half an hour! Seriously.
42:09
zedstatistics
Рет қаралды 2,9 МЛН
I Spent 100 Hours Inside The Pyramids!
21:43
MrBeast
Рет қаралды 24 МЛН
Bayes theorem, the geometry of changing beliefs
15:11
3Blue1Brown
Рет қаралды 4,6 МЛН
But what is a neural network? | Deep learning chapter 1
18:40
3Blue1Brown
Рет қаралды 18 МЛН
RStudio Introduction to Matrices
13:18
TheUdorblab
Рет қаралды 19 М.
The 7 Levels of Math Symbols
14:03
The Unqualified Tutor
Рет қаралды 60 М.
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН