1

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
  • 81
  • 6
  • 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

2

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
  • 16,640
  • 5
  • 21
  • 39
Bloxx
  • 1,495
  • 1
  • 9
  • 21