@@ -212,6 +212,16 @@ chart.pcomp <- function(data, choices = 1L:2L, name = deparse(substitute(data)),
212212 autoplot.pcomp(data, choices = choices, name = name, ..., type = type, env = env)
213213class(chart.pcomp) <- c("function", "subsettable_type")
214214
215+ # A hack to get fun$type() working in learnr
216+ chart <- list(
217+ screeplot = function(data, type, ...) chart(data, type = "screeplot", ...),
218+ altscreeplot = function(data, type, ...) chart(data, type = "altscreeplot", ...),
219+ loadings = function(data, type, ...) chart(data, type = "loadings", ...),
220+ correlations = function(data, type, ...) chart(data, type = "correlations", ...),
221+ scores = function(data, type, ...) chart(data, type = "scores", ...),
222+ biplot = function(data, type, ...) chart(data, type = "biplot", ...)
223+ )
224+
215225# Preparation of the dataset ------
216226penguins <- read("penguins", package = "palmerpenguins", lang = "fr") %>.%
217227 drop_na(., bill_length_mm)
0 commit comments