I want to write a vector to a csv file or text file. My data looks like this
> data
x y z xy
100 101 102 103
I want the data to be written in the same format. I have gone through many posts but nothing works out. It would be of great help if anyone could help me with this.
I guess, you are looking for sth. like this:
Data:
x <- c(1,2,3,4)
names(x) <- LETTERS[1:4]
Saving:
x_for_saving <- t(x)
write.csv(x_for_saving, file = "my file.csv", row.names = FALSE)