Closed aravindhebbali closed 4 years ago
This issue was brought to our notice by Peter B Mandeville:
I believe that generally when a calculation is made in R that the result is shown on the screen:
> 2+2 [1] 4
I also believe that generally when a calculation is made in R and the result is assigned to an object that the results isn’t shown on the screen:
> X <- 2+2 > X [1] 4
Or
> (X <- 2+2) [1] 4
The following code is from Packages olsrr – ols_step_forward_p. If the anterior is correct then this code ought to show the result on the screen:
# stepwise forward regression model <- lm(y ~ ., data = surgical) ols_step_forward_p(model)
which it does and
# stepwise forward regression plot model <- lm(y ~ ., data = surgical) k <- ols_step_forward_p(model)
shouldn’t show the result on the screen but it does.
It this is not an error, how can I stop showing the results on the screen when I am assigning them to an object?
These functions behave in the same way.
Finally, the I detected something strange with the ols_step_both_aic function but I can’t repeat it:
model <- lm(y ~ ., data = surgical) k <- ols_step_forward_p(model) k$names k$model > k$names NULL > k$model Call: lm(formula = paste(response, "~", paste(preds, collapse = " + ")), data = l) Coefficients: (Intercept) liver_test alc_heavy enzyme_test -1178.330 58.064 317.848 9.748 pindex bcs 8.924 59.864
> sessionInfo() R version 3.6.1 (2019-07-05) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18362) Matrix products: default locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets [6] methods base other attached packages: [1] olsrr_0.5.2 loaded via a namespace (and not attached): [1] Rcpp_1.0.3 lubridate_1.7.4 [3] lattice_0.20-38 tidyr_1.0.0 [5] clisymbols_1.2.0 class_7.3-15 [7] assertthat_0.2.1 zeallot_0.1.0 [9] digest_0.6.22 ipred_0.9-9 [11] mime_0.7 R6_2.4.0 [13] cellranger_1.1.0 backports_1.1.5 [15] httr_1.4.1 ggplot2_3.2.1 [17] pillar_1.4.2 rlang_0.4.1 [19] lazyeval_0.2.2 curl_4.2 [21] readxl_1.3.1 rstudioapi_0.10 [23] data.table_1.12.6 car_3.0-4 [25] rpart_4.1-15 Matrix_1.2-17 [27] goftest_1.1-1 checkmate_1.9.4 [29] splines_3.6.1 gower_0.2.1 [31] stringr_1.4.0 foreign_0.8-72 [33] munsell_0.5.0 shiny_1.4.0 [35] httpuv_1.5.2 compiler_3.6.1 [37] pkgconfig_2.0.3 htmltools_0.4.0 [39] nnet_7.3-12 tidyselect_0.2.5 [41] tibble_2.1.3 gridExtra_2.3 [43] prodlim_2019.10.13 rio_0.5.16 [45] later_1.0.0 crayon_1.3.4 [47] dplyr_0.8.3 withr_2.1.2 [49] MASS_7.3-51.4 recipes_0.1.7 [51] grid_3.6.1 lifecycle_0.1.0 [53] xtable_1.8-4 jsonlite_1.6 [55] gtable_0.3.0 magrittr_1.5 [57] scales_1.0.0 zip_2.0.4 [59] stringi_1.4.3 carData_3.0-2 [61] promises_1.1.0 timeDate_3043.102 [63] generics_0.0.2 vctrs_0.2.0 [65] gh_1.0.1 openxlsx_4.1.3 [67] nortest_1.0-4 lava_1.6.6 [69] tools_3.6.1 forcats_0.4.0 [71] glue_1.3.1 purrr_0.3.3 [73] hms_0.5.2 fastmap_1.0.1 [75] abind_1.4-5 survival_2.44-1.1 [77] colorspace_1.4-1 haven_2.2.0
This issue was brought to our notice by Peter B Mandeville:
I believe that generally when a calculation is made in R that the result is shown on the screen:
I also believe that generally when a calculation is made in R and the result is assigned to an object that the results isn’t shown on the screen:
Or
The following code is from Packages olsrr – ols_step_forward_p. If the anterior is correct then this code ought to show the result on the screen:
which it does and
shouldn’t show the result on the screen but it does.
It this is not an error, how can I stop showing the results on the screen when I am assigning them to an object?
These functions behave in the same way.
Finally, the I detected something strange with the ols_step_both_aic function but I can’t repeat it: