[1] "a" "a" "a" "b" "b" "b" "b" "b" "b" "b" "b" "b" "c" "c" "c" "c" "c" "c" "c"
[20] "c" "c" "c" "c" "a" "a" "a" "a" "a" "b" "a" NA "b" "b" "a" "a" "a" NA "c"
[39] "a" "a" "b" NA "a" NA NA "a" "c" "a" "a" "b" "c" NA NA "a" "a" "a" "a"
[58] "a" "a" NA "a" "a" NA "a" NA "a" "c" "a" "a" "a" "c" "c" "a" "a" "a" "a"
[77] "a" "a" NA "a"
str_extract(fruit, "b[a-n]")
[1] NA NA NA "ba" "be" "bi" "bl" "bl" "bl" "bl" "be" NA NA NA NA
[16] NA NA NA "be" NA "be" "be" NA NA NA NA NA NA "be" NA
[31] NA "be" "be" NA NA NA NA "be" NA NA "be" NA NA NA NA
[46] NA NA NA NA "be" NA NA NA NA NA NA NA NA NA NA
[61] NA NA NA NA NA NA NA NA NA "be" NA NA "be" NA NA
[76] "be" NA NA NA NA
str_glue("I bought ", "{fruit}", " by {rnorm(length(fruit), mean = 100, sd = 10) |> format(digits = 3)} yen")
I bought apple by 90.3 yen
I bought apricot by 101.2 yen
I bought avocado by 90.0 yen
I bought banana by 102.1 yen
I bought bell pepper by 81.2 yen
I bought bilberry by 113.2 yen
I bought blackberry by 94.6 yen
I bought blackcurrant by 103.7 yen
I bought blood orange by 95.5 yen
I bought blueberry by 110.6 yen
I bought boysenberry by 99.0 yen
I bought breadfruit by 93.1 yen
I bought canary melon by 106.1 yen
I bought cantaloupe by 95.7 yen
I bought cherimoya by 109.9 yen
I bought cherry by 92.7 yen
I bought chili pepper by 89.8 yen
I bought clementine by 95.4 yen
I bought cloudberry by 88.1 yen
I bought coconut by 80.9 yen
I bought cranberry by 108.0 yen
I bought cucumber by 91.2 yen
I bought currant by 89.8 yen
I bought damson by 100.6 yen
I bought date by 92.5 yen
I bought dragonfruit by 107.1 yen
I bought durian by 109.6 yen
I bought eggplant by 107.4 yen
I bought elderberry by 99.3 yen
I bought feijoa by 104.4 yen
I bought fig by 101.7 yen
I bought goji berry by 112.7 yen
I bought gooseberry by 107.2 yen
I bought grape by 82.8 yen
I bought grapefruit by 102.5 yen
I bought guava by 108.7 yen
I bought honeydew by 90.4 yen
I bought huckleberry by 102.3 yen
I bought jackfruit by 103.0 yen
I bought jambul by 91.4 yen
I bought jujube by 103.2 yen
I bought kiwi fruit by 94.5 yen
I bought kumquat by 97.1 yen
I bought lemon by 95.6 yen
I bought lime by 96.7 yen
I bought loquat by 89.7 yen
I bought lychee by 84.7 yen
I bought mandarine by 109.8 yen
I bought mango by 97.2 yen
I bought mulberry by 103.5 yen
I bought nectarine by 102.9 yen
I bought nut by 112.9 yen
I bought olive by 90.4 yen
I bought orange by 91.3 yen
I bought pamelo by 91.6 yen
I bought papaya by 90.1 yen
I bought passionfruit by 94.3 yen
I bought peach by 112.6 yen
I bought pear by 109.4 yen
I bought persimmon by 105.0 yen
I bought physalis by 105.7 yen
I bought pineapple by 105.9 yen
I bought plum by 104.2 yen
I bought pomegranate by 98.3 yen
I bought pomelo by 99.6 yen
I bought purple mangosteen by 100.7 yen
I bought quince by 106.3 yen
I bought raisin by 103.0 yen
I bought rambutan by 99.1 yen
I bought raspberry by 109.2 yen
I bought redcurrant by 80.2 yen
I bought rock melon by 107.5 yen
I bought salal berry by 107.2 yen
I bought satsuma by 88.1 yen
I bought star fruit by 96.4 yen
I bought strawberry by 110.6 yen
I bought tamarillo by 88.0 yen
I bought tangerine by 83.3 yen
I bought ugli fruit by 112.4 yen
I bought watermelon by 103.1 yen
starwars |>str_glue_data("Is {height} over 100? {ifelse(height >= 100, 'Yes','No')}.")
Is 172 over 100? Yes.
Is 167 over 100? Yes.
Is 96 over 100? No.
Is 202 over 100? Yes.
Is 150 over 100? Yes.
Is 178 over 100? Yes.
Is 165 over 100? Yes.
Is 97 over 100? No.
Is 183 over 100? Yes.
Is 182 over 100? Yes.
Is 188 over 100? Yes.
Is 180 over 100? Yes.
Is 228 over 100? Yes.
Is 180 over 100? Yes.
Is 173 over 100? Yes.
Is 175 over 100? Yes.
Is 170 over 100? Yes.
Is 180 over 100? Yes.
Is 66 over 100? No.
Is 170 over 100? Yes.
Is 183 over 100? Yes.
Is 200 over 100? Yes.
Is 190 over 100? Yes.
Is 177 over 100? Yes.
Is 175 over 100? Yes.
Is 180 over 100? Yes.
Is 150 over 100? Yes.
Is NA over 100? NA.
Is 88 over 100? No.
Is 160 over 100? Yes.
Is 193 over 100? Yes.
Is 191 over 100? Yes.
Is 170 over 100? Yes.
Is 185 over 100? Yes.
Is 196 over 100? Yes.
Is 224 over 100? Yes.
Is 206 over 100? Yes.
Is 183 over 100? Yes.
Is 137 over 100? Yes.
Is 112 over 100? Yes.
Is 183 over 100? Yes.
Is 163 over 100? Yes.
Is 175 over 100? Yes.
Is 180 over 100? Yes.
Is 178 over 100? Yes.
Is 79 over 100? No.
Is 94 over 100? No.
Is 122 over 100? Yes.
Is 163 over 100? Yes.
Is 188 over 100? Yes.
Is 198 over 100? Yes.
Is 196 over 100? Yes.
Is 171 over 100? Yes.
Is 184 over 100? Yes.
Is 188 over 100? Yes.
Is 264 over 100? Yes.
Is 188 over 100? Yes.
Is 196 over 100? Yes.
Is 185 over 100? Yes.
Is 157 over 100? Yes.
Is 183 over 100? Yes.
Is 183 over 100? Yes.
Is 170 over 100? Yes.
Is 166 over 100? Yes.
Is 165 over 100? Yes.
Is 193 over 100? Yes.
Is 191 over 100? Yes.
Is 183 over 100? Yes.
Is 168 over 100? Yes.
Is 198 over 100? Yes.
Is 229 over 100? Yes.
Is 213 over 100? Yes.
Is 167 over 100? Yes.
Is 96 over 100? No.
Is 193 over 100? Yes.
Is 191 over 100? Yes.
Is 178 over 100? Yes.
Is 216 over 100? Yes.
Is 234 over 100? Yes.
Is 188 over 100? Yes.
Is 178 over 100? Yes.
Is 206 over 100? Yes.
Is NA over 100? NA.
Is NA over 100? NA.
Is NA over 100? NA.
Is NA over 100? NA.
Is NA over 100? NA.
Warning: Using an external vector in selections was deprecated in tidyselect 1.1.0.
ℹ Please use `all_of()` or `any_of()` instead.
# Was:
data %>% select(select_vars)
# Now:
data %>% select(all_of(select_vars))
See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
function (x, trim = 0, na.rm = FALSE, ...)
{
if (!is.numeric(x) && !is.complex(x) && !is.logical(x)) {
warning("argument is not numeric or logical: returning NA")
return(NA_real_)
}
if (isTRUE(na.rm))
x <- x[!is.na(x)]
if (!is.numeric(trim) || length(trim) != 1L)
stop("'trim' must be numeric of length one")
n <- length(x)
if (trim > 0 && n) {
if (is.complex(x))
stop("trimmed means are not defined for complex data")
if (anyNA(x))
return(NA_real_)
if (trim >= 0.5)
return(stats::median(x, na.rm = FALSE))
lo <- floor(n * trim) + 1
hi <- n + 1 - lo
x <- sort.int(x, partial = unique(c(lo, hi)))[lo:hi]
}
.Internal(mean(x))
}
<bytecode: 0x1330142b0>
<environment: namespace:base>
getAnywhere(mean.default)
A single object matching 'mean.default' was found
It was found in the following places
package:base
registered S3 method for mean from namespace base
namespace:base
with value
function (x, trim = 0, na.rm = FALSE, ...)
{
if (!is.numeric(x) && !is.complex(x) && !is.logical(x)) {
warning("argument is not numeric or logical: returning NA")
return(NA_real_)
}
if (isTRUE(na.rm))
x <- x[!is.na(x)]
if (!is.numeric(trim) || length(trim) != 1L)
stop("'trim' must be numeric of length one")
n <- length(x)
if (trim > 0 && n) {
if (is.complex(x))
stop("trimmed means are not defined for complex data")
if (anyNA(x))
return(NA_real_)
if (trim >= 0.5)
return(stats::median(x, na.rm = FALSE))
lo <- floor(n * trim) + 1
hi <- n + 1 - lo
x <- sort.int(x, partial = unique(c(lo, hi)))[lo:hi]
}
.Internal(mean(x))
}
<bytecode: 0x1330142b0>
<environment: namespace:base>