arun
2013-Oct-19 04:47 UTC
[R] How would i set every column in a data frame to a scale of 1-100
Hi, Try dat <- read.table(text=" a?? b???? c 0?? 89?? 4 1?? 93?? 3 0?? 88?? 5",sep="",header=TRUE) datNew <- within(dat,{a<-a*(100/1);c <- c*(100/5)}) #or vec1 <- c(1,100,5) as.data.frame(t(t(dat*(100))/vec1)) #or sweep(dat*100,2,vec1,`/`) A.K. Hi, i am trying to get all the colums of my data frame to be in the same scale.. right now i have something like this... where a is on a 0-1 scale ?b is on a 100 scale and c is on a 1-5 scale a ? b ? ? c 0 ? 89 ? 4 1 ? 93 ? 3 0 ? 88 ? 5 How would i get it to a 100scale like this... a ? ? b ? ? ?c 0 ? ? 89 ? ? 80 100 ?93 ? ? 60 0 ? ? 88 ? ? 100 i hope that is somewhat clear..