我有一些大型数据文件,其中包含针对不同科目的生物识别时间进程数据。我已经能够平均数据子集并导出特定的一个数字指标,现在我试图修改我的代码以实际将原始时间过程数据(即数据子集)保存到data.frame中以便以后平均和可视化。
我尝试过像这样设置date.frame:
results = data.frame(filename = character(), SubNum = numeric(),
APTCode = character(), Pcode = character(),
FAAdata = logical(), FixPlus_AvgFAA = numeric(),
FAA_pringles = t(vector(mode = 'numeric', length = 25)),
FAA_ax = t(vector(mode = 'numeric', length = 25)),
FAA_pin = t(vector(mode = 'numeric', length = 25)),
FAA_inf = t(vector(mode = 'numeric', length = 25)),
FAA_lev = t(vector(mode = 'numeric', length = 25)),
FAA_col = t(vector(mode = 'numeric', length = 25)))
我的想法是让一个数据框有几个长度为25的转置数字向量,可以设置为零,然后用适当的子集填充。但是R不喜欢这个表达式,我得到以下错误:
Error in data.frame(filename = character(), SubNum = numeric(), APTCode = character(), :
arguments imply differing number of rows: 0, 1
我似乎能够让它适用于1个向量,但不能用于多个向量,即,这可行:
try1 = data.frame(longvector = t(vector(mode = 'numeric', length = 25)))
但这不起作用:
try2 = data.frame(longvector = t(vector(mode = 'numeric', length = 25), bigvector2 = t(vector(mode = 'numeric', length = 25))))
我收到错误:
Error in t(vector(mode = "numeric", length = 25), bigvector2 = t(vector(mode = "numeric", :
unused argument (bigvector2 = t(vector(mode = "numeric", length = 25)))
基本上,我需要一长串数字来保存提取的数据子集。