The actual issue: I’m trying to rearrange a bunch of names, street addresses, states, etc. into a nice list of addresses without any weird bracketed [row numbers], quotation marks, awkward breaks, etc.
So I’ve created 4 variables: address_name, address_line_1, address_line_2, address_line_3. I want those variables to go into a .txt document as
`
address_name
address_line_1
address_line_2
address_line_3`
so that I’ve got a nicely-formatted list of addresses for my work.
Here is a simplified version of my code (using abc/123 instead of the actual variables):
`letters <- c(“a”, “b”, “c”)
numbers <- c(“1”, “2”, “3”)
lapply(c(letters, numbers), function(c){ write(c, file = “Text_attempt.txt”,
sep = “n”, append = TRUE,
ncolumns = 100000) }) `
It generates the following output:
`a
b
c
1
2
3`
But I want it to generate this output instead:
`a
1
b
2
c
3
`
silima is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.