combine_detailpages: Combine list of detailpages into data.frame

Description Usage Arguments Value Examples

Description

Takes a list of parsed detailpages and combines them into a data.frame. The categories describing a product are the columns, and each product is represented as a row in the resulting tibble (data.frame). The tibble has as many columns as there are categories, if a product doesn't feature all categories in its description, this column will be NA. Column types are inferred from the data automatically.

Usage

1
combine_detailpages(singlepage_list_with_url)

Arguments

singlepage_list_with_url

A list of parsed detailpages as returned by the function parse_all_detailpages when used with returntype = "list".

Value

A tibble (data.frame) with as many columns as there are distinct categories in all feature pages, and as many rows as there are products.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
## get data from multiple geizhals category pages:
url_geizhals <- "https://geizhals.at/?cat=acam35"
listpagehtml_list <- fetch_all_listpages(url_geizhals, max_pages = 2)
dat_listpage <- parse_all_listpages(listpagehtml_list)
## pick only the three first detailpage urls:
wch_detailpage_urls <- dat_listpage[["detailpage_url"]][1:3]
detailpagehtml_list <- fetch_all_detailpage_html(wch_detailpage_urls)
## get the same data as a list:
dat_detailpages_list <- parse_all_detailpages(detailpagehtml_list,
                                              returntype = "list")
## combine to data.frame:
combine_detailpages(dat_detailpages_list)

## End(Not run)

ingonader/rgeizhals documentation built on May 29, 2019, 3:05 a.m.