# exporting Old Faithful dataset to txt: data(faithful) head(faithful) x=faithful # write.table( ) spe="\t" is needed to write the txt file sep="" for reading table write.table(x,file="oldfaithful.txt",sep="") X=read.table("oldfaithful.txt",header=T,sep="") head(X) write.table(x,file="oldfaithful.txt",sep="\t") Y=read.table("oldfaithful.txt",header=T,sep="") head(Y) # when writing a csv file, you can just use write.csv write.csv(x,"oldfaithful.csv") h=read.csv("oldfaithful.csv",header=T) # notice that there is another variable that are observation numbers # to get rid of that, use row.names=F write.csv(x,"oldfaithful.csv",row.names=F) h=read.csv("oldfaithful.csv",header=T) head(h)