I have to create a new dataframe from a data frame that I don't know apriori.
The new dataframe should have the same structure as the old, but it should be empty.
Example
Let's suppose that the old data frame is the following:
> c1 = c(1,2,3)
> c2 = c("str1", "str2", "str3")
> c3 = c(3.2, 2.4, 5.6)
> m <- data.frame(c1,c2,c3)
> m
c1 c2 c3
1 1 str1 3.2
2 2 str2 2.4
3 3 str3 5.6
> names(m) <- c("var1", "var2", "var3")
> m
var1 var2 var3
1 1 str1 3.2
2 2 str2 2.4
3 3 str3 5.6
The new data frame should be like this:
newDat <- data.frame("var1" = as.numeric(), "var2" = as.character(), "var3" = as.numeric())
The point is that I don't know how the existing data frame (m) is made