Writing a .txt with URLs in R -


i have data frame 1 variable url , each observation url. looks this:

> df$url  [[1]] [1] "https://url1"  [[2]] [1] "https://url2" 

what want output .txt file called url.txt each url pasted in straight line separated space (no line breaks, quotation marks etc.). this:

https://url1 https://url2 

i have tried write.table, output strange. example every : , / in urls replaced .. ideas on how achieve this? :)

edit

> dput(df) structure(list(url = list("https://url1",    "https://url2")), .names = "url", row.names = c(na, -2l), class = "data.frame") 

i bit confused structure of "dataframe". assuming final data dataframe, solution:

library(readr)  # create example dataset df <- data.frame(url = c("https://a.b.c/d1-e/2f3g", "https://h.i.j/k4-l/5m5n"))  # concatenate urls string <- paste(df$url, collapse=" ")  # write file write_file(string, "url.txt") 

Comments