Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

R "programming"

Name: Anonymous 2013-02-02 9:12

Hey /prog/,

Has anyone here studied the R programming language, and if so could you help me with a trivial problem?

#################################################
twr2 <- function() {
#making the vector and storing in y
y <- c(1,3,45,6,7)

#pasting the vector into txt so we can write to file
txt = paste(y,sep="")

#txt is now ready to be written to file, so here we go:
fileConn= file("c:\\r\\writeTest.fis")
writeLines(txt, fileConn)
close(fileConn)
}
#################################################

The above code creates a vector, and then stores it in a file. The problem is the file contents are
on individual lines, how can I separate them with a comma, or just a spac etc. instead of a new line?

Any help would be much appreciated (I'm also aware of the general consesus on R, and I agree with it but I'm being forced to use it)

Name: Anonymous 2013-02-02 21:34

I don't know yahoo answers was redirecting here, sorry about that >>1-san.

What you are looking for is
http://cran.r-project.org/doc/manuals/R-data.html#Export-to-text-files

You would have known that if you realised most things have a manual these days.

>>3 san's solution is correct.

Also, do a course on it if you want to understand it even better
https://www.coursera.org/course/compdata
then to apply you're new knowledge
https://www.coursera.org/course/dataanalysis

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List