How do you create a list with a single value in R? For example, I want a list of 50 zeros. What is the easiest way to define this?
Maybe
res <- list(rep(0,50))
is all you need?
How is a list of 50 zeros ~ a list with a single value?
Try this:
list(rep(0, 50))
Or if you want a list with fifty separate elements of zeros, you can do this:
as.list(rep(0, 50))