Question: i just need one function to be created You may use use code from outside sources in your project provided that it is released under
i just need one function to be created
You may use use code from outside sources in your project provided that it is released under an open license and provided that you clearly indicate the code with comments.
the function needs to be made using base R
and needs to be simple and easy to understand for a beginner in R


Consider the Best New Albums section of the popular music site Pitchfork. Write an R function to retrieve the text of a review of an album, and also the rating that the reviewer gives to the album (on the scale 0.0 to 10.0). Provide a function named pitchfork which takes a single parameter: a URL specified by a string. When this function is passed the URL to a review of an album in the Best New Albums section of Pitchfork, the pitchfork function should return a list with two elements: 1) an element named text with value given by the body of the review as a character string (with all HTML removed), 2) an element named rating with value given by the dec- imal value of the review, as a numeric. You can find URLs for these reviews by navigating to https://pitchfork.com/reviews/best/albums/ and right clicking on an album and then selecting something like Copy Link. Example usage follows. In this listing, the ellipsis indicates cropped R out- put. = = > url 'https://pitchfork.com/reviews/albums/jeff- parker-suite-for-max-brown/' > review pitchfork (url) > review$text [1] "Jeff Parker always always writes parts that sound unassuming at first listen and unavoidable by the fifth. And together, with the help of some friends, they build a nest from which to watch the world." > review$rating [1] 8.4 Consider the Best New Albums section of the popular music site Pitchfork. Write an R function to retrieve the text of a review of an album, and also the rating that the reviewer gives to the album (on the scale 0.0 to 10.0). Provide a function named pitchfork which takes a single parameter: a URL specified by a string. When this function is passed the URL to a review of an album in the Best New Albums section of Pitchfork, the pitchfork function should return a list with two elements: 1) an element named text with value given by the body of the review as a character string (with all HTML removed), 2) an element named rating with value given by the dec- imal value of the review, as a numeric. You can find URLs for these reviews by navigating to https://pitchfork.com/reviews/best/albums/ and right clicking on an album and then selecting something like Copy Link. Example usage follows. In this listing, the ellipsis indicates cropped R out- put. = = > url 'https://pitchfork.com/reviews/albums/jeff- parker-suite-for-max-brown/' > review pitchfork (url) > review$text [1] "Jeff Parker always always writes parts that sound unassuming at first listen and unavoidable by the fifth. And together, with the help of some friends, they build a nest from which to watch the world." > review$rating [1] 8.4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
