【发布时间】:2022-08-08 03:28:13
【问题描述】:
我正在尝试使用 colnames 函数重命名我的 R 脚本中的特定列,但到目前为止没有成功。
我对编程有点陌生,所以它可能很容易解决。
基本上,我试图重命名一个名为Reviewer Overall Notes 的列,并在名为notas 的数据框中将其命名为Nota Final,代码如下:
colnames(notas$`Reviewer Overall Notes`) <- `Nota Final`
它返回给我:
> colnames(notas$`Reviewer Overall Notes`) <- `Nota Final`
Error: object \'Nota Final\' not found
我还在 [this post][1] 中找到了一段代码:
colnames(notas) [13] <- `Nota Final`
但它也返回相同的消息。
我做错了什么?
附言:。抱歉有任何拼写错误,英语不是我的主要语言。
-
你能提供
names(notas)的输出吗?另外,可以确认notas是一个data.frame 吗?str(notas)的输出也很有用。 -
这里是:
code> names(notas) [1] \"Assessment Name\" \"Applicant First Name\" \"Applicant Last Name\" \"Applicant Email\" [5] \"Applicant Completed Date\ " \"Review URL\" \"Reviewer First Name\" \"Reviewer Last Name\" [9] \"Reviewer Email\" \"Assigned Competencies\" \"Reviewer 总评分\" \"Reviewer 总分(数字)\" [13] \"审稿人总体备注\"code实际是tibble!对于那个很抱歉! -
这是 > str(notas) tibble [860 × 13] (S3: tbl_df/tbl/data.frame) 不幸的是,那里有很多我无法分享的个人数据。 =( ,
标签: r