Fehler : ggplot2 nicht wissen, wie man mit Daten der Klasse uneval

Habe ich diesen code

ggplot() + 
  stat_density(kernel = "biweight",aes(x=fd, colour=id), data=foo1,position="identity",geom="line")+
  coord_cartesian(xlim = c(0, 200))+
  xlab("Flood Duration")+
  ylab("Density")+
  ggtitle("PDFs of Flood Duration")+
  ggsave("pdf_fd_conus.png")

Und ich schrieb diese Funktion

pdf.plot<-function(data,x,xl,yl,title,save){
  ggplot() + 
    stat_density(data, kernel = "biweight",aes_string(x=x, colour='id'),
                 position="identity",geom="line")+
    coord_cartesian(xlim = c(0, 200))+
    xlab(xl)+
    ylab(yl)+
    ggtitle(title)+
    ggsave(save)
}

Aufruf:

pdf.plot(data=foo1,x='fd',xl='b',
          yl='a',title='a',save='y.png')

Aber ich bin immer diese Fehlermeldung:

Error: ggplot2 doesn't know how to deal with data of class uneval
Called from: eval(expr, envir, enclos)

Dies ist dput(Kopf(foo1,4))

structure(list(id = structure(c(1L, 1L, 1L, 1L), .Label = c("dfa", 
"dfb", "cfa", "csb", "bsk"), class = "factor"), lon = c(-70.978611, 
-70.978611, -70.945278, -70.945278), lat = c(42.220833, 42.220833, 
42.190278, 42.190278), peakq = c(14.7531, 17.3865, 3.3414, 2.7751
), area = c(74.3327, 74.3327, 11.6549, 11.6549), fd = c(29, 54.75, 
23, 1), tp = c(14.25, 19.75, 13.5, 0.5), rt = c(14.75, 35, 9.5, 
0.5), bl = c(15485.3, 15485.3, 8242.64, 8242.64), el = c(0.643551, 
0.643551, 0.474219, 0.474219), k = c(0.325279, 0.325279, 0.176624, 
0.176624), r = c(81.947, 81.947, 38.7003, 38.7003), si = c(0.0037157, 
0.0037157, -9999, -9999), rr = c(0.00529193, 0.00529193, 0.00469513, 
0.00469513)), .Names = c("id", "lon", "lat", "peakq", "area", 
"fd", "tp", "rt", "bl", "el", "k", "r", "si", "rr"), row.names = c(NA, 
4L), class = "data.frame")

Könnten Sie bitte helfen?

InformationsquelleAutor Geekuna Matata | 2014-05-14

Schreibe einen Kommentar