Giter Club home page Giter Club logo

esm244_reprex_practice's Introduction

esm244_reprex_practice

esm244_reprex_practice's People

Contributors

oharac avatar

Forkers

tinafang-1207

esm244_reprex_practice's Issues

Coloring points by name - Shuying Yu

Cool plot

library(reprex)
library(tidyverse)

#Dataframe
df <- tribble(~name, ~wt, ~ht,
              "Teddy", 52, 0.5,
              "Khora", 60, 0.6,
              "Waffle", 28, 0.4)

#Create graph
ggplot(data = df, aes(x = wt, y = ht)) +
  
  #Color point by name
  geom_point(aes(color = name))

Created on 2022-01-04 by the reprex package (v2.0.1)

Terrible penguin graph, why won't my color work for year?? why is my facet_wrap not working? why is it breaking after that?? - Trevor Maggart

library(tidyverse)
library(palmerpenguins)

ggplot(penguins, aes(x = body_mass_g, y = flipper_length_mm)) +
         geom_point(color = year) +
         facet_wrap(~'species') 
#> Error in layer(data = data, mapping = mapping, stat = stat, geom = GeomPoint, : object 'year' not found
         theme_classic()
#> List of 93
#>  $ line                      :List of 6
#>   ..$ colour       : chr "black"
#>   ..$ size         : num 0.5
#>   ..$ linetype     : num 1
#>   ..$ lineend      : chr "butt"
#>   ..$ arrow        : logi FALSE
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_line" "element"
#>  $ rect                      :List of 5
#>   ..$ fill         : chr "white"
#>   ..$ colour       : chr "black"
#>   ..$ size         : num 0.5
#>   ..$ linetype     : num 1
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_rect" "element"
#>  $ text                      :List of 11
#>   ..$ family       : chr ""
#>   ..$ face         : chr "plain"
#>   ..$ colour       : chr "black"
#>   ..$ size         : num 11
#>   ..$ hjust        : num 0.5
#>   ..$ vjust        : num 0.5
#>   ..$ angle        : num 0
#>   ..$ lineheight   : num 0.9
#>   ..$ margin       : 'margin' num [1:4] 0points 0points 0points 0points
#>   .. ..- attr(*, "unit")= int 8
#>   ..$ debug        : logi FALSE
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ title                     : NULL
#>  $ aspect.ratio              : NULL
#>  $ axis.title                : NULL
#>  $ axis.title.x              :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : NULL
#>   ..$ size         : NULL
#>   ..$ hjust        : NULL
#>   ..$ vjust        : num 1
#>   ..$ angle        : NULL
#>   ..$ lineheight   : NULL
#>   ..$ margin       : 'margin' num [1:4] 2.75points 0points 0points 0points
#>   .. ..- attr(*, "unit")= int 8
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ axis.title.x.top          :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : NULL
#>   ..$ size         : NULL
#>   ..$ hjust        : NULL
#>   ..$ vjust        : num 0
#>   ..$ angle        : NULL
#>   ..$ lineheight   : NULL
#>   ..$ margin       : 'margin' num [1:4] 0points 0points 2.75points 0points
#>   .. ..- attr(*, "unit")= int 8
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ axis.title.x.bottom       : NULL
#>  $ axis.title.y              :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : NULL
#>   ..$ size         : NULL
#>   ..$ hjust        : NULL
#>   ..$ vjust        : num 1
#>   ..$ angle        : num 90
#>   ..$ lineheight   : NULL
#>   ..$ margin       : 'margin' num [1:4] 0points 2.75points 0points 0points
#>   .. ..- attr(*, "unit")= int 8
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ axis.title.y.left         : NULL
#>  $ axis.title.y.right        :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : NULL
#>   ..$ size         : NULL
#>   ..$ hjust        : NULL
#>   ..$ vjust        : num 0
#>   ..$ angle        : num -90
#>   ..$ lineheight   : NULL
#>   ..$ margin       : 'margin' num [1:4] 0points 0points 0points 2.75points
#>   .. ..- attr(*, "unit")= int 8
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ axis.text                 :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : chr "grey30"
#>   ..$ size         : 'rel' num 0.8
#>   ..$ hjust        : NULL
#>   ..$ vjust        : NULL
#>   ..$ angle        : NULL
#>   ..$ lineheight   : NULL
#>   ..$ margin       : NULL
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ axis.text.x               :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : NULL
#>   ..$ size         : NULL
#>   ..$ hjust        : NULL
#>   ..$ vjust        : num 1
#>   ..$ angle        : NULL
#>   ..$ lineheight   : NULL
#>   ..$ margin       : 'margin' num [1:4] 2.2points 0points 0points 0points
#>   .. ..- attr(*, "unit")= int 8
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ axis.text.x.top           :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : NULL
#>   ..$ size         : NULL
#>   ..$ hjust        : NULL
#>   ..$ vjust        : num 0
#>   ..$ angle        : NULL
#>   ..$ lineheight   : NULL
#>   ..$ margin       : 'margin' num [1:4] 0points 0points 2.2points 0points
#>   .. ..- attr(*, "unit")= int 8
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ axis.text.x.bottom        : NULL
#>  $ axis.text.y               :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : NULL
#>   ..$ size         : NULL
#>   ..$ hjust        : num 1
#>   ..$ vjust        : NULL
#>   ..$ angle        : NULL
#>   ..$ lineheight   : NULL
#>   ..$ margin       : 'margin' num [1:4] 0points 2.2points 0points 0points
#>   .. ..- attr(*, "unit")= int 8
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ axis.text.y.left          : NULL
#>  $ axis.text.y.right         :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : NULL
#>   ..$ size         : NULL
#>   ..$ hjust        : num 0
#>   ..$ vjust        : NULL
#>   ..$ angle        : NULL
#>   ..$ lineheight   : NULL
#>   ..$ margin       : 'margin' num [1:4] 0points 0points 0points 2.2points
#>   .. ..- attr(*, "unit")= int 8
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ axis.ticks                :List of 6
#>   ..$ colour       : chr "grey20"
#>   ..$ size         : NULL
#>   ..$ linetype     : NULL
#>   ..$ lineend      : NULL
#>   ..$ arrow        : logi FALSE
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_line" "element"
#>  $ axis.ticks.x              : NULL
#>  $ axis.ticks.x.top          : NULL
#>  $ axis.ticks.x.bottom       : NULL
#>  $ axis.ticks.y              : NULL
#>  $ axis.ticks.y.left         : NULL
#>  $ axis.ticks.y.right        : NULL
#>  $ axis.ticks.length         : 'simpleUnit' num 2.75points
#>   ..- attr(*, "unit")= int 8
#>  $ axis.ticks.length.x       : NULL
#>  $ axis.ticks.length.x.top   : NULL
#>  $ axis.ticks.length.x.bottom: NULL
#>  $ axis.ticks.length.y       : NULL
#>  $ axis.ticks.length.y.left  : NULL
#>  $ axis.ticks.length.y.right : NULL
#>  $ axis.line                 :List of 6
#>   ..$ colour       : chr "black"
#>   ..$ size         : 'rel' num 1
#>   ..$ linetype     : NULL
#>   ..$ lineend      : NULL
#>   ..$ arrow        : logi FALSE
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_line" "element"
#>  $ axis.line.x               : NULL
#>  $ axis.line.x.top           : NULL
#>  $ axis.line.x.bottom        : NULL
#>  $ axis.line.y               : NULL
#>  $ axis.line.y.left          : NULL
#>  $ axis.line.y.right         : NULL
#>  $ legend.background         :List of 5
#>   ..$ fill         : NULL
#>   ..$ colour       : logi NA
#>   ..$ size         : NULL
#>   ..$ linetype     : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_rect" "element"
#>  $ legend.margin             : 'margin' num [1:4] 5.5points 5.5points 5.5points 5.5points
#>   ..- attr(*, "unit")= int 8
#>  $ legend.spacing            : 'simpleUnit' num 11points
#>   ..- attr(*, "unit")= int 8
#>  $ legend.spacing.x          : NULL
#>  $ legend.spacing.y          : NULL
#>  $ legend.key                : list()
#>   ..- attr(*, "class")= chr [1:2] "element_blank" "element"
#>  $ legend.key.size           : 'simpleUnit' num 1.2lines
#>   ..- attr(*, "unit")= int 3
#>  $ legend.key.height         : NULL
#>  $ legend.key.width          : NULL
#>  $ legend.text               :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : NULL
#>   ..$ size         : 'rel' num 0.8
#>   ..$ hjust        : NULL
#>   ..$ vjust        : NULL
#>   ..$ angle        : NULL
#>   ..$ lineheight   : NULL
#>   ..$ margin       : NULL
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ legend.text.align         : NULL
#>  $ legend.title              :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : NULL
#>   ..$ size         : NULL
#>   ..$ hjust        : num 0
#>   ..$ vjust        : NULL
#>   ..$ angle        : NULL
#>   ..$ lineheight   : NULL
#>   ..$ margin       : NULL
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ legend.title.align        : NULL
#>  $ legend.position           : chr "right"
#>  $ legend.direction          : NULL
#>  $ legend.justification      : chr "center"
#>  $ legend.box                : NULL
#>  $ legend.box.just           : NULL
#>  $ legend.box.margin         : 'margin' num [1:4] 0cm 0cm 0cm 0cm
#>   ..- attr(*, "unit")= int 1
#>  $ legend.box.background     : list()
#>   ..- attr(*, "class")= chr [1:2] "element_blank" "element"
#>  $ legend.box.spacing        : 'simpleUnit' num 11points
#>   ..- attr(*, "unit")= int 8
#>  $ panel.background          :List of 5
#>   ..$ fill         : chr "white"
#>   ..$ colour       : logi NA
#>   ..$ size         : NULL
#>   ..$ linetype     : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_rect" "element"
#>  $ panel.border              : list()
#>   ..- attr(*, "class")= chr [1:2] "element_blank" "element"
#>  $ panel.spacing             : 'simpleUnit' num 5.5points
#>   ..- attr(*, "unit")= int 8
#>  $ panel.spacing.x           : NULL
#>  $ panel.spacing.y           : NULL
#>  $ panel.grid                :List of 6
#>   ..$ colour       : chr "grey92"
#>   ..$ size         : NULL
#>   ..$ linetype     : NULL
#>   ..$ lineend      : NULL
#>   ..$ arrow        : logi FALSE
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_line" "element"
#>  $ panel.grid.major          : list()
#>   ..- attr(*, "class")= chr [1:2] "element_blank" "element"
#>  $ panel.grid.minor          : list()
#>   ..- attr(*, "class")= chr [1:2] "element_blank" "element"
#>  $ panel.grid.major.x        : NULL
#>  $ panel.grid.major.y        : NULL
#>  $ panel.grid.minor.x        : NULL
#>  $ panel.grid.minor.y        : NULL
#>  $ panel.ontop               : logi FALSE
#>  $ plot.background           :List of 5
#>   ..$ fill         : NULL
#>   ..$ colour       : chr "white"
#>   ..$ size         : NULL
#>   ..$ linetype     : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_rect" "element"
#>  $ plot.title                :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : NULL
#>   ..$ size         : 'rel' num 1.2
#>   ..$ hjust        : num 0
#>   ..$ vjust        : num 1
#>   ..$ angle        : NULL
#>   ..$ lineheight   : NULL
#>   ..$ margin       : 'margin' num [1:4] 0points 0points 5.5points 0points
#>   .. ..- attr(*, "unit")= int 8
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ plot.title.position       : chr "panel"
#>  $ plot.subtitle             :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : NULL
#>   ..$ size         : NULL
#>   ..$ hjust        : num 0
#>   ..$ vjust        : num 1
#>   ..$ angle        : NULL
#>   ..$ lineheight   : NULL
#>   ..$ margin       : 'margin' num [1:4] 0points 0points 5.5points 0points
#>   .. ..- attr(*, "unit")= int 8
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ plot.caption              :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : NULL
#>   ..$ size         : 'rel' num 0.8
#>   ..$ hjust        : num 1
#>   ..$ vjust        : num 1
#>   ..$ angle        : NULL
#>   ..$ lineheight   : NULL
#>   ..$ margin       : 'margin' num [1:4] 5.5points 0points 0points 0points
#>   .. ..- attr(*, "unit")= int 8
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ plot.caption.position     : chr "panel"
#>  $ plot.tag                  :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : NULL
#>   ..$ size         : 'rel' num 1.2
#>   ..$ hjust        : num 0.5
#>   ..$ vjust        : num 0.5
#>   ..$ angle        : NULL
#>   ..$ lineheight   : NULL
#>   ..$ margin       : NULL
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ plot.tag.position         : chr "topleft"
#>  $ plot.margin               : 'margin' num [1:4] 5.5points 5.5points 5.5points 5.5points
#>   ..- attr(*, "unit")= int 8
#>  $ strip.background          :List of 5
#>   ..$ fill         : chr "white"
#>   ..$ colour       : chr "black"
#>   ..$ size         : 'rel' num 2
#>   ..$ linetype     : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_rect" "element"
#>  $ strip.background.x        : NULL
#>  $ strip.background.y        : NULL
#>  $ strip.placement           : chr "inside"
#>  $ strip.text                :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : chr "grey10"
#>   ..$ size         : 'rel' num 0.8
#>   ..$ hjust        : NULL
#>   ..$ vjust        : NULL
#>   ..$ angle        : NULL
#>   ..$ lineheight   : NULL
#>   ..$ margin       : 'margin' num [1:4] 4.4points 4.4points 4.4points 4.4points
#>   .. ..- attr(*, "unit")= int 8
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ strip.text.x              : NULL
#>  $ strip.text.y              :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : NULL
#>   ..$ size         : NULL
#>   ..$ hjust        : NULL
#>   ..$ vjust        : NULL
#>   ..$ angle        : num -90
#>   ..$ lineheight   : NULL
#>   ..$ margin       : NULL
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  $ strip.switch.pad.grid     : 'simpleUnit' num 2.75points
#>   ..- attr(*, "unit")= int 8
#>  $ strip.switch.pad.wrap     : 'simpleUnit' num 2.75points
#>   ..- attr(*, "unit")= int 8
#>  $ strip.text.y.left         :List of 11
#>   ..$ family       : NULL
#>   ..$ face         : NULL
#>   ..$ colour       : NULL
#>   ..$ size         : NULL
#>   ..$ hjust        : NULL
#>   ..$ vjust        : NULL
#>   ..$ angle        : num 90
#>   ..$ lineheight   : NULL
#>   ..$ margin       : NULL
#>   ..$ debug        : NULL
#>   ..$ inherit.blank: logi TRUE
#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
#>  - attr(*, "class")= chr [1:2] "theme" "gg"
#>  - attr(*, "complete")= logi TRUE
#>  - attr(*, "validate")= logi TRUE

Created on 2022-01-04 by the reprex package (v2.0.1)

Why is my graph not working?! Plz help - Taylor Gries

library(tidyverse)
library(palmerpenguins)

ggplot(penguins, aes(x = flipper_length_mm, y = body_mass_g)) +
  geom_pt(aes(color = species)) +
  facet_wrap(~ year) +
  theme_minimal()
#> Error in geom_pt(aes(color = species)): could not find function "geom_pt"

Created on 2022-01-04 by the reprex package (v2.0.1)

Been stuck since 2021, please help! - Tiffany Hsu

I just can't seem to figure this one out...

library(tidyverse)
library(palmerpenguins)

penguins_subset<- penguins %>% 
  select(species, body_mass_g, flipper_length_mm) %>% 
  summarize(mean_mass_g = mean(body_mass))
#> Error: Problem with `summarise()` input `mean_mass_g`.
#> x object 'body_mass' not found
#> ℹ Input `mean_mass_g` is `mean(body_mass)`.

Created on 2022-01-04 by the reprex package (v0.3.0)

Look at this cool plot! - Sophia Leiker

library(tidyverse)

df <- tribble(~name, ~wt, ~ht,
              "Teddy", 52, 0.5,
              "Khora", 60, 0.6,
              "Waffle", 28, 0.4)

