R: „Unary operator error” z wielowierszowego polecenia ggplot2
Używam ggplot2 do porównywania dwóch różnych gatunków, jak wskazano w trzeciej kolumnie pokazanej poniżej:
> library(reshape2)
> library(ggplot2)
> melt.data = melt(actb.raw.data)
> head(actb.raw.data)
region expression species
1 CG -0.17686667 human
2 CG -0.06506667 human
3 DG 1.04590000 human
4 CA1 1.94093333 human
5 CA2 1.55023333 human
6 CA3 1.75800000 human
> head(melt.data)
region species variable value
1 CG human expression -0.17686667
2 CG human expression -0.06506667
3 DG human expression 1.04590000
4 CA1 human expression 1.94093333
5 CA2 human expression 1.55023333
6 CA3 human expression 1.75800000
Jednak po uruchomieniu następującego kodu:
ggplot(combined.data, aes(x = region, y = expression, fill = species)) +
+ geom_boxplot() +
+ scale_fill_manual(values = c("yellow", "orange"))
+ ggtitle("Expression comparisons for ACTB")
+ theme(axis.text.x = element_text(angle=90, face="bold", colour="black"))
Dostaję ten błąd:
> ggplot(actb.raw.data, aes(x = region, y = expression, fill = species)) +
+ + geom_boxplot() +
+ + scale_fill_manual(values = c("yellow", "orange"))
Error in +geom_boxplot() : invalid argument to unary operator
> + ggtitle("ACTB expression in human vs. macaque")
Error in +ggtitle("ACTB expression in human vs. macaque") :
invalid argument to unary operator
> + theme(axis.text.x = element_text(angle=90, face="bold", colour="black"))
Error in inherits(x, "theme") : argument "e2" is missing, with no default
Dzieje się tak również, gdy uruchamiam za pomocą zmiennej melt.data, niezależnie od tego, co jest warte. Czy ktoś może mi pomóc to naprawić? Udało mi się uruchomić ten kod z innym zestawem danych, który został sformatowany identycznie i nie mogę zrozumieć, co się tutaj dzieje.