问题
I have a single DataFrame that needs to be sent to a Quality Test API that should return another DataFrame.
But unfortunately the API is not accepting the DataFrame as a whole and hence I am slicing it row by row and sending it to the API.
Hence I am getting single row DataFrames with each request. Can someone tell me how I can keep appending these single rows to a larger Data Frame?
回答1:
You can append data frames to each other using bind_rows
from the dplyr
package.
df1 = data.frame(number = c(1, 2, 3, 4),
name=c("Alice", "Bob", "Charlie", "Donna")
df2 = data.frame(number = c(5), name=c("Eve"))
df3 = bind_rows(df1, df2) #df3 has all five rows.
来源:https://stackoverflow.com/questions/42229019/how-to-append-smaller-dataframe-to-another-dataframe-in-r