I have a dataframe like this,
1 2 abc NA NA NA NA
2 3 abd be f NA NA
4 5 NA NA NA NA NA)
....................
Now, I want to remove those rows which contain all NA's from column 3 onwards. I was doing something like this,,
df <- df[ !(is.na(df$X3)) |!(is.na(df$X4)) ..........]
However, the above command is too cumbersome for large number of columns
Also, after removing such rows, I want to rename the column names of my dataframe in a sequence, i.e. V1 V2 V3...
. Till now, I was doing,
colnames(df) <- c("V1","V2","V3"...)
This is tedious for large number of columns. What can be a better method? Thanks!