zx8754

@zx8754.bsky.social

Analysis - Data - Analysis - Data - Volleyball - Father - #rstats #STEM #ProstateCancer

#rstats #TIL I knew about tibble::tribble, but just discovered data.table::rowwiseDT. "creates a data.table object by specifying a row-by-row layout. This is convenient and highly readable for small tables."

Create a data.table row-wise
Aliases: rowwiseDT

Keywords:

### ** Examples

rowwiseDT(
  A=,B=, C=,
  1, "a",2:3,
  2, "b",list(5)
)
       A      B      C
   <num> <char> <list>
1:     1      a    2,3
2:     2      b      5You can define a tibble row-by-row with tribble():

tribble(
  ~x, ~y,  ~z,
  "a", 2,  3.6,
  "b", 1,  8.5
)
#> # A tibble: 2 × 3
#>   x         y     z
#>   <chr> <dbl> <dbl>
#> 1 a         2   3.6
#> 2 b         1   8.5

#rstats pipe help, where is this from? I am guessing it is "modify and re-assign". %<+% Google didn't help, Gemini says it is invalid R code or it is a regex. ChatGPT says it is from ggplot, searching GitHub didn't help. But found this function ggplot2::`%+replace%`(), are they related?