Skip to content

Commit 7659e6d

Browse files
committed
update pca tests to reflext changes to scores type
1 parent 35b3913 commit 7659e6d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

tests/testthat/test-pca.R

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@ test_that('PCA scores chart returns ggplot object',{
3131
# apply the model
3232
M=model.predict(M,D)
3333
# chart
34-
C=pca_scores_plot(groups=D$sample_meta$Species)
34+
C=pca_scores_plot(factor_name='Species')
3535
# plot
3636
gg=chart.plot(C,M[2])
3737

3838
ggplot_build(gg)
3939
expect_true(is(gg,'ggplot'))
4040

4141
# label all points
42-
C=pca_scores_plot(groups=D$sample_meta$Species,points_to_label = 'all')
42+
C=pca_scores_plot(factor_name='Species',points_to_label = 'all')
4343
# plot
4444
gg=chart.plot(C,M[2])
4545

4646
ggplot_build(gg)
4747
expect_true(is(gg,'ggplot'))
4848

4949
# label outliers
50-
C=pca_scores_plot(groups=D$sample_meta$Species,points_to_label = 'outliers')
50+
C=pca_scores_plot(factor_name='Species',points_to_label = 'outliers')
5151
# plot
5252
gg=chart.plot(C,M[2])
5353

@@ -56,15 +56,16 @@ test_that('PCA scores chart returns ggplot object',{
5656

5757

5858
# continuous factor
59-
C=pca_scores_plot(groups=c(1:length(D$sample_meta$Species)))
59+
M[2]$scores$sample_meta$Sample_No=1:length(D$sample_meta$Species)
60+
C=pca_scores_plot(factor_name='Sample_No')
6061
# plot
6162
gg=chart.plot(C,M[2])
6263

6364
ggplot_build(gg)
6465
expect_true(is(gg,'ggplot'))
6566

6667
# label filter
67-
C=pca_scores_plot(groups=D$sample_meta$Species,label_filter='virginica',points_to_label='all')
68+
C=pca_scores_plot(factor_name='Species',label_filter='virginica',points_to_label='all')
6869
# plot
6970
gg=chart.plot(C,M[2])
7071

@@ -82,21 +83,21 @@ test_that('PCA biplot chart returns ggplot object',{
8283
# apply the model
8384
M=model.predict(M,D)
8485
# chart
85-
C=pca_biplot_plot(groups=D$sample_meta$Species,style='arrows')
86+
C=pca_biplot_plot(factor_name='Species',style='arrows')
8687
# plot
8788
gg=chart.plot(C,M[2])
8889

8990
ggplot_build(gg)
9091
expect_true(is(gg,'ggplot'))
9192
# different style
92-
C=pca_biplot_plot(groups=D$sample_meta$Species,style='points')
93+
C=pca_biplot_plot(factor_name='Species',style='points')
9394
# plot
9495
gg=chart.plot(C,M[2])
9596

9697
ggplot_build(gg)
9798
expect_true(is(gg,'ggplot'))
9899
# variable labels
99-
C=pca_biplot_plot(groups=D$sample_meta$Species,style='points',label_features = TRUE)
100+
C=pca_biplot_plot(factor_name='Species',style='points',label_features = TRUE)
100101
# plot
101102
gg=chart.plot(C,M[2])
102103

0 commit comments

Comments
 (0)