jfmeadow / Meadow_etal_Surfaces

Analysis of bacterial communities from university classroom surfaces.
5 stars 2 forks source link

Commands in Meadow_etal_Surfaces #1

Open ConnieHa opened 10 years ago

ConnieHa commented 10 years ago

Hi James,

Thanks for posting the R scripts used in Meadow et al. I'm trying to perform similar analysis with my dataset so this demo is extremely helpful. I have 2 questions regarding your R scripts:

1) It is not entirely clear to me why the following coordinates are selected for cap.txt considering they are not the centroids for the swab types. Can you elaborate a bit more on that?

cap.txt <- data.frame(x = c(1.3, 1.1, -0.8, -1), y = c(0.75, -0.2, -1, 0.75))

2) As I went through your demo I got an error message with the indval command but my files and previous commands looked fine. Do you know what might've caused the the error?

indic <- indval(swab.table, swab.map$type) Error in Summary.factor(c(4L, 4L, 4L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, : min not meaningful for factors

Many thanks, Connie

jfmeadow commented 10 years ago

Hi Connie,

I'm glad you find it useful!

1) the coordinates are purely aesthetic - for plotting the names in the figure. They are located in good spots to put the names so they don't clutter up the figure.

2) This is an interesting error. It seems that the indval function has changed recently to require ordinal variables. I will change the code on GitHub soon, but here is a workaround that gets to the identical results:

indic <- indval(swab.table, clustering=as.numeric(swab.map$type))

This makes a number of each factor level. Since the rest of the commands are referencing the OTU names and not the actual levels, this doesn't matter. If you are going to dig through the indic results, the factor levels translate like so:

numeric level
1 chair
2 desk
3 floor
4 wall

I hope that answers your questions, James

ConnieHa commented 10 years ago

I think it's great that you're sharing the workflow with everyone! The indval function is working now, thanks heaps =D

Cheers, Connie