0
我正在運行一個循環。 在此循環中,每次創建一個新的數據框(具有相同的列號和名稱)並附加到前一個表中。 例: 對於i = 1如何在零行(在R中)的數據框中創建新列?
i have df1 = df1(n rows, m column)
df1$new_col <- "some value"
df = rbind(df0,df1)
for i = 2
i have df1 = df1(0 rows, m column)
df1$new_col <- "some val"
Error in `$<-.data.frame`(`*tmp*`, "new_col", value = "some_value") :
replacement has 1 row, data has 0
如何將新列添加到DF與零行?