Skip to content

question about creating data frame

2 messages · T Bal, jim holtman

#
try this:
+ "Mathematics" 80 15
+ "Physics" 32 24
+ "Biology" 18 29', skip = 1, as.is = TRUE)
+     data.frame(course = x$V1[.row]
+         , A = c(rep(1, x$V2[.row]), rep(0, x$V3[.row]))
+         )
+ }))
course A
1   Mathematics 1
2   Mathematics 1
3   Mathematics 1
4   Mathematics 1
5   Mathematics 1
6   Mathematics 1
7   Mathematics 1
8   Mathematics 1
9   Mathematics 1
10  Mathematics 1
11  Mathematics 1
12  Mathematics 1
13  Mathematics 1
........
190     Biology 0
191     Biology 0
192     Biology 0
193     Biology 0
194     Biology 0
195     Biology 0
196     Biology 0
197     Biology 0
198     Biology 0
On Tue, May 15, 2012 at 2:47 PM, T Bal <studenttbal at gmail.com> wrote: