Little useless-useful R functions – Typing speed benchmark
Did you ever wonder how fast and with accuracy your typing is? For this instance, we will introduce some random pangrams, code samples and random strings sotrted by level of difficulty. # list of phrases is generated with the help of LLM. Because ..lazy!!!! phrases_db <- list( pangram = list( easy = c( "The quick brown fox jumps over the lazy dog", "Pack my box with five dozen liquor jugs", "How vexingly quick daft zebras jump", "The five boxing wizards jump quickly", "Sphinx of black quartz judge my vow" ), medium = c( "The quick brown fox jumps over the lazy dog while the cat watches", "A wizard's job is to vex chumps quickly in fog with zebra tricks", "Crazy Frederick bought many very exquisite opal jewels last week", "We promptly judged antique ivory buckles for the next prize winner", "Six big devils from Japan quickly forgot how to waltz in my room" ), hard = c( "The job requires extra pluck and zeal from every young wage earner, quickly!", "Grumpy wizards make a toxic brew for the jovial queen who lives in a palace", "Back in June we delivered oxygen equipment of the same size to a new complex", "A quivering Texas zombie fought republic linked jewelry and quartz watches", "The explorer was frozen in his survey before he made a quartz and jade box" ) ), pangram_slo = list( easy = c( "Škrbast mož fizično dviguje hlapca", "Iščem vzdolžen grb ptujskih fac", "Črn šef Gambijk hupa vzdolž cest" ), medium =c( "Ščepec soli fajn zažge tobak v sodih ruma", "Cagav bledoličnež nima škafa za prst juhe", "Vzdržljivi fant mečka gobec hišnemu psu" ), hard = c( "Škodoželjno ga je zafrknil - ni mu pustil več hlebca", "Majceni krastači vrh polža se gabi študij fizike", "Prgišče klofute včasih bolj zaleže od močne brce", "Pretkani gofljač razmišlja o zgodbicah sužnjev", "Fantu, ki je zbrcal špičasto mevžo, hudo grozijo" ) ), rstats = list( easy = c( "The mean is sensitive to outliers", "Always visualize your data first", "Check for missing values early", "The sample size was too small", "R is a language for statistics" ), medium = c( "The p-value was significant at alpha 0.05", "Always check your residuals for normality", "Correlation does not imply causation", "The model explains 87 percent of variance", "Use cross-validation to prevent overfitting", "The confidence interval contains the true mean", "Random forests reduce variance through bagging" ), hard = c( "The heteroscedasticity in residuals violates OLS assumptions", "Apply Bonferroni correction for multiple hypothesis testing", "The likelihood ratio test compares nested model specifications", "Multicollinearity inflates standard errors of coefficients", "Use bootstrapping when parametric assumptions are violated" ) ), code = list( easy = c( "x <- c(1, 2, 3, 4, 5)", "mean(x, na.rm = TRUE)", "print('Hello, World!')", "df <- data.frame(a = 1:5)", "sum(is.na(data))" ), medium = c( "df <- data.frame(x = 1:10, y = rnorm(10))", "result <- sapply(my_list, mean, na.rm = TRUE)", "filtered <- subset(df, value > 0 & group == 'A')", "model <- lm(y ~ x + z, data = train_set)", "apply(matrix_data, MARGIN = 2, FUN = sd)" ), hard = c( "result <- lapply(my_list, function(x) mean(x, na.rm = TRUE))", "ggplot(data, aes(x, y)) + geom_point() + theme_minimal()", "df %>% group_by(category) %>% summarise(avg = mean(value))", "tryCatch(expr = risky_function(), error = function(e) NULL)", "Map(function(x, y) x^2 + y, list_a, list_b)" ) ), chaos = list( easy = c( "df$column[1:5]", "list[[1]]$value", "x <- y + z * 2", "a & b | !c", "func(x = 1, y = 2)" ), medium = c( "data[[1]]$results[[2]]$value", "df[df$x > 0 & !is.na(df$y), ]", "paste0('value_', 1:5, collapse = ', ')", "grepl('^[A-Z]{2,3}$', strings)", "sprintf('%s: %.2f%%', name, pct * 100)" ), hard = c( "purrr::map2_dfr(.x = list_a, .y = list_b, .f = ~.x + .y)", "regex <- '\\\\d{4}-\\\\d{2}-\\\\d{2}\\\\s\\\\d{2}:\\\\d{2}'", "eval(parse(text = paste0('func_', i, '(x = ', j, ')')))", "do.call(rbind, lapply(1:n, function(i) df[sample(nrow(df), 1), ]))", "Reduce(function(acc, x) c(acc, x^2), 1:10, init = numeric(0))" ) ) ) …
Little useless-useful R functions – Typing speed benchmark
Did you ever wonder how fast and with accuracy your typing is? For this instance, we will introduce some random pangrams, code samples and random strings sotrted by level of difficulty. # list of phrases is generated with the help of LLM.…