Displaying 1 result from an estimated 1 matches for "thirtytwo".
2011 Jul 08
1
binary conversion list to data.frame with plyr... AND NO LOOPS!
...% 2), i %% 2, sep=""), "")
my.dat<-c(36,40,10,4)
my.binary.dat<-bb(my.dat)
my.list<-strsplit(my.binary.dat,'')
max.len<-max(ldply(my.list,length))
len<-length(my.list)
my.df<-data.frame(two=rep(0,len),four=rep(0,len),eight=rep(0,len),sixteen=rep(0,len),thirtytwo=rep(0,len),sixtyfour=rep(0,len))
for(i in 1:length(my.list)){
for(j in 1:length(my.list[[i]])){
my.df[i,max.len-length(my.list[[i]])+j]<-my.list[[i]][j]
}
}
But this isn't exactly feasable on a million+ rows where some binary
numbers are 20 digits... I know theres a way without loops...