From 7b47fdb3f0c775d6dc0136aef1aa185066c10616 Mon Sep 17 00:00:00 2001 From: carriewright11 Date: Sun, 29 Sep 2024 23:52:39 -0400 Subject: [PATCH] ugh merging issue --- .../Subsetting_Data_in_R.Rmd | 16 +- .../Subsetting_Data_in_R.html | 1166 ++++++++++++++++- 2 files changed, 1178 insertions(+), 4 deletions(-) diff --git a/modules/Subsetting_Data_in_R/Subsetting_Data_in_R.Rmd b/modules/Subsetting_Data_in_R/Subsetting_Data_in_R.Rmd index 29cfed73..506141df 100644 --- a/modules/Subsetting_Data_in_R/Subsetting_Data_in_R.Rmd +++ b/modules/Subsetting_Data_in_R/Subsetting_Data_in_R.Rmd @@ -347,19 +347,29 @@ library(janitor) ## janitor `clean_names` -The `clean_names` function can intuit what fixes you might need. Here it make sure year names aren't just a number, so that the colnames don't need ticks or quotes to be used. +The `clean_names` function can intuit what fixes you might need. The yearly_co2_emissions dataset contains estimated CO2 emissions for 265 countries between the years 1751 and 2014. ```{r} #library(dasehr) -yearly_co2 <- dasehr::yearly_co2_emissions +#yearly_co2 <- dasehr::yearly_co2_emissions # or this: yearly_co2 <- read_csv("https://daseh.org/data/Yearly_CO2_Emissions_1000_tonnes.csv") +``` + +## yearly_co2 column names + +```{r} head(yearly_co2, n = 2) -clean_names(yearly_co2) +``` + +## janitor `clean_names` can intuit fixes +The `clean_names` function can intuit what fixes you might need. Here it make sure year names aren't just a number, so that the colnames don't need ticks or quotes to be used. +```{r} +clean_names(yearly_co2) ``` ## more of clean_names diff --git a/modules/Subsetting_Data_in_R/Subsetting_Data_in_R.html b/modules/Subsetting_Data_in_R/Subsetting_Data_in_R.html index 1d2e8c3b..78a645eb 100644 --- a/modules/Subsetting_Data_in_R/Subsetting_Data_in_R.html +++ b/modules/Subsetting_Data_in_R/Subsetting_Data_in_R.html @@ -122,6 +122,7 @@ @media screen { pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } } +<<<<<<< Updated upstream code span.al { color: #ff0000; font-weight: bold; } /* Alert */ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ code span.at { color: #7d9029; } /* Attribute */ @@ -155,6 +156,1117 @@ +======= + } + return output; + } + + function isFunction( obj ){ + return Object.prototype.toString.call( obj ) == "[object Function]"; + } +} + + + + + + +>>>>>>> Stashed changes @@ -299,18 +1411,32 @@

slice_sample(er, n = 2)
# A tibble: 2 × 6
+<<<<<<< Updated upstream
   county      rate lower95cl upper95cl visits  year
   <chr>      <dbl>     <dbl>     <dbl>  <dbl> <dbl>
 1 Las Animas    NA        NA        NA     NA  2017
 2 Jackson        0         0         0      0  2011
+======= + county rate lower95cl upper95cl visits year + <chr> <dbl> <dbl> <dbl> <dbl> <dbl> +1 Gilpin NA NA NA NA 2020 +2 Sedgwick NA NA NA NA 2018 +>>>>>>> Stashed changes
slice_sample(er, n = 2)
# A tibble: 2 × 6
+<<<<<<< Updated upstream
   county  rate lower95cl upper95cl visits  year
   <chr>  <dbl>     <dbl>     <dbl>  <dbl> <dbl>
 1 Routt      0         0         0      0  2017
 2 Moffat    NA        NA        NA     NA  2012
+======= + county rate lower95cl upper95cl visits year + <chr> <dbl> <dbl> <dbl> <dbl> <dbl> +1 Delta NA NA NA NA 2017 +2 Chaffee 0 0 0 0 2016 +>>>>>>> Stashed changes

Data frames and tibbles

@@ -597,12 +1723,18 @@

janitor clean_names

-

The clean_names function can intuit what fixes you might need. Here it make sure year names aren’t just a number, so that the colnames don’t need ticks or quotes to be used.

+

The clean_names function can intuit what fixes you might need.

+ +

The yearly_co2_emissions dataset contains estimated CO2 emissions for 265 countries between the years 1751 and 2014.

The yearly_co2_emissions dataset contains estimated CO2 emissions for 265 countries between the years 1751 and 2014.

#library(dasehr)
+<<<<<<< Updated upstream
 yearly_co2 <- dasehr::yearly_co2_emissions
+=======
+#yearly_co2 <- dasehr::yearly_co2_emissions
+>>>>>>> Stashed changes
 # or this:
 yearly_co2 <- 
   read_csv("https://daseh.org/data/Yearly_CO2_Emissions_1000_tonnes.csv")
@@ -616,6 +1748,30 @@

ℹ Use `spec()` to retrieve the full column specification for this data. ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message. +<<<<<<< Updated upstream +======= +

yearly_co2 column names

+ +
head(yearly_co2, n = 2)
+ +
# A tibble: 2 × 265
+  country  `1751` `1752` `1753` `1754` `1755` `1756` `1757` `1758` `1759` `1760`
+  <chr>     <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>
+1 Afghani…     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA
+2 Albania      NA     NA     NA     NA     NA     NA     NA     NA     NA     NA
+# ℹ 254 more variables: `1761` <dbl>, `1762` <dbl>, `1763` <dbl>, `1764` <dbl>,
+#   `1765` <dbl>, `1766` <dbl>, `1767` <dbl>, `1768` <dbl>, `1769` <dbl>,
+#   `1770` <dbl>, `1771` <dbl>, `1772` <dbl>, `1773` <dbl>, `1774` <dbl>,
+#   `1775` <dbl>, `1776` <dbl>, `1777` <dbl>, `1778` <dbl>, `1779` <dbl>,
+#   `1780` <dbl>, `1781` <dbl>, `1782` <dbl>, `1783` <dbl>, `1784` <dbl>,
+#   `1785` <dbl>, `1786` <dbl>, `1787` <dbl>, `1788` <dbl>, `1789` <dbl>,
+#   `1790` <dbl>, `1791` <dbl>, `1792` <dbl>, `1793` <dbl>, `1794` <dbl>, …
+ +

janitor clean_names can intuit fixes

+ +

The clean_names function can intuit what fixes you might need. Here it make sure year names aren’t just a number, so that the colnames don’t need ticks or quotes to be used.

+ +>>>>>>> Stashed changes
head(yearly_co2, n = 2)
# A tibble: 2 × 265
@@ -995,7 +2151,11 @@ 

2 Denver 2.95 1.75 4.46 19 2013 3 Larimer 5.49 3.16 8.45 17 2014
+<<<<<<< Updated upstream

Subset rows of a data frame: dplyr

+======= +

Subset rows of a data frame: dplyr

+>>>>>>> Stashed changes

The %in% operator can be used find values from a pre-made list (using c()) for a single column at a time with different columns.

@@ -1389,7 +2549,11 @@

<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 Garfield NA NA NA NA 2018 NA +<<<<<<< Updated upstream
er_year_fix <- relocate(er_30, year, .before = rate)
+=======
+
tb_carb <- relocate(er_30, year, .before = rate)
+>>>>>>> Stashed changes
 
 head(er_year_fix, 1)