MicrobiomeStat icon indicating copy to clipboard operation
MicrobiomeStat copied to clipboard

Format time.var in generate_alpha_trend_test_long() function

Open QGaelle opened this issue 4 months ago • 10 comments

Dear Chen Yang,

I have a question regarding the use of the generate_alpha_trend_test_long() function. I am working on the microbiome communities of three coral species. Individual colonies of each species were monitored over a three year period. I would like to test for differences in alpha diversity across timepoints.

Here is the structure of my data object: Capture d’écran 2024-02-29 à 11 05 29

I have precalculated alpha diversity indices and passed them to the alpha.obj parameter: Capture d’écran 2024-02-29 à 11 12 09

I would like to use my column “Date_format” as time.var since it includes information on both year and month but I am not sure which format I should use. I tried to make it numeric using:

data.obj$meta.dat$Date_format<-as.numeric(data.obj$meta.dat$Date_format) Warning message: NAs introduced by coercion

All rows were replaced by NAs

I did the same using my column “m_format” just as a test. And got the following output: Capture d’écran 2024-02-29 à 11 04 05

My questions is thus: How should I write my year + month factor so it can be used as time.var in the generate_alpha_trend_test_long() function?

Thanks for your help! Gaëlle

QGaelle avatar Feb 29 '24 10:02 QGaelle