0

I have a dataset and I need to plot histograms for all the continuous data which i know how to do, however I cant use a loop as there are categorical columns too, meaning histograms wont be created for them which will create an error. Is there a way to separate the continuous data from the categorical data? If worse comes to worst, I can just manually remove the categorical features however I would like to know if theres a way to do this automatically for future reference.

helpmepls
  • 57
  • 5
  • Please make a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – Martin Gal Aug 27 '21 at 21:39

1 Answers1

1

You can use package "dplyr", and in the example below, you chose all columns with factor variables

data <- data %>% 
    select_if(is.factor)
Martin Gal
  • 14,910
  • 4
  • 18
  • 37
Bloxx
  • 1,407
  • 1
  • 6
  • 19