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

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
In addition: Warning messages:
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")
preData <- read.table("preData.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)?

Please help me in solving this issue.

R moanin time-series • 125 views
ADD COMMENT
2
Entering edit mode
4 weeks ago
arshad1292 ▴ 60

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.

ADD COMMENT

Login before adding your answer.

Traffic: 1632 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6