0

I am comfortable with ggplot2 and a number of other R plotting packages, but I was wondering if there was a way that Auto plots the summary function.

For example. If you create a data set like so:

pen<-round(rchisq(30,2))
p_cens<-rep(5,30)
p_type<-rep("pen",30)
p_bind<-cbind(pen,p_cens,p_type)


lonely<-round(rchisq(40,1))
l_cens<-rep(8,40)
l_type<-rep("lonely",40)
l_bind<-cbind(lonely,l_cens,l_type)

drunk<-sample(1:20,20,replace=T)
d_cens<-rep(9,20)
d_type<-rep("drunk",20)
d_bind<-cbind(drunk,d_cens,d_type)

chick<-sample(70:120,10,replace=T)
c_cens<-rep(2,10)
c_type<-rep("chick",10)
c_bind<-cbind(chick,c_cens,c_type)

# Create data frame
surv_data<-as.data.frame(rbind(p_bind,l_bind,d_bind,c_bind))
colnames(surv_data)<-c("time","censor","type")
surv_data$time<-as.numeric(surv_data$time)
surv_data$censor<-as.numeric(surv_data$censor)

Now if you then run:

summary(surv_data)

You get the awesome R stats. And yes, I can then plot each of them manually. Boxplot for the Min/Med/Max, and Bar/Hist plot for the Categorical counts. etc..

But if I have a dataframe with 150 variables, this is a lot of manual effort.

What I was hoping for is if there was a "autoplot(summary(surv_data))"

type function, that would auto detect each column, and produce a nice set of graphs for each column in the data set. (having NA remove option would be bonus) :) And non-gui like rattle or whatever, as that is easy, but still manual.

Does anything like this exist?

Maz
  • 183
  • 1
  • 2
  • 10
  • If they show up in viewer, you can just cycle through them. Preferably using a facet-wrap type feature you can specify how many to present per row/col. I would say you could have 2x75 and just keep scrolling down, or 3x if your width is set wide. Like in r Notebook markdown. The reason being, is you would be easily able to get a visual representation of your dataset in seconds/minutes, which is very powerful for explorative analytics. – Maz Jan 17 '20 at 02:23
  • https://joachim-gassen.github.io/2019/12/explore-your-data-with-expand/ – Tung Jan 17 '20 at 02:39
  • 1
    https://cran.r-project.org/web/packages/DataExplorer/vignettes/dataexplorer-intro.html – Tung Jan 17 '20 at 02:40
  • 1
    https://ropensci.org/blog/2019/10/29/skimrv2/ – Tung Jan 17 '20 at 02:42
  • Might be useful https://stackoverflow.com/a/52345926/786542 – Tung Jan 17 '20 at 02:45
  • 1
    Thank you for that Tung. The first 2 are close to what I was looking for. The first one is a manual shiny, which again is like Rattle. the Data Explorer is very close, but still requires manual. I think i might just build a package and maybe other people will find it useful :) – Maz Jan 19 '20 at 23:52

0 Answers0