Zoom Logo

Online Software Carpentry in R Workshop - Shared screen with speaker view
Richard Miller - Instructor
01:10:19
make sure you have opened the Workshop.Rproj first
gemmasicouri
01:10:59
Sorry I missed that please could you go over that again!
gemmasicouri
01:11:30
Got it
gemmasicouri
01:11:32
thanks
Richard Miller - Instructor
01:14:39
yep alt-minus on a windows machine
Batul T. Hasan
01:18:09
sorry I am still getting "cannot open file"
Batul T. Hasan
01:18:41
got it... missed 's' in surveys!
Batul T. Hasan
01:18:44
sorry
Krista
01:30:34
Would you be putting your units of measure in for the axes here or is that entered later?
Krista
01:31:09
Cool, thanks :-)
Tao Kan
01:35:51
Could I have the text of challenge 1? Thanks.
Richard Miller - Instructor
01:36:23
Challenges are on page 31 of the Google Doc
gemmasicouri
01:38:05
surveys_plot <- ggplot(data = surveys_complete, mapping = aes(x = hindfoot_length, y = weight)) +geom_point()
Katie Shead
01:38:06
ggplot(data = surveys_complete, mapping = aes(x = hindfoot_length, y = weight)) +geom_point()
Lianmei Jiang
01:38:25
ggplot(data = surveys_complete, mapping = aes(x = hindfoot_length, y =weight ))
Maria (Helper)
01:38:49
surveys_plot +geom_point(aes(x = hindfoot_length, y = weight))
Anthony Chariton
01:41:51
ggplot(data = surveys_complete, aes(x=weight)) +geom_histogram(binwidth=10)
Andrew Roberts
01:41:53
challenge2 <- ggplot(data = surveys_complete,mapping = aes(weight)) +geom_histogram()challenge2
Katie Shead
01:41:54
hist(surveys_complete$weight)
Belinda Fabian (Instructor)
01:47:30
Break for 20 mins, come back 10:20am
Belinda Fabian (Instructor)
02:07:48
Please put a green tick when you’re back
Vera Horigue
02:08:11
Binder's been helpful, and I'm keen to know more how to use it. Question though, can we change the version of R in binder? Given that it has limited access to versions of packages.
Richard Miller - Instructor
02:09:28
Binder lets you choose everything about your environment (you can even use other languages).
Vera Horigue
02:10:24
Cool! Thanks Richard!
Richard Miller - Instructor
02:10:44
We created a binder with R-3.6 with TidyVerse - but it could have contained any other packages or versions ...
Katie Shead
02:11:11
changed the opacity?
gemmasicouri
02:11:12
Graded the points
Vera Horigue
02:11:14
Changed the point to grey from black
gemmasicouri
02:11:32
That’s the word I was looking for!!
Richard Miller - Instructor
02:11:55
alpha referrers to transparency (opacity)
Maria (Helper)
02:13:18
same for grey/gray!
Maria (Helper)
02:13:22
both work
Katie Shead
02:14:17
taupe
Evan Matthews - Instructor
02:14:24
tahoma red :)
Vera Horigue
02:14:41
Tullamarine!
Maria (Helper)
02:15:03
https://www.datanovia.com/en/blog/top-r-color-palettes-to-know-for-great-data-visualization/
Maria (Helper)
02:15:17
https://www.nceas.ucsb.edu/sites/default/files/2020-04/colorPaletteCheatsheet.pdf
Maria (Helper)
02:16:13
There are also palettes that work both in color and black-and-white
Maria (Helper)
02:16:39
Also super useful for publications - you don't have to pay for coloured images
Andrew Roberts
02:26:26
ggplot(data = surveys_complete,mapping = aes(x = species_id, y = weight))+geom_jitter(alpha = 0.2, aes(colour = plot_type))
Vera Horigue
02:29:26
No.
Andrew Roberts
02:29:46
box plot
Anwar
02:29:49
boxplot
Vera Horigue
02:29:58
Yeah, boxplot definitely
Kate Tong
02:34:20
how to use a cross rather than circle for each data point?
Maria (Helper)
02:34:59
There is an argument called "shape
Maria (Helper)
02:35:17
I'll past the codes here in a sec
Maria (Helper)
02:37:19
will do
gemmasicouri
02:37:40
ggplot(data = surveys_complete, mapping = aes(x = species_id, y = weight)) +geom_jitter(alpha = 0.3, colour = "tomato") +geom_boxplot(alpha = 0)
Anthony Chariton
02:37:46
ggplot(data = surveys_complete,mapping = aes(x = species_id, y = weight))+geom_jitter(alpha = 0.3, colour = "tomato") +geom_boxplot(alpha = 0)
Krista
02:37:52
I just ran jitter first then box plot
Leanne Ruggero
02:38:58
The alpha is changing the transparency on the jitter plot. What is it changing in the boxplot?
Leanne Ruggero
02:39:55
Ah the box!
Anthony Chariton
02:43:42
ggplot(data = surveys_complete,mapping = aes(x = species_id, y = weight))+geom_violin(alpha = 0, colour = "tomato")
Vera Horigue
02:45:44
Yes
Maria (Helper)
02:45:50
Yep
Vera Horigue
02:45:51
Ecology
Katie Shead
02:45:57
I have for pottery typologies
Maria (Helper)
02:45:59
CogSci
Batul T. Hasan
02:46:15
not is business :)
Batul T. Hasan
02:46:18
in*
Batul T. Hasan
02:46:30
oh dear!
Vera Horigue
02:52:53
ggplot(data = surveys_complete, mapping = aes(x = species_id, y = hindfoot_length)) +geom_jitter(alpha = 0.1, aes(colour = plot_id)) +geom_boxplot(alpha = 0)
Maria (Helper)
02:54:05
Change plot_id to a factor?
Vera Horigue
02:54:29
Prefer to have totally different colours
Anthony Chariton
02:54:33
No it needs to be factorial
Maria (Helper)
02:58:29
It's also possible to change plot_id to a factor directly in the plot: ggplot(data = surveys_complete, mapping = aes(x = species_id, y = hindfoot_length)) +geom_jitter(alpha = 0.3, aes(color = as.factor(plot_id))) +geom_boxplot(alpha = 0)
Maria (Helper)
02:59:13
But then you will want to change the legend of course (it now says as.factor(plot_id))… Another nice thing to try out! :)
Evan Matthews - Instructor
02:59:38
Does the plot_id change to a factor permanently that way Maria, or just for the plot?
Maria (Helper)
03:00:02
Only in the plot
Evan Matthews - Instructor
03:00:11
Ahhh, nice! Thanks.
Maria (Helper)
03:00:45
This could be useful in case you only need it as factor for the plot but don't want to change the structure of your variable
Maria (Helper)
03:05:01
shall I past a solution?
Maria (Helper)
03:05:08
paste
Maria (Helper)
03:05:16
ggplot(data = surveys_complete, mapping = aes(x = species_id, y = weight)) +geom_jitter(alpha = 0.3, aes(color = as.factor(plot_id))) +scale_y_log10()
Maria (Helper)
03:05:45
or
Maria (Helper)
03:05:53
scale_y_continuous(trans='log10')
Anwar
03:06:16
ggplot(surveys_complete, aes(species_id ,weight))+ geom_point()+scale_y_log10()
Maria (Helper)
03:07:19
if you do both, R will complain that it already has a scale :)
Andrew Roberts
03:12:39
()
Anwar
03:12:44
No parenthesis
Andrew Roberts
03:13:31
because we have no data between years?
Vera Horigue
03:13:59
It's total count per year, but genus is not
Anwar
03:14:53
Is it the same as col or fill ?
Richard Miller - Instructor
03:38:14
I shall rename my ep02 - "Attach of the Dataframes"
Evan Matthews - Instructor
03:38:34
Hahaha Richard!
Leanne Ruggero
03:38:39
:D
Anthony Chariton
03:39:22
Thank you Belinda
Richard Miller - Instructor
03:40:37
count(year, genus, name = "some_name") # Note the quotes
Evan Matthews - Instructor
03:40:55
How do we export our graphs into say a paper?
Maria (Helper)
03:41:18
I think Belinda was going to talk about it at the end...?
Maria (Helper)
03:41:21
haha yep
Maria (Helper)
03:42:29
Note that you can use pipe to do count and plot at the same time
Maria (Helper)
03:42:30
yearly_counts_graph <- surveys_complete %>%count(year, genus) %>%ggplot(mapping = aes(x = year, y = n, color = genus)) +geom_line()
Maria (Helper)
03:42:47
Sorry!!!
Evan Matthews - Instructor
03:48:43
It's facetinating :D
Maria (Helper)
03:49:18
haha
Carola Ruiz
03:50:21
surveys complete?
Maria (Helper)
03:51:03
Have never used facets = vars() before! Have done this facet_wrap(~genus)
Maria (Helper)
03:53:19
You can also choose how many rows and/or columns you want to have in your facet plot, e.g. facet_wrap(~genus, ncol = 2)
Katie Shead
04:01:44
ggplot(data = yearly_sex_counts, mapping = aes(x = year, y = n, colour = sex)) +geom_line() +facet_grid(cols = vars(genus))
Andrew Roberts
04:01:47
yearly_sex_counts %>%ggplot(mapping = aes(x = year, y = n, colour = sex))+geom_line()+facet_grid(cols = vars(genus))
Maria (Helper)
04:04:25
list of themes: https://ggplot2.tidyverse.org/reference/ggtheme.html
Maria (Helper)
04:06:03
done already!
Maria (Helper)
04:07:05
Done!
Syed Haneef
04:08:29
Hi Team,I need to go, Thank you so much for this wonderful/ informative workshop. Great team work! Looking forward for some advanced workshops...See ya...
Evan Matthews - Instructor
04:09:06
No problem Syed, good luck with it. Keep an eye for the more advanced workshops in the future.
Vera Horigue
04:13:39
year and species
Vera Horigue
04:14:52
mean_weight = mean(weight)
gemmasicouri
04:14:57
mean_weight = mean(weight, na.rm = TRUE))
Andrew Roberts
04:16:59
yearly_weight <- surveys_complete %>%group_by(year, species) %>%filter(!is.na(weight)) %>%summarise(mean_weight = mean(weight)) %>%ggplot(mapping = aes(x = year, y = mean_weight, colour = species))+geom_line()+theme_bw()yearly_weight
Vera Horigue
04:18:55
yearly_species_weights %>%ggplot(mapping = aes (x = year, y = mean_weight))+geom_line()+facet_wrap(~species_id)+theme_void()
gemmasicouri
04:19:08
yearly_weight %>%ggplot(mapping = aes(x = year, y = mean_weight, colour = species_id)) +geom_line() +facet_wrap(~species_id)theme_bw()
Vera Horigue
04:19:56
So, for the void for example, this would be good if we want to adjust all the labels???
Vera Horigue
04:20:13
But if I try other themes, it's fine. All the axes are there
Maria (Helper)
04:21:28
@ Vera You can use labs(), guides() etc etc to adjust the labels and the legend
Andrew Roberts
04:21:43
Sorry, I'm going to have to run. There's a guy with a leaf blower outside and Frankfurt (my dachshund puppy) is going nuts. Thanks for the workshop, it was really good!
Batul T. Hasan
04:24:11
Thank you Everyone. Need to take my son to the doctor, but hopefully I won't miss very complicated things that the recording won't help with!Cheers
Batul T. Hasan
04:24:22
U2
Leanne Ruggero
04:27:01
ICould you just pause for a minute - haven’t had a chance to copy the code yet as the graphs keep popping up over the top
Belinda Fabian (Instructor)
04:27:17
yearly_sex_counts %>%ggplot(mapping = aes (x = year, y = n, colour = sex)) +geom_line() +facet_wrap(~genus) +labs(title = "Observed genera through time",x = "Year of observation",y = "Number of individuals") +theme_bw() +theme(text = element_text(size = 16))
Leanne Ruggero
04:27:33
Yes, but I have zoom on a different device haha!
Leanne Ruggero
04:27:49
thanks
Leanne Ruggero
04:28:11
yep
Vince Polito (Helper)
04:28:22
yep its in there
Maria (Helper)
04:37:28
Plot size in units ("in", "cm", or "mm"). If not supplied, uses the size of current graphics device.
Leanne Ruggero
04:42:48
Looks like you can also just google ‘R cheatsheets’ to take you to the repository
Maria (Helper)
04:46:43
https://carpentries.typeform.com/to/UgVdRQ?slug=2020-09-21-intro-to-r
Richard Miller - Instructor
04:46:44
https://carpentries.typeform.com/to/UgVdRQ?slug=2020-09-21-intro-to-r
gemmasicouri
04:46:48
Thank you very much, this workshop has been great
Anwar
04:46:57
Thank you so much everyone. This was a very helpful workshop. Thanks for all your efforts. Have a nice weekend.
Stephanie Attwell
04:46:58
all very helpful. thanks so much
Lianmei Jiang
04:47:01
Clapping!!!Thank you a lot for this informative workshop. Great work!!!
Anthony Chariton
04:47:11
Thank you so much!!
Elahe Ghasrodashti
04:47:15
Thank you eveyone
Leanne Ruggero
04:47:18
Thanks very much all!
Vera Horigue
04:47:22
THANK YOU EVERYONE -- Belinda, Richard, Evan, Odette and all the helpers!
Kate Tong
04:47:31
Thank you, great workshop! Very informative.
Krista
04:47:35
Thanks so much for the workshop. Very helpful intro to R
Belinda Fabian (Instructor)
04:48:19
https://carpentries.typeform.com/to/UgVdRQ?slug=2020-09-21-intro-to-r