rwb*_*rwb 8 r variable-assignment
抱歉,如果这是一个愚蠢的问题 - 但这是我第一次尝试使用R,并且我最终编写了一些代码:
some <- vector('list', length(files))
thing <- vector('list', length(files))
and <- vector('list', length(files))
another <- vector('list', length(files))
thing <- vector('list', length(files))
Run Code Online (Sandbox Code Playgroud)
有没有更好的(DRY)方式来做到这一点R?
换句话说,我想一次为多个变量分配相同的值(根据@Sven Hohenstein的回答)
Sve*_*ein 20
如果要一次为多个变量分配相同的值,请使用:
some <- thing <- and <- another <- thing <- vector('list', length(files))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6055 次 |
| 最近记录: |