hubeau R

parent 73337e9e
......@@ -42,9 +42,74 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#Titre"
"# Titre"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Titre 2"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"ename": "ERROR",
"evalue": "Error in read.json(\"https://hubeau.eaufrance.fr/api/vbeta/hydrometrie/observations_tr.csv?code_entite=U472002001&size=20000&grandeur_hydro=H&date_debut_obs=2018-11-19&fields=date_obs,resultat_obs\"): could not find function \"read.json\"\n",
"output_type": "error",
"traceback": [
"Error in read.json(\"https://hubeau.eaufrance.fr/api/vbeta/hydrometrie/observations_tr.csv?code_entite=U472002001&size=20000&grandeur_hydro=H&date_debut_obs=2018-11-19&fields=date_obs,resultat_obs\"): could not find function \"read.json\"\nTraceback:\n"
]
}
],
"source": [
"# Hub'eau - API Hydrométrie Temps Réel\n",
"#---------------------------------------------------------------------------\n",
"\n",
"# Chargement des paquets --------------------------------------------------\n",
"require(ggplot2)\n",
"require(jsonlite)\n",
"\n",
"# Appel des data\n",
"NPstation<-read.json(\"https://hubeau.eaufrance.fr/api/vbeta/hydrometrie/observations_tr.csv?code_entite=U472002001&size=20000&grandeur_hydro=H&date_debut_obs=2018-11-19&fields=date_obs,resultat_obs\")\n",
"#NPstation$date_obs<-as.Date(NPstation$date_obs)\n",
"NPstation$date_obs<-strptime(NPstation$date_obs, format=\"%d/%m/%Y %H:%M\")\n",
"NPstation$resultat_obs<-as.numeric(NPstation$resultat_obs)\n",
"\n",
"# Appel de ggplot et print du plot\n",
"p<-ggplot(NPstation)+geom_path(aes(x=date_obs, y=resultat_obs))\n",
"p<-p+theme_bw()+labs(x='',y='m NGF', title='La Saône à Lyon [Pont La Feuillée]')+guides(color='none')+scale_x_date(date_breaks = \"1 day\", date_labels = \"%Y\")\n",
"print(p)\n",
"\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
......@@ -55,21 +120,17 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
"display_name": "R",
"language": "R",
"name": "ir"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
"codemirror_mode": "r",
"file_extension": ".r",
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
"version": "3.4.1"
}
},
"nbformat": 4,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment