Here is (I think) a shorter version of your code that is generic in
that it will handle a matrix of any number of columns:
#Creation of list elements
c1<- c(1,4,3,2,4,1,3,2,4,3)
c2<- c(2,4,3,4,2,3,4,1,3,2)
c3<- c(1,3,2,4,4,3,4,4,2,2)
c4<- c(2,3,2,3,1,3,2,4,4,3)
c5<- c(1,2,1,1,2,2,3,3,2,1)
c6<- c
Instead of:
sample.df1 <-data.frame(list.sample[[1]])
sample.df2 <-data.frame(list.sample[[2]])
sample.df3 <-data.frame(list.sample[[3]])
sample.df4 <-data.frame(list.sample[[4]])
sample.df5 <-data.frame(list.sample[[5]])
sample.df6 <-data.frame(list.sample[[6]])
use 'lapply' to create a list of
# Hello,
# I have a list with 6 categories and with different numbers of rows.
# I would like to change each of them into a unique data frame in order to
match
# values with other data frames and perform some calculations.
# Or I could make each category or list element have the same number of ro
3 matches
Mail list logo