Displaying 2 results from an estimated 2 matches for "aframe2".
Did you mean:
frame2
2011 Feb 28
2
converting the string columns in a data.frame to factors?
...rying to convert the string columns in aframe1 to factors. But it
seems stringsAsFactors=T in as.data.frame() doesn't do anything. Could
anybody let know what is the correct way to converting strings to factors?
> aframe1=data.frame(x=LETTERS[1:10], y=LETTERS[1:10], stringsAsFactors=F)
> aframe2=as.data.frame(aframe1, stringsAsFactors=T)
>
> str(aframe1)
'data.frame': 10 obs. of 2 variables:
$ x: chr "A" "B" "C" "D" ...
$ y: chr "A" "B" "C" "D" ...
> str(aframe2)
'data.frame': 10 o...
2010 Feb 03
3
How to flatten a tree (based on list) to a certain depth?
...following list of lists of frames 'root'
(let's call it a 'tree' of frames). I want to flatten it to be a list
of frames. However, if I unlist(root), it will flatten the frames as
well. Is there a simply way to flatten the tree to certain depth?
aframe1=data.frame(x=1:3,y=1:3)
aframe2=data.frame(u=7:9,v=11:13)
aframe3=data.frame(p=3:5,q=6:8)
main1=list(sub1=aframe1, sub2=aframe2)
main2=list(sub3=aframe3)
root=list(main1=main1, main2=main2)
str(root)
unlist(root)