mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-18 11:36:13 +08:00
impr(quotes): add 5 code_r quotes (zachbrehm) (#5035)
* Create code_r.json Created initial quote file for R code and added two quotes for tidyverse functions. * Formatting text in code_r.json Fixed formatting to allow for new lines. Was unaware of how this worked before consulting the python quotes. * Added quotes to code_r.json Added two additional quotes to ensure that there is at least one in every size group. * Fixed code_r.json * Fixed quote lengths. Fixed the quote lengths for ID1 and ID2. I'm unclear and which shema ares are invalid, will investigate further.
This commit is contained in:
parent
67245ddafa
commit
086adffe3d
1 changed files with 42 additions and 0 deletions
42
frontend/static/quotes/code_r.json
Normal file
42
frontend/static/quotes/code_r.json
Normal file
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"language": "code_r",
|
||||
"groups": [
|
||||
[0, 100],
|
||||
[101, 300],
|
||||
[301, 600],
|
||||
[601, 9999]
|
||||
],
|
||||
"quotes": [
|
||||
{
|
||||
"text": "ggplot(data = sample_df, mapping = aes(x = group, y = value)) +\n\tgeom_point() +\n\tgeom_point(\n\tdata = group_means_df, mapping = aes(x = group, y = group_mean), \n\tcolor = \"red\", size = 3\n\t)",
|
||||
"source": "tidyverse - ggplot2 plot.R",
|
||||
"id": 1,
|
||||
"length": 187
|
||||
},
|
||||
{
|
||||
"text": "starwars %>% \n\tfilter(!is.na(height)) %>%\n\tslice_max(height, n = 3)",
|
||||
"source": "tidyverse - dplyr vignettes/dplyr.Rmd",
|
||||
"id": 2,
|
||||
"length": 67
|
||||
},
|
||||
{
|
||||
"text": "classroom2 <- classroom %>%\n\tpivot_longer(quiz1:test1, names_to = \"assessment\", values_to = \"grade\") %>%\n\tarrange(name, assessment)\nclassroom2",
|
||||
"source": "tidyverse - tidyr vignettes/tidy-data.Rmd",
|
||||
"id": 3,
|
||||
"length": 142
|
||||
},
|
||||
{
|
||||
"text": "library(palmerpenguins)\nlibrary(ggplot2)\nggplot2::theme_set(ggplot2::theme_minimal())\n\nbill_len_dep <- ggplot(\n\tdata = penguins,\n\taes(\n\t\tx = bill_length_mm,\n\t\ty = bill_depth_mm,\n\t\tgroup = species\n\t)\n) +\n\tgeom_point(\n\t\taes(\n\t\t\tcolor = species,\n\t\t\tshape = species\n\t\t),\n\t\tsize = 3,\n\t\talpha = 0.8\n\t) +\n\tgeom_smooth(method = \"lm\", se = FALSE, aes(color = species)) +\n\tscale_color_manual(values = c(\"darkorange\", \"purple\", \"cyan4\")) +\n\tlabs(\n\t\ttitle = \"Penguin bill dimensions\",\n\t\tsubtitle = \"Bill length and depth for Adelie, Chinstrap and Gentoo Penguins at Palmer Station LTER\",\n\t\tx = \"Bill length (mm)\",\n\t\ty = \"Bill depth (mm)\",\n\t\tcolor = \"Penguin species\",\n\t\tshape = \"Penguin species\",\n\t\t) +\n\ttheme(\n\t\tlegend.position = c(0.85, 0.15),\n\t\tplot.title.position = \"plot\",\n\t\tplot.caption = element_text(hjust = 0, face = \"italic\"),\n\t\tplot.caption.position = \"plot\"\n\t)\n\nbill_len_dep",
|
||||
"source": "Allison Horst: palmerpenguins example adapted to tidyverse style guide.",
|
||||
"id": 4,
|
||||
"length": 874
|
||||
},
|
||||
{
|
||||
"text": "my_summarise <- function(data, group_var) {\n\tdata %>%\n\t\tgroup_by({{ group_var }}) %>%\n\t\tsummarise(mean = mean(mass))\n}\nmy_summarise2 <- function(data, expr) {\n\tdata %>% summarise(\n\t\tmean = mean({{ expr }}),\n\t\tsum = sum({{ expr }}),\n\t\tn = n()\n\t)\n}\n\nmy_summarise3 <- function(data, mean_var, sd_var) {\n\tdata %>%\n\t\tsummarise(mean = mean({{ mean_var }}), sd = sd({{ sd_var }}))\n}",
|
||||
"source": "tidyverse - dplyr vignettes/programming.Rmd",
|
||||
"id": 5,
|
||||
"length": 375
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Add table
Reference in a new issue