Merging two columns into one in R

后端 未结 7 904
情深已故
情深已故 2020-11-29 02:06

I have the following data frame, and am trying to merge the two columns into one, while replacing NA\'s with the numeric values.

ID    A     B
1         


        
相关标签:
7条回答
  • 2020-11-29 02:44

    You can also do: with(d,ifelse(is.na(A),B,A))

    where d is your data frame.

    0 讨论(0)
提交回复
热议问题