Scatterplot: Error in Fun(X[[I]], ...):Object 'Group' Not Found

Scatterplot: Error in FUN(X[[i]], ...) : object 'Group' not found

aesthetics are inherited by default. The geom_path is trying to look for the Group variable on the path dataset to get the color. You should use inherit.aes = FALSE on the geom_path:

  geom_path(data = path, aes(x = x,y = y), inherit.aes = FALSE )

Error in FUN(X[[i]], ...) : object 'a' not found

In your initial ggplot(), you specify that y = a. This mapping is forwarded until it is overwritten. When the error occurs, you specify data that does not contain a yet a is still mapped onto y. Try to set y = NULL explicitly to overwrite the mapping.

Unable to plot a matrix using ggplotr : Error in FUN(X[[i]], ...) : object 'Var1' not found

I had found a possible solution :

m1 <-structure(list(Sensitivity = c(0, 0.701244813278008, 0.701244813278008, 
0.705394190871369, 0.711297071129707, 0.711297071129707, 0.7125,
0.714876033057851), Specificity = c(0, 0.295454545454545, 0.295454545454545,
0.318181818181818, 0.347826086956522, 0.347826086956522, 0.355555555555556,
0.372093023255814), `Pos Pred Value` = c(0, 0.845, 0.845, 0.85,
0.85, 0.85, 0.855, 0.865), `Neg Pred Value` = c(0, 0.152941176470588,
0.152941176470588, 0.164705882352941, 0.188235294117647, 0.188235294117647,
0.188235294117647, 0.188235294117647), Precision = c(0, 0.845,
0.845, 0.85, 0.85, 0.85, 0.855, 0.865), Recall = c(0, 0.701244813278008,
0.701244813278008, 0.705394190871369, 0.711297071129707, 0.711297071129707,
0.7125, 0.714876033057851), F1 = c(0, 0.766439909297052, 0.766439909297052,
0.770975056689342, 0.774487471526196, 0.774487471526196, 0.777272727272727,
0.782805429864253), Prevalence = c(0, 0.845614035087719, 0.845614035087719,
0.845614035087719, 0.83859649122807, 0.83859649122807, 0.842105263157895,
0.849122807017544), `Detection Rate` = c(0, 0.592982456140351,
0.592982456140351, 0.596491228070175, 0.596491228070175, 0.596491228070175,
0.6, 0.607017543859649), `Detection Prevalence` = c(0, 0.701754385964912,
0.701754385964912, 0.701754385964912, 0.701754385964912, 0.701754385964912,
0.701754385964912, 0.701754385964912), `Balanced Accuracy ` = c(0,
0.498349679366277, 0.498349679366277, 0.511788004526594, 0.529561579043114,
0.529561579043114, 0.534027777777778, 0.543484528156833)), row.names = c("m_metric",
"X", "X.1", "X.2", "X.3", "X.4", "X.5", "X.6"), class = "data.frame")

rownames(m1)<-NULL

print(m1)

print(colnames(m1))

library(ggplot2)
library(reshape2)

print(melt(m1))

V1=nrow(melt(m1))/length(which(melt(m1)[,"variable"] == "Sensitivity"))

melted=cbind(Var1=rep(which(melt(m1)[,"variable"] == "Sensitivity"),V1),melt(m1))
ggplot(melted, aes(x=Var1, y=value, group=variable, color=variable))+geom_line()+ labs(title = "TITLE", x = "X", y = "Y", color = "COLOR")

plot(melt(m1)[1:16,2],type="s")

This gives :

Sample Image

Error in FUN(X[[i]], ...) : object 'X' not found

it seems that it's just a case letter problem.

In the code where you got error, you replaced x by X in your sum function.

Please try the following:

p.sh = aggregate(x = list(SACRIFICE.HIT = e.2015.1990$SH.FLAG), by = list(GAME.ID = e.2015.1990$GAME.ID, PLAYER.ID = e.2015.1990$BATTER), FUN = function(x) sum(x == "TRUE"))
p.so = aggregate(x = list(STRIKE.OUT = e.2015.1990$EVENT.TYPE), by = list(GAME.ID = e.2015.1990$GAME.ID, PLAYER.ID = e.2015.1990$RES.PITCHER), FUN = function(x) sum(x == 3))
p.ha = aggregate(x = list(HITS.ALLOWED = e.2015.1990$EVENT.TYPE), by = list(GAME.ID = e.2015.1990$GAME.ID, PLAYER.ID = e.2015.1990$RES.PITCHER), FUN = function(x) sum(x > 1))
p.hb = aggregate(x = list(HIT.BATSMAN = e.2015.1990$EVENT.TYPE), by = list(GAME.ID = e.2015.1990$GAME.ID, PLAYER.ID = e.2015.1990$RES.PITCHER), FUN = function(x) sum(x == 16))


Related Topics



Leave a reply



Submit