There are 100 rows and about 20 variables in the small medical data. The problems are in the word document. Please use my R code as a start. Please give detailed steps. Thanks!!!

1 answer below »
There are 100 rows and about 20 variables in the small medical data. The problems are in the word document. Please use my R code as a start. Please give detailed steps. Thanks!!!
Answered Same DayMar 27, 2021

Answer To: There are 100 rows and about 20 variables in the small medical data. The problems are in the word...

Kshitij answered on Mar 28 2021
144 Votes
analysis_homework.rmd
---
title: "Untitled"
author: "BS"
date: "March 26, 2020"
output: html_document
---
```{r}
library(tidyverse)
data=read.table("Testdata_100.txt",sep= "\t" , na.strings = c('', 'NA', ''),head=TRUE)
data1=data%>%
mutate(old_preg=ifelse(age>35,1,0))%>%
mutate(bmi=weight/((
height/100)^2))%>%
separate(BBP,c("DP","SP"))%>%
mutate(SP=as.numeric(SP))%>%
mutate(DP=as.numeric(DP))%>%
mutate(MAP=(SP+DP*2)/3)%>%
mutate(premature=ifelse(gest_age<37,1,0))%>%
mutate(low_weight=ifelse(Bweight<2500,1,0))%>%
mutate(giant_baby=ifelse(Bweight>4000,1,0))
```
#removing NA form data
```{r}
data2<-na.omit(data1)
```
#boxplot after removing NA
```{r}
library(reshape2)
library(ggpubr)
meltDf <- melt(data2, id.vars = "id")
ggboxplot(meltDf , x= "variable" , y="value", fill= "variable" ) + theme(axis.text.x=element_text(angle=90))
```
#removing outliers
```{r}
for( i in 1:dim(data2)[2])
{
data2[,i]<-as.numeric(data2[,i])
outliers <- boxplot(data2[,i], plot = FALSE)$out
if(length(outliers) > 1)
{
# Remove outliers
data2 <- data2[!(data2[,i] %in% outliers), ]
}
}
```
#boxplot after removing outliers
```{r}
meltDf <- melt(data2, id.vars = "id")
ggboxplot(meltDf , x= "variable" , y="value", fill= "variable" ) + theme(axis.text.x=element_text(angle=90))
```
#correlation plot between variable
```{r}
library(corrplot)
correl<-cor(data2)
corrplot(correl, method = 'color')
```
#relationship between ogtt and baby’s weight (“Bweight”)/”giant_baby”
```{r}
data3<-data2[c("id","ogtt1","ogtt2","ogtt3","ogtt4", "Bweight", "giant_baby")]
correl<-cor(data3)
corrplot(correl, method = 'color')
ggscatter(data3, x= "ogtt1", y="Bweight", add = "reg.line", conf.int = TRUE, cor.coef = TRUE, cor.method = "pearson", main="Pearson Correlation between Ogtt1 and Bweight")
ggscatter(data3, x= "ogtt2", y="Bweight", add = "reg.line", conf.int = TRUE, cor.coef = TRUE, cor.method = "pearson", main="Pearson Correlation between Ogtt1 and Bweight")
ggscatter(data3, x= "ogtt3", y="Bweight", add = "reg.line", conf.int = TRUE, cor.coef = TRUE, cor.method = "pearson",main="Pearson Correlation between Ogtt1 and Bweight")
ggscatter(data3, x= "ogtt4", y="Bweight", add = "reg.line", conf.int = TRUE, cor.coef = TRUE, cor.method = "pearson",main="Pearson Correlation between Ogtt1 and Bweight")
ggscatter(data3, x= "ogtt1", y="giant_baby", add = "reg.line", conf.int = TRUE, cor.coef = TRUE, cor.method = "pearson", main="Pearson Correlation between Ogtt1 and giant_baby")
ggscatter(data3, x= "ogtt2", y="giant_baby", add = "reg.line", conf.int = TRUE, cor.coef = TRUE, cor.method = "pearson", main="Pearson Correlation between Ogtt1 and giant_baby")
ggscatter(data3, x= "ogtt3", y="giant_baby", add = "reg.line", conf.int = TRUE, cor.coef = TRUE, cor.method = "pearson", main="Pearson Correlation between Ogtt1 and giant_baby")
ggscatter(data3, x= "ogtt4", y="giant_baby", add = "reg.line", conf.int = TRUE, cor.coef = TRUE, cor.method = "pearson", main="Pearson Correlation between Ogtt1 and giant_baby")
```
#4. How do you deal with the...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here