[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.2 yen
I bought apricot by 92.7 yen
I bought avocado by 73.7 yen
I bought banana by 97.2 yen
I bought bell pepper by 102.6 yen
I bought bilberry by 117.3 yen
I bought blackberry by 118.3 yen
I bought blackcurrant by 98.3 yen
I bought blood orange by 104.6 yen
I bought blueberry by 101.8 yen
I bought boysenberry by 101.9 yen
I bought breadfruit by 99.0 yen
I bought canary melon by 95.0 yen
I bought cantaloupe by 90.9 yen
I bought cherimoya by 86.2 yen
I bought cherry by 101.5 yen
I bought chili pepper by 86.6 yen
I bought clementine by 95.8 yen
I bought cloudberry by 83.2 yen
I bought coconut by 103.6 yen
I bought cranberry by 88.3 yen
I bought cucumber by 97.6 yen
I bought currant by 99.1 yen
I bought damson by 106.2 yen
I bought date by 77.6 yen
I bought dragonfruit by 110.4 yen
I bought durian by 92.0 yen
I bought eggplant by 102.2 yen
I bought elderberry by 95.3 yen
I bought feijoa by 104.8 yen
I bought fig by 94.7 yen
I bought goji berry by 105.5 yen
I bought gooseberry by 97.8 yen
I bought grape by 109.0 yen
I bought grapefruit by 96.5 yen
I bought guava by 103.1 yen
I bought honeydew by 104.5 yen
I bought huckleberry by 105.7 yen
I bought jackfruit by 101.7 yen
I bought jambul by 93.4 yen
I bought jujube by 91.3 yen
I bought kiwi fruit by 101.3 yen
I bought kumquat by 91.7 yen
I bought lemon by 103.5 yen
I bought lime by 96.1 yen
I bought loquat by 89.4 yen
I bought lychee by 88.1 yen
I bought mandarine by 106.6 yen
I bought mango by 111.8 yen
I bought mulberry by 100.0 yen
I bought nectarine by 92.8 yen
I bought nut by 97.1 yen
I bought olive by 101.4 yen
I bought orange by 96.4 yen
I bought pamelo by 90.7 yen
I bought papaya by 102.5 yen
I bought passionfruit by 103.1 yen
I bought peach by 100.7 yen
I bought pear by 108.8 yen
I bought persimmon by 100.8 yen
I bought physalis by 104.1 yen
I bought pineapple by 110.3 yen
I bought plum by 91.1 yen
I bought pomegranate by 96.6 yen
I bought pomelo by 75.1 yen
I bought purple mangosteen by 112.2 yen
I bought quince by 97.8 yen
I bought raisin by 93.3 yen
I bought rambutan by 86.0 yen
I bought raspberry by 108.2 yen
I bought redcurrant by 106.1 yen
I bought rock melon by 100.5 yen
I bought salal berry by 75.5 yen
I bought satsuma by 98.6 yen
I bought star fruit by 102.5 yen
I bought strawberry by 113.2 yen
I bought tamarillo by 94.9 yen
I bought tangerine by 95.5 yen
I bought ugli fruit by 92.1 yen
I bought watermelon by 99.9 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 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 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 79 over 100? No.
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.
Is 165 over 100? Yes.
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: 0x124693e28>
<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: 0x124693e28>
<environment: namespace:base>