I've got some large data files with biometric time course data for different subjects. I've already been able to average subsets of data and export specific one number metrics, and now I am attempting to modify my code to actually save the raw time course data (i.e., subsets of data) into a data.frame for later averaging and visualization.
I have tried setting up a date.frame like this:
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)))
My idea is to have a data frame with several transposed numeric vectors of length 25 that can be set to zero, and then filled in with the appropriate subsets. But R doesn't like this expression, and I get the following error:
Error in data.frame(filename = character(), SubNum = numeric(), APTCode = character(), :
arguments imply differing number of rows: 0, 1
I seem to be able to get it to work for 1 vector, but not for more than one vector, i.e., this works:
try1 = data.frame(longvector = t(vector(mode = 'numeric', length = 25)))
But this doesn't work:
try2 = data.frame(longvector = t(vector(mode = 'numeric', length = 25), bigvector2 = t(vector(mode = 'numeric', length = 25))))
I get the error:
Error in t(vector(mode = "numeric", length = 25), bigvector2 = t(vector(mode = "numeric", :
unused argument (bigvector2 = t(vector(mode = "numeric", length = 25)))
Basically, I need a long string of numbers to hold the extracted subset of data.