ggplot(data = df, aes(x = name, y =wt)) +
  geom_point(aes(color = wt))

Created on 2022-01-04 by the reprex package (v2.0.1)

Discussion 1: Working Example Graph (German Silva)

A success!

library(tidyverse)

df <- tribble(~name, ~wt, ~ht,
              "Teddy", 52, 0.5,
              "Khora", 60, 0.6,
              "Waffle", 28, 0.4)

ggplot(data = df, aes(x= ht, y = wt)) +
  geom_point() +
  geom_smooth(method = "lm")
#> `geom_smooth()` using formula 'y ~ x'

Created on 2022-01-06 by the reprex package (v2.0.1)

my friends :') - Trevor Maggart

library(tidyverse)
library(datapasta)

my_friends <- tibble::tribble(~name, ~eye_color, ~height,
                              "Rhea", "green", 180,
                              "Nathaniel","blue", 186,
                              "Shayan", "brown", 175,
                              "Shaylin", "brown", 168)

my_friends %>%
  group_by(eye_color) %>%
  summarize(mean_ht = mean(height))
#> # A tibble: 3 × 2
#>   eye_color mean_ht
#>   <chr>       <dbl>
#> 1 blue         186 
#> 2 brown        172.
#> 3 green        180

Created on 2022-01-04 by the reprex package (v2.0.1)

