0

I am trying to scrape the table on this website : https://www.kimiafarma.co.id/index.php?option=com_content&view=article&id=193&Itemid=353&lang=id

I've tried using :

enter image description here

I would like to scrape the data from that table and put it in an excel file, but I'm quite new to R programming and web scraping. I would appreciate if someone could explain what I need to do step by step.

2
  • 1
    Hello, welcome to SO. Such how-to's are available in the web, see e.g. r-bloggers. Commented Jun 29, 2020 at 6:40
  • Please don't post code as images share them as text. Commented Jun 29, 2020 at 6:48

1 Answer 1

1

You can use :

library(rvest)
url <- 'https://www.kimiafarma.co.id/index.php?option=com_content&view=article&id=193&Itemid=353&lang=id'

data <- url %>%
          read_html() %>%
          html_nodes('table') %>%
          .[[1]] %>%
          html_table()

To write data as csv, you can use write.csv

write.csv(data, 'data.csv', row.names = FALSE)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.