Abstract
This Lab will allow you to discover R
and
Rstudio
through several exercices. The first one will be to
continue the running example of the class, plotting more complex data
from the house market Paris. Exercice 1 is the mandatory exercice.
Mastering these three questions is already quite complex when starting
R
, it is normal to struggle if you start. Please, don’t
abandon and ask question. If you want to learn more, you can pick one of
the optional exercices below that will help you learn about doing
dashboard or dealing with API. Both skills are very useful when willing
to communicate about your data or when you want to build your own data
base. These exercices are optional and not really use skills learned
during the class.
data.gouv.fr
data.gouv.fr
, plot the
evolution of the average Parisian market price per transaction as a
function of the year. Add confidence intervals. Note all the assumptions
you make.The data can be found here
https://files.data.gouv.fr/geo-dvf/2022-06/csv/
đź’ˇ You may have to use functions such as rbind
,
lubridate
(for date and time management, see
also), and group_by
.
🧹 When doing it, try to obtain clean code, with for example a header with assumptions, a part with raw data treatment, and a part with plots.
# INTRODUCTION
## Assumptions and parameters for raw data management
VALEUR_FONCIERE_MAX = 2000000
VALEUR_FONCIERE_MIN = 50000
## Libraries
library(ggplot2)
library(dplyr) # group_by
library(lubridate) # function to treat automatically year
# DATA LOADING and TREATMENT
# PLOTS
geom_smooth
.group_by
and n()
to count the number of rows
per group.Now, your boss asks you to propose an interface (or dashboard) of the Parisian house market price. The goal is that someone should be able to filter the previous graphic by “arrondissements”.
Some ressources to build your own dashboard:
Some of you have declared in the form the interest in Twitter data.
One of the first step is to gather data. You can try to do so with
rtweet
following this tutorial.
Note that you need a twitter account to do this, and in particular to create a Twitter App.