Is there any simple way, when using sink() in R to write to a csv file, to write a row where the first 2 cells are blank, and the third cell has a specific string? It is not all that simple, and I am struggling with it. I've tried the following:
# this approach writes all 5 numbers in one (the first) line with 2 spaces between each number
sink('myfile.csv')
for(i in 1:5) {
cat(c(' ', ' ', i))
}
sink()
# this approach writes each number on its own line, but in the 1st column with 2 spaces the number
sink('myfile.csv')
for(i in 1:5) {
cat(c(' ', ' ', i), '\n')
}
sink()
# this approach throws an error
sink('myfile.csv')
for(i in 1:5) {
a = data.frame(` ` = '', ` ` = '', `Requested Access?` = '')
cat(a, '\n')
}
sink()
To verify, the desired output in the example I have above would be a CSV file with the numbers 1,2,3,4,5 each in their own row, each in column C. Any help with this is appreciated!