Difference between revisions of "OpasnetUtils/Dropall"
From Testiwiki
m |
m |
||
Line 15: | Line 15: | ||
label="Initiate functions" | label="Initiate functions" | ||
graphics="1" | graphics="1" | ||
+ | showcode="1" | ||
> | > | ||
# DROPALL ##################################### | # DROPALL ##################################### |
Revision as of 10:48, 15 June 2012
This page is a method.
The page identifier is Op_en5721 |
---|
Moderator:Nobody (see all) Click here to sign up. |
This page is a stub. You may improve it into a full page, and then a rating bar will appear here. |
Upload data
|
Contents
Description
dropall pudottaa data.framesta pois kaikki faktorien sellaiset levelit, joita ei käytetä.
Parameters
- x = data.frame
Code
# DROPALL ##################################### ## dropall pudottaa data.framesta pois kaikki faktorien sellaiset levelit, joita ei käytetä. ## parametrit: x = data.frame dropall <- function(x){ isFac <- NULL for (i in 1:dim(x)[2]){ isFac[i] = is.factor(x[ , i]) } for (i in 1:length(isFac)){ x[, i] <- x[, i][ , drop = TRUE] } return(x) } |