Extend dplyr::left_join() to operate on the sampleTable slot of a mesaDimRed object.

# S3 method for class 'mesaDimRed'
left_join(
  x,
  y,
  by = NULL,
  copy = FALSE,
  suffix = c(".x", ".y"),
  keep = NULL,
  ...
)

Arguments

x

mesaDimRed Object whose sampleTable will be joined.

y

data.frame Table to join.

by

character() or NULL Join columns; see dplyr::left_join(). Default: NULL.

copy

logical(1) See dplyr::left_join(). Default: FALSE.

suffix

character(2) Suffixes appended to overlapping non-join column names. Default: c(".x", ".y").

keep

logical(1) or NULL Retain join keys from both tables. Default: NULL.

...

Additional arguments to dplyr::left_join().

Value

A mesaDimRed object:

  • sampleTable updated with y via a left join.

Examples

new <- data.frame(sample_name = c("Colon1_N", "Colon2_N"), foo = c(1, 2))

exampleTumourNormal %>%
    getPCA() %>%
    left_join(new, by = join_by(sample_name)) %>%
    getSampleTable()
#> ------------------------------
#> Initial number of windows = 819.
#> -----------
#> Generating table of beta values for 819 regions across 10 samples.
#> -----------
#> Filtered out 220 windows with at least one missing value: 599 windows remaining.
#> ------------------------------
#> The following topVarNum values are larger than the number of remaining windows (= 599): 1000
#> These values are not used; PCA will be done with all remaining windows instead.
#> ------------------------------
#> No filtering of windows based on window standard deviation.
#> Performing PCA with 10 samples and 599 windows
#> -> pca1.
#> ------------------------------
#>          sample_name    group patient        type tumour tissue age gender
#> Colon1_N    Colon1_N Colon1_N  Colon1 NormalColon Normal  Colon  80      F
#> Colon1_T    Colon1_T Colon1_T  Colon1         CRC Tumour  Colon  80      F
#> Colon2_N    Colon2_N Colon2_N  Colon2 NormalColon Normal  Colon  67      F
#> Colon2_T    Colon2_T Colon2_T  Colon2         CRC Tumour  Colon  67      F
#> Lung1_N      Lung1_N  Lung1_N   Lung1  NormalLung Normal   Lung  64      F
#> Lung1_T      Lung1_T  Lung1_T   Lung1        LUAD Tumour   Lung  64      F
#> Lung2_N      Lung2_N  Lung2_N   Lung2  NormalLung Normal   Lung  71      F
#> Lung2_T      Lung2_T  Lung2_T   Lung2        LUSC Tumour   Lung  71      F
#> Lung3_N      Lung3_N  Lung3_N   Lung3  NormalLung Normal   Lung  72      M
#> Lung3_T      Lung3_T  Lung3_T   Lung3        LUAD Tumour   Lung  72      M
#>          stage foo
#> Colon1_N  <NA>   1
#> Colon1_T   III  NA
#> Colon2_N  <NA>   2
#> Colon2_T    IV  NA
#> Lung1_N   <NA>  NA
#> Lung1_T    IIA  NA
#> Lung2_N   <NA>  NA
#> Lung2_T     IA  NA
#> Lung3_N   <NA>  NA
#> Lung3_T     IB  NA