0
ggplot(flights, aes(sched_arr_time)) +
  geom_bar()

this works fine, but this does not

plot <- function(colname) {
  ggplot(flights, aes(colname)) +
    geom_bar()
}
plot(sched_arr_time)

I've tried inserting the column name in every way I could think of and nothing seems to work? c(colname), c('colname'), 'colname' none of them work.

also tried:

plot <- function(colname) {
  p <- ggplot(node2, aes(colname)) 
  p + geom_histogram()
}

this did not work either. If anyone needs specific error messages from every of the above mentioned attempts I can provide them. Appreciate the help.

  • wrap the final ggplot in a `print` function. – lmo Jun 30 '16 at 16:53
  • You may want to include the error messages. Your last function seemed to work for me (at least in the sense that I received no error, and a plot was produced when I called the function with data). – Sam Jun 30 '16 at 16:53

0 Answers0