EliasIssaRproject#10
Open
haveaniceday9 wants to merge 2 commits into
Open
Conversation
qtran4
reviewed
Dec 16, 2022
| write.csv(data, file = paste(directory, sub(".txt",".csv", i), sep ="/"), quote=F, row.names=F, sep = ",") | ||
| file.remove(paste(directory,i, sep ="/" )) | ||
| } | ||
| } |
qtran4
reviewed
Dec 16, 2022
| #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)} |
Owner
There was a problem hiding this comment.
There should be a condition when the user choose not to type either of these.
-0.25
qtran4
reviewed
Dec 16, 2022
| #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) |
qtran4
reviewed
Dec 16, 2022
| 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))) |
qtran4
reviewed
Dec 16, 2022
| 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) |
qtran4
reviewed
Dec 16, 2022
| } | ||
| } | ||
| } | ||
|
|
qtran4
reviewed
Dec 16, 2022
| ggplot() + geom_histogram(data=infected, aes(x=age,color="red"), binwidth = 1) +theme_classic() | ||
|
|
||
| } | ||
|
|
qtran4
reviewed
Dec 16, 2022
| #Compiles the CSV data for each country into a file allData.csv for future analysis with NAs removed | ||
| compileCSV("countryY", "removeNA") | ||
| compileCSV("countryX", "removeNA") | ||
|
|
qtran4
reviewed
Dec 16, 2022
|
|
||
| #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 |
qtran4
reviewed
Dec 16, 2022
| #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 | ||
|
|
qtran4
reviewed
Dec 16, 2022
| #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 |
Owner
There was a problem hiding this comment.
Good commenting and efficient code that uses coding concepts that we covered in class – 3.5 points (max is 4)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.