Need help to remove NA values from data frame

Need help to remove NA values from data frame

2

I have this data frame :
df

and I want to remove those rows which contain NA values from the log2fold change column

How can I do this through R?


DeSEQ2


R

• 256 views

Hi Anas,

If your data frame is called res, then:

res[!is.na(res$log2FoldChange),]

Kevin

Hi,

For dataframe manipulation you should look into the dplyr and tidyr libraries. You can take a look a this cheatsheet for example.

You can remove NAs and rename columns as follows:

library(dplyr)

your_dataframe %>%
  dplyr::filter(!is.na(log2FoldChange)) %>%
  dplyr::rename(gene_names = X)


Login
before adding your answer.

Traffic: 1287 users visited in the last hour

Read more here: Source link