Merge pull request 'Lab 5' (#11) from tomekg/aitech-wizualizacja:master into master

Reviewed-on: #11
This commit is contained in:
Tomasz Górecki 2021-06-09 15:33:21 +02:00
commit dc59b3ffeb
2 changed files with 154 additions and 27 deletions

181
05.ipynb
View File

@ -9,7 +9,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 3,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -116,9 +116,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 4,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Listening on http://127.0.0.1:3182\n",
"\n"
]
}
],
"source": [ "source": [
"ui <- fluidPage(\n", "ui <- fluidPage(\n",
" textInput('name', 'What is your name?'), # Input \n", " textInput('name', 'What is your name?'), # Input \n",
@ -136,7 +146,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -206,9 +216,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Listening on http://127.0.0.1:3182\n",
"\n"
]
}
],
"source": [ "source": [
"ui <- fluidPage(\n", "ui <- fluidPage(\n",
" titlePanel('Baby Name Explorer'),\n", " titlePanel('Baby Name Explorer'),\n",
@ -230,9 +250,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Listening on http://127.0.0.1:3182\n",
"\n"
]
}
],
"source": [ "source": [
"ui <- fluidPage(\n", "ui <- fluidPage(\n",
" titlePanel(\"What's in a Name?\"),\n", " titlePanel(\"What's in a Name?\"),\n",
@ -263,9 +293,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 8,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Listening on http://127.0.0.1:3182\n",
"\n"
]
}
],
"source": [ "source": [
"ui <- fluidPage(\n", "ui <- fluidPage(\n",
" titlePanel(\"What's in a Name?\"),\n", " titlePanel(\"What's in a Name?\"),\n",
@ -306,9 +346,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 9,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Listening on http://127.0.0.1:3182\n",
"\n"
]
}
],
"source": [ "source": [
"# Layout\n", "# Layout\n",
"\n", "\n",
@ -358,9 +408,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 10,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Listening on http://127.0.0.1:3182\n",
"\n"
]
}
],
"source": [ "source": [
"# Themes\n", "# Themes\n",
"\n", "\n",
@ -407,9 +467,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 11,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Listening on http://127.0.0.1:3182\n",
"\n"
]
}
],
"source": [ "source": [
"ui <- fluidPage(\n", "ui <- fluidPage(\n",
" titlePanel('BMI Calculator'),\n", " titlePanel('BMI Calculator'),\n",
@ -458,9 +528,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 12,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Listening on http://127.0.0.1:3182\n",
"\n"
]
}
],
"source": [ "source": [
"ui <- fluidPage(\n", "ui <- fluidPage(\n",
" textInput('name', 'Enter your name')\n", " textInput('name', 'Enter your name')\n",
@ -507,9 +587,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 13,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Listening on http://127.0.0.1:3182\n",
"\n"
]
}
],
"source": [ "source": [
"# Isolate\n", "# Isolate\n",
"ui <- fluidPage(\n", "ui <- fluidPage(\n",
@ -542,9 +632,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 14,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Listening on http://127.0.0.1:3182\n",
"\n"
]
}
],
"source": [ "source": [
"# eventReactive\n", "# eventReactive\n",
"ui <- fluidPage(\n", "ui <- fluidPage(\n",
@ -579,9 +679,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 15,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Listening on http://127.0.0.1:3182\n",
"\n"
]
}
],
"source": [ "source": [
"# observeEvent\n", "# observeEvent\n",
"bmiHelpText <- \"Body Mass Index is a simple calculation using a person's height and weight. The formula is BMI = kg/m2 where kg is a person's weight in kilograms and m2 is their height in metres squared. A BMI of 25.0 or more is overweight, while the healthy range is 18.5 to 24.9.\"\n", "bmiHelpText <- \"Body Mass Index is a simple calculation using a person's height and weight. The formula is BMI = kg/m2 where kg is a person's weight in kilograms and m2 is their height in metres squared. A BMI of 25.0 or more is overweight, while the healthy range is 18.5 to 24.9.\"\n",
@ -646,7 +756,19 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Listening on http://127.0.0.1:3182\n",
"\n",
"Warning message:\n",
"“Error in renderText: nie znaleziono obiektu 'x'”\n"
]
}
],
"source": [ "source": [
"ui <- fluidPage(\n", "ui <- fluidPage(\n",
" sliderInput(\"x\", label = \"If x is\", min = 1, max = 50, value = 30),\n", " sliderInput(\"x\", label = \"If x is\", min = 1, max = 50, value = 30),\n",
@ -736,6 +858,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"datasets <- c(\"economics\", \"faithfuld\", \"seals\")\n", "datasets <- c(\"economics\", \"faithfuld\", \"seals\")\n",
"\n",
"ui <- fluidPage(\n", "ui <- fluidPage(\n",
" selectInput(\"dataset\", \"Dataset\", choices = datasets),\n", " selectInput(\"dataset\", \"Dataset\", choices = datasets),\n",
" verbatimTextOutput(\"summary\"),\n", " verbatimTextOutput(\"summary\"),\n",
@ -779,9 +902,13 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"7. Narodowe Centrum Raportowania UFO (NUFORC) zbierało dane o zdarzeniach UFO w ciągu ostatniego stulecia (zbiór danych: usaUFOsightings.csv). Zbuduj aplikację, która pozwoli użytkownikom wybrać stan USA i okres, w którym miały miejsce zdarzenia. Wykres powinien pokazywać liczbę zdarzeń dla wybranego stanu i okresu. Tabela powinna pokazywać, dla wybranego stanu i okresu czasu, liczbę zaobserwowanych obserwacji oraz średnią, medianę, minimalny i maksymalny czas trwania (w sekundach) wydarzenia. Twoja ostateczna aplikacja powinna wizualnie przypominać zrzut ekranu poniżej.\n", "7. Narodowe Centrum Raportowania UFO (NUFORC) zbierało dane o zdarzeniach UFO w ciągu ostatniego stulecia (zbiór danych: usaUFOsightings.csv). Zbuduj aplikację, która pozwoli użytkownikom wybrać stan USA i okres, w którym miały miejsce zdarzenia. Wykres powinien pokazywać liczbę zdarzeń dla wybranego stanu i okresu. Tabela powinna pokazywać, dla wybranego stanu i okresu czasu, liczbę zaobserwowanych obserwacji oraz średnią, medianę, minimalny i maksymalny czas trwania (w sekundach) wydarzenia. Twoja ostateczna aplikacja powinna wizualnie przypominać zrzutu ekranu poniżej.\n",
"\n", "\n",
"<img src=\"figs/ex5_7.png\" width=\"800\">" "<img src=\"figs/ex5_7.png\" width=\"800\">\n",
"\n",
"8. Zbuduj aplikację do wizualizacji Centralnego Twierdzenia Granicznego. Próbki powinny być losowane z rozkładu jednostajnego na odcinku $[0, 1]$. Użytkownik powinien móc zmienić liczbę próbek (od 1 do 100, domyślnie 2) oraz liczbę słupków w histogramie (od 5 do 50, domślnie 20). Liczba doświadczeń (liczenia średnich) powinna być ustalona na stałe (10 000). Ustaw szablon na *darkly*. Zebezpiecz aplikację przed wpisaniem ujemnych wartości dla liczby próbek i liczby słupków (biblioteka *shinyFeedback*). Dopasuj wylgąd aplikacji do zrzutu ekranu poniżej.\n",
"\n",
"<img src=\"figs/ex5_8.png\" width=\"800\">"
] ]
} }
], ],

BIN
figs/ex5_8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB