Entering edit mode
3.0 years ago
Sumit Paliwal
▴
40
Hi All, I have the following dataframe:
> head(allTF_NFIC_TPM_df)
Gene Sample TPM TF Genotype
1 Nfic SRR4103512 2.097590 Ptf1a WT
2 Nfic SRR4103513 1.989032 Ptf1a WT
3 Nfic SRR4103514 0.475040 Ptf1a WT
4 Nfic SRR4103515 0.498004 Ptf1a WT
5 Nfic SRR4103516 0.588734 Ptf1a WT
6 Nfic SRR4103517 0.820988 Ptf1a KO
The TF column has three subgroups: Ptf1a, Mist1, and Nr5a2. Within each subgroup, I want to compare TPM values between WT and KO. Thus, I executed the following:
cmeans <- compare_means(TPM ~ Genotype, data = allTF_NFIC_TPM_df, method = "t.test", paired = F, group.by = TF)
However, I get an error that says:
Error: Can't subset columns that don't exist. x Column `Ptf1a` doesn't exist.
I partly understand that something's wrong with the group.by
argument. I have looked around but was unable to find a solution.
I hope someone from the community can help me find one.
Thanks.
Check if you are using correct data frame. Check if
group.by
column is factor and correctgroup.by = TF
togroup.by = "TF"
. To my understanding your function should fail with a different error unless objectTF
exists.Thanks for the suggestion(s). Changing
group.by = TF
togroup.by = "TF"
worked. However, I do not understand the logic behind this.group.by = TF (group.by existing object
TF
)group.by = "TF" (group.by column
TF
in the data, in this context)