Skip to content

Instantly share code, notes, and snippets.

@brymer-meneses
Last active September 29, 2021 12:23
Show Gist options
  • Save brymer-meneses/582673c3d52ba0f79c56faad7d58c4e2 to your computer and use it in GitHub Desktop.
Save brymer-meneses/582673c3d52ba0f79c56faad7d58c4e2 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"id": "87010e94-45f2-455f-9380-04ced364c146",
"metadata": {
"tags": []
},
"source": [
"# Importing the dataset\n",
"My current working directory contains the dataset\n",
"so I didn't have to use `setwd`"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "4427a9a2-74b3-4cc9-a6c3-6fa652e25619",
"metadata": {},
"outputs": [],
"source": [
"iris <- read.csv(\"iris.csv\", header=TRUE)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "e0e1db15-24d8-4ac4-8808-41aac820fd93",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table class=\"dataframe\">\n",
"<caption>A data.frame: 6 × 5</caption>\n",
"<thead>\n",
"\t<tr><th></th><th scope=col>sepal_length</th><th scope=col>sepal_width</th><th scope=col>petal_length</th><th scope=col>petal_width</th><th scope=col>species</th></tr>\n",
"\t<tr><th></th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;chr&gt;</th></tr>\n",
"</thead>\n",
"<tbody>\n",
"\t<tr><th scope=row>1</th><td>5.1</td><td>3.5</td><td>1.4</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>2</th><td>4.9</td><td>3.0</td><td>1.4</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>3</th><td>4.7</td><td>3.2</td><td>1.3</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>4</th><td>4.6</td><td>3.1</td><td>1.5</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>5</th><td>5.0</td><td>3.6</td><td>1.4</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>6</th><td>5.4</td><td>3.9</td><td>1.7</td><td>0.4</td><td>setosa</td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"A data.frame: 6 × 5\n",
"\\begin{tabular}{r|lllll}\n",
" & sepal\\_length & sepal\\_width & petal\\_length & petal\\_width & species\\\\\n",
" & <dbl> & <dbl> & <dbl> & <dbl> & <chr>\\\\\n",
"\\hline\n",
"\t1 & 5.1 & 3.5 & 1.4 & 0.2 & setosa\\\\\n",
"\t2 & 4.9 & 3.0 & 1.4 & 0.2 & setosa\\\\\n",
"\t3 & 4.7 & 3.2 & 1.3 & 0.2 & setosa\\\\\n",
"\t4 & 4.6 & 3.1 & 1.5 & 0.2 & setosa\\\\\n",
"\t5 & 5.0 & 3.6 & 1.4 & 0.2 & setosa\\\\\n",
"\t6 & 5.4 & 3.9 & 1.7 & 0.4 & setosa\\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"A data.frame: 6 × 5\n",
"\n",
"| <!--/--> | sepal_length &lt;dbl&gt; | sepal_width &lt;dbl&gt; | petal_length &lt;dbl&gt; | petal_width &lt;dbl&gt; | species &lt;chr&gt; |\n",
"|---|---|---|---|---|---|\n",
"| 1 | 5.1 | 3.5 | 1.4 | 0.2 | setosa |\n",
"| 2 | 4.9 | 3.0 | 1.4 | 0.2 | setosa |\n",
"| 3 | 4.7 | 3.2 | 1.3 | 0.2 | setosa |\n",
"| 4 | 4.6 | 3.1 | 1.5 | 0.2 | setosa |\n",
"| 5 | 5.0 | 3.6 | 1.4 | 0.2 | setosa |\n",
"| 6 | 5.4 | 3.9 | 1.7 | 0.4 | setosa |\n",
"\n"
],
"text/plain": [
" sepal_length sepal_width petal_length petal_width species\n",
"1 5.1 3.5 1.4 0.2 setosa \n",
"2 4.9 3.0 1.4 0.2 setosa \n",
"3 4.7 3.2 1.3 0.2 setosa \n",
"4 4.6 3.1 1.5 0.2 setosa \n",
"5 5.0 3.6 1.4 0.2 setosa \n",
"6 5.4 3.9 1.7 0.4 setosa "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Show data\n",
"head(iris)\n",
"\n",
"# Using head() only shows a portion of the \n",
"# dataset"
]
},
{
"cell_type": "markdown",
"id": "e46acff7-16c9-4092-9611-d9d4685135e2",
"metadata": {
"tags": []
},
"source": [
"# Dataset Manipulations"
]
},
{
"cell_type": "markdown",
"id": "85b52f03-ca4a-4fac-a2d7-d9d64d54ef15",
"metadata": {},
"source": [
"## View only rows 10 to 15"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "4a8c025a-d1c9-425c-a51f-252f1df82590",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table class=\"dataframe\">\n",
"<caption>A data.frame: 6 × 5</caption>\n",
"<thead>\n",
"\t<tr><th></th><th scope=col>sepal_length</th><th scope=col>sepal_width</th><th scope=col>petal_length</th><th scope=col>petal_width</th><th scope=col>species</th></tr>\n",
"\t<tr><th></th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;chr&gt;</th></tr>\n",
"</thead>\n",
"<tbody>\n",
"\t<tr><th scope=row>10</th><td>4.9</td><td>3.1</td><td>1.5</td><td>0.1</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>11</th><td>5.4</td><td>3.7</td><td>1.5</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>12</th><td>4.8</td><td>3.4</td><td>1.6</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>13</th><td>4.8</td><td>3.0</td><td>1.4</td><td>0.1</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>14</th><td>4.3</td><td>3.0</td><td>1.1</td><td>0.1</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>15</th><td>5.8</td><td>4.0</td><td>1.2</td><td>0.2</td><td>setosa</td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"A data.frame: 6 × 5\n",
"\\begin{tabular}{r|lllll}\n",
" & sepal\\_length & sepal\\_width & petal\\_length & petal\\_width & species\\\\\n",
" & <dbl> & <dbl> & <dbl> & <dbl> & <chr>\\\\\n",
"\\hline\n",
"\t10 & 4.9 & 3.1 & 1.5 & 0.1 & setosa\\\\\n",
"\t11 & 5.4 & 3.7 & 1.5 & 0.2 & setosa\\\\\n",
"\t12 & 4.8 & 3.4 & 1.6 & 0.2 & setosa\\\\\n",
"\t13 & 4.8 & 3.0 & 1.4 & 0.1 & setosa\\\\\n",
"\t14 & 4.3 & 3.0 & 1.1 & 0.1 & setosa\\\\\n",
"\t15 & 5.8 & 4.0 & 1.2 & 0.2 & setosa\\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"A data.frame: 6 × 5\n",
"\n",
"| <!--/--> | sepal_length &lt;dbl&gt; | sepal_width &lt;dbl&gt; | petal_length &lt;dbl&gt; | petal_width &lt;dbl&gt; | species &lt;chr&gt; |\n",
"|---|---|---|---|---|---|\n",
"| 10 | 4.9 | 3.1 | 1.5 | 0.1 | setosa |\n",
"| 11 | 5.4 | 3.7 | 1.5 | 0.2 | setosa |\n",
"| 12 | 4.8 | 3.4 | 1.6 | 0.2 | setosa |\n",
"| 13 | 4.8 | 3.0 | 1.4 | 0.1 | setosa |\n",
"| 14 | 4.3 | 3.0 | 1.1 | 0.1 | setosa |\n",
"| 15 | 5.8 | 4.0 | 1.2 | 0.2 | setosa |\n",
"\n"
],
"text/plain": [
" sepal_length sepal_width petal_length petal_width species\n",
"10 4.9 3.1 1.5 0.1 setosa \n",
"11 5.4 3.7 1.5 0.2 setosa \n",
"12 4.8 3.4 1.6 0.2 setosa \n",
"13 4.8 3.0 1.4 0.1 setosa \n",
"14 4.3 3.0 1.1 0.1 setosa \n",
"15 5.8 4.0 1.2 0.2 setosa "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"\n",
"iris[10:15,] "
]
},
{
"cell_type": "markdown",
"id": "2d307ee4-d7d0-4fd3-8b96-e3468022f3be",
"metadata": {},
"source": [
"## Show only a certain column\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "98b6731e-dbf3-444a-9681-84126e2e5ddc",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<style>\n",
".list-inline {list-style: none; margin:0; padding: 0}\n",
".list-inline>li {display: inline-block}\n",
".list-inline>li:not(:last-child)::after {content: \"\\00b7\"; padding: 0 .5ex}\n",
"</style>\n",
"<ol class=list-inline><li>5.1</li><li>4.9</li><li>4.7</li><li>4.6</li><li>5</li><li>5.4</li><li>4.6</li><li>5</li><li>4.4</li><li>4.9</li><li>5.4</li><li>4.8</li><li>4.8</li><li>4.3</li><li>5.8</li><li>5.7</li><li>5.4</li><li>5.1</li><li>5.7</li><li>5.1</li><li>5.4</li><li>5.1</li><li>4.6</li><li>5.1</li><li>4.8</li><li>5</li><li>5</li><li>5.2</li><li>5.2</li><li>4.7</li><li>4.8</li><li>5.4</li><li>5.2</li><li>5.5</li><li>4.9</li><li>5</li><li>5.5</li><li>4.9</li><li>4.4</li><li>5.1</li><li>5</li><li>4.5</li><li>4.4</li><li>5</li><li>5.1</li><li>4.8</li><li>5.1</li><li>4.6</li><li>5.3</li><li>5</li><li>7</li><li>6.4</li><li>6.9</li><li>5.5</li><li>6.5</li><li>5.7</li><li>6.3</li><li>4.9</li><li>6.6</li><li>5.2</li><li>5</li><li>5.9</li><li>6</li><li>6.1</li><li>5.6</li><li>6.7</li><li>5.6</li><li>5.8</li><li>6.2</li><li>5.6</li><li>5.9</li><li>6.1</li><li>6.3</li><li>6.1</li><li>6.4</li><li>6.6</li><li>6.8</li><li>6.7</li><li>6</li><li>5.7</li><li>5.5</li><li>5.5</li><li>5.8</li><li>6</li><li>5.4</li><li>6</li><li>6.7</li><li>6.3</li><li>5.6</li><li>5.5</li><li>5.5</li><li>6.1</li><li>5.8</li><li>5</li><li>5.6</li><li>5.7</li><li>5.7</li><li>6.2</li><li>5.1</li><li>5.7</li><li>6.3</li><li>5.8</li><li>7.1</li><li>6.3</li><li>6.5</li><li>7.6</li><li>4.9</li><li>7.3</li><li>6.7</li><li>7.2</li><li>6.5</li><li>6.4</li><li>6.8</li><li>5.7</li><li>5.8</li><li>6.4</li><li>6.5</li><li>7.7</li><li>7.7</li><li>6</li><li>6.9</li><li>5.6</li><li>7.7</li><li>6.3</li><li>6.7</li><li>7.2</li><li>6.2</li><li>6.1</li><li>6.4</li><li>7.2</li><li>7.4</li><li>7.9</li><li>6.4</li><li>6.3</li><li>6.1</li><li>7.7</li><li>6.3</li><li>6.4</li><li>6</li><li>6.9</li><li>6.7</li><li>6.9</li><li>5.8</li><li>6.8</li><li>6.7</li><li>6.7</li><li>6.3</li><li>6.5</li><li>6.2</li><li>5.9</li></ol>\n"
],
"text/latex": [
"\\begin{enumerate*}\n",
"\\item 5.1\n",
"\\item 4.9\n",
"\\item 4.7\n",
"\\item 4.6\n",
"\\item 5\n",
"\\item 5.4\n",
"\\item 4.6\n",
"\\item 5\n",
"\\item 4.4\n",
"\\item 4.9\n",
"\\item 5.4\n",
"\\item 4.8\n",
"\\item 4.8\n",
"\\item 4.3\n",
"\\item 5.8\n",
"\\item 5.7\n",
"\\item 5.4\n",
"\\item 5.1\n",
"\\item 5.7\n",
"\\item 5.1\n",
"\\item 5.4\n",
"\\item 5.1\n",
"\\item 4.6\n",
"\\item 5.1\n",
"\\item 4.8\n",
"\\item 5\n",
"\\item 5\n",
"\\item 5.2\n",
"\\item 5.2\n",
"\\item 4.7\n",
"\\item 4.8\n",
"\\item 5.4\n",
"\\item 5.2\n",
"\\item 5.5\n",
"\\item 4.9\n",
"\\item 5\n",
"\\item 5.5\n",
"\\item 4.9\n",
"\\item 4.4\n",
"\\item 5.1\n",
"\\item 5\n",
"\\item 4.5\n",
"\\item 4.4\n",
"\\item 5\n",
"\\item 5.1\n",
"\\item 4.8\n",
"\\item 5.1\n",
"\\item 4.6\n",
"\\item 5.3\n",
"\\item 5\n",
"\\item 7\n",
"\\item 6.4\n",
"\\item 6.9\n",
"\\item 5.5\n",
"\\item 6.5\n",
"\\item 5.7\n",
"\\item 6.3\n",
"\\item 4.9\n",
"\\item 6.6\n",
"\\item 5.2\n",
"\\item 5\n",
"\\item 5.9\n",
"\\item 6\n",
"\\item 6.1\n",
"\\item 5.6\n",
"\\item 6.7\n",
"\\item 5.6\n",
"\\item 5.8\n",
"\\item 6.2\n",
"\\item 5.6\n",
"\\item 5.9\n",
"\\item 6.1\n",
"\\item 6.3\n",
"\\item 6.1\n",
"\\item 6.4\n",
"\\item 6.6\n",
"\\item 6.8\n",
"\\item 6.7\n",
"\\item 6\n",
"\\item 5.7\n",
"\\item 5.5\n",
"\\item 5.5\n",
"\\item 5.8\n",
"\\item 6\n",
"\\item 5.4\n",
"\\item 6\n",
"\\item 6.7\n",
"\\item 6.3\n",
"\\item 5.6\n",
"\\item 5.5\n",
"\\item 5.5\n",
"\\item 6.1\n",
"\\item 5.8\n",
"\\item 5\n",
"\\item 5.6\n",
"\\item 5.7\n",
"\\item 5.7\n",
"\\item 6.2\n",
"\\item 5.1\n",
"\\item 5.7\n",
"\\item 6.3\n",
"\\item 5.8\n",
"\\item 7.1\n",
"\\item 6.3\n",
"\\item 6.5\n",
"\\item 7.6\n",
"\\item 4.9\n",
"\\item 7.3\n",
"\\item 6.7\n",
"\\item 7.2\n",
"\\item 6.5\n",
"\\item 6.4\n",
"\\item 6.8\n",
"\\item 5.7\n",
"\\item 5.8\n",
"\\item 6.4\n",
"\\item 6.5\n",
"\\item 7.7\n",
"\\item 7.7\n",
"\\item 6\n",
"\\item 6.9\n",
"\\item 5.6\n",
"\\item 7.7\n",
"\\item 6.3\n",
"\\item 6.7\n",
"\\item 7.2\n",
"\\item 6.2\n",
"\\item 6.1\n",
"\\item 6.4\n",
"\\item 7.2\n",
"\\item 7.4\n",
"\\item 7.9\n",
"\\item 6.4\n",
"\\item 6.3\n",
"\\item 6.1\n",
"\\item 7.7\n",
"\\item 6.3\n",
"\\item 6.4\n",
"\\item 6\n",
"\\item 6.9\n",
"\\item 6.7\n",
"\\item 6.9\n",
"\\item 5.8\n",
"\\item 6.8\n",
"\\item 6.7\n",
"\\item 6.7\n",
"\\item 6.3\n",
"\\item 6.5\n",
"\\item 6.2\n",
"\\item 5.9\n",
"\\end{enumerate*}\n"
],
"text/markdown": [
"1. 5.1\n",
"2. 4.9\n",
"3. 4.7\n",
"4. 4.6\n",
"5. 5\n",
"6. 5.4\n",
"7. 4.6\n",
"8. 5\n",
"9. 4.4\n",
"10. 4.9\n",
"11. 5.4\n",
"12. 4.8\n",
"13. 4.8\n",
"14. 4.3\n",
"15. 5.8\n",
"16. 5.7\n",
"17. 5.4\n",
"18. 5.1\n",
"19. 5.7\n",
"20. 5.1\n",
"21. 5.4\n",
"22. 5.1\n",
"23. 4.6\n",
"24. 5.1\n",
"25. 4.8\n",
"26. 5\n",
"27. 5\n",
"28. 5.2\n",
"29. 5.2\n",
"30. 4.7\n",
"31. 4.8\n",
"32. 5.4\n",
"33. 5.2\n",
"34. 5.5\n",
"35. 4.9\n",
"36. 5\n",
"37. 5.5\n",
"38. 4.9\n",
"39. 4.4\n",
"40. 5.1\n",
"41. 5\n",
"42. 4.5\n",
"43. 4.4\n",
"44. 5\n",
"45. 5.1\n",
"46. 4.8\n",
"47. 5.1\n",
"48. 4.6\n",
"49. 5.3\n",
"50. 5\n",
"51. 7\n",
"52. 6.4\n",
"53. 6.9\n",
"54. 5.5\n",
"55. 6.5\n",
"56. 5.7\n",
"57. 6.3\n",
"58. 4.9\n",
"59. 6.6\n",
"60. 5.2\n",
"61. 5\n",
"62. 5.9\n",
"63. 6\n",
"64. 6.1\n",
"65. 5.6\n",
"66. 6.7\n",
"67. 5.6\n",
"68. 5.8\n",
"69. 6.2\n",
"70. 5.6\n",
"71. 5.9\n",
"72. 6.1\n",
"73. 6.3\n",
"74. 6.1\n",
"75. 6.4\n",
"76. 6.6\n",
"77. 6.8\n",
"78. 6.7\n",
"79. 6\n",
"80. 5.7\n",
"81. 5.5\n",
"82. 5.5\n",
"83. 5.8\n",
"84. 6\n",
"85. 5.4\n",
"86. 6\n",
"87. 6.7\n",
"88. 6.3\n",
"89. 5.6\n",
"90. 5.5\n",
"91. 5.5\n",
"92. 6.1\n",
"93. 5.8\n",
"94. 5\n",
"95. 5.6\n",
"96. 5.7\n",
"97. 5.7\n",
"98. 6.2\n",
"99. 5.1\n",
"100. 5.7\n",
"101. 6.3\n",
"102. 5.8\n",
"103. 7.1\n",
"104. 6.3\n",
"105. 6.5\n",
"106. 7.6\n",
"107. 4.9\n",
"108. 7.3\n",
"109. 6.7\n",
"110. 7.2\n",
"111. 6.5\n",
"112. 6.4\n",
"113. 6.8\n",
"114. 5.7\n",
"115. 5.8\n",
"116. 6.4\n",
"117. 6.5\n",
"118. 7.7\n",
"119. 7.7\n",
"120. 6\n",
"121. 6.9\n",
"122. 5.6\n",
"123. 7.7\n",
"124. 6.3\n",
"125. 6.7\n",
"126. 7.2\n",
"127. 6.2\n",
"128. 6.1\n",
"129. 6.4\n",
"130. 7.2\n",
"131. 7.4\n",
"132. 7.9\n",
"133. 6.4\n",
"134. 6.3\n",
"135. 6.1\n",
"136. 7.7\n",
"137. 6.3\n",
"138. 6.4\n",
"139. 6\n",
"140. 6.9\n",
"141. 6.7\n",
"142. 6.9\n",
"143. 5.8\n",
"144. 6.8\n",
"145. 6.7\n",
"146. 6.7\n",
"147. 6.3\n",
"148. 6.5\n",
"149. 6.2\n",
"150. 5.9\n",
"\n",
"\n"
],
"text/plain": [
" [1] 5.1 4.9 4.7 4.6 5.0 5.4 4.6 5.0 4.4 4.9 5.4 4.8 4.8 4.3 5.8 5.7 5.4 5.1\n",
" [19] 5.7 5.1 5.4 5.1 4.6 5.1 4.8 5.0 5.0 5.2 5.2 4.7 4.8 5.4 5.2 5.5 4.9 5.0\n",
" [37] 5.5 4.9 4.4 5.1 5.0 4.5 4.4 5.0 5.1 4.8 5.1 4.6 5.3 5.0 7.0 6.4 6.9 5.5\n",
" [55] 6.5 5.7 6.3 4.9 6.6 5.2 5.0 5.9 6.0 6.1 5.6 6.7 5.6 5.8 6.2 5.6 5.9 6.1\n",
" [73] 6.3 6.1 6.4 6.6 6.8 6.7 6.0 5.7 5.5 5.5 5.8 6.0 5.4 6.0 6.7 6.3 5.6 5.5\n",
" [91] 5.5 6.1 5.8 5.0 5.6 5.7 5.7 6.2 5.1 5.7 6.3 5.8 7.1 6.3 6.5 7.6 4.9 7.3\n",
"[109] 6.7 7.2 6.5 6.4 6.8 5.7 5.8 6.4 6.5 7.7 7.7 6.0 6.9 5.6 7.7 6.3 6.7 7.2\n",
"[127] 6.2 6.1 6.4 7.2 7.4 7.9 6.4 6.3 6.1 7.7 6.3 6.4 6.0 6.9 6.7 6.9 5.8 6.8\n",
"[145] 6.7 6.7 6.3 6.5 6.2 5.9"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"\n",
"sepal_length <- iris$sepal_length\n",
"sepal_length"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "82dadc70-11e5-47d0-8d8c-8a123e05adc8",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table class=\"dataframe\">\n",
"<caption>A data.frame: 50 × 5</caption>\n",
"<thead>\n",
"\t<tr><th></th><th scope=col>sepal_length</th><th scope=col>sepal_width</th><th scope=col>petal_length</th><th scope=col>petal_width</th><th scope=col>species</th></tr>\n",
"\t<tr><th></th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;chr&gt;</th></tr>\n",
"</thead>\n",
"<tbody>\n",
"\t<tr><th scope=row>1</th><td>5.1</td><td>3.5</td><td>1.4</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>2</th><td>4.9</td><td>3.0</td><td>1.4</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>3</th><td>4.7</td><td>3.2</td><td>1.3</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>4</th><td>4.6</td><td>3.1</td><td>1.5</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>5</th><td>5.0</td><td>3.6</td><td>1.4</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>6</th><td>5.4</td><td>3.9</td><td>1.7</td><td>0.4</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>7</th><td>4.6</td><td>3.4</td><td>1.4</td><td>0.3</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>8</th><td>5.0</td><td>3.4</td><td>1.5</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>9</th><td>4.4</td><td>2.9</td><td>1.4</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>10</th><td>4.9</td><td>3.1</td><td>1.5</td><td>0.1</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>11</th><td>5.4</td><td>3.7</td><td>1.5</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>12</th><td>4.8</td><td>3.4</td><td>1.6</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>13</th><td>4.8</td><td>3.0</td><td>1.4</td><td>0.1</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>14</th><td>4.3</td><td>3.0</td><td>1.1</td><td>0.1</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>15</th><td>5.8</td><td>4.0</td><td>1.2</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>16</th><td>5.7</td><td>4.4</td><td>1.5</td><td>0.4</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>17</th><td>5.4</td><td>3.9</td><td>1.3</td><td>0.4</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>18</th><td>5.1</td><td>3.5</td><td>1.4</td><td>0.3</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>19</th><td>5.7</td><td>3.8</td><td>1.7</td><td>0.3</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>20</th><td>5.1</td><td>3.8</td><td>1.5</td><td>0.3</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>21</th><td>5.4</td><td>3.4</td><td>1.7</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>22</th><td>5.1</td><td>3.7</td><td>1.5</td><td>0.4</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>23</th><td>4.6</td><td>3.6</td><td>1.0</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>24</th><td>5.1</td><td>3.3</td><td>1.7</td><td>0.5</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>25</th><td>4.8</td><td>3.4</td><td>1.9</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>26</th><td>5.0</td><td>3.0</td><td>1.6</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>27</th><td>5.0</td><td>3.4</td><td>1.6</td><td>0.4</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>28</th><td>5.2</td><td>3.5</td><td>1.5</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>29</th><td>5.2</td><td>3.4</td><td>1.4</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>30</th><td>4.7</td><td>3.2</td><td>1.6</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>31</th><td>4.8</td><td>3.1</td><td>1.6</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>32</th><td>5.4</td><td>3.4</td><td>1.5</td><td>0.4</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>33</th><td>5.2</td><td>4.1</td><td>1.5</td><td>0.1</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>34</th><td>5.5</td><td>4.2</td><td>1.4</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>35</th><td>4.9</td><td>3.1</td><td>1.5</td><td>0.1</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>36</th><td>5.0</td><td>3.2</td><td>1.2</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>37</th><td>5.5</td><td>3.5</td><td>1.3</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>38</th><td>4.9</td><td>3.1</td><td>1.5</td><td>0.1</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>39</th><td>4.4</td><td>3.0</td><td>1.3</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>40</th><td>5.1</td><td>3.4</td><td>1.5</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>41</th><td>5.0</td><td>3.5</td><td>1.3</td><td>0.3</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>42</th><td>4.5</td><td>2.3</td><td>1.3</td><td>0.3</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>43</th><td>4.4</td><td>3.2</td><td>1.3</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>44</th><td>5.0</td><td>3.5</td><td>1.6</td><td>0.6</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>45</th><td>5.1</td><td>3.8</td><td>1.9</td><td>0.4</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>46</th><td>4.8</td><td>3.0</td><td>1.4</td><td>0.3</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>47</th><td>5.1</td><td>3.8</td><td>1.6</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>48</th><td>4.6</td><td>3.2</td><td>1.4</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>49</th><td>5.3</td><td>3.7</td><td>1.5</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>50</th><td>5.0</td><td>3.3</td><td>1.4</td><td>0.2</td><td>setosa</td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"A data.frame: 50 × 5\n",
"\\begin{tabular}{r|lllll}\n",
" & sepal\\_length & sepal\\_width & petal\\_length & petal\\_width & species\\\\\n",
" & <dbl> & <dbl> & <dbl> & <dbl> & <chr>\\\\\n",
"\\hline\n",
"\t1 & 5.1 & 3.5 & 1.4 & 0.2 & setosa\\\\\n",
"\t2 & 4.9 & 3.0 & 1.4 & 0.2 & setosa\\\\\n",
"\t3 & 4.7 & 3.2 & 1.3 & 0.2 & setosa\\\\\n",
"\t4 & 4.6 & 3.1 & 1.5 & 0.2 & setosa\\\\\n",
"\t5 & 5.0 & 3.6 & 1.4 & 0.2 & setosa\\\\\n",
"\t6 & 5.4 & 3.9 & 1.7 & 0.4 & setosa\\\\\n",
"\t7 & 4.6 & 3.4 & 1.4 & 0.3 & setosa\\\\\n",
"\t8 & 5.0 & 3.4 & 1.5 & 0.2 & setosa\\\\\n",
"\t9 & 4.4 & 2.9 & 1.4 & 0.2 & setosa\\\\\n",
"\t10 & 4.9 & 3.1 & 1.5 & 0.1 & setosa\\\\\n",
"\t11 & 5.4 & 3.7 & 1.5 & 0.2 & setosa\\\\\n",
"\t12 & 4.8 & 3.4 & 1.6 & 0.2 & setosa\\\\\n",
"\t13 & 4.8 & 3.0 & 1.4 & 0.1 & setosa\\\\\n",
"\t14 & 4.3 & 3.0 & 1.1 & 0.1 & setosa\\\\\n",
"\t15 & 5.8 & 4.0 & 1.2 & 0.2 & setosa\\\\\n",
"\t16 & 5.7 & 4.4 & 1.5 & 0.4 & setosa\\\\\n",
"\t17 & 5.4 & 3.9 & 1.3 & 0.4 & setosa\\\\\n",
"\t18 & 5.1 & 3.5 & 1.4 & 0.3 & setosa\\\\\n",
"\t19 & 5.7 & 3.8 & 1.7 & 0.3 & setosa\\\\\n",
"\t20 & 5.1 & 3.8 & 1.5 & 0.3 & setosa\\\\\n",
"\t21 & 5.4 & 3.4 & 1.7 & 0.2 & setosa\\\\\n",
"\t22 & 5.1 & 3.7 & 1.5 & 0.4 & setosa\\\\\n",
"\t23 & 4.6 & 3.6 & 1.0 & 0.2 & setosa\\\\\n",
"\t24 & 5.1 & 3.3 & 1.7 & 0.5 & setosa\\\\\n",
"\t25 & 4.8 & 3.4 & 1.9 & 0.2 & setosa\\\\\n",
"\t26 & 5.0 & 3.0 & 1.6 & 0.2 & setosa\\\\\n",
"\t27 & 5.0 & 3.4 & 1.6 & 0.4 & setosa\\\\\n",
"\t28 & 5.2 & 3.5 & 1.5 & 0.2 & setosa\\\\\n",
"\t29 & 5.2 & 3.4 & 1.4 & 0.2 & setosa\\\\\n",
"\t30 & 4.7 & 3.2 & 1.6 & 0.2 & setosa\\\\\n",
"\t31 & 4.8 & 3.1 & 1.6 & 0.2 & setosa\\\\\n",
"\t32 & 5.4 & 3.4 & 1.5 & 0.4 & setosa\\\\\n",
"\t33 & 5.2 & 4.1 & 1.5 & 0.1 & setosa\\\\\n",
"\t34 & 5.5 & 4.2 & 1.4 & 0.2 & setosa\\\\\n",
"\t35 & 4.9 & 3.1 & 1.5 & 0.1 & setosa\\\\\n",
"\t36 & 5.0 & 3.2 & 1.2 & 0.2 & setosa\\\\\n",
"\t37 & 5.5 & 3.5 & 1.3 & 0.2 & setosa\\\\\n",
"\t38 & 4.9 & 3.1 & 1.5 & 0.1 & setosa\\\\\n",
"\t39 & 4.4 & 3.0 & 1.3 & 0.2 & setosa\\\\\n",
"\t40 & 5.1 & 3.4 & 1.5 & 0.2 & setosa\\\\\n",
"\t41 & 5.0 & 3.5 & 1.3 & 0.3 & setosa\\\\\n",
"\t42 & 4.5 & 2.3 & 1.3 & 0.3 & setosa\\\\\n",
"\t43 & 4.4 & 3.2 & 1.3 & 0.2 & setosa\\\\\n",
"\t44 & 5.0 & 3.5 & 1.6 & 0.6 & setosa\\\\\n",
"\t45 & 5.1 & 3.8 & 1.9 & 0.4 & setosa\\\\\n",
"\t46 & 4.8 & 3.0 & 1.4 & 0.3 & setosa\\\\\n",
"\t47 & 5.1 & 3.8 & 1.6 & 0.2 & setosa\\\\\n",
"\t48 & 4.6 & 3.2 & 1.4 & 0.2 & setosa\\\\\n",
"\t49 & 5.3 & 3.7 & 1.5 & 0.2 & setosa\\\\\n",
"\t50 & 5.0 & 3.3 & 1.4 & 0.2 & setosa\\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"A data.frame: 50 × 5\n",
"\n",
"| <!--/--> | sepal_length &lt;dbl&gt; | sepal_width &lt;dbl&gt; | petal_length &lt;dbl&gt; | petal_width &lt;dbl&gt; | species &lt;chr&gt; |\n",
"|---|---|---|---|---|---|\n",
"| 1 | 5.1 | 3.5 | 1.4 | 0.2 | setosa |\n",
"| 2 | 4.9 | 3.0 | 1.4 | 0.2 | setosa |\n",
"| 3 | 4.7 | 3.2 | 1.3 | 0.2 | setosa |\n",
"| 4 | 4.6 | 3.1 | 1.5 | 0.2 | setosa |\n",
"| 5 | 5.0 | 3.6 | 1.4 | 0.2 | setosa |\n",
"| 6 | 5.4 | 3.9 | 1.7 | 0.4 | setosa |\n",
"| 7 | 4.6 | 3.4 | 1.4 | 0.3 | setosa |\n",
"| 8 | 5.0 | 3.4 | 1.5 | 0.2 | setosa |\n",
"| 9 | 4.4 | 2.9 | 1.4 | 0.2 | setosa |\n",
"| 10 | 4.9 | 3.1 | 1.5 | 0.1 | setosa |\n",
"| 11 | 5.4 | 3.7 | 1.5 | 0.2 | setosa |\n",
"| 12 | 4.8 | 3.4 | 1.6 | 0.2 | setosa |\n",
"| 13 | 4.8 | 3.0 | 1.4 | 0.1 | setosa |\n",
"| 14 | 4.3 | 3.0 | 1.1 | 0.1 | setosa |\n",
"| 15 | 5.8 | 4.0 | 1.2 | 0.2 | setosa |\n",
"| 16 | 5.7 | 4.4 | 1.5 | 0.4 | setosa |\n",
"| 17 | 5.4 | 3.9 | 1.3 | 0.4 | setosa |\n",
"| 18 | 5.1 | 3.5 | 1.4 | 0.3 | setosa |\n",
"| 19 | 5.7 | 3.8 | 1.7 | 0.3 | setosa |\n",
"| 20 | 5.1 | 3.8 | 1.5 | 0.3 | setosa |\n",
"| 21 | 5.4 | 3.4 | 1.7 | 0.2 | setosa |\n",
"| 22 | 5.1 | 3.7 | 1.5 | 0.4 | setosa |\n",
"| 23 | 4.6 | 3.6 | 1.0 | 0.2 | setosa |\n",
"| 24 | 5.1 | 3.3 | 1.7 | 0.5 | setosa |\n",
"| 25 | 4.8 | 3.4 | 1.9 | 0.2 | setosa |\n",
"| 26 | 5.0 | 3.0 | 1.6 | 0.2 | setosa |\n",
"| 27 | 5.0 | 3.4 | 1.6 | 0.4 | setosa |\n",
"| 28 | 5.2 | 3.5 | 1.5 | 0.2 | setosa |\n",
"| 29 | 5.2 | 3.4 | 1.4 | 0.2 | setosa |\n",
"| 30 | 4.7 | 3.2 | 1.6 | 0.2 | setosa |\n",
"| 31 | 4.8 | 3.1 | 1.6 | 0.2 | setosa |\n",
"| 32 | 5.4 | 3.4 | 1.5 | 0.4 | setosa |\n",
"| 33 | 5.2 | 4.1 | 1.5 | 0.1 | setosa |\n",
"| 34 | 5.5 | 4.2 | 1.4 | 0.2 | setosa |\n",
"| 35 | 4.9 | 3.1 | 1.5 | 0.1 | setosa |\n",
"| 36 | 5.0 | 3.2 | 1.2 | 0.2 | setosa |\n",
"| 37 | 5.5 | 3.5 | 1.3 | 0.2 | setosa |\n",
"| 38 | 4.9 | 3.1 | 1.5 | 0.1 | setosa |\n",
"| 39 | 4.4 | 3.0 | 1.3 | 0.2 | setosa |\n",
"| 40 | 5.1 | 3.4 | 1.5 | 0.2 | setosa |\n",
"| 41 | 5.0 | 3.5 | 1.3 | 0.3 | setosa |\n",
"| 42 | 4.5 | 2.3 | 1.3 | 0.3 | setosa |\n",
"| 43 | 4.4 | 3.2 | 1.3 | 0.2 | setosa |\n",
"| 44 | 5.0 | 3.5 | 1.6 | 0.6 | setosa |\n",
"| 45 | 5.1 | 3.8 | 1.9 | 0.4 | setosa |\n",
"| 46 | 4.8 | 3.0 | 1.4 | 0.3 | setosa |\n",
"| 47 | 5.1 | 3.8 | 1.6 | 0.2 | setosa |\n",
"| 48 | 4.6 | 3.2 | 1.4 | 0.2 | setosa |\n",
"| 49 | 5.3 | 3.7 | 1.5 | 0.2 | setosa |\n",
"| 50 | 5.0 | 3.3 | 1.4 | 0.2 | setosa |\n",
"\n"
],
"text/plain": [
" sepal_length sepal_width petal_length petal_width species\n",
"1 5.1 3.5 1.4 0.2 setosa \n",
"2 4.9 3.0 1.4 0.2 setosa \n",
"3 4.7 3.2 1.3 0.2 setosa \n",
"4 4.6 3.1 1.5 0.2 setosa \n",
"5 5.0 3.6 1.4 0.2 setosa \n",
"6 5.4 3.9 1.7 0.4 setosa \n",
"7 4.6 3.4 1.4 0.3 setosa \n",
"8 5.0 3.4 1.5 0.2 setosa \n",
"9 4.4 2.9 1.4 0.2 setosa \n",
"10 4.9 3.1 1.5 0.1 setosa \n",
"11 5.4 3.7 1.5 0.2 setosa \n",
"12 4.8 3.4 1.6 0.2 setosa \n",
"13 4.8 3.0 1.4 0.1 setosa \n",
"14 4.3 3.0 1.1 0.1 setosa \n",
"15 5.8 4.0 1.2 0.2 setosa \n",
"16 5.7 4.4 1.5 0.4 setosa \n",
"17 5.4 3.9 1.3 0.4 setosa \n",
"18 5.1 3.5 1.4 0.3 setosa \n",
"19 5.7 3.8 1.7 0.3 setosa \n",
"20 5.1 3.8 1.5 0.3 setosa \n",
"21 5.4 3.4 1.7 0.2 setosa \n",
"22 5.1 3.7 1.5 0.4 setosa \n",
"23 4.6 3.6 1.0 0.2 setosa \n",
"24 5.1 3.3 1.7 0.5 setosa \n",
"25 4.8 3.4 1.9 0.2 setosa \n",
"26 5.0 3.0 1.6 0.2 setosa \n",
"27 5.0 3.4 1.6 0.4 setosa \n",
"28 5.2 3.5 1.5 0.2 setosa \n",
"29 5.2 3.4 1.4 0.2 setosa \n",
"30 4.7 3.2 1.6 0.2 setosa \n",
"31 4.8 3.1 1.6 0.2 setosa \n",
"32 5.4 3.4 1.5 0.4 setosa \n",
"33 5.2 4.1 1.5 0.1 setosa \n",
"34 5.5 4.2 1.4 0.2 setosa \n",
"35 4.9 3.1 1.5 0.1 setosa \n",
"36 5.0 3.2 1.2 0.2 setosa \n",
"37 5.5 3.5 1.3 0.2 setosa \n",
"38 4.9 3.1 1.5 0.1 setosa \n",
"39 4.4 3.0 1.3 0.2 setosa \n",
"40 5.1 3.4 1.5 0.2 setosa \n",
"41 5.0 3.5 1.3 0.3 setosa \n",
"42 4.5 2.3 1.3 0.3 setosa \n",
"43 4.4 3.2 1.3 0.2 setosa \n",
"44 5.0 3.5 1.6 0.6 setosa \n",
"45 5.1 3.8 1.9 0.4 setosa \n",
"46 4.8 3.0 1.4 0.3 setosa \n",
"47 5.1 3.8 1.6 0.2 setosa \n",
"48 4.6 3.2 1.4 0.2 setosa \n",
"49 5.3 3.7 1.5 0.2 setosa \n",
"50 5.0 3.3 1.4 0.2 setosa "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"\n",
"iris[iris$species==\"setosa\",]"
]
},
{
"cell_type": "markdown",
"id": "e7c7d75a-d9da-4b24-9a50-5a1bbe627ab7",
"metadata": {
"tags": []
},
"source": [
"## Filtering out\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "bbece7a7-87d5-4e41-ad64-323d5b604c66",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table class=\"dataframe\">\n",
"<caption>A data.frame: 50 × 4</caption>\n",
"<thead>\n",
"\t<tr><th></th><th scope=col>sepal_length</th><th scope=col>sepal_width</th><th scope=col>petal_length</th><th scope=col>petal_width</th></tr>\n",
"\t<tr><th></th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th></tr>\n",
"</thead>\n",
"<tbody>\n",
"\t<tr><th scope=row>1</th><td>5.1</td><td>3.5</td><td>1.4</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>2</th><td>4.9</td><td>3.0</td><td>1.4</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>3</th><td>4.7</td><td>3.2</td><td>1.3</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>4</th><td>4.6</td><td>3.1</td><td>1.5</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>5</th><td>5.0</td><td>3.6</td><td>1.4</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>6</th><td>5.4</td><td>3.9</td><td>1.7</td><td>0.4</td></tr>\n",
"\t<tr><th scope=row>7</th><td>4.6</td><td>3.4</td><td>1.4</td><td>0.3</td></tr>\n",
"\t<tr><th scope=row>8</th><td>5.0</td><td>3.4</td><td>1.5</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>9</th><td>4.4</td><td>2.9</td><td>1.4</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>10</th><td>4.9</td><td>3.1</td><td>1.5</td><td>0.1</td></tr>\n",
"\t<tr><th scope=row>11</th><td>5.4</td><td>3.7</td><td>1.5</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>12</th><td>4.8</td><td>3.4</td><td>1.6</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>13</th><td>4.8</td><td>3.0</td><td>1.4</td><td>0.1</td></tr>\n",
"\t<tr><th scope=row>14</th><td>4.3</td><td>3.0</td><td>1.1</td><td>0.1</td></tr>\n",
"\t<tr><th scope=row>15</th><td>5.8</td><td>4.0</td><td>1.2</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>16</th><td>5.7</td><td>4.4</td><td>1.5</td><td>0.4</td></tr>\n",
"\t<tr><th scope=row>17</th><td>5.4</td><td>3.9</td><td>1.3</td><td>0.4</td></tr>\n",
"\t<tr><th scope=row>18</th><td>5.1</td><td>3.5</td><td>1.4</td><td>0.3</td></tr>\n",
"\t<tr><th scope=row>19</th><td>5.7</td><td>3.8</td><td>1.7</td><td>0.3</td></tr>\n",
"\t<tr><th scope=row>20</th><td>5.1</td><td>3.8</td><td>1.5</td><td>0.3</td></tr>\n",
"\t<tr><th scope=row>21</th><td>5.4</td><td>3.4</td><td>1.7</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>22</th><td>5.1</td><td>3.7</td><td>1.5</td><td>0.4</td></tr>\n",
"\t<tr><th scope=row>23</th><td>4.6</td><td>3.6</td><td>1.0</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>24</th><td>5.1</td><td>3.3</td><td>1.7</td><td>0.5</td></tr>\n",
"\t<tr><th scope=row>25</th><td>4.8</td><td>3.4</td><td>1.9</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>26</th><td>5.0</td><td>3.0</td><td>1.6</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>27</th><td>5.0</td><td>3.4</td><td>1.6</td><td>0.4</td></tr>\n",
"\t<tr><th scope=row>28</th><td>5.2</td><td>3.5</td><td>1.5</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>29</th><td>5.2</td><td>3.4</td><td>1.4</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>30</th><td>4.7</td><td>3.2</td><td>1.6</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>31</th><td>4.8</td><td>3.1</td><td>1.6</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>32</th><td>5.4</td><td>3.4</td><td>1.5</td><td>0.4</td></tr>\n",
"\t<tr><th scope=row>33</th><td>5.2</td><td>4.1</td><td>1.5</td><td>0.1</td></tr>\n",
"\t<tr><th scope=row>34</th><td>5.5</td><td>4.2</td><td>1.4</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>35</th><td>4.9</td><td>3.1</td><td>1.5</td><td>0.1</td></tr>\n",
"\t<tr><th scope=row>36</th><td>5.0</td><td>3.2</td><td>1.2</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>37</th><td>5.5</td><td>3.5</td><td>1.3</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>38</th><td>4.9</td><td>3.1</td><td>1.5</td><td>0.1</td></tr>\n",
"\t<tr><th scope=row>39</th><td>4.4</td><td>3.0</td><td>1.3</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>40</th><td>5.1</td><td>3.4</td><td>1.5</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>41</th><td>5.0</td><td>3.5</td><td>1.3</td><td>0.3</td></tr>\n",
"\t<tr><th scope=row>42</th><td>4.5</td><td>2.3</td><td>1.3</td><td>0.3</td></tr>\n",
"\t<tr><th scope=row>43</th><td>4.4</td><td>3.2</td><td>1.3</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>44</th><td>5.0</td><td>3.5</td><td>1.6</td><td>0.6</td></tr>\n",
"\t<tr><th scope=row>45</th><td>5.1</td><td>3.8</td><td>1.9</td><td>0.4</td></tr>\n",
"\t<tr><th scope=row>46</th><td>4.8</td><td>3.0</td><td>1.4</td><td>0.3</td></tr>\n",
"\t<tr><th scope=row>47</th><td>5.1</td><td>3.8</td><td>1.6</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>48</th><td>4.6</td><td>3.2</td><td>1.4</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>49</th><td>5.3</td><td>3.7</td><td>1.5</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>50</th><td>5.0</td><td>3.3</td><td>1.4</td><td>0.2</td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"A data.frame: 50 × 4\n",
"\\begin{tabular}{r|llll}\n",
" & sepal\\_length & sepal\\_width & petal\\_length & petal\\_width\\\\\n",
" & <dbl> & <dbl> & <dbl> & <dbl>\\\\\n",
"\\hline\n",
"\t1 & 5.1 & 3.5 & 1.4 & 0.2\\\\\n",
"\t2 & 4.9 & 3.0 & 1.4 & 0.2\\\\\n",
"\t3 & 4.7 & 3.2 & 1.3 & 0.2\\\\\n",
"\t4 & 4.6 & 3.1 & 1.5 & 0.2\\\\\n",
"\t5 & 5.0 & 3.6 & 1.4 & 0.2\\\\\n",
"\t6 & 5.4 & 3.9 & 1.7 & 0.4\\\\\n",
"\t7 & 4.6 & 3.4 & 1.4 & 0.3\\\\\n",
"\t8 & 5.0 & 3.4 & 1.5 & 0.2\\\\\n",
"\t9 & 4.4 & 2.9 & 1.4 & 0.2\\\\\n",
"\t10 & 4.9 & 3.1 & 1.5 & 0.1\\\\\n",
"\t11 & 5.4 & 3.7 & 1.5 & 0.2\\\\\n",
"\t12 & 4.8 & 3.4 & 1.6 & 0.2\\\\\n",
"\t13 & 4.8 & 3.0 & 1.4 & 0.1\\\\\n",
"\t14 & 4.3 & 3.0 & 1.1 & 0.1\\\\\n",
"\t15 & 5.8 & 4.0 & 1.2 & 0.2\\\\\n",
"\t16 & 5.7 & 4.4 & 1.5 & 0.4\\\\\n",
"\t17 & 5.4 & 3.9 & 1.3 & 0.4\\\\\n",
"\t18 & 5.1 & 3.5 & 1.4 & 0.3\\\\\n",
"\t19 & 5.7 & 3.8 & 1.7 & 0.3\\\\\n",
"\t20 & 5.1 & 3.8 & 1.5 & 0.3\\\\\n",
"\t21 & 5.4 & 3.4 & 1.7 & 0.2\\\\\n",
"\t22 & 5.1 & 3.7 & 1.5 & 0.4\\\\\n",
"\t23 & 4.6 & 3.6 & 1.0 & 0.2\\\\\n",
"\t24 & 5.1 & 3.3 & 1.7 & 0.5\\\\\n",
"\t25 & 4.8 & 3.4 & 1.9 & 0.2\\\\\n",
"\t26 & 5.0 & 3.0 & 1.6 & 0.2\\\\\n",
"\t27 & 5.0 & 3.4 & 1.6 & 0.4\\\\\n",
"\t28 & 5.2 & 3.5 & 1.5 & 0.2\\\\\n",
"\t29 & 5.2 & 3.4 & 1.4 & 0.2\\\\\n",
"\t30 & 4.7 & 3.2 & 1.6 & 0.2\\\\\n",
"\t31 & 4.8 & 3.1 & 1.6 & 0.2\\\\\n",
"\t32 & 5.4 & 3.4 & 1.5 & 0.4\\\\\n",
"\t33 & 5.2 & 4.1 & 1.5 & 0.1\\\\\n",
"\t34 & 5.5 & 4.2 & 1.4 & 0.2\\\\\n",
"\t35 & 4.9 & 3.1 & 1.5 & 0.1\\\\\n",
"\t36 & 5.0 & 3.2 & 1.2 & 0.2\\\\\n",
"\t37 & 5.5 & 3.5 & 1.3 & 0.2\\\\\n",
"\t38 & 4.9 & 3.1 & 1.5 & 0.1\\\\\n",
"\t39 & 4.4 & 3.0 & 1.3 & 0.2\\\\\n",
"\t40 & 5.1 & 3.4 & 1.5 & 0.2\\\\\n",
"\t41 & 5.0 & 3.5 & 1.3 & 0.3\\\\\n",
"\t42 & 4.5 & 2.3 & 1.3 & 0.3\\\\\n",
"\t43 & 4.4 & 3.2 & 1.3 & 0.2\\\\\n",
"\t44 & 5.0 & 3.5 & 1.6 & 0.6\\\\\n",
"\t45 & 5.1 & 3.8 & 1.9 & 0.4\\\\\n",
"\t46 & 4.8 & 3.0 & 1.4 & 0.3\\\\\n",
"\t47 & 5.1 & 3.8 & 1.6 & 0.2\\\\\n",
"\t48 & 4.6 & 3.2 & 1.4 & 0.2\\\\\n",
"\t49 & 5.3 & 3.7 & 1.5 & 0.2\\\\\n",
"\t50 & 5.0 & 3.3 & 1.4 & 0.2\\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"A data.frame: 50 × 4\n",
"\n",
"| <!--/--> | sepal_length &lt;dbl&gt; | sepal_width &lt;dbl&gt; | petal_length &lt;dbl&gt; | petal_width &lt;dbl&gt; |\n",
"|---|---|---|---|---|\n",
"| 1 | 5.1 | 3.5 | 1.4 | 0.2 |\n",
"| 2 | 4.9 | 3.0 | 1.4 | 0.2 |\n",
"| 3 | 4.7 | 3.2 | 1.3 | 0.2 |\n",
"| 4 | 4.6 | 3.1 | 1.5 | 0.2 |\n",
"| 5 | 5.0 | 3.6 | 1.4 | 0.2 |\n",
"| 6 | 5.4 | 3.9 | 1.7 | 0.4 |\n",
"| 7 | 4.6 | 3.4 | 1.4 | 0.3 |\n",
"| 8 | 5.0 | 3.4 | 1.5 | 0.2 |\n",
"| 9 | 4.4 | 2.9 | 1.4 | 0.2 |\n",
"| 10 | 4.9 | 3.1 | 1.5 | 0.1 |\n",
"| 11 | 5.4 | 3.7 | 1.5 | 0.2 |\n",
"| 12 | 4.8 | 3.4 | 1.6 | 0.2 |\n",
"| 13 | 4.8 | 3.0 | 1.4 | 0.1 |\n",
"| 14 | 4.3 | 3.0 | 1.1 | 0.1 |\n",
"| 15 | 5.8 | 4.0 | 1.2 | 0.2 |\n",
"| 16 | 5.7 | 4.4 | 1.5 | 0.4 |\n",
"| 17 | 5.4 | 3.9 | 1.3 | 0.4 |\n",
"| 18 | 5.1 | 3.5 | 1.4 | 0.3 |\n",
"| 19 | 5.7 | 3.8 | 1.7 | 0.3 |\n",
"| 20 | 5.1 | 3.8 | 1.5 | 0.3 |\n",
"| 21 | 5.4 | 3.4 | 1.7 | 0.2 |\n",
"| 22 | 5.1 | 3.7 | 1.5 | 0.4 |\n",
"| 23 | 4.6 | 3.6 | 1.0 | 0.2 |\n",
"| 24 | 5.1 | 3.3 | 1.7 | 0.5 |\n",
"| 25 | 4.8 | 3.4 | 1.9 | 0.2 |\n",
"| 26 | 5.0 | 3.0 | 1.6 | 0.2 |\n",
"| 27 | 5.0 | 3.4 | 1.6 | 0.4 |\n",
"| 28 | 5.2 | 3.5 | 1.5 | 0.2 |\n",
"| 29 | 5.2 | 3.4 | 1.4 | 0.2 |\n",
"| 30 | 4.7 | 3.2 | 1.6 | 0.2 |\n",
"| 31 | 4.8 | 3.1 | 1.6 | 0.2 |\n",
"| 32 | 5.4 | 3.4 | 1.5 | 0.4 |\n",
"| 33 | 5.2 | 4.1 | 1.5 | 0.1 |\n",
"| 34 | 5.5 | 4.2 | 1.4 | 0.2 |\n",
"| 35 | 4.9 | 3.1 | 1.5 | 0.1 |\n",
"| 36 | 5.0 | 3.2 | 1.2 | 0.2 |\n",
"| 37 | 5.5 | 3.5 | 1.3 | 0.2 |\n",
"| 38 | 4.9 | 3.1 | 1.5 | 0.1 |\n",
"| 39 | 4.4 | 3.0 | 1.3 | 0.2 |\n",
"| 40 | 5.1 | 3.4 | 1.5 | 0.2 |\n",
"| 41 | 5.0 | 3.5 | 1.3 | 0.3 |\n",
"| 42 | 4.5 | 2.3 | 1.3 | 0.3 |\n",
"| 43 | 4.4 | 3.2 | 1.3 | 0.2 |\n",
"| 44 | 5.0 | 3.5 | 1.6 | 0.6 |\n",
"| 45 | 5.1 | 3.8 | 1.9 | 0.4 |\n",
"| 46 | 4.8 | 3.0 | 1.4 | 0.3 |\n",
"| 47 | 5.1 | 3.8 | 1.6 | 0.2 |\n",
"| 48 | 4.6 | 3.2 | 1.4 | 0.2 |\n",
"| 49 | 5.3 | 3.7 | 1.5 | 0.2 |\n",
"| 50 | 5.0 | 3.3 | 1.4 | 0.2 |\n",
"\n"
],
"text/plain": [
" sepal_length sepal_width petal_length petal_width\n",
"1 5.1 3.5 1.4 0.2 \n",
"2 4.9 3.0 1.4 0.2 \n",
"3 4.7 3.2 1.3 0.2 \n",
"4 4.6 3.1 1.5 0.2 \n",
"5 5.0 3.6 1.4 0.2 \n",
"6 5.4 3.9 1.7 0.4 \n",
"7 4.6 3.4 1.4 0.3 \n",
"8 5.0 3.4 1.5 0.2 \n",
"9 4.4 2.9 1.4 0.2 \n",
"10 4.9 3.1 1.5 0.1 \n",
"11 5.4 3.7 1.5 0.2 \n",
"12 4.8 3.4 1.6 0.2 \n",
"13 4.8 3.0 1.4 0.1 \n",
"14 4.3 3.0 1.1 0.1 \n",
"15 5.8 4.0 1.2 0.2 \n",
"16 5.7 4.4 1.5 0.4 \n",
"17 5.4 3.9 1.3 0.4 \n",
"18 5.1 3.5 1.4 0.3 \n",
"19 5.7 3.8 1.7 0.3 \n",
"20 5.1 3.8 1.5 0.3 \n",
"21 5.4 3.4 1.7 0.2 \n",
"22 5.1 3.7 1.5 0.4 \n",
"23 4.6 3.6 1.0 0.2 \n",
"24 5.1 3.3 1.7 0.5 \n",
"25 4.8 3.4 1.9 0.2 \n",
"26 5.0 3.0 1.6 0.2 \n",
"27 5.0 3.4 1.6 0.4 \n",
"28 5.2 3.5 1.5 0.2 \n",
"29 5.2 3.4 1.4 0.2 \n",
"30 4.7 3.2 1.6 0.2 \n",
"31 4.8 3.1 1.6 0.2 \n",
"32 5.4 3.4 1.5 0.4 \n",
"33 5.2 4.1 1.5 0.1 \n",
"34 5.5 4.2 1.4 0.2 \n",
"35 4.9 3.1 1.5 0.1 \n",
"36 5.0 3.2 1.2 0.2 \n",
"37 5.5 3.5 1.3 0.2 \n",
"38 4.9 3.1 1.5 0.1 \n",
"39 4.4 3.0 1.3 0.2 \n",
"40 5.1 3.4 1.5 0.2 \n",
"41 5.0 3.5 1.3 0.3 \n",
"42 4.5 2.3 1.3 0.3 \n",
"43 4.4 3.2 1.3 0.2 \n",
"44 5.0 3.5 1.6 0.6 \n",
"45 5.1 3.8 1.9 0.4 \n",
"46 4.8 3.0 1.4 0.3 \n",
"47 5.1 3.8 1.6 0.2 \n",
"48 4.6 3.2 1.4 0.2 \n",
"49 5.3 3.7 1.5 0.2 \n",
"50 5.0 3.3 1.4 0.2 "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"iris[iris$species==\"setosa\", 1:4]"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "75c69777-cd45-4815-8bd3-01c127b11786",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table class=\"dataframe\">\n",
"<caption>A data.frame: 128 × 5</caption>\n",
"<thead>\n",
"\t<tr><th></th><th scope=col>sepal_length</th><th scope=col>sepal_width</th><th scope=col>petal_length</th><th scope=col>petal_width</th><th scope=col>species</th></tr>\n",
"\t<tr><th></th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;chr&gt;</th></tr>\n",
"</thead>\n",
"<tbody>\n",
"\t<tr><th scope=row>1</th><td>5.1</td><td>3.5</td><td>1.4</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>5</th><td>5.0</td><td>3.6</td><td>1.4</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>6</th><td>5.4</td><td>3.9</td><td>1.7</td><td>0.4</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>8</th><td>5.0</td><td>3.4</td><td>1.5</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>11</th><td>5.4</td><td>3.7</td><td>1.5</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>15</th><td>5.8</td><td>4.0</td><td>1.2</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>16</th><td>5.7</td><td>4.4</td><td>1.5</td><td>0.4</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>17</th><td>5.4</td><td>3.9</td><td>1.3</td><td>0.4</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>18</th><td>5.1</td><td>3.5</td><td>1.4</td><td>0.3</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>19</th><td>5.7</td><td>3.8</td><td>1.7</td><td>0.3</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>20</th><td>5.1</td><td>3.8</td><td>1.5</td><td>0.3</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>21</th><td>5.4</td><td>3.4</td><td>1.7</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>22</th><td>5.1</td><td>3.7</td><td>1.5</td><td>0.4</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>24</th><td>5.1</td><td>3.3</td><td>1.7</td><td>0.5</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>26</th><td>5.0</td><td>3.0</td><td>1.6</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>27</th><td>5.0</td><td>3.4</td><td>1.6</td><td>0.4</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>28</th><td>5.2</td><td>3.5</td><td>1.5</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>29</th><td>5.2</td><td>3.4</td><td>1.4</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>32</th><td>5.4</td><td>3.4</td><td>1.5</td><td>0.4</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>33</th><td>5.2</td><td>4.1</td><td>1.5</td><td>0.1</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>34</th><td>5.5</td><td>4.2</td><td>1.4</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>36</th><td>5.0</td><td>3.2</td><td>1.2</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>37</th><td>5.5</td><td>3.5</td><td>1.3</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>40</th><td>5.1</td><td>3.4</td><td>1.5</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>41</th><td>5.0</td><td>3.5</td><td>1.3</td><td>0.3</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>44</th><td>5.0</td><td>3.5</td><td>1.6</td><td>0.6</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>45</th><td>5.1</td><td>3.8</td><td>1.9</td><td>0.4</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>47</th><td>5.1</td><td>3.8</td><td>1.6</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>49</th><td>5.3</td><td>3.7</td><td>1.5</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>50</th><td>5.0</td><td>3.3</td><td>1.4</td><td>0.2</td><td>setosa</td></tr>\n",
"\t<tr><th scope=row>⋮</th><td>⋮</td><td>⋮</td><td>⋮</td><td>⋮</td><td>⋮</td></tr>\n",
"\t<tr><th scope=row>121</th><td>6.9</td><td>3.2</td><td>5.7</td><td>2.3</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>122</th><td>5.6</td><td>2.8</td><td>4.9</td><td>2.0</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>123</th><td>7.7</td><td>2.8</td><td>6.7</td><td>2.0</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>124</th><td>6.3</td><td>2.7</td><td>4.9</td><td>1.8</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>125</th><td>6.7</td><td>3.3</td><td>5.7</td><td>2.1</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>126</th><td>7.2</td><td>3.2</td><td>6.0</td><td>1.8</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>127</th><td>6.2</td><td>2.8</td><td>4.8</td><td>1.8</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>128</th><td>6.1</td><td>3.0</td><td>4.9</td><td>1.8</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>129</th><td>6.4</td><td>2.8</td><td>5.6</td><td>2.1</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>130</th><td>7.2</td><td>3.0</td><td>5.8</td><td>1.6</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>131</th><td>7.4</td><td>2.8</td><td>6.1</td><td>1.9</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>132</th><td>7.9</td><td>3.8</td><td>6.4</td><td>2.0</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>133</th><td>6.4</td><td>2.8</td><td>5.6</td><td>2.2</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>134</th><td>6.3</td><td>2.8</td><td>5.1</td><td>1.5</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>135</th><td>6.1</td><td>2.6</td><td>5.6</td><td>1.4</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>136</th><td>7.7</td><td>3.0</td><td>6.1</td><td>2.3</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>137</th><td>6.3</td><td>3.4</td><td>5.6</td><td>2.4</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>138</th><td>6.4</td><td>3.1</td><td>5.5</td><td>1.8</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>139</th><td>6.0</td><td>3.0</td><td>4.8</td><td>1.8</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>140</th><td>6.9</td><td>3.1</td><td>5.4</td><td>2.1</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>141</th><td>6.7</td><td>3.1</td><td>5.6</td><td>2.4</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>142</th><td>6.9</td><td>3.1</td><td>5.1</td><td>2.3</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>143</th><td>5.8</td><td>2.7</td><td>5.1</td><td>1.9</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>144</th><td>6.8</td><td>3.2</td><td>5.9</td><td>2.3</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>145</th><td>6.7</td><td>3.3</td><td>5.7</td><td>2.5</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>146</th><td>6.7</td><td>3.0</td><td>5.2</td><td>2.3</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>147</th><td>6.3</td><td>2.5</td><td>5.0</td><td>1.9</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>148</th><td>6.5</td><td>3.0</td><td>5.2</td><td>2.0</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>149</th><td>6.2</td><td>3.4</td><td>5.4</td><td>2.3</td><td>virginica</td></tr>\n",
"\t<tr><th scope=row>150</th><td>5.9</td><td>3.0</td><td>5.1</td><td>1.8</td><td>virginica</td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"A data.frame: 128 × 5\n",
"\\begin{tabular}{r|lllll}\n",
" & sepal\\_length & sepal\\_width & petal\\_length & petal\\_width & species\\\\\n",
" & <dbl> & <dbl> & <dbl> & <dbl> & <chr>\\\\\n",
"\\hline\n",
"\t1 & 5.1 & 3.5 & 1.4 & 0.2 & setosa\\\\\n",
"\t5 & 5.0 & 3.6 & 1.4 & 0.2 & setosa\\\\\n",
"\t6 & 5.4 & 3.9 & 1.7 & 0.4 & setosa\\\\\n",
"\t8 & 5.0 & 3.4 & 1.5 & 0.2 & setosa\\\\\n",
"\t11 & 5.4 & 3.7 & 1.5 & 0.2 & setosa\\\\\n",
"\t15 & 5.8 & 4.0 & 1.2 & 0.2 & setosa\\\\\n",
"\t16 & 5.7 & 4.4 & 1.5 & 0.4 & setosa\\\\\n",
"\t17 & 5.4 & 3.9 & 1.3 & 0.4 & setosa\\\\\n",
"\t18 & 5.1 & 3.5 & 1.4 & 0.3 & setosa\\\\\n",
"\t19 & 5.7 & 3.8 & 1.7 & 0.3 & setosa\\\\\n",
"\t20 & 5.1 & 3.8 & 1.5 & 0.3 & setosa\\\\\n",
"\t21 & 5.4 & 3.4 & 1.7 & 0.2 & setosa\\\\\n",
"\t22 & 5.1 & 3.7 & 1.5 & 0.4 & setosa\\\\\n",
"\t24 & 5.1 & 3.3 & 1.7 & 0.5 & setosa\\\\\n",
"\t26 & 5.0 & 3.0 & 1.6 & 0.2 & setosa\\\\\n",
"\t27 & 5.0 & 3.4 & 1.6 & 0.4 & setosa\\\\\n",
"\t28 & 5.2 & 3.5 & 1.5 & 0.2 & setosa\\\\\n",
"\t29 & 5.2 & 3.4 & 1.4 & 0.2 & setosa\\\\\n",
"\t32 & 5.4 & 3.4 & 1.5 & 0.4 & setosa\\\\\n",
"\t33 & 5.2 & 4.1 & 1.5 & 0.1 & setosa\\\\\n",
"\t34 & 5.5 & 4.2 & 1.4 & 0.2 & setosa\\\\\n",
"\t36 & 5.0 & 3.2 & 1.2 & 0.2 & setosa\\\\\n",
"\t37 & 5.5 & 3.5 & 1.3 & 0.2 & setosa\\\\\n",
"\t40 & 5.1 & 3.4 & 1.5 & 0.2 & setosa\\\\\n",
"\t41 & 5.0 & 3.5 & 1.3 & 0.3 & setosa\\\\\n",
"\t44 & 5.0 & 3.5 & 1.6 & 0.6 & setosa\\\\\n",
"\t45 & 5.1 & 3.8 & 1.9 & 0.4 & setosa\\\\\n",
"\t47 & 5.1 & 3.8 & 1.6 & 0.2 & setosa\\\\\n",
"\t49 & 5.3 & 3.7 & 1.5 & 0.2 & setosa\\\\\n",
"\t50 & 5.0 & 3.3 & 1.4 & 0.2 & setosa\\\\\n",
"\t⋮ & ⋮ & ⋮ & ⋮ & ⋮ & ⋮\\\\\n",
"\t121 & 6.9 & 3.2 & 5.7 & 2.3 & virginica\\\\\n",
"\t122 & 5.6 & 2.8 & 4.9 & 2.0 & virginica\\\\\n",
"\t123 & 7.7 & 2.8 & 6.7 & 2.0 & virginica\\\\\n",
"\t124 & 6.3 & 2.7 & 4.9 & 1.8 & virginica\\\\\n",
"\t125 & 6.7 & 3.3 & 5.7 & 2.1 & virginica\\\\\n",
"\t126 & 7.2 & 3.2 & 6.0 & 1.8 & virginica\\\\\n",
"\t127 & 6.2 & 2.8 & 4.8 & 1.8 & virginica\\\\\n",
"\t128 & 6.1 & 3.0 & 4.9 & 1.8 & virginica\\\\\n",
"\t129 & 6.4 & 2.8 & 5.6 & 2.1 & virginica\\\\\n",
"\t130 & 7.2 & 3.0 & 5.8 & 1.6 & virginica\\\\\n",
"\t131 & 7.4 & 2.8 & 6.1 & 1.9 & virginica\\\\\n",
"\t132 & 7.9 & 3.8 & 6.4 & 2.0 & virginica\\\\\n",
"\t133 & 6.4 & 2.8 & 5.6 & 2.2 & virginica\\\\\n",
"\t134 & 6.3 & 2.8 & 5.1 & 1.5 & virginica\\\\\n",
"\t135 & 6.1 & 2.6 & 5.6 & 1.4 & virginica\\\\\n",
"\t136 & 7.7 & 3.0 & 6.1 & 2.3 & virginica\\\\\n",
"\t137 & 6.3 & 3.4 & 5.6 & 2.4 & virginica\\\\\n",
"\t138 & 6.4 & 3.1 & 5.5 & 1.8 & virginica\\\\\n",
"\t139 & 6.0 & 3.0 & 4.8 & 1.8 & virginica\\\\\n",
"\t140 & 6.9 & 3.1 & 5.4 & 2.1 & virginica\\\\\n",
"\t141 & 6.7 & 3.1 & 5.6 & 2.4 & virginica\\\\\n",
"\t142 & 6.9 & 3.1 & 5.1 & 2.3 & virginica\\\\\n",
"\t143 & 5.8 & 2.7 & 5.1 & 1.9 & virginica\\\\\n",
"\t144 & 6.8 & 3.2 & 5.9 & 2.3 & virginica\\\\\n",
"\t145 & 6.7 & 3.3 & 5.7 & 2.5 & virginica\\\\\n",
"\t146 & 6.7 & 3.0 & 5.2 & 2.3 & virginica\\\\\n",
"\t147 & 6.3 & 2.5 & 5.0 & 1.9 & virginica\\\\\n",
"\t148 & 6.5 & 3.0 & 5.2 & 2.0 & virginica\\\\\n",
"\t149 & 6.2 & 3.4 & 5.4 & 2.3 & virginica\\\\\n",
"\t150 & 5.9 & 3.0 & 5.1 & 1.8 & virginica\\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"A data.frame: 128 × 5\n",
"\n",
"| <!--/--> | sepal_length &lt;dbl&gt; | sepal_width &lt;dbl&gt; | petal_length &lt;dbl&gt; | petal_width &lt;dbl&gt; | species &lt;chr&gt; |\n",
"|---|---|---|---|---|---|\n",
"| 1 | 5.1 | 3.5 | 1.4 | 0.2 | setosa |\n",
"| 5 | 5.0 | 3.6 | 1.4 | 0.2 | setosa |\n",
"| 6 | 5.4 | 3.9 | 1.7 | 0.4 | setosa |\n",
"| 8 | 5.0 | 3.4 | 1.5 | 0.2 | setosa |\n",
"| 11 | 5.4 | 3.7 | 1.5 | 0.2 | setosa |\n",
"| 15 | 5.8 | 4.0 | 1.2 | 0.2 | setosa |\n",
"| 16 | 5.7 | 4.4 | 1.5 | 0.4 | setosa |\n",
"| 17 | 5.4 | 3.9 | 1.3 | 0.4 | setosa |\n",
"| 18 | 5.1 | 3.5 | 1.4 | 0.3 | setosa |\n",
"| 19 | 5.7 | 3.8 | 1.7 | 0.3 | setosa |\n",
"| 20 | 5.1 | 3.8 | 1.5 | 0.3 | setosa |\n",
"| 21 | 5.4 | 3.4 | 1.7 | 0.2 | setosa |\n",
"| 22 | 5.1 | 3.7 | 1.5 | 0.4 | setosa |\n",
"| 24 | 5.1 | 3.3 | 1.7 | 0.5 | setosa |\n",
"| 26 | 5.0 | 3.0 | 1.6 | 0.2 | setosa |\n",
"| 27 | 5.0 | 3.4 | 1.6 | 0.4 | setosa |\n",
"| 28 | 5.2 | 3.5 | 1.5 | 0.2 | setosa |\n",
"| 29 | 5.2 | 3.4 | 1.4 | 0.2 | setosa |\n",
"| 32 | 5.4 | 3.4 | 1.5 | 0.4 | setosa |\n",
"| 33 | 5.2 | 4.1 | 1.5 | 0.1 | setosa |\n",
"| 34 | 5.5 | 4.2 | 1.4 | 0.2 | setosa |\n",
"| 36 | 5.0 | 3.2 | 1.2 | 0.2 | setosa |\n",
"| 37 | 5.5 | 3.5 | 1.3 | 0.2 | setosa |\n",
"| 40 | 5.1 | 3.4 | 1.5 | 0.2 | setosa |\n",
"| 41 | 5.0 | 3.5 | 1.3 | 0.3 | setosa |\n",
"| 44 | 5.0 | 3.5 | 1.6 | 0.6 | setosa |\n",
"| 45 | 5.1 | 3.8 | 1.9 | 0.4 | setosa |\n",
"| 47 | 5.1 | 3.8 | 1.6 | 0.2 | setosa |\n",
"| 49 | 5.3 | 3.7 | 1.5 | 0.2 | setosa |\n",
"| 50 | 5.0 | 3.3 | 1.4 | 0.2 | setosa |\n",
"| ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |\n",
"| 121 | 6.9 | 3.2 | 5.7 | 2.3 | virginica |\n",
"| 122 | 5.6 | 2.8 | 4.9 | 2.0 | virginica |\n",
"| 123 | 7.7 | 2.8 | 6.7 | 2.0 | virginica |\n",
"| 124 | 6.3 | 2.7 | 4.9 | 1.8 | virginica |\n",
"| 125 | 6.7 | 3.3 | 5.7 | 2.1 | virginica |\n",
"| 126 | 7.2 | 3.2 | 6.0 | 1.8 | virginica |\n",
"| 127 | 6.2 | 2.8 | 4.8 | 1.8 | virginica |\n",
"| 128 | 6.1 | 3.0 | 4.9 | 1.8 | virginica |\n",
"| 129 | 6.4 | 2.8 | 5.6 | 2.1 | virginica |\n",
"| 130 | 7.2 | 3.0 | 5.8 | 1.6 | virginica |\n",
"| 131 | 7.4 | 2.8 | 6.1 | 1.9 | virginica |\n",
"| 132 | 7.9 | 3.8 | 6.4 | 2.0 | virginica |\n",
"| 133 | 6.4 | 2.8 | 5.6 | 2.2 | virginica |\n",
"| 134 | 6.3 | 2.8 | 5.1 | 1.5 | virginica |\n",
"| 135 | 6.1 | 2.6 | 5.6 | 1.4 | virginica |\n",
"| 136 | 7.7 | 3.0 | 6.1 | 2.3 | virginica |\n",
"| 137 | 6.3 | 3.4 | 5.6 | 2.4 | virginica |\n",
"| 138 | 6.4 | 3.1 | 5.5 | 1.8 | virginica |\n",
"| 139 | 6.0 | 3.0 | 4.8 | 1.8 | virginica |\n",
"| 140 | 6.9 | 3.1 | 5.4 | 2.1 | virginica |\n",
"| 141 | 6.7 | 3.1 | 5.6 | 2.4 | virginica |\n",
"| 142 | 6.9 | 3.1 | 5.1 | 2.3 | virginica |\n",
"| 143 | 5.8 | 2.7 | 5.1 | 1.9 | virginica |\n",
"| 144 | 6.8 | 3.2 | 5.9 | 2.3 | virginica |\n",
"| 145 | 6.7 | 3.3 | 5.7 | 2.5 | virginica |\n",
"| 146 | 6.7 | 3.0 | 5.2 | 2.3 | virginica |\n",
"| 147 | 6.3 | 2.5 | 5.0 | 1.9 | virginica |\n",
"| 148 | 6.5 | 3.0 | 5.2 | 2.0 | virginica |\n",
"| 149 | 6.2 | 3.4 | 5.4 | 2.3 | virginica |\n",
"| 150 | 5.9 | 3.0 | 5.1 | 1.8 | virginica |\n",
"\n"
],
"text/plain": [
" sepal_length sepal_width petal_length petal_width species \n",
"1 5.1 3.5 1.4 0.2 setosa \n",
"5 5.0 3.6 1.4 0.2 setosa \n",
"6 5.4 3.9 1.7 0.4 setosa \n",
"8 5.0 3.4 1.5 0.2 setosa \n",
"11 5.4 3.7 1.5 0.2 setosa \n",
"15 5.8 4.0 1.2 0.2 setosa \n",
"16 5.7 4.4 1.5 0.4 setosa \n",
"17 5.4 3.9 1.3 0.4 setosa \n",
"18 5.1 3.5 1.4 0.3 setosa \n",
"19 5.7 3.8 1.7 0.3 setosa \n",
"20 5.1 3.8 1.5 0.3 setosa \n",
"21 5.4 3.4 1.7 0.2 setosa \n",
"22 5.1 3.7 1.5 0.4 setosa \n",
"24 5.1 3.3 1.7 0.5 setosa \n",
"26 5.0 3.0 1.6 0.2 setosa \n",
"27 5.0 3.4 1.6 0.4 setosa \n",
"28 5.2 3.5 1.5 0.2 setosa \n",
"29 5.2 3.4 1.4 0.2 setosa \n",
"32 5.4 3.4 1.5 0.4 setosa \n",
"33 5.2 4.1 1.5 0.1 setosa \n",
"34 5.5 4.2 1.4 0.2 setosa \n",
"36 5.0 3.2 1.2 0.2 setosa \n",
"37 5.5 3.5 1.3 0.2 setosa \n",
"40 5.1 3.4 1.5 0.2 setosa \n",
"41 5.0 3.5 1.3 0.3 setosa \n",
"44 5.0 3.5 1.6 0.6 setosa \n",
"45 5.1 3.8 1.9 0.4 setosa \n",
"47 5.1 3.8 1.6 0.2 setosa \n",
"49 5.3 3.7 1.5 0.2 setosa \n",
"50 5.0 3.3 1.4 0.2 setosa \n",
"⋮ ⋮ ⋮ ⋮ ⋮ ⋮ \n",
"121 6.9 3.2 5.7 2.3 virginica\n",
"122 5.6 2.8 4.9 2.0 virginica\n",
"123 7.7 2.8 6.7 2.0 virginica\n",
"124 6.3 2.7 4.9 1.8 virginica\n",
"125 6.7 3.3 5.7 2.1 virginica\n",
"126 7.2 3.2 6.0 1.8 virginica\n",
"127 6.2 2.8 4.8 1.8 virginica\n",
"128 6.1 3.0 4.9 1.8 virginica\n",
"129 6.4 2.8 5.6 2.1 virginica\n",
"130 7.2 3.0 5.8 1.6 virginica\n",
"131 7.4 2.8 6.1 1.9 virginica\n",
"132 7.9 3.8 6.4 2.0 virginica\n",
"133 6.4 2.8 5.6 2.2 virginica\n",
"134 6.3 2.8 5.1 1.5 virginica\n",
"135 6.1 2.6 5.6 1.4 virginica\n",
"136 7.7 3.0 6.1 2.3 virginica\n",
"137 6.3 3.4 5.6 2.4 virginica\n",
"138 6.4 3.1 5.5 1.8 virginica\n",
"139 6.0 3.0 4.8 1.8 virginica\n",
"140 6.9 3.1 5.4 2.1 virginica\n",
"141 6.7 3.1 5.6 2.4 virginica\n",
"142 6.9 3.1 5.1 2.3 virginica\n",
"143 5.8 2.7 5.1 1.9 virginica\n",
"144 6.8 3.2 5.9 2.3 virginica\n",
"145 6.7 3.3 5.7 2.5 virginica\n",
"146 6.7 3.0 5.2 2.3 virginica\n",
"147 6.3 2.5 5.0 1.9 virginica\n",
"148 6.5 3.0 5.2 2.0 virginica\n",
"149 6.2 3.4 5.4 2.3 virginica\n",
"150 5.9 3.0 5.1 1.8 virginica"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"iris[iris$sepal_length>=5,]"
]
},
{
"cell_type": "markdown",
"id": "3bb92b88-3e68-4ee1-8b71-66780128efb8",
"metadata": {
"tags": []
},
"source": [
"## Multiple conditions\n"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "d96704f3-7200-4ad9-b0c3-cbbe3ea1630f",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table class=\"dataframe\">\n",
"<caption>A data.frame: 25 × 4</caption>\n",
"<thead>\n",
"\t<tr><th></th><th scope=col>sepal_length</th><th scope=col>sepal_width</th><th scope=col>petal_length</th><th scope=col>petal_width</th></tr>\n",
"\t<tr><th></th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th><th scope=col>&lt;dbl&gt;</th></tr>\n",
"</thead>\n",
"<tbody>\n",
"\t<tr><th scope=row>1</th><td>5.1</td><td>3.5</td><td>1.4</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>5</th><td>5.0</td><td>3.6</td><td>1.4</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>6</th><td>5.4</td><td>3.9</td><td>1.7</td><td>0.4</td></tr>\n",
"\t<tr><th scope=row>8</th><td>5.0</td><td>3.4</td><td>1.5</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>11</th><td>5.4</td><td>3.7</td><td>1.5</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>17</th><td>5.4</td><td>3.9</td><td>1.3</td><td>0.4</td></tr>\n",
"\t<tr><th scope=row>18</th><td>5.1</td><td>3.5</td><td>1.4</td><td>0.3</td></tr>\n",
"\t<tr><th scope=row>20</th><td>5.1</td><td>3.8</td><td>1.5</td><td>0.3</td></tr>\n",
"\t<tr><th scope=row>21</th><td>5.4</td><td>3.4</td><td>1.7</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>22</th><td>5.1</td><td>3.7</td><td>1.5</td><td>0.4</td></tr>\n",
"\t<tr><th scope=row>24</th><td>5.1</td><td>3.3</td><td>1.7</td><td>0.5</td></tr>\n",
"\t<tr><th scope=row>26</th><td>5.0</td><td>3.0</td><td>1.6</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>27</th><td>5.0</td><td>3.4</td><td>1.6</td><td>0.4</td></tr>\n",
"\t<tr><th scope=row>28</th><td>5.2</td><td>3.5</td><td>1.5</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>29</th><td>5.2</td><td>3.4</td><td>1.4</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>32</th><td>5.4</td><td>3.4</td><td>1.5</td><td>0.4</td></tr>\n",
"\t<tr><th scope=row>33</th><td>5.2</td><td>4.1</td><td>1.5</td><td>0.1</td></tr>\n",
"\t<tr><th scope=row>36</th><td>5.0</td><td>3.2</td><td>1.2</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>40</th><td>5.1</td><td>3.4</td><td>1.5</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>41</th><td>5.0</td><td>3.5</td><td>1.3</td><td>0.3</td></tr>\n",
"\t<tr><th scope=row>44</th><td>5.0</td><td>3.5</td><td>1.6</td><td>0.6</td></tr>\n",
"\t<tr><th scope=row>45</th><td>5.1</td><td>3.8</td><td>1.9</td><td>0.4</td></tr>\n",
"\t<tr><th scope=row>47</th><td>5.1</td><td>3.8</td><td>1.6</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>49</th><td>5.3</td><td>3.7</td><td>1.5</td><td>0.2</td></tr>\n",
"\t<tr><th scope=row>50</th><td>5.0</td><td>3.3</td><td>1.4</td><td>0.2</td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"A data.frame: 25 × 4\n",
"\\begin{tabular}{r|llll}\n",
" & sepal\\_length & sepal\\_width & petal\\_length & petal\\_width\\\\\n",
" & <dbl> & <dbl> & <dbl> & <dbl>\\\\\n",
"\\hline\n",
"\t1 & 5.1 & 3.5 & 1.4 & 0.2\\\\\n",
"\t5 & 5.0 & 3.6 & 1.4 & 0.2\\\\\n",
"\t6 & 5.4 & 3.9 & 1.7 & 0.4\\\\\n",
"\t8 & 5.0 & 3.4 & 1.5 & 0.2\\\\\n",
"\t11 & 5.4 & 3.7 & 1.5 & 0.2\\\\\n",
"\t17 & 5.4 & 3.9 & 1.3 & 0.4\\\\\n",
"\t18 & 5.1 & 3.5 & 1.4 & 0.3\\\\\n",
"\t20 & 5.1 & 3.8 & 1.5 & 0.3\\\\\n",
"\t21 & 5.4 & 3.4 & 1.7 & 0.2\\\\\n",
"\t22 & 5.1 & 3.7 & 1.5 & 0.4\\\\\n",
"\t24 & 5.1 & 3.3 & 1.7 & 0.5\\\\\n",
"\t26 & 5.0 & 3.0 & 1.6 & 0.2\\\\\n",
"\t27 & 5.0 & 3.4 & 1.6 & 0.4\\\\\n",
"\t28 & 5.2 & 3.5 & 1.5 & 0.2\\\\\n",
"\t29 & 5.2 & 3.4 & 1.4 & 0.2\\\\\n",
"\t32 & 5.4 & 3.4 & 1.5 & 0.4\\\\\n",
"\t33 & 5.2 & 4.1 & 1.5 & 0.1\\\\\n",
"\t36 & 5.0 & 3.2 & 1.2 & 0.2\\\\\n",
"\t40 & 5.1 & 3.4 & 1.5 & 0.2\\\\\n",
"\t41 & 5.0 & 3.5 & 1.3 & 0.3\\\\\n",
"\t44 & 5.0 & 3.5 & 1.6 & 0.6\\\\\n",
"\t45 & 5.1 & 3.8 & 1.9 & 0.4\\\\\n",
"\t47 & 5.1 & 3.8 & 1.6 & 0.2\\\\\n",
"\t49 & 5.3 & 3.7 & 1.5 & 0.2\\\\\n",
"\t50 & 5.0 & 3.3 & 1.4 & 0.2\\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"A data.frame: 25 × 4\n",
"\n",
"| <!--/--> | sepal_length &lt;dbl&gt; | sepal_width &lt;dbl&gt; | petal_length &lt;dbl&gt; | petal_width &lt;dbl&gt; |\n",
"|---|---|---|---|---|\n",
"| 1 | 5.1 | 3.5 | 1.4 | 0.2 |\n",
"| 5 | 5.0 | 3.6 | 1.4 | 0.2 |\n",
"| 6 | 5.4 | 3.9 | 1.7 | 0.4 |\n",
"| 8 | 5.0 | 3.4 | 1.5 | 0.2 |\n",
"| 11 | 5.4 | 3.7 | 1.5 | 0.2 |\n",
"| 17 | 5.4 | 3.9 | 1.3 | 0.4 |\n",
"| 18 | 5.1 | 3.5 | 1.4 | 0.3 |\n",
"| 20 | 5.1 | 3.8 | 1.5 | 0.3 |\n",
"| 21 | 5.4 | 3.4 | 1.7 | 0.2 |\n",
"| 22 | 5.1 | 3.7 | 1.5 | 0.4 |\n",
"| 24 | 5.1 | 3.3 | 1.7 | 0.5 |\n",
"| 26 | 5.0 | 3.0 | 1.6 | 0.2 |\n",
"| 27 | 5.0 | 3.4 | 1.6 | 0.4 |\n",
"| 28 | 5.2 | 3.5 | 1.5 | 0.2 |\n",
"| 29 | 5.2 | 3.4 | 1.4 | 0.2 |\n",
"| 32 | 5.4 | 3.4 | 1.5 | 0.4 |\n",
"| 33 | 5.2 | 4.1 | 1.5 | 0.1 |\n",
"| 36 | 5.0 | 3.2 | 1.2 | 0.2 |\n",
"| 40 | 5.1 | 3.4 | 1.5 | 0.2 |\n",
"| 41 | 5.0 | 3.5 | 1.3 | 0.3 |\n",
"| 44 | 5.0 | 3.5 | 1.6 | 0.6 |\n",
"| 45 | 5.1 | 3.8 | 1.9 | 0.4 |\n",
"| 47 | 5.1 | 3.8 | 1.6 | 0.2 |\n",
"| 49 | 5.3 | 3.7 | 1.5 | 0.2 |\n",
"| 50 | 5.0 | 3.3 | 1.4 | 0.2 |\n",
"\n"
],
"text/plain": [
" sepal_length sepal_width petal_length petal_width\n",
"1 5.1 3.5 1.4 0.2 \n",
"5 5.0 3.6 1.4 0.2 \n",
"6 5.4 3.9 1.7 0.4 \n",
"8 5.0 3.4 1.5 0.2 \n",
"11 5.4 3.7 1.5 0.2 \n",
"17 5.4 3.9 1.3 0.4 \n",
"18 5.1 3.5 1.4 0.3 \n",
"20 5.1 3.8 1.5 0.3 \n",
"21 5.4 3.4 1.7 0.2 \n",
"22 5.1 3.7 1.5 0.4 \n",
"24 5.1 3.3 1.7 0.5 \n",
"26 5.0 3.0 1.6 0.2 \n",
"27 5.0 3.4 1.6 0.4 \n",
"28 5.2 3.5 1.5 0.2 \n",
"29 5.2 3.4 1.4 0.2 \n",
"32 5.4 3.4 1.5 0.4 \n",
"33 5.2 4.1 1.5 0.1 \n",
"36 5.0 3.2 1.2 0.2 \n",
"40 5.1 3.4 1.5 0.2 \n",
"41 5.0 3.5 1.3 0.3 \n",
"44 5.0 3.5 1.6 0.6 \n",
"45 5.1 3.8 1.9 0.4 \n",
"47 5.1 3.8 1.6 0.2 \n",
"49 5.3 3.7 1.5 0.2 \n",
"50 5.0 3.3 1.4 0.2 "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"iris[iris$sepal_length>=5 & iris$sepal_length<5.5& iris$species==\"setosa\",1:4]"
]
},
{
"cell_type": "markdown",
"id": "fcea8da6-3223-4c03-b2cb-b2ed3c752b90",
"metadata": {},
"source": [
"# Tabulating data and Summarizing data"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "29927a2b-04c1-4906-9539-78359a8d8f80",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"sepal.length\n",
"4.3 4.4 4.5 4.6 4.7 4.8 4.9 5 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6 6.1 6.2 \n",
" 1 3 1 4 2 5 6 10 9 4 1 6 7 6 8 7 3 6 6 4 \n",
"6.3 6.4 6.5 6.6 6.7 6.8 6.9 7 7.1 7.2 7.3 7.4 7.6 7.7 7.9 \n",
" 9 7 5 2 8 3 4 1 1 3 1 1 1 4 1 "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"sepal.length = iris$sepal_length\n",
"table(sepal.length)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "031d5ecc-ba32-488d-83d2-9738250cfc49",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"sepal.length\n",
"4.3 4.4 4.5 4.6 4.7 4.8 4.9 5 5.1 5.2 5.3 5.4 5.5 5.7 5.8 \n",
" 1 3 1 4 2 5 4 8 8 3 1 5 2 2 1 "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"sepal.length = iris[iris$species==\"setosa\",]$sepal_length\n",
"table(sepal.length)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "59d83a9e-a082-4a86-8775-7019a7422521",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
" Min. 1st Qu. Median Mean 3rd Qu. Max. \n",
" 4.300 4.800 5.000 5.006 5.200 5.800 "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"summary(sepal.length)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "88643c8e-f08c-4725-b714-c7015c5da257",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "R",
"language": "R",
"name": "ir"
},
"language_info": {
"codemirror_mode": "r",
"file_extension": ".r",
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
"version": "4.1.1"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
@ark1tech
Copy link

Lupet bry my forever lodi <333

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment