# `letters` contains the 26 letters of the English alphabet
# data.frames will recycle `letters` twice to match the length of `a` (52)
data.frame(
a = 1:52,
b = letters
)
#> a b
#> 1 1 a
#> 2 2 b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set.seed(123) # Set seed for reproducibility | |
library(tidymodels) | |
fit_models <- function(n = 100) { | |
# Step 2: Create 10 predictors, some of which are noisy or highly correlated | |
x1 <- rnorm(n) | |
x2 <- rnorm(n) | |
x3 <- rnorm(n) | |
x4 <- rnorm(n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Untitled" | |
format: html | |
jupyter: python3 | |
--- | |
```{python} | |
#| label: setup | |
#| include: false | |
import pandas as pd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# or use Posit Cloud https://posit.cloud/content/5749861 | |
quarto.workshop::use_module("quarto_whole_game") | |
# or use Posit Cloud https://posit.cloud/content/5749854 | |
quarto.workshop::use_module("quarto_basics") | |
# or use Posit Cloud https://posit.cloud/content/5890555 | |
quarto.workshop::use_module("quarto_tables") | |
# or use Posit Cloud https://posit.cloud/content/5890550 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rhc <- readr::read_csv("https://biostat.app.vumc.org/wiki/pub/Main/DataSets/rhc.csv") | |
rhc$swang1 <- factor(rhc$swang1, levels = c("No RHC", "RHC")) | |
psModel <- glm( | |
formula = swang1 ~ age + sex + race + edu + income + ninsclas + | |
cat1 + das2d3pc + dnr1 + ca + surv2md1 + aps1 + scoma1 + | |
wtkilo1 + temp1 + meanbp1 + resp1 + hrt1 + pafi1 + | |
paco21 + ph1 + wblc1 + hema1 + sod1 + pot1 + crea1 + | |
bili1 + alb1 + resp + card + neuro + gastr + renal + | |
meta + hema + seps + trauma + ortho + cardiohx + chfhx + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hello, | |
# Can anyone help me: I want just to have line plot but when I plot it looks like so as it is indicated in the picture. I am using the following code: | |
# Plot the 7th graph for Google mobility. Recreation & Retail | |
USAMobility <- USAMobility %>% | |
dplyr::mutate(date=dmy(j)) | |
PLOT7 <- USAMobility %>% | |
ggplot(aes(x=date, y=retail_and_recreation_percent_change_from_baseline)) + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"panes": { | |
"quadrants": [ | |
"Source", | |
"Console", | |
"TabSet1", | |
"TabSet2" | |
], | |
"tabSet1": [ | |
"Environment", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use_custom_build <- function(file) { | |
stopifnot(file_exists(file)) | |
build_pane_active <- has_buildtype() | |
bail_out <- check_buildtype() | |
if (bail_out) { | |
return(invisible(NULL)) | |
} | |
file_chmod(file, "+x") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prepare a question about this code and post it on the RStudio Community thread listed in the assignment. | |
# 1. Ask a clear question about the code in English. Tell us what you expect and what is happening. | |
# 2. Use the reprex package to create an example in R. | |
# Your reprex should be something that I can copy and paste on my machine and run right away. | |
# Do NOT just share a screenshot of your RStudio session. | |
# Consider these questions while preparing your reprex: | |
# What do we expect this code to do, and what is happening? | |
# Are the data accesible? Do we need to use the diabetes dataset, or will a built-in dataset do? | |
# Is every part of this code necessary to show the problem? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(broom) | |
library(rsample) | |
# remotes::install_github("malcolmbarrett/cidata") | |
library(cidata) | |
# fit ipw model for a single bootstrap sample | |
fit_ipw <- function(split, ...) { | |
# get bootstrapped data sample | |
.df <- analysis(split) |
NewerOlder