This graph works and is ugly (Joseph Kilgallen)

library(tidyverse)
library(reprex)


df <- tribble(~name, ~wt, ~ht,
              "Teddy", 52, 0.5,
              "Khora", 60, 0.6,
              "Waffle", 28, 0.4)

ggplot(data = df, aes(x = wt, y =ht)) +
  geom_point(color ='blue') +
  theme_minimal() +
  labs(x= "Weight", y= "Height", title =  "Boring plot") 

Created on 2022-01-06 by the reprex package (v2.0.1)

Penguins Issue, can't find Gentoo! - Sam Kuglen

library(tidyverse)
library(palmerpenguins)

female_penguins <- penguins %>% 
  filter(species = "Gentoo") %>% 
  group_by(species) 
#> Error: Problem with `filter()` input `..1`.
#> x Input `..1` is named.
#> ℹ This usually means that you've used `=` instead of `==`.
#> ℹ Did you mean `species == "Gentoo"`?

Created on 2022-01-04 by the reprex package (v2.0.1)

thing

why no work?!

library(tidyverse)
library(palmerpenguins)

penguins %>%
  group_by(species) %>%
  summarize(mean_wt = mean(body_mass_g))
#> # A tibble: 3 × 2
#>   species   mean_wt
#>   <fct>       <dbl>
#> 1 Adelie        NA 
#> 2 Chinstrap   3733.
#> 3 Gentoo        NA
ggplot(penguins, aes(x = flipper_length_mm, y = body_mass_g)) +
  geom_point(aes(color = 'species')) +
  scale_color_viridis_d() +
  theme_classic()
