summaryrefslogtreecommitdiffhomepage
path: root/r.html.markdown
diff options
context:
space:
mode:
authorElena Bolshakova <lena-san@yandex-team.ru>2015-06-10 11:34:14 +0300
committerElena Bolshakova <lena-san@yandex-team.ru>2015-06-10 11:34:14 +0300
commit193f66553fc114e83e7c4cfb4607e4a1b57c4f09 (patch)
tree30988e25d31ed6dff83cf409ad093c3c7ec9322c /r.html.markdown
parent676568cca8731d0dbb2d2bdeff08cc092d283177 (diff)
parent5086480a04d27cff2380f04609210082000538d4 (diff)
Merge branch 'master' of https://github.com/adambard/learnxinyminutes-docs
Diffstat (limited to 'r.html.markdown')
-rw-r--r--r.html.markdown8
1 files changed, 8 insertions, 0 deletions
diff --git a/r.html.markdown b/r.html.markdown
index c555d748..d3d725d3 100644
--- a/r.html.markdown
+++ b/r.html.markdown
@@ -229,6 +229,13 @@ FALSE != FALSE # FALSE
FALSE != TRUE # TRUE
# Missing data (NA) is logical, too
class(NA) # "logical"
+# Use | and & for logic operations.
+# OR
+TRUE | FALSE # TRUE
+# AND
+TRUE & FALSE # FALSE
+# You can test if x is TRUE
+isTRUE(TRUE) # TRUE
# Here we get a logical vector with many elements:
c('Z', 'o', 'r', 'r', 'o') == "Zorro" # FALSE FALSE FALSE FALSE FALSE
c('Z', 'o', 'r', 'r', 'o') == "Z" # TRUE FALSE FALSE FALSE FALSE
@@ -252,6 +259,7 @@ levels(infert$education) # "0-5yrs" "6-11yrs" "12+ yrs"
# NULL
# "NULL" is a weird one; use it to "blank out" a vector
class(NULL) # NULL
+parakeet = c("beak", "feathers", "wings", "eyes")
parakeet
# =>
# [1] "beak" "feathers" "wings" "eyes"