r - R:如何在 aw_weight() 函数中添加变量作为参数?
问题描述
我正在尝试在 R 的 aw_weight() 函数中传递一个变量。(https://www.rdocumentation.org/packages/areal/versions/0.1.7/topics/aw_weight)
例如:
aw_weight(intersect, areaVar = "area", totalVar = "totalArea", areaWeight = "areaWeight")
而不是将变量传递给 areaWeight 而不是字符串:
for (n in c("1","2","3")){
aw_weight(intersect, areaVar = "area", totalVar = "totalArea", areaWeight = paste0(areaWeight, n))
}
但这不起作用。它将“ areaWeight ”列命名为“paste0(areaWeight, n)”,而不是我想要的“areaWeight1”、“areaWeight2”、“areaWeight3”。
提前感谢您的回答!!
解决方案
推荐阅读
- java - 如何实现 StringBuilder 以避免不可变字符串分配问题?
- postgresql - 使用 fetchtype LAZY 和 @ManyToOne 从 Spring 存储库传输错误的 UUID(主键)
- ibm-cloud - IBM 认知实验室登录
- android - How to create handler with callbacks that run on a different thread?
- python - 从日期列表中使用 Pandas (DateOffset) 创建日历
- css - 如何将 DIV 与其容器底部对齐?
- python - 蟒蛇:名称错误:名称
- ionic3 - 如何在ionic3中调用没有表单数据的POST API?
- javascript - Cordova 中的 URL 添加了感叹号
- android - Lottie 动画编译不工作 - 为什么?