#> Warning: Removed 2 rows containing missing values (geom_point).

Created on 2022-01-01 by the reprex package (v2.0.1)

Pesky penguins - Erika Egg

What is the issue in grouping?

library(tidyverse)
library(palmerpenguins)

fem_peng_grouped <- penguins %>% 
  filter(sex == "female") %>% 
  group_by(~species)
#> Error: Problem adding computed columns in `group_by()`.
#> x Problem with `mutate()` input `..1`.
#> ℹ `..1 = ~species`.
#> x `..1` must be a vector, not a `formula` object.

Created on 2022-01-04 by the reprex package (v2.0.1)

Number of species across land-use changes (Kacie Ring)

#Submit a working reprex example as a github issue 

#Step 1: call in the tidyverse
library(tidyverse)
library(ggplot2)
#Step 2 : make a tibble with a tribble 

df <- tribble(~land_use, ~size_ha, ~species, ~invasive_species, ~native_species,
              "primary_forest", 15, 42, 15, 27,
              "secondary_forest", 8, 36, 16, 20,
              "agriculture", 4, 25, 20, 5,
              "urban", 6, 9, 7, 2)


#Step 2: Write some code that successfully creates a graph or a summary statistic
graph <-ggplot(df, aes(y=species, x=land_use, fill = land_use)) +
    geom_bar(stat="identity")+theme_minimal() 

graph2 <- graph + theme(axis.text.x = element_text(angle = 90)) 

graph2 + ggtitle("Number of species along a land-use gradient") +
  xlab("Land use type") + ylab("Number of species (count)")   

Created on 2022-01-06 by the reprex package (v2.0.1)

Dog weight summary stats (Kort Alexander)

library(tidyverse)

df <- tribble(~name, ~wt, ~ht,
              "Teddy", 52, 0.5,
              "Khora", 60, 0.6,
              "Waffle", 28, 0.4)

stats <- df %>% 
  group_by() %>% 
  summarize(mean_wt = mean(wt), sd_wt = sd(wt))

