Created
September 29, 2019 15:29
-
-
Save adash333/d67f914181ae21bf6377896011ba42b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "R Notebook" | |
output: html_notebook | |
--- | |
This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you execute code within the notebook, the results appear beneath the code. | |
Try executing this chunk by clicking the *Run* button within the chunk or by placing your cursor inside it and pressing *Ctrl+Shift+Enter*. | |
```{r} | |
library(drc) | |
library(nplr) | |
library(tidyverse) | |
library("RCurl") | |
getURL("https://raw.githubusercontent.com/Razumall/NOPS/master/Data/ELISA.csv") %>% | |
read.csv(text = ., header = TRUE) %>% | |
tbl_df() -> df | |
``` | |
```{r} | |
df %>% | |
mutate_all(funs(. - as.numeric((df[8,1]+df[8,2])/2 ))) -> df2 | |
``` | |
```{r} | |
df2 %>% | |
dplyr::select(X1, X2) %>% | |
mutate(Concentration = c(1000*0.5^(0:6), 0)) %>% | |
gather(Column, Absorbance, -Concentration) %>% | |
filter(Concentration!=0) %>% | |
dplyr::select(-Column) -> Standard | |
``` | |
```{r} | |
ggplot(Standard, aes(x=Concentration, y=Absorbance))+ | |
geom_point()+ | |
scale_x_log10() | |
``` | |
```{r} | |
library(nplr) | |
nplr <- nplr( x = Standard$Concentration, | |
y = Standard$Absorbance ) | |
nplr | |
``` | |
```{r} | |
plot( nplr, | |
xlab="Concenttration", | |
ylab="Absorbance") | |
``` | |
```{r} | |
df2 %>% | |
dplyr::select(-c(X1, X2)) %>% | |
gather(Column, Absorbance) %>% | |
mutate(Sample = c(rep(1:8, 2), rep(9:16, 2), rep(17:24, 2), rep(25:32, 2), rep(33:40, 2)) ) %>% | |
mutate(Sample = as.factor(Sample)) %>% | |
group_by(Sample) %>% | |
summarise(Mean = mean(Absorbance), SD = sd(Absorbance)) -> Measured | |
``` | |
```{r} | |
Measured %>% | |
filter(Mean > 0) -> Measured2 | |
getEstimates(nplr, Measured2$Mean) %>% | |
tbl_df() %>% | |
dplyr::rename(Absorbance=y, Concentration=x) -> Estimates_nplr | |
# kable(Estimates_nplr %>% head(), align="c") | |
``` | |
Add a new chunk by clicking the *Insert Chunk* button on the toolbar or by pressing *Ctrl+Alt+I*. | |
When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the *Preview* button or press *Ctrl+Shift+K* to preview the HTML file). | |
The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike *Knit*, *Preview* does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment