Error while running time series analysis in R
1
0
Entering edit mode
4 weeks ago

Hello,

I am using "moanin" package for my time-series data analysis. When I load and run the data object (varoquaux2019leaf) the whole pipeline runs just fine. However, when I load my own data (data and metadata), it gives me the following error at creating the moanin object stage:

My code:

moaninObject <- create_moanin_model(data=preData, meta=preMeta, group_variable="Condition", time_variable="Week")


Error:

Error in colData(data)[, group_variable_name]:as.factor(colData(data)[,  : NA/NaN argument
1: In colData(data)[, group_variable_name]:as.factor(colData(data)[,  : numerical expression has 97 elements: only the first used
2: In colData(data)[, group_variable_name]:as.factor(colData(data)[,  : numerical expression has 97 elements: only the first used
3: In make.names(colData(data)[, group_variable_name]:as.factor(colData(data)[,  : NAs introduced by coercion


Now what I did to check, I wrote .txt file from "varoquaux2019leaf" data and saved it on my computer as below:

data(varoquaux2019leaf)
write.table(varoquaux2019leaf$data, "preData.txt") write.table(varoquaux2019leaf$meta, "preMeta.txt")


Then loaded the same data as below:

preMeta <- read.table("preMeta.txt")


But still, I get the same error as above. I also tried saving it in .csv format but again get error while creating the monain object. I was wondering whats the reason that if I load the data directly from their object (varoquaux2019leaf) it works, but with my own data it gives an error? Could it be due to file format (.txt/csv)?

R moanin time-series • 125 views
2
Entering edit mode
4 weeks ago

Ok I have solved this error. Actually my data was in "chr" format that I needed to convert to "Factor" before running the code. Thanks everyone.