Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

Importing HTML values to R

$
0
0

@nmani1191 wrote:

Hello Friends,

I am just trying to read values from HTML files using R.

I have around 74 tags like below in my input XML. So iam expecting to read all the 74 names to a character vector.

Manikandan

Below is which i tried in R:

library(rvest)

input_file <- read_html("C:/Users/MANI/Desktop/Yammer _ Data Scientists.html")

user_name <- input_file %>% html_node("div h3 span") %>% html_text()

user_name

Output:

library(rvest)

input_file <- read_html("C:/Users/MANI/Desktop/Yammer _ Data Scientists.html")

user_name <- input_file %>% html_node("div h3 span") %>% html_text()
Warning message:
In node_find_one(x$node, x$doc, xpath = xpath, nsMap = ns) :
74 matches for .//div/descendant-or-self::/h3/descendant-or-self::/span: using first

user_name
[1] " Manikandan "

When i tried to print the vector , it just print the first name alone even though the output says 74 matches.

Anyone please let me know where i need to focus to get printed all the names.

Thanks,
Mani N

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles