diff --git a/dev/articles/base.html b/dev/articles/base.html index 48ae5efe1f..987c85c96f 100644 --- a/dev/articles/base.html +++ b/dev/articles/base.html @@ -302,19 +302,19 @@

#> # A tibble: 10 × 1 #> x #> <int> -#> 1 4 -#> 2 10 -#> 3 2 -#> 4 6 +#> 1 2 +#> 2 3 +#> 3 6 +#> 4 8 #> # ℹ 6 more rows df %>% distinct(x, .keep_all = TRUE) # whole data frame #> # A tibble: 10 × 2 #> x y #> <int> <int> -#> 1 4 8 -#> 2 10 10 -#> 3 2 6 -#> 4 6 4 +#> 1 2 9 +#> 2 3 3 +#> 3 6 8 +#> 4 8 2 #> # ℹ 6 more rows

There are two equivalents in base R, depending on whether you want the whole data frame, or just selected variables:

@@ -323,19 +323,19 @@

#> # A tibble: 10 × 1 #> x #> <int> -#> 1 4 -#> 2 10 -#> 3 2 -#> 4 6 +#> 1 2 +#> 2 3 +#> 3 6 +#> 4 8 #> # ℹ 6 more rows df[!duplicated(df$x), , drop = FALSE] # whole data frame #> # A tibble: 10 × 2 #> x y #> <int> <int> -#> 1 4 8 -#> 2 10 10 -#> 3 2 6 -#> 4 6 4 +#> 1 2 9 +#> 2 3 3 +#> 3 6 8 +#> 4 8 2 #> # ℹ 6 more rows
@@ -450,22 +450,22 @@

#> # A tibble: 100 × 4 #> x y z z2 #> <int> <int> <int> <dbl> -#> 1 4 8 12 144 -#> 2 10 10 20 400 -#> 3 2 6 8 64 -#> 4 6 4 10 100 +#> 1 2 9 11 121 +#> 2 3 3 6 36 +#> 3 6 8 14 196 +#> 4 8 2 10 100 #> # ℹ 96 more rows

The closest base equivalent is transform(), but note that it cannot use freshly created variables:

 head(transform(df, z = x + y, z2 = (x + y) ^ 2))
-#>    x  y  z  z2
-#> 1  4  8 12 144
-#> 2 10 10 20 400
-#> 3  2  6  8  64
-#> 4  6  4 10 100
-#> 5  4  2  6  36
-#> 6  6  9 15 225
+#> x y z z2 +#> 1 2 9 11 121 +#> 2 3 3 6 36 +#> 3 6 8 14 196 +#> 4 8 2 10 100 +#> 5 9 2 11 121 +#> 6 7 1 8 64

Alternatively, you can use $<-:

 mtcars$cyl2 <- mtcars$cyl * 2
diff --git a/dev/pkgdown.yml b/dev/pkgdown.yml
index 482ed511c0..b61ce3e4c5 100644
--- a/dev/pkgdown.yml
+++ b/dev/pkgdown.yml
@@ -11,7 +11,7 @@ articles:
   rowwise: rowwise.html
   two-table: two-table.html
   window-functions: window-functions.html
-last_built: 2023-08-23T14:11Z
+last_built: 2023-08-23T14:21Z
 urls:
   reference: https://dplyr.tidyverse.org/reference
   article: https://dplyr.tidyverse.org/articles
diff --git a/dev/reference/between.html b/dev/reference/between.html
index c51f1f2c13..e7c983c90e 100644
--- a/dev/reference/between.html
+++ b/dev/reference/between.html
@@ -123,21 +123,20 @@ 

Examples x <- rnorm(1e2) x[between(x, -1, 1)] -#> [1] -0.57981294 -0.52879956 0.38839095 0.86985258 -0.49805823 -#> [6] -0.73938131 -0.59342199 -0.05676830 -0.86516029 0.78202289 -#> [11] -0.39342678 0.31406382 -0.04640035 0.65311436 0.90165947 -#> [16] 0.79689305 0.05611812 -0.21551702 0.85612385 0.42637689 -#> [21] -0.52124688 0.05742137 0.86729064 -0.75429488 0.20649026 -#> [26] -0.11358057 0.96436933 -0.21759508 0.11509106 0.46444834 -#> [31] -0.80583889 0.02790291 0.77677786 0.32125085 0.53079262 -#> [36] -0.46563019 -0.91694296 0.94050344 -0.60311398 -0.15559806 -#> [41] -0.09292467 0.27427110 -0.45518281 -0.32040784 -0.87125186 -#> [46] 0.54227097 0.25663863 0.15690718 -0.05344594 -0.33009328 -#> [51] -0.82346374 0.21957039 0.29646912 0.03290689 -0.16866147 -#> [56] -0.34605080 -0.65033110 -0.89337311 -0.51715996 -0.27322185 -#> [61] 0.10355422 0.33517936 -0.88482570 0.78081430 -0.38731973 -#> [66] -0.49702114 0.19662836 -0.08775866 -0.24129613 0.05548746 -#> [71] -0.78629860 -0.69371389 -0.41816411 0.63037859 +#> [1] 0.13153983 0.17731882 -0.70901740 0.54993143 -0.70723189 +#> [6] -0.34981207 -0.28089394 0.47620424 0.57171013 -0.06602885 +#> [11] 0.63201517 0.07392526 0.57006251 -0.74250803 0.65595679 +#> [16] -0.77294777 0.91281045 -0.38564850 0.12219822 -0.27543495 +#> [21] -0.82053173 -0.53708412 -0.24520207 0.22859778 -0.89935785 +#> [26] 0.69504785 -0.96956765 0.90262538 0.44607882 -0.20033298 +#> [31] 0.42071670 -0.27319466 -0.36854633 -0.92257242 0.85863387 +#> [36] 0.21837736 0.81985746 0.42734345 -0.67610261 -0.20130827 +#> [41] 0.17887411 0.16395960 -0.03444662 -0.63427080 -0.60472696 +#> [46] 0.26501417 -0.36858746 -0.51833221 0.56359351 -0.30848708 +#> [51] -0.18455164 -0.32731122 -0.77018627 -0.69556921 0.18558315 +#> [56] -0.46978886 -0.26554225 -0.64887450 -0.10474704 0.38773795 +#> [61] 0.37918584 0.15828449 -0.01535869 -0.69888377 -0.36209960 +#> [66] 0.28782196 0.64257579 -0.00514415 # On a tibble using `filter()` filter(starwars, between(height, 100, 150)) diff --git a/dev/reference/c_across.html b/dev/reference/c_across.html index d4d5cadc95..6acfa7ce1f 100644 --- a/dev/reference/c_across.html +++ b/dev/reference/c_across.html @@ -123,12 +123,12 @@

Examples ) #> # A tibble: 4 × 7 #> # Rowwise: -#> id w x y z sum sd -#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> -#> 1 1 0.959 0.392 0.407 0.980 2.74 0.329 -#> 2 2 0.542 0.637 0.581 0.473 2.23 0.0692 -#> 3 3 0.669 0.722 0.840 0.194 2.43 0.284 -#> 4 4 0.143 0.127 0.386 0.480 1.14 0.176 +#> id w x y z sum sd +#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> +#> 1 1 0.678 0.353 0.327 0.228 1.59 0.195 +#> 2 2 0.854 0.0627 0.776 0.964 2.66 0.408 +#> 3 3 0.545 0.272 0.653 0.125 1.60 0.243 +#> 4 4 0.421 0.537 0.786 0.915 2.66 0.226