The reduced data is stored as reduced_data
in the partition object and can
thus be returned by subsetting object$reduced_data
. Alternatively, the
functions partition_score()
and fitted()
also return the reduced data.
partition_scores(object, ...)
# S3 method for class 'partition'
fitted(object, ...)
a partition
object
not currently used (for S3 consistency with fitted()
)
a tibble containing the reduced data for the partition
set.seed(123)
df <- simulate_block_data(c(3, 4, 5), lower_corr = .4, upper_corr = .6, n = 100)
# fit partition
prt <- partition(df, threshold = .6)
# three ways to retrieve reduced data
partition_scores(prt)
#> # A tibble: 100 × 9
#> block1_x1 block1_x2 block1_x3 block2_x4 block3_x2 block3_x3 block3_x4
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 -0.441 -0.327 0.503 -0.526 0.203 -0.907 -0.919
#> 2 -0.180 -0.584 0.490 -1.71 -0.249 -1.39 -0.398
#> 3 0.376 0.158 -0.0732 0.693 -0.554 -1.52 0.714
#> 4 1.10 1.54 0.564 -0.524 -0.585 -0.00592 0.299
#> 5 -1.66 -1.25 -1.44 0.189 -1.69 -1.43 0.140
#> 6 1.60 2.42 0.192 0.463 -1.26 -0.346 -1.86
#> 7 1.40 0.236 -0.354 -0.313 -0.223 -1.13 0.0716
#> 8 2.21 2.41 1.73 -0.521 1.72 2.19 1.04
#> 9 0.404 0.311 0.672 -0.572 -1.10 -0.0893 -1.55
#> 10 0.199 0.348 0.0455 -0.408 -0.192 -0.355 0.223
#> # ℹ 90 more rows
#> # ℹ 2 more variables: reduced_var_1 <dbl>, reduced_var_2 <dbl>
fitted(prt)
#> # A tibble: 100 × 9
#> block1_x1 block1_x2 block1_x3 block2_x4 block3_x2 block3_x3 block3_x4
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 -0.441 -0.327 0.503 -0.526 0.203 -0.907 -0.919
#> 2 -0.180 -0.584 0.490 -1.71 -0.249 -1.39 -0.398
#> 3 0.376 0.158 -0.0732 0.693 -0.554 -1.52 0.714
#> 4 1.10 1.54 0.564 -0.524 -0.585 -0.00592 0.299
#> 5 -1.66 -1.25 -1.44 0.189 -1.69 -1.43 0.140
#> 6 1.60 2.42 0.192 0.463 -1.26 -0.346 -1.86
#> 7 1.40 0.236 -0.354 -0.313 -0.223 -1.13 0.0716
#> 8 2.21 2.41 1.73 -0.521 1.72 2.19 1.04
#> 9 0.404 0.311 0.672 -0.572 -1.10 -0.0893 -1.55
#> 10 0.199 0.348 0.0455 -0.408 -0.192 -0.355 0.223
#> # ℹ 90 more rows
#> # ℹ 2 more variables: reduced_var_1 <dbl>, reduced_var_2 <dbl>
prt$reduced_data
#> # A tibble: 100 × 9
#> block1_x1 block1_x2 block1_x3 block2_x4 block3_x2 block3_x3 block3_x4
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 -0.441 -0.327 0.503 -0.526 0.203 -0.907 -0.919
#> 2 -0.180 -0.584 0.490 -1.71 -0.249 -1.39 -0.398
#> 3 0.376 0.158 -0.0732 0.693 -0.554 -1.52 0.714
#> 4 1.10 1.54 0.564 -0.524 -0.585 -0.00592 0.299
#> 5 -1.66 -1.25 -1.44 0.189 -1.69 -1.43 0.140
#> 6 1.60 2.42 0.192 0.463 -1.26 -0.346 -1.86
#> 7 1.40 0.236 -0.354 -0.313 -0.223 -1.13 0.0716
#> 8 2.21 2.41 1.73 -0.521 1.72 2.19 1.04
#> 9 0.404 0.311 0.672 -0.572 -1.10 -0.0893 -1.55
#> 10 0.199 0.348 0.0455 -0.408 -0.192 -0.355 0.223
#> # ℹ 90 more rows
#> # ℹ 2 more variables: reduced_var_1 <dbl>, reduced_var_2 <dbl>