Commit cfb779ab authored by Laurence Viry's avatar Laurence Viry

mise à jour etudes

parent 1440ca9a
......@@ -4,7 +4,15 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"*Ce notebook est issu du document fourni par H. Commenges lors d'une formation pour ATMO en avril 2017*\n",
"*Ce notebook est issu du document fourni par H. Commenges lors d'une formation pour ATMO en avril 2017*.\n",
"\n",
"Vous le trouverez dans les fichiers fournis sous : **.../ATMO_IntroR/TP/notebooks/ObjetManip.ipynb**\n",
"\n",
"Pour vous exercer:\n",
"\n",
"* **Utiliser le notebbok**: jupyter notebook ObjetManip.ipynb\n",
"\n",
"* **Sous RStudio**, recopier les commandes des cellules R et tester.\n",
"\n",
"## Création, manipulation d'objets R et de structures de données\n",
"\n",
......@@ -20,9 +28,82 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 76,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"2"
],
"text/latex": [
"2"
],
"text/markdown": [
"2"
],
"text/plain": [
"[1] 2"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"2"
],
"text/latex": [
"2"
],
"text/markdown": [
"2"
],
"text/plain": [
"[1] 2"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"13"
],
"text/latex": [
"13"
],
"text/markdown": [
"13"
],
"text/plain": [
"[1] 13"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"15"
],
"text/latex": [
"15"
],
"text/markdown": [
"15"
],
"text/plain": [
"[1] 15"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"1+1\n",
"Var1Somme <- 1+1\n",
......@@ -36,9 +117,28 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 77,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"8"
],
"text/latex": [
"8"
],
"text/markdown": [
"8"
],
"text/plain": [
"[1] 8"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"Var2Somme <- 8\n",
"Var2Somme"
......@@ -59,7 +159,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 78,
"metadata": {},
"outputs": [],
"source": [
......@@ -79,9 +179,154 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 79,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"'numeric'"
],
"text/latex": [
"'numeric'"
],
"text/markdown": [
"'numeric'"
],
"text/plain": [
"[1] \"numeric\""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"'numeric'"
],
"text/latex": [
"'numeric'"
],
"text/markdown": [
"'numeric'"
],
"text/plain": [
"[1] \"numeric\""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"TRUE"
],
"text/latex": [
"TRUE"
],
"text/markdown": [
"TRUE"
],
"text/plain": [
"[1] TRUE"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"'integer'"
],
"text/latex": [
"'integer'"
],
"text/markdown": [
"'integer'"
],
"text/plain": [
"[1] \"integer\""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"'numeric'"
],
"text/latex": [
"'numeric'"
],
"text/markdown": [
"'numeric'"
],
"text/plain": [
"[1] \"numeric\""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"TRUE"
],
"text/latex": [
"TRUE"
],
"text/markdown": [
"TRUE"
],
"text/plain": [
"[1] TRUE"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"'character'"
],
"text/latex": [
"'character'"
],
"text/markdown": [
"'character'"
],
"text/plain": [
"[1] \"character\""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"FALSE"
],
"text/latex": [
"FALSE"
],
"text/markdown": [
"FALSE"
],
"text/plain": [
"[1] FALSE"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"class(estNum)\n",
"mode(estNum)\n",
......@@ -107,9 +352,82 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 80,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<ol class=list-inline>\n",
"\t<li>3</li>\n",
"\t<li>8</li>\n",
"\t<li>-8</li>\n",
"\t<li>10</li>\n",
"\t<li>11</li>\n",
"</ol>\n"
],
"text/latex": [
"\\begin{enumerate*}\n",
"\\item 3\n",
"\\item 8\n",
"\\item -8\n",
"\\item 10\n",
"\\item 11\n",
"\\end{enumerate*}\n"
],
"text/markdown": [
"1. 3\n",
"2. 8\n",
"3. -8\n",
"4. 10\n",
"5. 11\n",
"\n",
"\n"
],
"text/plain": [
"[1] 3 8 -8 10 11"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<ol class=list-inline>\n",
"\t<li>4</li>\n",
"\t<li>4</li>\n",
"\t<li>4</li>\n",
"\t<li>4</li>\n",
"\t<li>4</li>\n",
"</ol>\n"
],
"text/latex": [
"\\begin{enumerate*}\n",
"\\item 4\n",
"\\item 4\n",
"\\item 4\n",
"\\item 4\n",
"\\item 4\n",
"\\end{enumerate*}\n"
],
"text/markdown": [
"1. 4\n",
"2. 4\n",
"3. 4\n",
"4. 4\n",
"5. 4\n",
"\n",
"\n"
],
"text/plain": [
"[1] 4 4 4 4 4"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"vec1 <- c(3,8,-8,10,11)\n",
"vec1\n",
......@@ -119,28 +437,165 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Opération\n",
"vec1 + vec2\n",
"vec1*6\n",
"vec1*vec2\n",
"vec1%*%vec2"
]
},
{
"cell_type": "markdown",
"execution_count": 81,
"metadata": {},
"source": [
"## "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"outputs": [
{
"data": {
"text/html": [
"<ol class=list-inline>\n",
"\t<li>7</li>\n",
"\t<li>12</li>\n",
"\t<li>-4</li>\n",
"\t<li>14</li>\n",
"\t<li>15</li>\n",
"</ol>\n"
],
"text/latex": [
"\\begin{enumerate*}\n",
"\\item 7\n",
"\\item 12\n",
"\\item -4\n",
"\\item 14\n",
"\\item 15\n",
"\\end{enumerate*}\n"
],
"text/markdown": [
"1. 7\n",
"2. 12\n",
"3. -4\n",
"4. 14\n",
"5. 15\n",
"\n",
"\n"
],
"text/plain": [
"[1] 7 12 -4 14 15"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<ol class=list-inline>\n",
"\t<li>18</li>\n",
"\t<li>48</li>\n",
"\t<li>-48</li>\n",
"\t<li>60</li>\n",
"\t<li>66</li>\n",
"</ol>\n"
],
"text/latex": [
"\\begin{enumerate*}\n",
"\\item 18\n",
"\\item 48\n",
"\\item -48\n",
"\\item 60\n",
"\\item 66\n",
"\\end{enumerate*}\n"
],
"text/markdown": [
"1. 18\n",
"2. 48\n",
"3. -48\n",
"4. 60\n",
"5. 66\n",
"\n",
"\n"
],
"text/plain": [
"[1] 18 48 -48 60 66"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<ol class=list-inline>\n",
"\t<li>12</li>\n",
"\t<li>32</li>\n",
"\t<li>-32</li>\n",
"\t<li>40</li>\n",
"\t<li>44</li>\n",
"</ol>\n"
],
"text/latex": [
"\\begin{enumerate*}\n",
"\\item 12\n",
"\\item 32\n",
"\\item -32\n",
"\\item 40\n",
"\\item 44\n",
"\\end{enumerate*}\n"
],
"text/markdown": [
"1. 12\n",
"2. 32\n",
"3. -32\n",
"4. 40\n",
"5. 44\n",
"\n",
"\n"
],
"text/plain": [
"[1] 12 32 -32 40 44"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<table>\n",
"<tbody>\n",
"\t<tr><td>96</td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"\\begin{tabular}{l}\n",
"\t 96\\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"| 96 | \n",
"\n",
"\n"
],
"text/plain": [
" [,1]\n",
"[1,] 96 "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Opération\n",
"vec1 + vec2\n",
"vec1*6\n",
"vec1*vec2\n",
"vec1%*%vec2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Manipulation de structure de données\n",
"\n",
"### Les Vecteurs\n",
......@@ -151,9 +606,46 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 82,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<ol class=list-inline>\n",
"\t<li>6</li>\n",
"\t<li>7</li>\n",
"\t<li>1</li>\n",
"\t<li>2</li>\n",
"\t<li>9</li>\n",
"</ol>\n"
],
"text/latex": [
"\\begin{enumerate*}\n",
"\\item 6\n",
"\\item 7\n",
"\\item 1\n",
"\\item 2\n",
"\\item 9\n",
"\\end{enumerate*}\n"
],
"text/markdown": [
"1. 6\n",
"2. 7\n",
"3. 1\n",
"4. 2\n",
"5. 9\n",
"\n",
"\n"
],
"text/plain": [
"[1] 6 7 1 2 9"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"c(6,7,1,2,9)\n",
"vecTaille <- c(10, 40, 20, 17, 12)"
......@@ -168,9 +660,62 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 83,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" num [1:5] 10 40 20 17 12\n"
]
},
{
"data": {
"text/html": [
"'numeric'"
],
"text/latex": [
"'numeric'"
],
"text/markdown": [
"'numeric'"
],
"text/plain": [
"[1] \"numeric\""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"5"
],
"text/latex": [
"5"
],
"text/markdown": [
"5"
],
"text/plain": [