【发布时间】:2018-06-20 13:27:25
【问题描述】:
我正在阅读使用 readxl 将数据作为小标题列表带入 R。
library("readxl")
library("reshape2")
xlsx_example<-readxl_example("datasets.xlsx")
AllSheets<-lapply(excel_sheets(xlsx_example), read_excel, path=xlsx_example)
AllSheets
这会调出 4 个小标题,从 [[1]] 到 [[4]]]。
我想为所有四个添加一个新列,每个列都有一个唯一的标签。如果是单个数据框,我会使用
AllSheets%Newcolumn<-"number1"
但是当你有一个小标题列表时,这不起作用。有没有办法将 NewColumn 添加到所有工作表中,每个工作表中都有“number1”、“number2”等?
【问题讨论】: