knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(healthforum)
On patient.info forum, there are different levels of posts.
This is a basic example which shows you how to scrape the discussion thread of this main post from patient.info.
## scrape pages 1-2 from thread about gastritis gas <- scrape_one_post( url = "https://patient.info/forums/discuss/can-gastritis-be-cured--613999", From = 1, To = 2, get_user_info = FALSE) ## preview the returned data frame tibble::as_tibble(gas)
This is a basic example which shows you how to scrape the discussion thread of posts from this group.
## scrape the thread of a random main posts from the group "Angiotensin II Receptor Blockers" gas <- scrape_one_group( group_url = "https://patient.info/forums/discuss/browse/angiotensin-ii-receptor-blockers-3037", random_post_number = 1) ## preview the returned data frame tibble::as_tibble(gas)
You can get posts from multiple groups whose name has the same initial letter.
## scrape the thread of one random post from all groups whose names starting with the letter "x". gas <- scrape_groups_by_initial_letter(index = "x", post_number_per_group = 1, get_user_info = FALSE) ## preview the returned data frame tibble::as_tibble(gas)
This is an example which shows you how to scrape the discussion thread of posts from the categroy "Health Promotion".
## scrape the thread of one random post from every group that belongs to the categroy "Health Promotion" gas <- scrape_groups_by_category(cat = "health-promotion", post_number_per_group = 1, get_user_info = FALSE) ## preview the returned data frame tibble::as_tibble(gas)
You can also scrape the posts made by a specific user.
This is an example which shows you how to scrape the posts sent by this user.
``` {r eval = FALSE}
userposts <- scrape_user_posts( user_profile_url <- "https://patient.info/forums/profiles/utgh4k33-1264038", type = "both")
tibble::as_tibble(userposts)
`healthforum` contains a medical glossary dictionary which can be used to count the number of medical words used in posts. This is an example which shows you how to count medical words. ``` {r} ## create a text vector medical_text <- c( "No, it isn't possible to predict anything before the result of your biopsy is received.", "Thank you for the nice reply! Very thoughtful answer that did ease my fears!", "Can't help regards the meds. Just want to give support." ) ## counts the medical words in this text vector counts <- count_medical_terms(text = medical_text) ## show results tibble::as_tibble(counts)
healthforum
was developed to collect publicly available data from the website patient.info. The purpose of this package is to facilitate academic research. It is the final user's responsibility to store the data securely and obey all applicable local, state, and federal laws and ethical guidelines. For informed consent procedures for using patients.info forum data, please contact their Data Protection Officer at privacy@emishealth.com. Their address is Fulford Grange, Micklefield Lane, Rawdon, Leeds, LS19 6BA. You may also want to contact your local IRB to obtain information about privacy policy.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.