Add empty columns to a dataframe with specified names from a vector

前端 未结 4 1605
执念已碎
执念已碎 2020-11-30 02:36

I have a dataframe, df, with a a number of columns of data already. I have a vector, namevector, full of strings. I need empty columns added to

4条回答
  •  情话喂你
    2020-11-30 02:55

    The below works for me

    dataframe[,"newName"] <- NA
    

    Make sure to add "" for new name string.

提交回复
热议问题