Quantcast
Channel: r software hub
Viewing all articles
Browse latest Browse all 1015

R: Remove constant and identical features programmatically

$
0
0

By jdm

RStudio-icon

##### Removing constant features
cat("n## Removing the constants features.n")
for (f in names(train)) {
  if (length(unique(train[[f]])) == 1) {
    cat(f, "is constant in train. We delete it.n")
    train[[f]] 

Related

To leave a comment for the author, please follow the link and comment on their blog: R – The Hack-R Blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...


If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

…read more

Source:: r-bloggers.com


Viewing all articles
Browse latest Browse all 1015

Trending Articles