This is more a programming question than bioinformatics... So if a row contains one element which starts with "chr" the entire row has to be deleted? ADD REPLY • 0 views • link written 9.6 years ago by WouterDeCoster
Maybe, this could help you Delete rows containing specific strings in R remove rows containing certain data ADD REPLY • 0 views • link written 9.6 years ago by venu
I highly recommend the dplyr package by Hadley Wickham: https://cran.rstudio.com/web/packages/dplyr/vignettes/introduction.html. ADD REPLY • 0 views • link written 9.6 years ago by Dave Tang
So do I - but it is not especially relevant to this problem. ADD REPLY • 0 views • link written 9.6 years ago by Neilfws
Fair enough. I thought filter() would easily address the problem but there's no straightforward way of filtering on all columns. ADD REPLY • 0 views • link written 9.6 years ago by Dave Tang
Thanks you all, your advice has been useful. I solved with grepl function. Now, another question: I need to delete from a dataframe rows of another dataframe (with the same structure) using, maybe, a common cell. Thanks for your help. ADD REPLY • 0 views • link written 9.6 years ago by mzezza •
Thanks you all, your advice has been useful. I solved with grepl function. Now, another question: I need to delete from a dataframe rows of another dataframe (with the same structure) using, maybe, a common cell. Thanks for your help. ADD REPLY • 0 views • link written 9.6 years ago by mzezza •
It's advisable to create new threads for new questions. In addition, this is again not a bioinformatics question. ADD REPLY • 0 views • link written 9.6 years ago by WouterDeCoster
just change to:data[-grep("^chr",data$cell,perl=T),] ADD REPLY • 0 views • link written 9.6 years ago by zjhzwang
This is more a programming question than bioinformatics...
So if a row contains one element which starts with "chr" the entire row has to be deleted?
Maybe, this could help you
Delete rows containing specific strings in R
remove rows containing certain data
I highly recommend the dplyr package by Hadley Wickham: https://cran.rstudio.com/web/packages/dplyr/vignettes/introduction.html.
So do I - but it is not especially relevant to this problem.
Fair enough. I thought filter() would easily address the problem but there's no straightforward way of filtering on all columns.
Thanks you all, your advice has been useful. I solved with grepl function.
Now, another question: I need to delete from a dataframe rows of another dataframe (with the same structure) using, maybe, a common cell.
Thanks for your help.
Thanks you all, your advice has been useful. I solved with grepl function.
Now, another question: I need to delete from a dataframe rows of another dataframe (with the same structure) using, maybe, a common cell.
Thanks for your help.
It's advisable to create new threads for new questions. In addition, this is again not a bioinformatics question.