cheesecakeylayyabai
Category:Tamil film scores by Ilaiyaraaja
Category:2002 film scoresQ:
Catch values of missing values (na.locf)
How do you put NA's in a dataframe after using the command "na.locf" in R?
I am using a big dataframe that contains a column of NA values, and I want to put the NA values at the end of the dataframe.
A:
You can try replacing with NA (as I understand it's a logical argument) and then reindex using:
t(replace(df,df=="NA",NA))
# a b c
# 1 4 7 5
# 2 6 3 3
# 3 1 4 2
# 4 2 6 6
# 5 3 8 4
# 6 4 9 3
# 7 5 1 2
# 8 5 2 1
# 9 4 3 2
# 10 5 4 3
# 11 2 6 4
# 12 4 7 be359ba680
Related links:
コメント