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
21 changes: 21 additions & 0 deletions Exercise07work.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Exercise07

# Part 1
# file creation
file.create("iris.txt")
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 this line

# input
read.csv("iris.csv",header=TRUE,stringsAsFactors=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.

this just read the file but not assign the contain of it to anything

# assigning data as the variable called inputIris
inputIris<-read.csv("iris.csv",header=TRUE,stringsAsFactors=TRUE)
#output as file called iris.txt
write.table(inputIris,file="iris.txt",row.names=FALSE,col.names=TRUE,sep="\t",append=FALSE)

# Part 2
#making data structures
vecone<-seq(from=100,to=1000,length.out=10)
dftwo<-data.frame(name=c('Notre Dame','Syracuse'),score=c('41','24'))
vecthree<-999
matfour<-matrix(data=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.

don't need byrow = T here

vecfive<-c('r','g','f')
# putting data structures into list called listex7
listex7<-list(vecone,dftwo,vecthree,matfour,vecfive)
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