Created on 2022-01-06 by the reprex package (v2.0.1)

Error with summary statistics - Katie Munster

library(tidyverse)
library(palmerpenguins)

penguins %>%
  group_by(islands) %>% 
  summarize(mean_bill_length = mean(bill_length_mm))
#> Error: Must group by variables found in `.data`.
#> * Column `islands` is not found.

Created on 2022-01-04 by the reprex package (v2.0.1)

How can I be less basic?

library(tidyverse)

# make a tibble with tribble:
df <- tribble(~name, ~wt, ~ht,
              "Teddy", 52, 0.5,
              "Khora", 60, 0.6,
              "Waffle", 28, 0.4)

# create a graph or summary statistic
ggplot(data = df, 
       aes(x = wt, y = ht)) +
  geom_point()

3 Pups Summary Statistics - Sarah Lam

library(tidyverse)

df <- tribble(~name, ~wt, ~ht,
              "Teddy", 52, 0.5,
              "Khora", 60, 0.6,
              "Waffle", 28, 0.4)

dog_summary <- df %>% 
  summarize(mean_weight = mean(wt), 
            sd_weight = sd(ht),
            mean_height = mean(ht), 
            sd_hegith = sd(ht))

dog_summary
#> # A tibble: 1 × 4
#>   mean_weight sd_weight mean_height sd_hegith
#>         <dbl>     <dbl>       <dbl>     <dbl>
#> 1        46.7       0.1         0.5       0.1

Created on 2022-01-04 by the reprex package (v2.0.1)

california population data? - Taylor Medina

library(tidyverse)

ca_county <- tribble(
  ~county, ~population, ~density,
  "Los Angeles", 10e6, 2099,
  "San Diego", 3.3e6, 703.4,
  "Orange", 3.1e6, 3255.4)

ca_county_stats <- ca_county %>% 
  group_by() %>% 
  summarize(mean_pop = mean(population))

Created on 2022-01-04 by the reprex package (v2.0.1)

A plot about dogs!- Janelle Gaun

Any witty thoughts about this plot about dogs?

library(tidyverse)
library(ggplot2)

dataframe <- tribble(~name, ~wt, ~ht, 
                    "Teddy", 52, 0.5, 
                    "Khora", 60, 0.6,
                    "Waffle", 28, 0.4)

ggplot(dataframe)+
  geom_point(aes(x = wt, y= ht))

Created on 2022-01-04 by the reprex package (v2.0.1)

It's a Pawty - Tiffany Hsu

Check out the weight distribution of the pups!

library(tidyverse)

df <- tribble(~name, ~wt, ~ht,
              "Teddy", 52, 0.5,
              "Khora", 60, 0.6,
              "Waffle", 28, 0.4)

ggplot(df, aes(x = name, y = wt)) +
  geom_point() +
  labs(x = "Name",
       y = "Weight") +
  theme_minimal()

Created on 2022-01-04 by the reprex package (v0.3.0)

Dog plot - Mia Guarnieri

library(tidyverse)
# Make a data table with tribble
df <- tribble(~name, ~wt, ~ht,
              "Teddy", 52, 0.5,
              "Khora", 60, 0.6,
              "Waffle", 28, 0.4)

ggplot(df, aes(x = name, y = wt)) +
  geom_point(color = "blue") +
  labs(x = "Dog", 
       y = "Weight")

Created on 2022-01-04 by the reprex package (v2.0.1)

Code won't run, HELP!!!! - Lucas Boyd

library(tidyverse)
library(palmerpenguins)
library(datasets)
library(ggbeeswarm)

ggplot(data = penguins, aes(x = species, y = flipper_length_mm, color = species)) +
  geom_beeswarm() +
  scale_color_manual(values = c("firebrick", "cyan4", "forestgreen")) +
  labs(x = "Species", y = "Flipper Length (mm)") +
  theme(legend.position = "none") %>% 
  theme_minimal()
#> Error in base_size/2: non-numeric argument to binary operator

Created on 2022-01-04 by the reprex package (v2.0.1)

what about this awesome plot - Casey O'Hara

cool

library(tidyverse)

penguins_subset <- tibble::tribble(
  ~species, ~body_mass_g, ~flipper_length_mm,
  "Adelie",        3750L,               181L,
  "Adelie",        3800L,               186L,
  "Adelie",        3250L,               195L,
  "Adelie",           NA,                 NA,
  "Adelie",        3450L,               193L,
  "Adelie",        3650L,               190L
  )

