Here is a general approach. It does not assume that you will only have three lines; it will work with any number of lines that you have. And if there is no value in the nested structure (for example, var1 does not exist for some subscriptions in section 2), the code correctly returns NA for this cell.
eg. if we use the following data:
test <- structure(list(id = 1, var1 = 2, var3 = 4, section1 = structure(list(var1 = 1, var2 = 2, var3 = 3), .Names = c("var1", "var2", "var3")), section2 = structure(list(row = structure(list(var1 = 1, var2 = 2), .Names = c("var1", "var2")), row = structure(list(var1 = 4, var2 = 5), .Names = c("var1", "var2")), row = structure(list( var2 = 8, var3 = 9), .Names = c("var2", "var3"))), .Names = c("row", "row", "row"))), .Names = c("id", "var1", "var3", "section1", "section2"))
A general approach is to use a melt to create a data frame that includes information about the nested structure, and then dcast to format it to the desired format.
library("reshape2") flat <- unlist(test, recursive=FALSE) names(flat)[grep("row", names(flat))] <- gsub("row", "var", paste0(names(flat)[grep("row", names(flat))], seq_len(length(names(flat)[grep("row", names(flat))]))))