I have this set of data
BF Condition SampleID
1 Partially Formula Fed VD25FE8997
2 Exclusively Breast Fed VD25FE8986
3 Exclusively Breast Fed VD25FE8974
4 Exclusively Breast Fed VD25FE8960
5 Exclusively Formula Fed VD25FE8951
there are three ‘levels’ i would like to establish in order to run Chao1 Indexes using a boxplot
Exclusively Breast Fed, Partially for
When I pull up the levels, they appear as ‘NULL’
# Convert 'category' to factor if it's not already
VitDSI_Data$BFCondition <- factor(VitDSI_Data$BFCondition)
# Add new levels to the 'category' factor
levelsToAdd <- c("Exclusively Breast Fed", "Partially Breast Fed", "Exclusively Formula Fed")
VitDSI_Data$BFCondition <- factor(VitDSI_Data$BFCondition, levels = c(levels(VitDSI_Data$BFCondition), levelsToAdd))
I tried this, but in turn it is clearing out the data in the environment. I am not sure how to assign the levels in order to get the following readout (shortened)
Is it that my ‘levels’ assignments are too long?
`## [1] Exclusively Breast Fed Exclusively Formula Fed Partially Formula Fed
Levels: Exclusively Breast Fed Exclusively Formula Fed Partially Formula Fed
`
mistletoestars is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.