ggplot(penguins_subset, aes(x = body_mass_g, y = flipper_length_mm)) +
  geom_point(aes(color = species))
#> Warning: Removed 1 rows containing missing values (geom_point).

Created on 2022-01-04 by the reprex package (v2.0.1)

Why am I getting NAs?? (Kiera Matiska)

library(tidyverse)
library(palmerpenguins)

penguins %>% 
  group_by(species) %>% 
  summarize(mean_mm = mean(flipper_length_mm))
#> # A tibble: 3 × 2
#>   species   mean_mm
#>   <fct>       <dbl>
#> 1 Adelie        NA 
#> 2 Chinstrap    196.
#> 3 Gentoo        NA

Created on 2022-01-04 by the reprex package (v2.0.1)

Why won't my graph work? (Sarah Hamilton)

library(tidyverse)
library(palmerpenguins)

penguins_df <- penguins %>%
  select(bill_length_mm, body_mass_g)

ggplot(data = penguins_df, aes(x = bill_length_mm, y = body_mass_g)) +
  geom_histogram()
#> Error: stat_bin() can only have an x or y aesthetic.

Created on 2022-01-06 by the reprex package (v2.0.1)

Graph of dog weights - Katie Munster

library(tidyverse)

df <- tribble(~name, ~wt, ~ht,
              "Teddy", 52, 0.5,
              "Khora", 60, 0.6,
              "Waffle", 28, 0.4)

ggplot(df, aes(x = name, y = wt)) +
  geom_point() +
  theme_classic()

Created on 2022-01-04 by the reprex package (v2.0.1)

This Code Doesn't Work (Mae Rennick)

library(tidyverse)
library(palmerpenguins)

penguins<- penguins %>% 
  filter(-bill_depth_mm) %>% 
  mutate(sum(species))
#> Error: Problem with `filter()` input `..1`.
#> ℹ Input `..1` is `-bill_depth_mm`.
#> x Input `..1` must be a logical vector, not a double.

Created on 2022-01-06 by the reprex package (v2.0.1)

Dog weights! - Sam Kuglen

library(tidyverse)

df <- tribble(~name, ~wt, ~ht,
              "Teddy", 52, 0.5,
              "Khora", 60, 0.6,
              "Waffle", 28, 0.4)

ggplot(df, aes(x = name, y = wt)) +
  geom_point(aes(color = name))

Created on 2022-01-04 by the reprex package (v2.0.1)

Why can't I select 'species' in palmerpenguin? - Janelle Gaun

I'm trying to select a subset of only Gentoo pengiuns. The data shows a column named 'species'. Why won't it recognize the column name?

library(tidyverse)
library(palmerpenguins)

penguins %>% 
  count(species)
#> # A tibble: 3 x 2
#>   species       n
#>   <fct>     <int>
#> 1 Adelie      152
#> 2 Chinstrap    68
#> 3 Gentoo      124

sub_penguins <- penguins %>% 
  select(species == 'Gentoo')
#> Error: object 'species' not found

Created on 2022-01-04 by the reprex package (v2.0.1)

Dog weights (Mae Rennick) Reprex example

library(tidyverse)
  
df <- tribble(~name, ~wt, ~ht,
                "Teddy", 52, 0.5,
                "Khora", 60, 0.6,
                "Waffle", 28, 0.4,
              "Fergus", 56, 0.5)
ggplot(df,aes(x=wt, y=ht))+
  geom_point(aes(color=name))+
  theme_minimal()+
  labs(x="weight(lbs)",
       y="height (meters)")

Created on 2022-01-06 by the reprex package (v2.0.1)

I just want to see penguins by island! (Broken Code)- Sophia Leiker

library(tidyverse)
library(palmerpenguins)

#Working to only retain the species, island, bill_length_mm column
penguins_filtered <- penguins %>%
  filter(species, island,, "bill_length_mm")
#> Error: Problem with `filter()` input `..1`.
#> ℹ Input `..1` is `species`.
#> x Input `..1` must be a logical vector, not a factor<b22a0>.
head(penguins_filtered)
#> Error in head(penguins_filtered): object 'penguins_filtered' not found

