本文介绍了如何在R中使用变量标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个函数,将输入作为数据框的列名作为columnname~1
.
I have a function that takes input as the column name of dataframe as columnname~1
.
数据框由大约50列组成,我想在其中重复该过程
The dataframe consists of about 50 columns in which I want to repeat the process, I can
使用for循环来生成列名作为字符,不幸的是该函数可以完成
use a for loop to generate column name as a character which unfortunately the function does
无法识别.区别只是M1~1
(有效)与"M1"~1
not recognize. The difference is just M1~1
(works) vs "M1"~1
欢迎任何建议
推荐答案
尝试:
as.formula(paste("M1","1",sep="~"))
这篇关于如何在R中使用变量标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!