Biostar Beta. Not for public use.
Question: Remove lines from a toptable that have an empty ID (symbol)
0
Entering edit mode

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

ADD COMMENTlink 15 months ago mannoulag1 • 60 • updated 15 months ago zx8754 7.5k
Entering edit mode
0

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

ADD REPLYlink 15 months ago
WouterDeCoster
39k
Entering edit mode
0

Basic R questions are more relevant to StackOverflow:

ADD REPLYlink 15 months ago
zx8754
7.5k
3
Entering edit mode

Hi

notEmpty <- subset(tt, tt$ID !="")
ADD COMMENTlink 15 months ago ahmad mousavi • 430
Entering edit mode
1

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 != "", ]
ADD REPLYlink 15 months ago
zx8754
7.5k
Entering edit mode
0

yeah that's work too, nice code !!

ADD REPLYlink 15 months ago
ahmad mousavi
• 430
Entering edit mode
0

thank you ahmad mousavi

ADD REPLYlink 15 months ago
mannoulag1
• 60
Entering edit mode
0

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

ADD REPLYlink 15 months ago
WouterDeCoster
39k

Login before adding your answer.

Similar Posts
Loading Similar Posts
Powered by the version 2.0