Created on 2022-01-04 by the reprex package (v2.0.1)

Pup heights - Erika Egg

Check out the heights of these dogs! How could I make it prettier/improve it?

library(tidyverse)

df <- tribble(~name, ~wt, ~ht,
              "Teddy", 52, 0.5,
              "Khora", 60, 0.6,
              "Waffle", 28, 0.4)

ggplot(df, aes(x = name, y = ht)) +
   geom_point() +
   theme_minimal()

Created on 2022-01-04 by the reprex package (v2.0.1)

Warning message about removed rows? (Narjes Mathlouthi)

library(tidyverse)


#plot(airquality)
View(airquality)

airquality1 <- tribble(~ozone, ~solar_r, ~temp,
                       20, 120, 55,
                       10, 100, 10,
                       30, 80, 5,)

ggplot(airquality, aes(x = Ozone, y = Solar.R, color = Temp)) +
  geom_jitter() 
#> Warning: Removed 42 rows containing missing values (geom_point).

airquality %>%
  group_by(Temp) %>%
  summarize(mean = mean(Ozone, na.rm = TRUE))
#> # A tibble: 40 × 2
#>     Temp  mean
#>    <int> <dbl>
#>  1    56 NaN  
#>  2    57   6  
#>  3    58  18  
#>  4    59  10  
#>  5    61  14.7
#>  6    62  14.5
#>  7    63  14  
#>  8    64  13.5
#>  9    65  21.5
#> 10    66  24.3
#> # … with 30 more rows

Created on 2022-01-04 by the reprex package (v2.0.1)

Penguins issue, island not found - Shuying Yu

Issue for part 4

library(tidyverse)
library(palmerpenguins)

penguins %>% group_by(species) %>% 
  filter(island == Torgersen) %>% 
  summarize(mean_flipper_length_mm = mean(flipper_length_mm))
#> Error: Problem with `filter()` input `..1`.
#> i Input `..1` is `island == Torgersen`.
#> x object 'Torgersen' not found
#> i The error occurred in group 1: species = Adelie.

Created on 2022-01-04 by the reprex package (v2.0.1)

Missing flipper length mean and standard deviation on palmer penguins - Taylor Medina

library(tidyverse)
library(palmerpenguins)
#> Warning: package 'palmerpenguins' was built under R version 4.1.2
penguins_subset <- penguins %>% 
  group_by(species) %>% 
  summarize(mean_length = mean(flipper_length_mm),
            sd_length = sd(flipper_length_mm)) 
  
head(penguins_subset)
#> # A tibble: 3 x 3
#>   species   mean_length sd_length
#>   <fct>           <dbl>     <dbl>
#> 1 Adelie            NA      NA   
#> 2 Chinstrap        196.      7.13
#> 3 Gentoo            NA      NA

Created on 2022-01-04 by the reprex package (v2.0.1)

Look at these penguins!!! - Lucas Boyd

library(tidyverse)
library(palmerpenguins)
library(datasets)
library(ggbeeswarm)

ggplot(data = penguins, aes(x = species, y = flipper_length_mm, color = species)) +
  geom_beeswarm() +
  scale_color_manual(values = c("firebrick", "cyan4", "forestgreen")) +
  labs(x = "Species", y = "Flipper Length (mm)") +
  theme(legend.position = "none")
#> Warning: Removed 2 rows containing missing values (position_beeswarm).

Created on 2022-01-04 by the reprex package (v2.0.1)

Filter not working for female penguins - Mia Guarnieri

library(tidyverse)
library(palmerpenguins)

# Incorrectly wrangling data
female_penguins <- penguins %>% 
  filter(sex = female)
#> Error: Problem with `filter()` input `..1`.
#> x Input `..1` is named.
#> ℹ This usually means that you've used `=` instead of `==`.
#> ℹ Did you mean `sex == female`?

Created on 2022-01-04 by the reprex package (v2.0.1)

whyyyyyy (Casey O'Hara)

Why no colors?

library(tidyverse)
library(palmerpenguins)

ggplot(penguins, aes(x = flipper_length_mm, y = body_mass_g)) +
  geom_point(aes(color = 'species'))
#> Warning: Removed 2 rows containing missing values (geom_point).

Created on 2022-01-06 by the reprex package (v2.0.1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.