Skip to content

EliasIssaRproject#10

Open
haveaniceday9 wants to merge 2 commits into
qtran4:mainfrom
haveaniceday9:main
Open

EliasIssaRproject#10
haveaniceday9 wants to merge 2 commits into
qtran4:mainfrom
haveaniceday9:main

Conversation

@haveaniceday9
Copy link
Copy Markdown

No description provided.

Comment thread supportingFunctions.R
write.csv(data, file = paste(directory, sub(".txt",".csv", i), sep ="/"), quote=F, row.names=F, sep = ",")
file.remove(paste(directory,i, sep ="/" ))
}
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+2

Comment thread supportingFunctions.R
#Stores the data in .csv files as temporary value
data2 <- read.csv(paste(directory,i, sep = "/"))
#Remove NAs if choice is removeNA
if(choice=="removeNA"){ data <- na.omit(data2)}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a condition when the user choose not to type either of these.
-0.25

Comment thread supportingFunctions.R
#Total number of rows is equal to the number of screens
numscreen <- nrow(all)
#Subsets the data for patients with a single marker present in any of the markers
infected <- subset(all, marker01 > 0 | marker02 > 0 | marker03 > 0 | marker04 > 0 | marker05 > 0 | marker06 > 0 | marker07 > 0 | marker08 > 0 | marker09 > 0 | marker10 > 0)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be made as a for loop

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-0.25 for code inefficiency

Comment thread supportingFunctions.R
all <- subset(data, age<122)
#Creates a dataframe with the markers 1,10 and corresponding total marker count
df <- data.frame(marker = c(seq.int(1,10,by =1)),
count = c(sum(all$marker01),sum(all$marker02),sum(all$marker03),sum(all$marker04),sum(all$marker05),sum(all$marker06),sum(all$marker07),sum(all$marker08),sum(all$marker09),sum(all$marker10)))
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use colSums for this

Comment thread supportingFunctions.R
firstInfection <- function(file){
data <- read.csv(file)
#Subsets the data for patients with a single marker present in any of the markers
infected <- subset(data, marker01 > 0 | marker02 > 0 | marker03 > 0 | marker04 > 0 | marker05 > 0 | marker06 > 0 | marker07 > 0 | marker08 > 0 | marker09 > 0 | marker10 > 0)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use the for loop

Comment thread supportingFunctions.R
}
}
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+2

Comment thread supportingFunctions.R
ggplot() + geom_histogram(data=infected, aes(x=age,color="red"), binwidth = 1) +theme_classic()

}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+2

Comment thread analysis.R
#Compiles the CSV data for each country into a file allData.csv for future analysis with NAs removed
compileCSV("countryY", "removeNA")
compileCSV("countryX", "removeNA")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+2

Comment thread analysis.R

#As country Y is developed the vaccine they would likely develop it for markers 5-10
#These markers are present at low levels in country X
#As such the country Y vaccine would likely not work for country X
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+4

Comment thread analysis.R
#The first infection for country X is 120
firstInfection("countryX/allData.csv")
#As Country X had infections at day 120, 19 days prior to country Y, the infection likely began in country X

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+4

Comment thread analysis.R
#Summarizes data for both countries form the file allData.csv
summarizeData("allData.csv")

#The disease appears to infect both sexes fairly equally and appears to mostly infect younger patients under 20 years old
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good commenting and efficient code that uses coding concepts that we covered in class – 3.5 points (max is 4)

Copy link
Copy Markdown
Owner

@qtran4 qtran4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

19.5

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants