Closed jgduenasl closed 4 years ago
@jgduenasl
plot_outlier () only performs visualization. No visualization object is returned. Therefore, the result cannot be stored in the object. and can not modify the aesthetics of the plots.
However, the following code can save the individual visualization results as an image file rather than an R object.
carseats <- ISLR::Carseats carseats[sample(seq(NROW(carseats)), 20), "Income"] <- NA carseats[sample(seq(NROW(carseats)), 5), "Urban"] <- NA
num_vbles <- carseats %>% names() %>% grep("ce|ge", ., value = TRUE)
plot_num_outliers <- function(df, ls_vbles){ df %>% select(!!ls_vbles) %>% plot_outlier(diagnose_outlier(.) %>% filter(outliers_ratio >= 0.5) %>% select(variables) %>% unlist()) }
png("plotoutliers%02d.png", width = 800, height = 600) plot_num_outliers(carseats, quo(num_vbles)) dev.off()
Thanks for the reply Choonghyunryu,
I am trying to produce an analysis report in Spanish, therefore I wish to customize the aesthetics of the plot results. Is there some way I could work with the results plot function in dlookr? or I would need to make my own customization of the plot functions in my script?
@jgduenasl
customize the aesthetics of plot_outlier() only supports changing the color of the plot using col argument.
There is no way to create this function using R graphics function and save it as an object. Therefore, it must be saved as the graphic file described above.
Visualizations to be made with the ggplot2 package can be saved, but it seems unreasonable to develop plot_outlier() to the ggplot2 package version.
Hi choonghyunryu,
I have revisited your code for generating the quality data report in /inst/report/Diagnosis_Report.Rmd. At the moment, I could adjust it to Spanish and put each diagnosis into a function to use at any moment. However, I would like to know if it is possible to generate reports in Spanish. I could work on it to integrate this possibility into dlookr. Really, I am interested in using this package intensively. Let me know what do you think.
Cheers,
Juan
@jgduenasl
Hi Juan,
Currently, pdf reports only support English and Korean. The html report will support Spanish. However, the title, chapter, subject, etc. are expressed in English, but information on data containing Spanish will work normally.
If dlookr's pdf report supports Spanish, you will need to modify the code to include latex packages that support Spanish.
This topic is closer to the domain of Latex than the domain of R.
Cheers, choonghyunryu
@jgduenasl
merge the "#24 diagnose_report() is not working"
Based on the example for plotting the effect of the outliers of numerical variables, I have defined the function plot_num_outliers() to apply the example to a list of variables named num_vbles of a data frame rnr_df and defined as:
num_vbles <- rnr_df %>% select_at(vars(contains("how_many"), contains("number_of")) %>% names(.)
plot function for outliers visualization of numerical variables
plot_num_outliers <- function(df, ls_vbles){ df %>% select(!!ls_vbles) %>% plot_outlier(diagnose_outlier(.) %>% filter(outliers_ratio >= 0.5) %>% select(variables) %>% unlist()) } When I try to save the results of a object called plot_outliers running plot_outliers <- plot_num_outliers(rnr_df, quo(num_vbles))
seeing the result stored in plot_outliers, it gives me
What is the type of object backed by plot_outlier(), could I modify the aesthetics of the plots and how could I store the plots into a variable?