how do I remove entries in data frame from a vector
Thank you so much!
On Wed, Oct 21, 2020 at 4:47 PM Rui Barradas <ruipbarradas at sapo.pt> wrote:
Hello, To remove the file extension it's much easier to use base R filename <- tools::file_path_sans_ext(basename(celFiles)) Hope this helps, Rui Barradas ?s 22:41 de 21/10/20, Rui Barradas escreveu:
Hello,
This is probably because basename keeps the file extension, try instead
filename <- sub("(^[^\\.]*)\\..+$", "\\1", basename(celFiles))
celFiles[!filename %in% as.character(remove$V1)]
Hope this helps,
Rui Barradas
?s 22:15 de 21/10/20, Ana Marija escreveu:
Hello, I have a data frame with one column:
remove
V1
1 ABAFT_g_4RWG569_BI_SNP_A10_35096
2 ABAFT_g_4RWG569_BI_SNP_B12_35130
3 ABAFT_g_4RWG569_BI_SNP_E09_35088
4 ABAFT_g_4RWG569_BI_SNP_E12_35136
5 ABAFT_g_4RWG569_BI_SNP_F11_35122
6 ABAFT_g_4RWG569_BI_SNP_F12_35138
7 ABAFT_g_4RWG569_BI_SNP_G07_35060
8 ABAFT_g_4RWG569_BI_SNP_G12_35140
I want to remove these 8 entries from remove data frame from this
vector that looks like this:
head(celFiles)
[1] "/GOKIND/75327/PhenoGenotypeFiles/RootStudyConsentSet_phs000018.GAIN_GoKinD.v2.p1.c1.DS-T1DCR-IRB/GenotypeFiles/ABAFT_g_4RWG569_BI_SNP_A01_34952.CEL" [2] "/GOKIND/75327/PhenoGenotypeFiles/RootStudyConsentSet_phs000018.GAIN_GoKinD.v2.p1.c1.DS-T1DCR-IRB/GenotypeFiles/ABAFT_g_4RWG569_BI_SNP_A02_34968.CEL" [3] "/GOKIND/75327/PhenoGenotypeFiles/RootStudyConsentSet_phs000018.GAIN_GoKinD.v2.p1.c1.DS-T1DCR-IRB/GenotypeFiles/ABAFT_g_4RWG569_BI_SNP_A03_34984.CEL" [4] "GOKIND/75327/PhenoGenotypeFiles/RootStudyConsentSet_phs000018.GAIN_GoKinD.v2.p1.c1.DS-T1DCR-IRB/GenotypeFiles/ABAFT_g_4RWG569_BI_SNP_A04_35000.CEL" [5] "/GOKIND/75327/PhenoGenotypeFiles/RootStudyConsentSet_phs000018.GAIN_GoKinD.v2.p1.c1.DS-T1DCR-IRB/GenotypeFiles/ABAFT_g_4RWG569_BI_SNP_A05_35016.CEL" [6] "/GOKIND/75327/PhenoGenotypeFiles/RootStudyConsentSet_phs000018.GAIN_GoKinD.v2.p1.c1.DS-T1DCR-IRB/GenotypeFiles/ABAFT_g_4RWG569_BI_SNP_A06_35032.CEL" ... I tried doing this: b= celFiles[!basename(celFiles) %in% as.character(remove$V1)] but none of the 8th entries in "remove" data frame have been removed. Please advise, Ana
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.