0

I have combine different values which means the same, under the variable "Wine_type"

 Mock     Neg Neg1PCR  NegPBS     red     Red RedWine   water   Water   white   White 
  1       9       1       1       2      18       4       3       4       2      24 

into

Mock       Neg   Neg1PCR    NegPBS   Redwine     Water Whitewine 
    1         9         1         1        24         7        26 

By using this code

dat2<- data.frame(sample_data(psdata.r), stringsAsFactors =FALSE )
dat2$Project<- as.character(dat2$Wine_type)
table(dat2$Project)
dat2[grepl("water|water", dat2$Project, ignore.case = TRUE), "Project"] <- "Water"

dat2[grepl("White|white", dat2$Project, ignore.case = TRUE), "Project"] <- "Whitewine"

dat2[grepl("red|Red", dat2$Project, ignore.case = TRUE), "Project"] <- "Red"

dat2[grepl("Red|Redwine", dat2$Project, ignore.case = TRUE), "Project"] <- "Redwine"

then i produce a plot by the code

   plot_richness(psdata.r, measures = c("Observed","Shannon"), x = "Wine_type", color = "SampleType") + geom_boxplot()

the only problem is that i get a plot with the old values. What am i missing to use the new group together values?

Rasmus
  • 3
  • 3
  • 1
    You are changing dat2 dataframe , but you are displaying GlobalPatterns. – Katia May 24 '18 at 16:50
  • After edits, you are modifying a data frame named `dat2`, and then plotting a different data frame named `psdata.r`. You need to plot the same data that you modify. – Gregor Thomas May 24 '18 at 17:11
  • A mistake i missed when i paste it to here,but In the original run i ran psdata.r. I have fixed it in the code. – Rasmus May 24 '18 at 17:12
  • i get a error"Error in .local(object, taxa_are_rows) : argument "taxa_are_rows" is missing, with no default" – Rasmus May 24 '18 at 18:43

0 Answers0