alperyilmaz / dav-exercises

Exercise questions submitted by Data Analysis and Visualization with R course students at YTU
GNU General Public License v3.0
1 stars 2 forks source link

Radiation #20

Open baslamisli opened 6 years ago

baslamisli commented 6 years ago

Question

Radiation carries enough energy to break down the DNA, the genetic material of the cell, and the cells die by the breakdown of DNA. As a result, naturally the tissues are damaged and cause cancer. The data shows the survival percentages of batches of rats who were given varying doses of radiation.

Accordingly, please use the given data to find the percentage of rats that can survive the highest radiation dose. Create a chart like this:

image

Please import file from : https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/boot/survival.csv

HİNT

Your answer should be like this:
      surv
1    .......

Please open a new text file in your Desktop and paste the contents and save the file as .csv in Desktop.
Please use setwd()

library(ggplot2)
library(dplyr)
library(readr)
rats <- read.csv("rats.csv")
rats %>%
  arrange(desc(dose)) %>%
  top_n(-1)

rats %>%
  ggplot(aes(x=surv, y=dose)) +
  geom_smooth(size = 2, se = FALSE) +
  xlab("Survival Rate") +
  ylab("Radiation Dose")  

Additional information

dose: The dose of radiation administered surv: The survival rate of the batches expressed as a percentage.

Originality

Is this question

Difficulty Level

Tags

import , dplyr, ggplot2

alperyilmaz commented 6 years ago

14 rows of data, and it's very obvious, the survival rate at highest dose, since the data is sorted already, the last column says:

X dose surv
14 1410.0 0.006

but the solution you provided says

rats %>%
  arrange(desc(dose)) %>%
  top_n(1)
X dose surv
2 117.5 55  

because top_n sorts for last column.

Also, this question and it's solution is nowhere near Intermediate in difficulty

baslamisli commented 6 years ago

I noticed now. There have been some mistakes. I'll fix it.