0

I am new to R and am trying to generate a volcano plot of DEGs in my study. Unfortunately, I am having some trouble with the data frame. It seemed to format the genes as a header column but I need to access them in order to annotate my plot. Is there any way to call that column or possibly reformat it through R so that there is a new column titled "genes"? I appreciate any feedback, thank you!

Data frame

I've tried to reformat the table outside of R but has led to no solution as it doesn't seem to recognize the file even though it is still a .csv.

I'd like to be able to run this line, where the top 30 genes are marked on the plot:

df$delabel <- ifelse(df$gene %in% head(df[order(df$p_val_adj), "gene"], 30), 
                                       df$gene, 
                                       NA)
stefan
  • 90,330
  • 6
  • 25
  • 51
  • 2
    `df$genes <- rownames(df)` – LMc Aug 30 '23 at 00:26
  • 2
    Please read about [how to make a great R reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) and update your question accordingly. Include a sample of your data by pasting the output of `dput()` into your post or `dput(head())` if you have a large data frame. Also include code you have tried, any relevant errors, and expected output. If you cannot post your data, then post code for creating representative data. [Do not post images of code and/or data.](https://meta.stackoverflow.com/a/285557/6382434). – LMc Aug 30 '23 at 00:26

0 Answers0