Permalink
Browse files

Added functions to search in abstracts and titles

  • Loading branch information...
1 parent a74c08a commit fb746fe667bf8fba0795fba0cde04ee75006d1e6 @DASpringate DASpringate committed Feb 15, 2013
Showing with 34 additions and 1 deletion.
  1. +13 −1 R/rpubmed_textsearch.R
  2. +11 −0 man/in_record_text_p.Rd
  3. +10 −0 man/title_to_text.Rd
View
@@ -69,6 +69,11 @@ mesh_to_text <- function(article){
paste(unlist(get_mesh_headings(article)), collapse = " ")
}
+#' concatenates a list of MeSH headings to a single string
+title_to_text <- function(article){
+ paste(unlist(article$MedlineCitation$Article$ArticleTitle), collapse = " ")
+}
+
#' predicate function for presence of a term in an article text
term_in_text_p <- function(term, text, case_sensitive, ...){
@@ -101,6 +106,13 @@ in_mesh_abstract_p <- function(article, terms, case_sensitive = FALSE, ...){
text = mesh_article, case_sensitive, ...)
}
-
+#' predicate function for searching in title and abstract
+in_record_text_p <- function(article, terms, case_sensitive = FALSE, ...){
+ # Are terms found in the mesh headings?
+ pattern <- paste(terms, collapse = "|")
+ mesh_article <- paste(title_to_text(article), abstract_to_text(article))
+ term_in_text_p(term = pattern,
+ text = mesh_article, case_sensitive, ...)
+}
View
@@ -0,0 +1,11 @@
+\name{in_record_text_p}
+\alias{in_record_text_p}
+\title{predicate function for searching in title and abstract}
+\usage{
+ in_record_text_p(article, terms, case_sensitive = FALSE,
+ ...)
+}
+\description{
+ predicate function for searching in title and abstract
+}
+
View
@@ -0,0 +1,10 @@
+\name{title_to_text}
+\alias{title_to_text}
+\title{concatenates a list of MeSH headings to a single string}
+\usage{
+ title_to_text(article)
+}
+\description{
+ concatenates a list of MeSH headings to a single string
+}
+

0 comments on commit fb746fe

Please sign in to comment.