I want to create an empty data frame with one column holding character data and one column holding numeric data, and then populate that data frame.
dat<-as.data.frame(cbind(character(3),vector("numeric",3)))
dat
for (i in 1:3)
{
dat[i,1]<-as.character("f")
dat[i,2]<-i
}
dat
The results are below. As you can see I get all NA:
> dat
V1 V2
1 <NA> <NA>
2 <NA> <NA>
3 <NA> <NA>
Can you advise how to do it?