You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _empty-hands-on.qmd
+10-4Lines changed: 10 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -27,10 +27,7 @@ Loading the necessary packages. DuckDB has its own R package that is mostly a wr
27
27
#| message: false
28
28
29
29
library(tidyverse)
30
-
library(dbplyr) # to query databases in a tidyverse style manner
31
-
library(DBI) # to connect to databases
32
-
# install.packages("duckdb") # install this package to get duckDB API
33
-
library(duckdb) # Specific to duckDB
30
+
34
31
```
35
32
36
33
Import the csv files with the bird species information:
@@ -113,6 +110,15 @@ Ideally we would like the scientific names...
113
110
114
111
## Let's connect to our first database
115
112
113
+
```{r}
114
+
#| message: false
115
+
116
+
library(dbplyr) # to query databases in a tidyverse style manner
117
+
library(DBI) # to connect to databases
118
+
# install.packages("duckdb") # install this package to get duckDB API
119
+
library(duckdb) # Specific to duckDB
120
+
```
121
+
116
122
### Load the bird database
117
123
118
124
This database has been built from the csv files we just analyzed, so the data should be very similar - note we did not say identical more on this in the last section:
inner_join(species_egg_volume_avg, by = join_by(Code == Species))
132
128
133
-
species_egg_area_avg
129
+
species_egg_vol_avg
134
130
```
135
131
136
132
137
133
## Let's connect to our first database
138
134
135
+
```{r}
136
+
#| message: false
137
+
138
+
library(dbplyr) # to query databases in a tidyverse style manner
139
+
library(DBI) # to connect to databases
140
+
# install.packages("duckdb") # install this package to get duckDB API
141
+
library(duckdb) # Specific to duckDB
142
+
```
143
+
139
144
### Load the bird database
140
145
141
146
This database has been built from the csv files we just analyzed, so the data should be very similar - note we did not say identical more on this in the last section:
@@ -245,7 +250,7 @@ Compute the volume using the same code as previously!! Yes, you can use mutate t
245
250
246
251
```{r}
247
252
# Compute the egg volume
248
-
eggs_area_db <- eggs_db %>%
253
+
eggs_volume_db <- eggs_db %>%
249
254
mutate(egg_volume = pi/6*Width^2*Length)
250
255
```
251
256
@@ -258,7 +263,7 @@ Now let's join this information to the nest table, and average by species
0 commit comments