开发者

How do you create a list with a single value in R?

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 d开发者_运维百科efine this?


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))


Maybe

res <- list(rep(0,50))

is all you need?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