diff --git a/01-exploratorio.Rmd b/01-exploratorio.Rmd index dade559..a76fe67 100644 --- a/01-exploratorio.Rmd +++ b/01-exploratorio.Rmd @@ -458,7 +458,8 @@ Por otro lado, las variaciones con respecto a las medianas **dentro** de cada zona, por grupo, se resume como: ```{r} -quantile(casas |> group_by(nombre_zona) |> +quantile(casas |> + group_by(nombre_zona) |> mutate(residual = precio_m2 - median(precio_m2)) |> pull(residual)) |> round() @@ -833,18 +834,15 @@ marcar <- marcar_tabla_fun(25, "red", "black") tab_out <- tabla_perfil |> arrange(desc(bolsas)) |> select(-pct, everything()) |> - mutate(across(where(is.numeric), round, 0)) |> - mutate(across(where(if_profile), marcar)) |> + mutate(across(where(is.numeric), \(x) round(x, 0))) |> + mutate(across(where(if_profile), \(x) marcar(x))) |> knitr::kable(format_table_salida(), escape = FALSE, digits = 0, booktabs = T) |> kableExtra::kable_styling(latex_options = c("striped", "scale_down"), bootstrap_options = c( "hover", "condensed"), full_width = FALSE) -if (knitr::is_latex_output()) { - gsub("marca_propia", "marca-propia", tab_out) -} else { - tab_out -} +tab_out + ``` Leemos esta tabla como sigue: por ejemplo, los compradores de té suelto diff --git a/renv.lock b/renv.lock index 6b3f861..a4e56f4 100644 --- a/renv.lock +++ b/renv.lock @@ -94,6 +94,19 @@ ], "Hash": "f27411eb6d9c3dada5edd444b8416675" }, + "V8": { + "Package": "V8", + "Version": "4.4.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "Rcpp", + "curl", + "jsonlite", + "utils" + ], + "Hash": "ca98390ad1cef2a5a609597b49d3d042" + }, "abind": { "Package": "abind", "Version": "1.4-5", @@ -136,6 +149,16 @@ ], "Hash": "543776ae6848fde2f48ff3816d0628bc" }, + "bigD": { + "Package": "bigD", + "Version": "0.2.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "93637e906f3fe962413912c956eb44db" + }, "bit": { "Package": "bit", "Version": "4.0.5", @@ -160,6 +183,13 @@ ], "Hash": "9fe98599ca456d6552421db0d6772d8f" }, + "bitops": { + "Package": "bitops", + "Version": "1.0-8", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "da69e6b6f8feebec0827205aad3fdbd8" + }, "blob": { "Package": "blob", "Version": "1.2.4", @@ -366,6 +396,13 @@ ], "Hash": "d954cb1c57e8d8b756165d7ba18aa55a" }, + "commonmark": { + "Package": "commonmark", + "Version": "1.9.1", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "5d8225445acb167abf7797de48b2ee3c" + }, "conflicted": { "Package": "conflicted", "Version": "1.2.0", @@ -804,6 +841,36 @@ ], "Hash": "d6db1667059d027da730decdc214b959" }, + "gt": { + "Package": "gt", + "Version": "0.11.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "base64enc", + "bigD", + "bitops", + "cli", + "commonmark", + "dplyr", + "fs", + "glue", + "htmltools", + "htmlwidgets", + "juicyjuice", + "magrittr", + "markdown", + "reactable", + "rlang", + "sass", + "scales", + "tidyselect", + "vctrs", + "xml2" + ], + "Hash": "3470c2eb1123db6a2c54ec812de38284" + }, "gtable": { "Package": "gtable", "Version": "0.3.5", @@ -891,6 +958,21 @@ ], "Hash": "81d371a9cc60640e74e4ab6ac46dcedc" }, + "htmlwidgets": { + "Package": "htmlwidgets", + "Version": "1.6.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "grDevices", + "htmltools", + "jsonlite", + "knitr", + "rmarkdown", + "yaml" + ], + "Hash": "04291cc45198225444a397606810ac37" + }, "httr": { "Package": "httr", "Version": "1.4.7", @@ -948,6 +1030,16 @@ ], "Hash": "e1b9c55281c5adc4dd113652d9e26768" }, + "juicyjuice": { + "Package": "juicyjuice", + "Version": "0.1.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "V8" + ], + "Hash": "3bcd11943da509341838da9399e18bce" + }, "kableExtra": { "Package": "kableExtra", "Version": "1.4.0", @@ -1058,6 +1150,19 @@ ], "Hash": "7ce2733a9826b3aeb1775d56fd305472" }, + "markdown": { + "Package": "markdown", + "Version": "1.13", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "commonmark", + "utils", + "xfun" + ], + "Hash": "074efab766a9d6360865ad39512f2a7e" + }, "matrixStats": { "Package": "matrixStats", "Version": "1.3.0", @@ -1332,6 +1437,31 @@ ], "Hash": "5e3c5dc0b071b21fa128676560dbe94d" }, + "reactR": { + "Package": "reactR", + "Version": "0.6.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "htmltools" + ], + "Hash": "10f4d661c235181648a5958c02c0382a" + }, + "reactable": { + "Package": "reactable", + "Version": "0.4.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "digest", + "htmltools", + "htmlwidgets", + "jsonlite", + "reactR" + ], + "Hash": "6069eb2a6597963eae0605c1875ff14c" + }, "readr": { "Package": "readr", "Version": "2.1.5",