From 2aa246a37064fdc3ad6fa58741fa06d1d54f8c2a Mon Sep 17 00:00:00 2001 From: Therese Reisch Date: Fri, 4 Nov 2022 11:15:41 -0400 Subject: [PATCH] finished the exercise --- exercise07submission.R | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 exercise07submission.R diff --git a/exercise07submission.R b/exercise07submission.R new file mode 100644 index 0000000..4588f22 --- /dev/null +++ b/exercise07submission.R @@ -0,0 +1,23 @@ +# exercise 07 +# 1. write R code that will convert the comma-delimited "iris.csv" file to a tab-delimited version named iris.txt +##### set to appropriate working directory +setwd("/Users/theresereisch/Desktop/Exercise07") +##### use read.table to switch the delimiter from commas to tab +iris.txt <- read.table("iris.csv", header=T, sep='\t') + + +# 2. provide R code that creates a list of length 5; the list should contain the following elements: +### 1) a vector with length 10 containing 100, 200, ..., 1000 +vector1 <- seq(from = 100, to = 1000, by = 100) +### 2) a two-row, two-column data frame with the team names and final score from last week's ND football game +ndfb <- data.frame(team.name=c("notre dame", "unlv"), + final.score=c(44, 21)) +### 3) the number 999 +part3 <- 999 +### 4) a 10-row, 5-column matrix containing integers from 1 to 50 +mat <- matrix(data=1:50, nrow=10, ncol=5) +### 5) a vector containing three letters +threeLetters <- c("a","b","c") + +##### making list with all the components +list <- list(vector1, ndfb, part3, mat, threeLetters) \ No newline at end of file