Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Exercise07_Culbert.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#Question 1:
#import data and view file
setwd("~/R/Exercise07")
iris_data <- read.csv(file = "iris.csv")
head(iris_data)
#convert from comma-delimited to tab-delimited
write.table(iris_data, file="iris.txt", sep = "\t", row.names=FALSE, col.names=TRUE)
read.table(file = "iris.txt")


#Question 2:
#1 = vector containing 100-1000 by 100s
a <- c(100, 200, 300, 400, 500, 600, 700, 800, 900, 1000)

#2 = a two-row by two-column data frame with the teams names and final score
#from ND football game
b <- data.frame (TEAM = c("ND", "UNLV"), SCORE = c("44", "21"))

#3 = number 999
c <- 999

#4 = a 10-row, 5-column matrix containing integers 1-50
d <- matrix(1:50, nrow=10, ncol=5, byrow=TRUE)

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 don't need byrow here


#5 = vector containing 3 letters
e <- c("S", "A", "C")

#combining elements into entire list
tutorial_list <- list(a, b, c, d, e)
tutorial_list

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