diff --git a/.RData b/.RData new file mode 100644 index 0000000..538f64d Binary files /dev/null and b/.RData differ diff --git a/.Rhistory b/.Rhistory new file mode 100644 index 0000000..d00e38b --- /dev/null +++ b/.Rhistory @@ -0,0 +1,132 @@ +?matrix +setwd("~/") +source("~/.active-rstudio-document") +View(data) +View(data) +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +a = c(1:10) +a = a^3 +sqrt(-5) +max(c(1,5,9)) +x<-(c(1:10))^3 +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +halfval <- function(x,y){ +z <- min(x)/y +return(z) +} +halfval(c(1,5,9),4) +halfval <- function(x,y=2){ +z <- min(x)/y +return(z) +} +halfval(c(1,5,9)) +View(halfval) +View(halfval) +View(halfval) +View(halfval) +test <- function(x){ +print(x) +} +test('hi') +?read.table +setwd("~/My Files/Notes/NDU/Coursework/Biocomputing/Biocomp_tutorial10") +source("~/.active-rstudio-document") +View(data) +View(data) +source("~/.active-rstudio-document") +View(data) +View(data) +View(data) +View(data) +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +View(data_UW) +View(data_UW) +View(data) +View(data) +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +length(data_UW) +source("~/.active-rstudio-document") +data[1,3] +View(data) +View(data) +source("~/.active-rstudio-document") +View(data) +View(data) +View(data_UW) +View(data_UW) +rm(list = ls()) +source("~/.active-rstudio-document") +View(data_UW) +View(data_UW) +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +View(data) +View(data) +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +View(data) +View(data) +source("~/.active-rstudio-document") +source("~/My Files/Notes/NDU/Coursework/Biocomputing/Biocomp_tutorial10/Q1_SummaryPlot.R") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") +source("~/.active-rstudio-document") diff --git a/Q1_SummaryPlot.R b/Q1_SummaryPlot.R new file mode 100644 index 0000000..d0ca29c --- /dev/null +++ b/Q1_SummaryPlot.R @@ -0,0 +1,22 @@ +#import the data as a dataframe +data <- read.table(file = "UWvMSU_1-22-13.txt", header = TRUE) + +#divide the dataframe into two sets, UW and MSU +data_UW <- data[data$team=="UW",] +data_MS <- data[data$team=="MSU",] + +#Create cumulative sum data +cum_UW <- c(data_UW[1,3]) +for (i in 1:nrow(data_UW)-1){ + cum_UW <- append(cum_UW,data_UW[i+1,3] + cum_UW[i]) +} +cum_MS <- c(data_MS[1,3]) +for (i in 1:nrow(data_MS)-1){ + cum_MS <- append(cum_MS,data_MS[i+1,3] + cum_MS[i]) +} + +#Plot +plot(data_MS$time,cum_MS,type="o", col="blue", xlab = 'time', ylab ='score') +points(data_UW$time,cum_UW,type="o", col="red") +legend("topleft",legend=c("MSU","UW"), col=c("blue","red"),pch=c("o"), lty = 1) + diff --git a/guessMyNumber.R b/guessMyNumber.R new file mode 100644 index 0000000..5864e94 --- /dev/null +++ b/guessMyNumber.R @@ -0,0 +1,23 @@ +#choose the random number +num <- sample(1:100,1) + +#Ask for input +attempt <- 1 +guess <- strtoi(readline(prompt="Take a guess: ")) +while(guess != num & attempt < 10){ + if (guess > num){ + print("lower") + guess <- strtoi(readline(prompt="Take a guess: ")) + attempt <- attempt + 1 + } + else if(guess < num){ + print("higher") + guess <- strtoi(readline(prompt="Take a guess: ")) + attempt <- attempt + 1 + } +} +if(guess == num){ + print('Correct') +}else{ + print('End of guesses') +} \ No newline at end of file