首页
编程
java
php
前端
首页
编程
java
php
前端
R语言 自定义函数无法用列名引用
R
transformer <- function(df, col){
df1 <- df %>%select(cycling, col)
df1 <- df1[order(df1$col, decreasing = F),]
return (df1$col)
}
df1 <- transformer(df, 'dist_km')
df1 只有NULL
把df1$col改为df1[,2]即可
但为什么不能用df1$col呢
点击展开全文