3

I have a question with my code in R, for a function that draws a graph in excel via BERT.

  library("ggplot2")
  # link the graphics to the calling cell, so it won't get erased 
  # when another cell draws a plot
  BERT.graphics.device(cell=T)
  
  # flatten the data and make sure it's numeric
  x <- as.numeric(unlist(x))
  y1 <- as.numeric(unlist(y1))
  y2 <- as.numeric(unlist(y2))
  
  df <- data.frame(x,y1,y2)
  
  # draw the plot
  g <- ggplot(df, aes(x=x))
  g <- g + geom_line(aes(y=y1), colour="red")
  g <- g + geom_line(aes(y=y2), colour="green")

 g
  # we're done with the graphics device, so shut it off for now
  #dev.off();
  
  # this is a convenient return value for the calling cell
  T;
}

It gves me the error that ggplot package is not found, but i have installed it via packages - install packages - 0 - ggplot2 in BERT console.

Thanks!

MrFlick
  • 195,160
  • 17
  • 277
  • 295

0 Answers0