rec.list <- function(len){
if(length(len) == 1){
vector("list", len)
} else {
lapply(1:len[1], function(...) rec.list(len[-1]))
}
}
depth = c(1, # only one object
2 # two objects
)
my.list <- rec.list()
# The obtained structure is:
## [[1]]
## [[1]][[1]]
## [[1]][[2]]
my.list<-lapply(my.list<-vector(mode = 'list',5),function(x) # 1st level with 5 objects
x<-lapply(x<-vector(mode = 'list',3),function(x) # 2nd level with 3 nested objects
x<-vector(mode='list',2))) # 3rd level with 2 nested objects
Code Example |
---|
R :: dplyr replace na |
R :: r clear variables |
R :: r count number of na |
R :: automatically wrap r text label ggplot |
R :: r type of all columns |
R :: if not i startswith r |
R :: how to read number of excel sheet in r |
R :: make a sequence of timeseries per day in r |
R :: r optim |
R :: variable assignment in r |
R :: how to group by 2 variables in r |
R :: how to split a column in r |
R :: import excel into r |
R :: r seq |
R :: ggplot_regression_line |
R :: gather function in r |
R :: R dplyr select |
R :: r sapply syntax |
R :: create list in r |
R :: read.table |
R :: if in r |
R :: count equal values in a vector |
R :: geom_boxplot line width |
R :: r max and min functions |
R :: arrange rows according to a vector in r |
R :: How to remove duplicates based on the combinations of two columns r |
Rust :: rust dictionary |
Rust :: rust check if key in hashmap |
Rust :: rust string to f64 |
Rust :: armanriazi•rust•vec•some•pop |