From 590068aa038b98de550ec4b3e30c1d96679cf765 Mon Sep 17 00:00:00 2001 From: ytakemon Date: Tue, 12 Nov 2024 09:21:57 -0800 Subject: [PATCH] Modified an example to include a demo and blurb on character case sensitivity to fix #305 --- episodes/01-r-basics.Rmd | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/episodes/01-r-basics.Rmd b/episodes/01-r-basics.Rmd index 03183688..c232df7f 100644 --- a/episodes/01-r-basics.Rmd +++ b/episodes/01-r-basics.Rmd @@ -751,12 +751,15 @@ the vector you are searching: # current value of 'snp_genes': # chr [1:7] "OXTR" "ACTN3" "AR" "OPRM1" "CYP1A1" NA "APOA5" -# test to see if "ACTN3" or "APO5A" is in the snp_genes vector +# test to see if "ACTN3", "APO5A", or "actn3" is in the snp_genes vector # if you are looking for more than one value, you must pass this as a vector -c("ACTN3","APOA5") %in% snp_genes +c("ACTN3","APOA5", "actn3") %in% snp_genes ``` +Notice that the gene "actn3" is FALSE? This is because character vectors are case sensitive, so +keep this in mind when subsetting and selecting values from a character vector. + ::::::::::::::::::::::::::::::::::::::::: callout ## Tip: What's the difference between the `%in% and the `==` operators?