last day (14 days later) » 

10:47 AM
0
Q: Select all the rows in R that have some attributes from other columns R

MixalisI want to search my dataset for those values that some attributes from multiple columns. For that, I found that I can use grep like so: df <- read.csv('example.csv', header = TRUE, sep='\t') df[grep("region+druggable", df$locus_type=="region", df$drug_binary==1),] But when I run this, my out...

 
Hi Mixalis, please provide some minimal example data for your problem using dput(). Also make sure that you have looked into ?grep, that you have understood what arguments you put into the function, and what the effects of these arguments are.
 
@tobiasegli_le done :)
 
Not really :) use dput(df), that way we can copy/paste your data into our R-session
 
@tobiasegli_te the dataframe is 41000 rows and 60 columns. I don't think this is a good idea...
 
Then do it for a subset like df[1:20, 1:10]
 
10:47 AM
@tobiasegli_te you get nothing different that what I have included in the description.
hello.
I moved it to chat so we wont drag this too long in the comment section
 
Hi!
yes good idea
If you copy paste like you did in your example, I can't just copy/paste the data into my R-session. If you use dput(), this is possible.
You should always use dput() (or something similar) if you want to provide example data on SO
 
okay wait
i might be doing something wrong
okay. i will redirect to file.
 
It's okay, I think you got your answer already. But remember to use dput() in future examples.
 

last day (14 days later) »