This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Remove lines from a toptable that have an empty ID (symbol)

Hi,

How to remove lines (genes) from a toptable tt that have an empty ID (symbol)? These genes are not annotated and I would like to remove them from the toptable.

the columns are:

row.names, ID, logFC, AverExpr, …

Thanks

toptable limma r gene

What have you tried? This is a quite basic R question on slicing/subsetting a dataframe.

1 answer

Hi

notEmpty <- subset(tt, tt$ID !="")

thank you ahmad mousavi

If an answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted.
Upvote|Bookmark|Accept

No need to call tt in subset again, try:

notEmpty <- subset(tt, ID != "")

Also note, from ?subset manual:

This is a convenience function intended for use interactively. For programming it is better to use the standard subsetting functions like [, and in particular the non-standard evaluation of argument subset can have unanticipated consequences.

So the preferred way would be:

notEmpty <- tt[ tt$ID != "", ]

yeah that's work too, nice code !!

Log in to answer this question.