0

I'm trying to use the browseURL() command for opening different filenames of one website from my data-frame. My problem is, I don't have the full URL inside my columns but rather just the part after the hostname (the filename). Now, can I somehow adjust the command so that it allows the second part of the URL-string to be a variable, for example as in

browseURL("http://www.example-website.com

this is where I'm looking for help

example_exampledata[1, "exampleText"]")

For better understanding: posts_exampledata is my data-frame on which I'm trying to address the first line and the column "exampleText", which contains a filename such as /forum/exapmle-theme/12345-what-is-example.html

Any tips and hints are highly appreciated, and please excuse the potential unclarity of this post since I'm very new to R and english isn't my native language.

psyph
  • 291
  • 1
  • 10

1 Answers1

0

you could use the paste0() function. You would be able to directly paste the variable URL to your browseURL() function.

Example of paste0 :

# the paste0() function in R

paste0("one", "two", "three")
[1] "onetwothree"

url <- "www.url.com"

paste0("/some/kind/of_URL")
[1] "/some/kind/of_URL"

paste0(url, "/some/kind/of_URL")
[1] "www.url.com/some/kind/of_URL"

This function should allow you to do what your seeking for.

Edit : Sorry noticed ismirsehregal comment.

Gainz
  • 1,721
  • 9
  • 24
  • @M.P. Glad it work! I suggest you take a look at the ``paste()`` function which is alsmost the same. Those functions can be really usefull. – Gainz Jun 13 '19 at 13:59