R/plot_histogram.R

histogram<-function(data,title="", x="Rating values", y="# of ratings"){
  
  if(class(data) == "dataSet"){
    m <- data@data[!is.na(data@data)]
  }else if(class(data) == "sparseDataSet"){
    m <- data@data[,3]
  }else{
    stop()
  }
  
  
  
  qplot(m, geom="histogram", binwidth = 0.5)+
    theme_minimal()+
    theme(legend.position="none",text=element_text(family="mono"),panel.border = element_rect(fill = NA,colour = "grey50"))+
    labs(title=title, x=x, y=y)
}

Try the rrecsys package in your browser

Any scripts or data that you put into this service are public.

rrecsys documentation built on June 10, 2019, 1:02 a.m.