search for: simgap

Displaying 1 result from an estimated 1 matches for "simgap".

Did you mean: simap
2007 Aug 31
0
FW: sapply to return factors in dataframe
Ahhrg List, there was a hitch in the previous code. Updated and functional version follows after my initial question: I am trying to randomise a dataframe with mixed factors/numeric variables and return a new (randomised) dataframe with the same columns (as factors/numeric). simgap<-function(x) { ma<-max(x) mi<-min(x) Xout<-runif(length(x),min=mi,max=ma) return(Xout) } rdize.dta<-function(x){ if(is.factor(x)) { cat(str(x),"\n") factor(as.character(round(runif(n=length(x),min=1,max=nlevels(x)),0)))}...