bc-anaisabel / juniperus_paper

Pipeline for analyzing Illumina MiSeq paired-end data of fungal communities
BSD 2-Clause "Simplified" License
2 stars 1 forks source link

Error in `[.data.frame`(data.frame(x), i, j, drop = FALSE) : undefined columns selected #13

Closed bc-anaisabel closed 3 years ago

bc-anaisabel commented 3 years ago

I added new soil variables (C and N) to table amptk.mapping_file.csv. When doing the soil analysis in 4_models.R script I got an error message when trying to do a subset based on a vector I created with all the names of the soil variables (using now the new ones):

#subset 
soil <- subset_samples(texcoco.binary.models, Type %in% "soil") # phyloseq object subset with only soil samples
soil

binary_table <- otu_table(soil) #just otu table
binary_table

meta_table <- sample_data(soil) #only sample data and only from soil samples
meta_table

env <- c("pH","Pdis","Ca","Mg","K","Na","H","Al", "SoilM","C","N") 

#Transform columns to numeric values, each column separately 

env_table <- subset(meta_table, select = env)

Error message was:

> env_table <- subset(meta_table, select = env)
Error in `[.data.frame`(data.frame(x), i, j, drop = FALSE) : 
  undefined columns selected
bc-anaisabel commented 3 years ago

Trying out solutions I remembered the "Al" column has some empty cells because that's how the data came, there were missing values for Aluminum in some of the samples. So I removed the "Al" from the c vector but still it does not work

bc-anaisabel commented 3 years ago

It was an incorrect column name. SoilM was named SoilMoisture in csv data so it was not defining this column name because it could not find it. Changed .csv file.