Hello, I am a newbie in R, and would like to learn the language. I really can't wrap my head round the codes I listed below and how the outcomes are different. Can someone please explain?
cats<-data.frame(coat=c("calico","black","tabby"),
weight=c(2.1,5.0,3.2),
likes_string=c(1,0,1))
write.csv(x=cats,file="data/feline-data.csv", row.names=TRUE)
cats<-read.csv(file="data/feline-data.csv")
So, here if you put "cats", you get this table
X coat weight likes_string
1 1 calico 2.1 1
2 2 black 5.0 0
3 3 tabby 3.2 1
However, if you call the statement "FALSE"
cats<-data.frame(coat=c("calico","black","tabby"),
weight=c(2.1,5.0,3.2),
likes_string=c(1,0,1))
write.csv(x=cats,file="data/feline-data.csv", row.names=FALSE)
cats<-read.csv(file="data/feline-data.csv")
You get
coat weight likes_string
1 calico 2.1 1
2 black 5.0 0
3 tabby 3.2 1
Why the "TRUE" code would not provide me an error message instead since the row names are different?
Thanks so much!