├── LICENSE ├── .gitignore ├── tests ├── testthat.R └── testthat │ └── test-pkg-style.R ├── inst └── examples │ ├── example1.pdf │ ├── example2.pdf │ ├── example3.pdf │ ├── example4.pdf │ ├── example5.pdf │ └── example1.txt ├── man-roxygen └── config.R ├── .lintr ├── .Rbuildignore ├── README.md ├── README-NOT.md ├── extractr.Rproj ├── .travis.yml ├── NAMESPACE ├── man ├── pdftotext.Rd ├── pdfx_html.Rd ├── pdfx_targz.Rd ├── extract_corpus.Rd ├── pdfx.Rd ├── extractr-package.Rd ├── gs.Rd ├── xpdf.Rd └── extract.Rd ├── DESCRIPTION └── R ├── extractr-package.R ├── gs.r ├── xpdf.r ├── extract_corpus.R ├── pdfx.r ├── zzz.R └── extract.R /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2017 2 | COPYRIGHT HOLDER: Scott Chamberlain 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | cache 5 | .DS_Store 6 | 7 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(extractr) 3 | 4 | test_check("extractr") 5 | -------------------------------------------------------------------------------- /inst/examples/example1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci-archive/extractr/HEAD/inst/examples/example1.pdf -------------------------------------------------------------------------------- /inst/examples/example2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci-archive/extractr/HEAD/inst/examples/example2.pdf -------------------------------------------------------------------------------- /inst/examples/example3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci-archive/extractr/HEAD/inst/examples/example3.pdf -------------------------------------------------------------------------------- /inst/examples/example4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci-archive/extractr/HEAD/inst/examples/example4.pdf -------------------------------------------------------------------------------- /inst/examples/example5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci-archive/extractr/HEAD/inst/examples/example5.pdf -------------------------------------------------------------------------------- /man-roxygen/config.R: -------------------------------------------------------------------------------- 1 | #' @param ... Further args passed to \code{\link[httr]{GET}}. These aren't named, so just do e.g. , 2 | #' \code{verbose()}, or \code{timeout(3)} 3 | -------------------------------------------------------------------------------- /.lintr: -------------------------------------------------------------------------------- 1 | cache_directory: ".lintr_cache" 2 | linters: with_defaults( 3 | camel_case_linter = NULL, 4 | object_name_linter = NULL, 5 | commented_code_linter = NULL, 6 | line_length_linter(80), 7 | NULL 8 | ) 9 | -------------------------------------------------------------------------------- /tests/testthat/test-pkg-style.R: -------------------------------------------------------------------------------- 1 | # https://github.com/jimhester/lintr 2 | if (requireNamespace("lintr", quietly = TRUE)) { 3 | context("lints") 4 | test_that("Package Style", { 5 | lintr::expect_lint_free(cache = TRUE) 6 | }) 7 | } 8 | -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | man-roxygen/ 2 | .travis.yml 3 | .DS_Store 4 | travis-tool.sh 5 | vignettes/margins.sty 6 | Makefile 7 | inst/stuff/ 8 | appveyor.yml 9 | ^.*\.Rproj$ 10 | ^\.Rproj\.user$ 11 | README.Rmd 12 | README.md 13 | cache 14 | .lintr 15 | 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # extractr 2 | 3 | [![Project Status: Abandoned](https://www.repostatus.org/badges/latest/abandoned.svg)](https://www.repostatus.org/#abandoned) 4 | 5 | This repository has been archived. The former README is now in [README-NOT.md](README-NOT.md). 6 | -------------------------------------------------------------------------------- /README-NOT.md: -------------------------------------------------------------------------------- 1 | [![Project Status: Abandoned – Initial development has started, but there has not yet been a stable, usable release; the project has been abandoned and the author(s) do not intend on continuing development.](http://www.repostatus.org/badges/latest/abandoned.svg)](http://www.repostatus.org/#abandoned) 2 | 3 | extractr 4 | ======= 5 | 6 | See https://github.com/ropensci/pdftools 7 | -------------------------------------------------------------------------------- /extractr.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: knitr 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | 17 | BuildType: Package 18 | PackageUseDevtools: Yes 19 | PackageInstallArgs: --no-multiarch --with-keep.source 20 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: r 2 | cache: packages 3 | 4 | addons: 5 | apt: 6 | packages: 7 | - libpoppler-cpp-dev 8 | - xpdf 9 | - ghostscript 10 | 11 | notifications: 12 | email: 13 | on_success: change 14 | on_failure: change 15 | slack: 16 | secure: XjCNOufVyfFUl9MIW6Vh7d/lcInse0lM3Le/XAdOJLYMpqwGiVQjhbxcHU68uXSX2LmuraLA0PsXTq6Hw2ciNUFo5oqCdTkhTNRbk8S5mzZWupZzGR1JEdAtP3MlOQcRmeObzw35pEdJh4fmG7OPhq4vLCeh915oClmFYyoXBgk= 17 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | S3method(print,gs_extr) 4 | S3method(print,xpdf_extr) 5 | export(extract) 6 | export(extract_corpus) 7 | export(pdftotext) 8 | export(pdfx) 9 | export(pdfx_html) 10 | export(pdfx_targz) 11 | import(XML) 12 | importFrom(httr,GET) 13 | importFrom(httr,POST) 14 | importFrom(httr,content) 15 | importFrom(httr,content_type) 16 | importFrom(httr,upload_file) 17 | importFrom(httr,write_disk) 18 | importFrom(plyr,rbind.fill) 19 | importFrom(tm,Corpus) 20 | importFrom(tm,URISource) 21 | importFrom(tm,readPDF) 22 | -------------------------------------------------------------------------------- /man/pdftotext.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/xpdf.r 3 | \name{pdftotext} 4 | \alias{pdftotext} 5 | \title{Use pdftotext to get text from a pdf} 6 | \usage{ 7 | pdftotext(path, ...) 8 | } 9 | \arguments{ 10 | \item{path}{A file path.} 11 | 12 | \item{...}{Further command line flags passed to pdftotext. see examples} 13 | } 14 | \description{ 15 | Use pdftotext to get text from a pdf 16 | } 17 | \examples{ 18 | \donttest{ 19 | path <- "~/github/sac/scott/pdfs/ChamberlainEtal2013Ecosphere.pdf" 20 | pdftotext(path) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /man/pdfx_html.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/pdfx.r 3 | \name{pdfx_html} 4 | \alias{pdfx_html} 5 | \title{Get html version of the extracted text} 6 | \usage{ 7 | pdfx_html(input, ...) 8 | } 9 | \arguments{ 10 | \item{input}{Output from \code{pdfx} function} 11 | 12 | \item{...}{Further args passed to \code{\link[httr]{GET}}. These aren't named, so just do e.g. , 13 | \code{verbose()}, or \code{timeout(3)}} 14 | } 15 | \description{ 16 | Get html version of the extracted text 17 | } 18 | \examples{ 19 | \donttest{ 20 | path <- "~/github/sac/scott/pdfs/BarraquandEtal2014peerj.pdf" 21 | out <- pdfx(file = path) 22 | pdfx_html(out) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: extractr 2 | Title: Extract Text from 'PDFs' 3 | Description: Extract text from 'PDFs' using various tools, including 4 | local or web based tools for scanned-type and non-scanned 'PDFs'. 5 | Version: 0.0.6.9300 6 | Authors@R: person("Scott", "Chamberlain", role = c("aut", "cre"), 7 | email = "myrmecocystus@gmail.com") 8 | License: MIT + file LICENSE 9 | URL: https://github.com/ropensci/extractr 10 | BugReports: https://github.com/ropensci/extractr/issues 11 | LazyLoad: yes 12 | LazyData: yes 13 | Imports: 14 | httr, 15 | XML, 16 | tm, 17 | plyr, 18 | pdftools 19 | Suggests: 20 | roxygen2 (>= 5.0.1), 21 | testthat, 22 | knitr, 23 | lintr 24 | RoxygenNote: 6.0.1 25 | -------------------------------------------------------------------------------- /man/pdfx_targz.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/pdfx.r 3 | \name{pdfx_targz} 4 | \alias{pdfx_targz} 5 | \title{Get tar.gz version of the extracted text} 6 | \usage{ 7 | pdfx_targz(input, write_path, ...) 8 | } 9 | \arguments{ 10 | \item{input}{Output from \code{pdfx} function} 11 | 12 | \item{write_path}{Path to write tar ball to.} 13 | 14 | \item{...}{Further args passed to \code{\link[httr]{GET}}. These aren't named, so just do e.g. , 15 | \code{verbose()}, or \code{timeout(3)}} 16 | } 17 | \description{ 18 | Get tar.gz version of the extracted text 19 | } 20 | \examples{ 21 | \donttest{ 22 | path <- "~/github/sac/scott/pdfs/BarraquandEtal2014peerj.pdf" 23 | out <- pdfx(file = path) 24 | tarfile <- tempfile(fileext = "tar.gz") 25 | pdfx_targz(input = out, write_path = tarfile) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /man/extract_corpus.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extract_corpus.R 3 | \name{extract_corpus} 4 | \alias{extract_corpus} 5 | \title{Extract text from one to many pdf documents into a tm Corpus.} 6 | \usage{ 7 | extract_corpus(paths, which, ...) 8 | } 9 | \arguments{ 10 | \item{paths}{Path to a file} 11 | 12 | \item{which}{One of gs, or xpdf.} 13 | 14 | \item{...}{further args passed on} 15 | } 16 | \value{ 17 | A tm Corpus or VCorpus 18 | } 19 | \description{ 20 | Extract text from one to many pdf documents into a tm Corpus. 21 | } 22 | \examples{ 23 | \donttest{ 24 | paths <- c("~/github/sac/scott/pdfs/BarraquandEtal2014peerj.pdf", 25 | "~/github/sac/scott/pdfs/Chamberlain&Holland2009Ecology.pdf", 26 | "~/github/sac/scott/pdfs/Revell&Chamberlain2014MEE.pdf") 27 | res <- extract_corpus(paths, "gs") 28 | res 29 | tm::TermDocumentMatrix(res$data) 30 | 31 | res <- extract_corpus(path, "xpdf") 32 | res 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /man/pdfx.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/pdfx.r 3 | \name{pdfx} 4 | \alias{pdfx} 5 | \title{PDF-to-XML conversion of scientific articles using pdfx} 6 | \usage{ 7 | pdfx(file = NULL, what = "parsed", ...) 8 | } 9 | \arguments{ 10 | \item{file}{(character) Path to a file, or files on your machine.} 11 | 12 | \item{what}{(character) One of parsed, text, or html.} 13 | 14 | \item{...}{Further args passed to \code{\link[httr]{GET}}. These aren't named, so just do e.g. , 15 | \code{verbose()}, or \code{timeout(3)}} 16 | } 17 | \value{ 18 | Raw XML text, parsed to XMLInternalDocument, or to html text 19 | } 20 | \description{ 21 | Uses a web service provided by Utopia at \url{http://pdfx.cs.man.ac.uk/}. 22 | } 23 | \examples{ 24 | \dontrun{ 25 | path <- system.file("examples", "example1.pdf", package = "extractr") 26 | pdfx(file = path) 27 | } 28 | } 29 | \author{ 30 | Scott Chamberlain {myrmecocystus@gmail.com} 31 | } 32 | -------------------------------------------------------------------------------- /R/extractr-package.R: -------------------------------------------------------------------------------- 1 | #' @title R client for pdf extraction 2 | #' 3 | #' @description R interface to many web and local pdf extraction tools. 4 | #' 5 | #' @section Dependencies: 6 | #' 7 | #' Most packages and tools are easy to install, but some require some more 8 | #' in depth instructions. 9 | #' 10 | #' @section Tools used in extractr: 11 | #' 12 | #' \itemize{ 13 | #' \item XPDF - \url{http://www.foolabs.com/xpdf/} - Local usage 14 | #' \item Ghostscript - \url{http://www.ghostscript.com} - Local usage 15 | #' \item pdftools - Package \pkg{pdftools} that uses the Poppler library 16 | #' \url{http://poppler.freedesktop.org/} - Local usage 17 | #' \item pdfx - \url{http://pdfx.cs.man.ac.uk/usage} - Web API 18 | #' } 19 | #' 20 | #' @importFrom httr GET POST content_type upload_file content write_disk 21 | #' @import XML 22 | #' @name extractr-package 23 | #' @aliases extractr 24 | #' @docType package 25 | #' @author Scott Chamberlain \email{myrmecocystus@@gmail.com} 26 | #' @keywords package 27 | NULL 28 | -------------------------------------------------------------------------------- /man/extractr-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extractr-package.R 3 | \docType{package} 4 | \name{extractr-package} 5 | \alias{extractr-package} 6 | \alias{extractr} 7 | \title{R client for pdf extraction} 8 | \description{ 9 | R interface to many web and local pdf extraction tools. 10 | } 11 | \section{Dependencies}{ 12 | 13 | 14 | Most packages and tools are easy to install, but some require some more 15 | in depth instructions. 16 | } 17 | 18 | \section{Tools used in extractr}{ 19 | 20 | 21 | \itemize{ 22 | \item XPDF - \url{http://www.foolabs.com/xpdf/} - Local usage 23 | \item Ghostscript - \url{http://www.ghostscript.com} - Local usage 24 | \item pdftools - Package \pkg{pdftools} that uses the Poppler library 25 | \url{http://poppler.freedesktop.org/} - Local usage 26 | \item pdfx - \url{http://pdfx.cs.man.ac.uk/usage} - Web API 27 | } 28 | } 29 | 30 | \author{ 31 | Scott Chamberlain \email{myrmecocystus@gmail.com} 32 | } 33 | \keyword{package} 34 | -------------------------------------------------------------------------------- /man/gs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gs.r 3 | \name{gs} 4 | \alias{gs} 5 | \title{PDF-to-text conversion using Ghostscript} 6 | \usage{ 7 | gs(files = NULL, ...) 8 | } 9 | \arguments{ 10 | \item{files}{(character) Path to a file, or files on your machine.} 11 | 12 | \item{...}{Further args passed on to the \code{tm} package, which does the conversion} 13 | } 14 | \value{ 15 | A S3 object of class xpdf with slots for meta and data 16 | } 17 | \description{ 18 | Uses a local tool called xpdf at \url{http://www.ghostscript.com/}. 19 | } 20 | \examples{ 21 | \dontrun{ 22 | path <- "~/github/sac/scott/pdfs/ChamberlainEtal2013Ecosphere.pdf" 23 | gs(files = path) 24 | 25 | paths <- c("~/github/sac/scott/pdfs/BarraquandEtal2014peerj.pdf", 26 | "~/github/sac/scott/pdfs/Chamberlain&Holland2009Ecology.pdf", 27 | "~/github/sac/scott/pdfs/Revell&Chamberlain2014MEE.pdf") 28 | res <- gs(files=paths) 29 | } 30 | } 31 | \author{ 32 | Scott Chamberlain {myrmecocystus@gmail.com} 33 | } 34 | -------------------------------------------------------------------------------- /man/xpdf.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/xpdf.r 3 | \name{xpdf} 4 | \alias{xpdf} 5 | \title{PDF-to-text conversion using XPDF} 6 | \usage{ 7 | xpdf(files = NULL, ...) 8 | } 9 | \arguments{ 10 | \item{files}{(character) Path to a file, or files on your machine.} 11 | 12 | \item{...}{Further args passed on to the \code{tm} package, which does 13 | the conversion} 14 | } 15 | \value{ 16 | A S3 object of class xpdf with slots for meta and data 17 | } 18 | \description{ 19 | PDF-to-text conversion using XPDF 20 | } 21 | \examples{ 22 | \dontrun{ 23 | path <- "~/github/sac/scott/pdfs/ChamberlainEtal2013Ecosphere.pdf" 24 | res <- xpdf(files = path) 25 | 26 | paths <- c("~/github/sac/scott/pdfs/BarraquandEtal2014peerj.pdf", 27 | "~/github/sac/scott/pdfs/Chamberlain&Holland2009Ecology.pdf", 28 | "~/github/sac/scott/pdfs/Revell&Chamberlain2014MEE.pdf") 29 | (res <- xpdf(files=paths)) 30 | res$data[[3]] 31 | } 32 | } 33 | \author{ 34 | Scott Chamberlain {myrmecocystus@gmail.com} 35 | } 36 | -------------------------------------------------------------------------------- /R/gs.r: -------------------------------------------------------------------------------- 1 | #' PDF-to-text conversion using Ghostscript 2 | #' 3 | #' Uses a local tool called xpdf at \url{http://www.ghostscript.com/}. 4 | #' 5 | #' @param files (character) Path to a file, or files on your machine. 6 | #' @param ... Further args passed on to the \code{tm} package, which does the conversion 7 | #' 8 | #' @author Scott Chamberlain {myrmecocystus@@gmail.com} 9 | #' @return A S3 object of class xpdf with slots for meta and data 10 | #' 11 | #' @examples \dontrun{ 12 | #' path <- "~/github/sac/scott/pdfs/ChamberlainEtal2013Ecosphere.pdf" 13 | #' gs(files = path) 14 | #' 15 | #' paths <- c("~/github/sac/scott/pdfs/BarraquandEtal2014peerj.pdf", 16 | #' "~/github/sac/scott/pdfs/Chamberlain&Holland2009Ecology.pdf", 17 | #' "~/github/sac/scott/pdfs/Revell&Chamberlain2014MEE.pdf") 18 | #' res <- gs(files=paths) 19 | #' } 20 | 21 | gs <- function(files = NULL, ...) { 22 | 23 | files_exist(files) 24 | files <- path.expand(files) 25 | out <- Corpus(URISource(files), readerControl = 26 | list(reader = readPDF(engine = "ghostscript", control = list(...)))) 27 | meta <- get_meta(out) 28 | structure(list(meta = meta, data = out), class = "xpdf") 29 | } 30 | # tm:::pdf_text_via_gs(path.expand(paths[1])) 31 | -------------------------------------------------------------------------------- /man/extract.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extract.R 3 | \name{extract} 4 | \alias{extract} 5 | \title{Extract text from a single pdf document} 6 | \usage{ 7 | extract(paths, which = "xpdf", ...) 8 | } 9 | \arguments{ 10 | \item{paths}{(character) One or more paths to a file} 11 | 12 | \item{which}{(character) One of gs, xpdf (default), or pdftools} 13 | 14 | \item{...}{further args passed on} 15 | } 16 | \value{ 17 | A list or a single object, of class \code{gs_extr}, 18 | \code{xpdf_extr}, or \code{poppler_extr}. All share the 19 | same global class \code{extr} 20 | } 21 | \description{ 22 | This function wraps many methods to extract text from 23 | non-scanned PDFs - no OCR methods used here. Available methods include 24 | xpdf, Ghostscript, and Poppler via \pkg{pdftools} 25 | } 26 | \examples{ 27 | \dontrun{ 28 | path <- system.file("examples", "example1.pdf", package = "extractr") 29 | 30 | # xpdf 31 | xpdf <- extract(path, "xpdf") 32 | xpdf$meta 33 | xpdf$data 34 | 35 | # Ghostscript 36 | gs <- extract(path, "gs") 37 | gs$meta 38 | gs$data 39 | 40 | # pdftools 41 | pdft <- extract(path, "pdftools") 42 | pdft$meta 43 | cat(pdft$data) 44 | 45 | # Pass many paths at once 46 | path1 <- system.file("examples", "example1.pdf", package = "extractr") 47 | path2 <- system.file("examples", "example2.pdf", package = "extractr") 48 | path3 <- system.file("examples", "example3.pdf", package = "extractr") 49 | extract(c(path1, path2, path3)) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /R/xpdf.r: -------------------------------------------------------------------------------- 1 | #' PDF-to-text conversion using XPDF 2 | #' 3 | #' @param files (character) Path to a file, or files on your machine. 4 | #' @param ... Further args passed on to the \code{tm} package, which does 5 | #' the conversion 6 | #' 7 | #' @author Scott Chamberlain {myrmecocystus@@gmail.com} 8 | #' @return A S3 object of class xpdf with slots for meta and data 9 | #' 10 | #' @examples \dontrun{ 11 | #' path <- "~/github/sac/scott/pdfs/ChamberlainEtal2013Ecosphere.pdf" 12 | #' res <- xpdf(files = path) 13 | #' 14 | #' paths <- c("~/github/sac/scott/pdfs/BarraquandEtal2014peerj.pdf", 15 | #' "~/github/sac/scott/pdfs/Chamberlain&Holland2009Ecology.pdf", 16 | #' "~/github/sac/scott/pdfs/Revell&Chamberlain2014MEE.pdf") 17 | #' (res <- xpdf(files=paths)) 18 | #' res$data[[3]] 19 | #' } 20 | 21 | xpdf <- function(files = NULL, ...) { 22 | files_exist(files) 23 | files <- path.expand(files) 24 | out <- Corpus( 25 | URISource(files), 26 | readerControl = list(reader = readPDF(engine = "xpdf", control = list(...)))) 27 | meta <- get_meta(out) 28 | structure(list(meta = meta, data = out), class = "xpdf") 29 | } 30 | 31 | #' Use pdftotext to get text from a pdf 32 | #' 33 | #' @export 34 | #' @param path A file path. 35 | #' @param ... Further command line flags passed to pdftotext. see examples 36 | #' @examples \donttest{ 37 | #' path <- "~/github/sac/scott/pdfs/ChamberlainEtal2013Ecosphere.pdf" 38 | #' pdftotext(path) 39 | #' } 40 | 41 | pdftotext <- function(path, ...){ 42 | cmds <- list(...) 43 | cmds <- if (length(cmds) == 0) "" else cmds 44 | path <- path.expand(path) 45 | system2(sprintf("pdftotext %s out.txt %s", path, cmds)) 46 | txt <- readLines("out.txt") 47 | gsub("\f", "\n", txt) 48 | } 49 | -------------------------------------------------------------------------------- /R/extract_corpus.R: -------------------------------------------------------------------------------- 1 | #' Extract text from one to many pdf documents into a tm Corpus. 2 | #' 3 | #' @importFrom tm Corpus URISource readPDF 4 | #' @importFrom plyr rbind.fill 5 | #' 6 | #' @export 7 | #' 8 | #' @param paths Path to a file 9 | #' @param which One of gs, or xpdf. 10 | #' @param ... further args passed on 11 | #' @return A tm Corpus or VCorpus 12 | #' @examples \donttest{ 13 | #' paths <- c("~/github/sac/scott/pdfs/BarraquandEtal2014peerj.pdf", 14 | #' "~/github/sac/scott/pdfs/Chamberlain&Holland2009Ecology.pdf", 15 | #' "~/github/sac/scott/pdfs/Revell&Chamberlain2014MEE.pdf") 16 | #' res <- extract_corpus(paths, "gs") 17 | #' res 18 | #' tm::TermDocumentMatrix(res$data) 19 | #' 20 | #' res <- extract_corpus(path, "xpdf") 21 | #' res 22 | #' } 23 | extract_corpus <- function(paths, which, ...){ 24 | switch(which, 25 | gs = extract_tm_gs(paths, ...), 26 | xpdf = extract_tm_xpdf(paths, ...) 27 | ) 28 | } 29 | 30 | extract_tm_gs <- function(paths, which, ...){ 31 | paths <- process_paths(paths) 32 | out <- Corpus(URISource(paths), readerControl = 33 | list(reader = readPDF(engine = "ghostscript", control = list(...)))) 34 | meta <- get_meta(out) 35 | structure(list(meta = meta, data = out), class = "xpdf") 36 | } 37 | 38 | extract_tm_xpdf <- function(paths, which, ...){ 39 | paths <- process_paths(paths) 40 | out <- Corpus(URISource(paths), readerControl = 41 | list(reader = readPDF(engine = "xpdf", control = list(...)))) 42 | meta <- get_meta(out) 43 | structure(list(meta = meta, data = out), class = "xpdf") 44 | } 45 | 46 | files_exist <- function(x){ 47 | tmp <- sapply(x, file.exists) 48 | if (!all(tmp)) stop(sprintf("These do not exist or can not be found:\n%s", 49 | paste(names(tmp[tmp == FALSE]), collapse = "\n") )) 50 | } 51 | 52 | get_meta <- function(input){ 53 | do.call(rbind.fill, lapply(input, function(x) { 54 | tmp <- attributes(x) 55 | tmp[sapply(tmp, length) == 0] <- NA 56 | tmp <- lapply(tmp, function(z) if (length(z) > 1) { 57 | paste(z, collapse = ", ") 58 | } else z) 59 | data.frame(tmp, stringsAsFactors = FALSE) 60 | })) 61 | } 62 | 63 | process_paths <- function(x){ 64 | files_exist(x) 65 | path.expand(x) 66 | } 67 | 68 | # 69 | # print.gs_char <- function(x, ...) { 70 | # cat("", attr(x, "path"), "\n", sep = "") 71 | # cat(" Title: ", x$meta$Title, "\n", sep = "") 72 | # cat(" Producer: ", x$meta$Producer, "\n", sep = "") 73 | # cat(" Creation date: ", as.character(as.Date(x$meta$CreationDate)), "\n", sep = "") 74 | # } 75 | # 76 | # 77 | # print.xpdf_char <- function(x, ...) { 78 | # cat("", attr(x, "path"), "\n", sep = "") 79 | # cat(" Pages: ", x$meta$Pages, "\n", sep = "") 80 | # cat(" Title: ", x$meta$Title, "\n", sep = "") 81 | # cat(" Producer: ", x$meta$Producer, "\n", sep = "") 82 | # cat(" Creation date: ", as.character(as.Date(x$meta$CreationDate)), "\n", sep = "") 83 | # } 84 | -------------------------------------------------------------------------------- /R/pdfx.r: -------------------------------------------------------------------------------- 1 | #' PDF-to-XML conversion of scientific articles using pdfx 2 | #' 3 | #' Uses a web service provided by Utopia at \url{http://pdfx.cs.man.ac.uk/}. 4 | #' 5 | #' @export 6 | #' 7 | #' @param file (character) Path to a file, or files on your machine. 8 | #' @param what (character) One of parsed, text, or html. 9 | #' @template config 10 | #' 11 | #' @author Scott Chamberlain {myrmecocystus@@gmail.com} 12 | #' @return Raw XML text, parsed to XMLInternalDocument, or to html text 13 | #' 14 | #' @examples \dontrun{ 15 | #' path <- system.file("examples", "example1.pdf", package = "extractr") 16 | #' pdfx(file = path) 17 | #' } 18 | 19 | pdfx <- function(file = NULL, what = "parsed", ...) { 20 | out <- pdfx_POST(file, ...) 21 | parsed <- XML::xmlParse(out) 22 | meta <- pdfx_get_meta(parsed) 23 | 24 | toput <- switch(what, 25 | parsed = XML::xmlParse(out), 26 | text = out, 27 | html = "not yet" 28 | ) 29 | structure(list(meta = meta, data = toput), class = "pdfx") 30 | } 31 | 32 | pdfx_POST <- function(file, ...) { 33 | url <- "http://pdfx.cs.man.ac.uk" 34 | res <- POST(url, config = c(content_type("application/pdf"), ...), 35 | body = upload_file(file)) 36 | if (!res$status_code == 200) stop("something's wrong", call. = FALSE) 37 | stopifnot(res$headers$`content-type` == "text/xml") 38 | content(res, as = "text") 39 | } 40 | 41 | pdfx_GET <- function(input, type="html", write_path, ...) { 42 | type <- match.arg(type, c("html", "tar.gz")) 43 | stopifnot(inherits(input, "pdfx")) 44 | jobid <- input$meta$base_name 45 | url <- paste0(file.path("http://pdfx.cs.man.ac.uk", jobid), ".", type) 46 | if (type == "html") { 47 | res <- GET(url, ...) 48 | if (!res$status_code == 200) stop("something's wrong", call. = FALSE) 49 | content(res) 50 | } else { 51 | res <- GET(url, write_disk(path = write_path), ...) 52 | if (!res$status_code == 200) stop("something's wrong", call. = FALSE) 53 | message(sprintf("tar file written to\n %s", write_path)) 54 | } 55 | } 56 | 57 | pdfx_get_meta <- function(x){ 58 | xpathApply(x, "//meta", xmlToList)[[1]] 59 | } 60 | 61 | #' Get html version of the extracted text 62 | #' 63 | #' @export 64 | #' @param input Output from \code{pdfx} function 65 | #' @template config 66 | #' @examples \donttest{ 67 | #' path <- "~/github/sac/scott/pdfs/BarraquandEtal2014peerj.pdf" 68 | #' out <- pdfx(file = path) 69 | #' pdfx_html(out) 70 | #' } 71 | pdfx_html <- function(input, ...) pdfx_GET(input, "html", ...) 72 | 73 | #' Get tar.gz version of the extracted text 74 | #' 75 | #' @export 76 | #' @param input Output from \code{pdfx} function 77 | #' @param write_path Path to write tar ball to. 78 | #' @template config 79 | #' @examples \donttest{ 80 | #' path <- "~/github/sac/scott/pdfs/BarraquandEtal2014peerj.pdf" 81 | #' out <- pdfx(file = path) 82 | #' tarfile <- tempfile(fileext = "tar.gz") 83 | #' pdfx_targz(input = out, write_path = tarfile) 84 | #' } 85 | pdfx_targz <- function(input, write_path, ...) { 86 | pdfx_GET(input, type = "tar.gz", write_path, ...) 87 | } 88 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | pdf_info_via_gs <- function(file){ 2 | file <- normalizePath(file) 3 | gs_cmd <- find_gs_cmd(Sys.getenv("R_GSCMD", "")) 4 | out <- system2(gs_cmd, c("-dNODISPLAY -q", sprintf("-sFile=%s", 5 | shQuote(file)), system.file("ghostscript", "pdf_info.ps", 6 | package = "tm")), stdout = TRUE) 7 | out <- out[cumsum(out == "") == 2L][-1L] 8 | val <- sub("^[^:]+:[[:space:]]*", "", out) 9 | names(val) <- sub(":.*", "", out) 10 | val <- as.list(val) 11 | if (!is.null(d <- val$CreationDate)) 12 | val$CreationDate <- PDF_Date_to_POSIXt(d) 13 | if (!is.null(d <- val$ModDate)) 14 | val$ModDate <- PDF_Date_to_POSIXt(d) 15 | val 16 | } 17 | 18 | find_gs_cmd <- function(gs_cmd = ""){ 19 | if (!nzchar(gs_cmd)) { 20 | if (.Platform$OS.type == "windows") { 21 | gsexe <- Sys.getenv("R_GSCMD") 22 | if (!nzchar(gsexe)) 23 | gsexe <- Sys.getenv("GSC") 24 | gs_cmd <- Sys.which(gsexe) 25 | if (!nzchar(gs_cmd)) 26 | gs_cmd <- Sys.which("gswin64c") 27 | if (!nzchar(gs_cmd)) 28 | gs_cmd <- Sys.which("gswin32c") 29 | gs_cmd 30 | } 31 | else Sys.which(Sys.getenv("R_GSCMD", "gs")) 32 | } 33 | else Sys.which(gs_cmd) 34 | } 35 | 36 | pdf_info_via_xpdf <- function(file, options = NULL){ 37 | outfile <- tempfile("pdfinfo") 38 | on.exit(unlink(outfile)) 39 | status <- system2("pdfinfo", c(options, shQuote(normalizePath(file))), 40 | stdout = outfile) 41 | tags <- c("Title", "Subject", "Keywords", "Author", "Creator", 42 | "Producer", "CreationDate", "ModDate", "Tagged", "Form", 43 | "Pages", "Encrypted", "Page size", "File size", "Optimized", 44 | "PDF version") 45 | re <- sprintf("^(%s)", 46 | paste(sprintf("%-16s", sprintf("%s:", tags)), collapse = "|")) 47 | lines <- readLines(outfile, warn = FALSE) 48 | ind <- grepl(re, lines) 49 | tags <- sub(": *", "", substring(lines[ind], 1L, 16L)) 50 | info <- split(sub(re, "", lines), cumsum(ind)) 51 | names(info) <- tags 52 | fmt <- "%a %b %d %X %Y" 53 | if (!is.null(d <- info$CreationDate)) 54 | info$CreationDate <- strptime(d, fmt) 55 | if (!is.null(d <- info$ModDate)) 56 | info$ModDate <- strptime(d, fmt) 57 | if (!is.null(p <- info$Pages)) 58 | info$Pages <- as.integer(p) 59 | info 60 | } 61 | 62 | pdf_text_via_gs <- function (file){ 63 | file <- normalizePath(file) 64 | gs_cmd <- find_gs_cmd(Sys.getenv("R_GSCMD", "")) 65 | tf <- tempfile("pdf") 66 | on.exit(unlink(tf)) 67 | res <- system2(gs_cmd, 68 | c("-q -dNOPAUSE -dBATCH -P- -dSAFER -sDEVICE=ps2write", 69 | sprintf("-sOutputFile=%s", tf), "-c save pop -f", shQuote(file))) 70 | txt <- system2(gs_cmd, 71 | c("-q -dNODISPLAY -P- -dSAFER -dDELAYBIND -dWRITESYSTEMDICT -dSIMPLE", 72 | "-c save -f ps2ascii.ps", tf, "-c quit"), stdout = TRUE) 73 | if (any(grepl("Error handled by opdfread.ps", txt))) { 74 | stop(paste(c("Ghostscript failed, with output:", txt), collapse = "\n")) 75 | } 76 | strsplit(paste(txt, collapse = "\n"), "\f")[[1L]] 77 | } 78 | 79 | PDF_Date_to_POSIXt <- function(s){ 80 | s <- sub("^D:", "", s) 81 | s <- gsub("'", "", s) 82 | if (nchar(s) <= 14L) { 83 | s <- sprintf("%s%s", s, substring(" 0101000000", nchar(s) + 1L, 14L)) 84 | strptime(s, "%Y%m%d%H%M%S") 85 | } 86 | else if (substring(s, 15L, 15L) == "Z") { 87 | strptime(substring(s, 1L, 14L), "%Y%m%d%H%M%S") 88 | } 89 | else { 90 | strptime(s, "%Y%m%d%H%M%S%z") 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /R/extract.R: -------------------------------------------------------------------------------- 1 | #' @title Extract text from a single pdf document 2 | #' 3 | #' @description This function wraps many methods to extract text from 4 | #' non-scanned PDFs - no OCR methods used here. Available methods include 5 | #' xpdf, Ghostscript, and Poppler via \pkg{pdftools} 6 | #' 7 | #' @export 8 | #' @param paths (character) One or more paths to a file 9 | #' @param which (character) One of gs, xpdf (default), or pdftools 10 | #' @param ... further args passed on 11 | #' @return A list or a single object, of class \code{gs_extr}, 12 | #' \code{xpdf_extr}, or \code{poppler_extr}. All share the 13 | #' same global class \code{extr} 14 | #' 15 | #' @examples \dontrun{ 16 | #' path <- system.file("examples", "example1.pdf", package = "extractr") 17 | #' 18 | #' # xpdf 19 | #' xpdf <- extract(path, "xpdf") 20 | #' xpdf$meta 21 | #' xpdf$data 22 | #' 23 | #' # Ghostscript 24 | #' gs <- extract(path, "gs") 25 | #' gs$meta 26 | #' gs$data 27 | #' 28 | #' # pdftools 29 | #' pdft <- extract(path, "pdftools") 30 | #' pdft$meta 31 | #' cat(pdft$data) 32 | #' 33 | #' # Pass many paths at once 34 | #' path1 <- system.file("examples", "example1.pdf", package = "extractr") 35 | #' path2 <- system.file("examples", "example2.pdf", package = "extractr") 36 | #' path3 <- system.file("examples", "example3.pdf", package = "extractr") 37 | #' extract(c(path1, path2, path3)) 38 | #' } 39 | extract <- function(paths, which = "xpdf", ...){ 40 | which <- match.arg(which, c("gs", "xpdf", "pdftools")) 41 | fxn <- switch( 42 | which, 43 | gs = extract_gs, 44 | xpdf = extract_xpdf, 45 | pdftools = extract_pdftools 46 | ) 47 | if (length(paths) > 1) { 48 | lapply(paths, fxn, ...) 49 | } else { 50 | fxn(paths, ...) 51 | } 52 | } 53 | 54 | extract_pdftools <- function(path, which, ...){ 55 | check4pdftools() 56 | path <- path.expand(path) 57 | res <- paste(pdftools::pdf_text(path), collapse = ", ") 58 | meta <- pdftools::pdf_info(path) 59 | structure(list(meta = meta, data = res), class = c("pdftools_extr", "extr"), 60 | path = path) 61 | } 62 | 63 | extract_gs <- function(path, which, ...){ 64 | check_gs() 65 | path <- path.expand(path) 66 | res <- pdf_text_via_gs(path) 67 | res <- paste(res, collapse = ", ") 68 | meta <- pdf_info_via_gs(path) 69 | structure(list(meta = meta, data = res), class = c("gs_extr", "extr"), 70 | path = path) 71 | } 72 | 73 | extract_xpdf <- function(path, which, ...){ 74 | check_pdftotext() 75 | cmds <- get_cmds(...) 76 | path <- path.expand(path) 77 | res <- system2("pdftotext", paste(cmds, shQuote(path))) 78 | newpath <- sub("\\.pdf", ".txt", path) 79 | res <- paste(readLines(newpath, warn = FALSE), collapse = ", ") 80 | meta <- pdf_info_via_xpdf(path) 81 | structure(list(meta = meta, data = res), class = c("xpdf_extr", "extr"), 82 | path = path) 83 | } 84 | 85 | get_cmds <- function(...){ 86 | d <- list(...) 87 | if (length(d) == 0) "" else paste0(unlist(d), collapse = " ") 88 | } 89 | 90 | check_pdftotext <- function(x) { 91 | chk <- Sys.which("pdftotext") 92 | if (chk == "") stop("Please install xpdf. See ?extract_tools for more", 93 | call. = FALSE) 94 | } 95 | 96 | check_gs <- function(x) { 97 | chk <- Sys.which("gs") 98 | if (chk == "") stop("Please install Ghostscript. See ?extract_tools for more", 99 | call. = FALSE) 100 | } 101 | 102 | check4pdftools <- function() { 103 | if (!requireNamespace("pdftools", quietly = TRUE)) { 104 | stop("Please install pdftools", call. = FALSE) 105 | } else { 106 | invisible(TRUE) 107 | } 108 | } 109 | 110 | #' @export 111 | print.gs_extr <- function(x, ...) { 112 | cat("", attr(x, "path"), "\n", sep = "") 113 | cat(" Title: ", x$meta$Title, "\n", sep = "") 114 | cat(" Producer: ", x$meta$Producer, "\n", sep = "") 115 | cat(" Creation date: ", as.character(as.Date(x$meta$CreationDate)), "\n", 116 | sep = "") 117 | } 118 | 119 | #' @export 120 | print.xpdf_extr <- function(x, ...) { 121 | cat("", attr(x, "path"), "\n", sep = "") 122 | cat(" Pages: ", x$meta$Pages, "\n", sep = "") 123 | cat(" Title: ", x$meta$Title, "\n", sep = "") 124 | cat(" Producer: ", x$meta$Producer, "\n", sep = "") 125 | cat(" Creation date: ", as.character(as.Date(x$meta$CreationDate)), "\n", 126 | sep = "") 127 | } 128 | -------------------------------------------------------------------------------- /inst/examples/example1.txt: -------------------------------------------------------------------------------- 1 | Suffering and mental health among older 2 | people living in nursing homes—a 3 | mixed-methods study 4 | Jorunn Drageset1,2 , Elin Dysvik3 , Birgitte Espehaug1 , Gerd Karin Natvig2 5 | and Bodil Furnes3 6 | 1 Faculty of Health and Social Sciences, Bergen University College, Norway 7 | 2 Department of Global Public Health and Primary Care, University of Bergen, Norway 8 | 3 Department of Health Studies, Faculty of Social Sciences, University of Stavanger, Norway 9 | 10 | ABSTRACT 11 | 12 | Submitted 31 March 2015 13 | Accepted 2 July 2015 14 | Published 30 July 2015 15 | Corresponding author 16 | Jorunn Drageset, 17 | Jorunn.Drageset@hib.no 18 | Academic editor 19 | Lia Fernandes 20 | Additional Information and 21 | Declarations can be found on 22 | page 14 23 | DOI 10.7717/peerj.1120 24 | Copyright 25 | 2015 Drageset et al. 26 | Distributed under 27 | Creative Commons CC-BY 4.0 28 | OPEN ACCESS 29 | 30 | Background. Knowledge about mixed-methods perspectives that examine anxiety, 31 | depression, social support, mental health and the phenomenon of suffering among 32 | cognitively intact NH residents is scarce. We aimed to explore suffering and mental 33 | health among cognitively intact NH residents. 34 | Methods. This study used a mixed-methods design to explore different aspects 35 | of the same phenomena of interest to gain a more comprehensive understanding. 36 | The qualitative core component comprised a qualitative interview from 18 nursing 37 | home residents (≥65 years) about experiences related to pain, grief and loss. The 38 | supplementary component comprised interview from the same respondents using 39 | the SF-36 Health Survey subscales, the Hospital Anxiety and Depression Scale and the 40 | Social Provisions Scale. 41 | Results. The individual descriptions reveal suffering caused by painful experiences 42 | during life. The quantitative results indicated that symptoms of anxiety and 43 | depression were related to mental health and symptoms of anxiety were related to 44 | bodily pain and emotional role limitations. Attachment and social integration were 45 | associated with vitality and social functioning. 46 | Discussion. To improve the situation, more attention should be paid to the residents’ 47 | suffering related to anxiety, depression and psychosocial relations. 48 | Subjects Geriatrics, Nursing, Psychiatry and Psychology, Palliative Care 49 | Keywords Suffering, Mental health, Mix-methods, Nursing homes 50 | 51 | INTRODUCTION 52 | Nursing home (NH) residents without cognitive impairment comprise a minority of 53 | NH residents and often have somatic and/or other mental health conditions (Nygaard, 54 | Naik & Ruths, 2000; Linton & Lach, 2007; Selbaek et al., 2007). NH residents may also 55 | experience stressful events such as relational losses, loss of home and loss of spouse, 56 | relatives and friends. Such conditions may cause them to experience suffering (Morse, 57 | 2001; Cassel, 2004; Ferrell & Coyle, 2008) and affect both mental and physical health (Travis 58 | et al., 2004; Garcia et al., 2005). Morse (2011) describes suffering as a basic emotional 59 | experience that follows illnesses that threaten one’s physical or psychosocial integration. 60 | 61 | How to cite this article Drageset et al. (2015), Suffering and mental health among older people living in nursing homes—a mixedmethods study. PeerJ 3:e1120; DOI 10.7717/peerj.1120 62 | 63 | Thus, suffering refers to human existence as a whole, whereas experiencing suffering 64 | can mean being unable to keep oneself together as a whole entity. Alleviating suffering 65 | implies lessening people’s sense of vulnerability (Rehnsfeldt & Eriksson, 2004). Studies 66 | from Canada (Daneault et al., 2004) and Finland (Kuuppelomaki & Lauri, 1998) found 67 | that people report suffering in three dimensions; physical, mental and social well-being. 68 | Physical suffering includes pain, mental suffering is mostly expressed as depression and 69 | social suffering is often caused by disease that results in isolation and withdrawal from 70 | social contact (Kuuppelomaki & Lauri, 1998). 71 | Depression is common among older people living in NHs (Smalbrugge et al., 72 | 2005a; Smalbrugge et al., 2006a; Drageset, Eide & Ranhoff, 2011; Drageset, Eide & Ranhoff, 73 | 2013); the prevalence is 34–41%. Depression is often experienced together with anxiety, 74 | where anxiety tends to follow traumatic events and loss situations (Bland, 2012), such as 75 | loss of significant others but also functional abilities and loss caused by disease. 76 | Only a few studies of the associations between the experience of anxiety and depression 77 | and quality of life among older cognitively intact people in NHs have been published 78 | (Smalbrugge et al., 2006b; Rodriguez-Blazquez et al., 2012). In Spain, Rodriguez-Blazquez et 79 | al. (2012) found that depression, health status and the interaction of age and institutionalization were related to well-being. In a study in the Netherlands among NH residents, 80 | Smalbrugge et al. (2006b) studied the impact of depression and anxiety on well-being and 81 | found that depression and/or anxiety were associated with significantly worse psychosocial 82 | well-being. 83 | Another source of suffering may be social isolation, resulting from difficulty in 84 | maintaining social contact because of disabilities and loss of spouse and friends (Drageset, 85 | Kirkevold & Espehaug, 2010). For some NH residents, it means that they no longer have 86 | anyone close in their social network. The experience of suffering may be a reaction to the 87 | lack of someone close (Morse, 2011). 88 | Social support may alleviate the experience of suffering and, in turn, may affect mental 89 | and physical health. Social support involves qualitative aspects of human relationships, 90 | such as the content and the availability of relationships with significant others (Sarason, 91 | Sarason & Pierce, 1990). Social support is conceptualized in the literature from three 92 | dimensions (affect, affirmation and aid (Kahn, 1979)) to five dimensions (emotional 93 | support, esteem support, material support, instrumental support and active support 94 | (Cobb, 1979; Cohen, Lynn & Gottlieb, 2000)). Most authors include dimensions related 95 | to emotional support, confirmation support and practical support. Few relevant studies of 96 | social support and quality of life among mental intact NH residents have been conducted. 97 | In a quantitative study, Tseng & Wang (2001) found that social support from nursing aides 98 | and the frequency of interaction with family significantly predict the quality of life of 99 | NH residents. In a qualitative NH study in Norway, Bergland & Kirkevold (2005) found 100 | that residents reported positive peer relationships, and positive relationships with family 101 | were essential for thriving. A qualitative study in Canada (Welsh, Moore & Getzlaf, 2012) 102 | explored meaning in life for NH residents. Connectedness and engaging in “normal” 103 | activities emerged as enhancing meaning in life for the residents. A systematic qualitative 104 | 105 | Drageset et al. (2015), PeerJ, DOI 10.7717/peerj.1120 106 | 107 | 2/18 108 | 109 | review of NH life in relation to residents’ quality of life reported connectedness with others 110 | as being essential for residents’ quality of life (Bradshaw, Playford & Riazi, 2012). 111 | We have recently found that NH residents reported symptoms of anxiety and depression 112 | (Drageset, Eide & Ranhoff, 2013), and some dimensions of social support (attachment, 113 | nurturance and reassurance of worth) have been shown to be important for health-related 114 | quality of life (Drageset et al., 2009a). Based on our recent findings and the present 115 | literature review, one may question that cognitively intact NH residents who report 116 | symptoms of anxiety and depression and a lack of social contact are particularly prone to 117 | reduced health-related quality of life (HRQOL) and the increased experience of suffering. 118 | Some studies have investigated the association between anxiety, depression, social 119 | support and HRQOL among cognitively intact NH residents (Kuuppelomaki & Lauri, 120 | 1998; Tseng & Wang, 2001; Bergland & Kirkevold, 2005; Drageset et al., 2009a; Bradshaw, 121 | Playford & Riazi, 2012; Welsh, Moore & Getzlaf, 2012; Drageset, Eide & Ranhoff, 2013), 122 | but we found no relevant studies about mixed-methods perspectives that examine this 123 | association and the phenomenon of suffering. Better care and treatment for older people 124 | with no cognitive impairment living in NHs requires focusing on well-being at a holistic 125 | level. This means including emotional well-being and the availability of meaningful social 126 | relationships. Meeting this challenge requires extending the perspectives beyond what one 127 | specific research approach can give. 128 | 129 | AIM 130 | The aim of this study was to investigate suffering and mental health among cognitively 131 | intact NH residents more broadly by using a mixed-methods design. The specific research 132 | questions were as follows. 133 | • How do older people living in NHs experience their life situation? 134 | • What is the association between sociodemographic and illness variables and anxiety, 135 | depression and health-related quality of life for NH residents? 136 | • How can the quantitative findings extend findings from qualitative analysis for NH 137 | residents? 138 | 139 | METHODS 140 | Design and population 141 | Since we wanted to explore different aspects of the same phenomena, we used a qualitative 142 | mixed-methods design with concurrently components: qualitative and quantitative (Morse 143 | & Niehaus, 2009). The theoretical drive or the inductive direction of a research project 144 | guides the qualitative methodological core (Morse et al., 2006) and allows researchers 145 | to explore experiences qualitatively and to build a theoretical model of suffering during 146 | anxiety, depression and social support subdimensions and health-related quality of life. 147 | These methods differ from other approaches because the qualitative core component is 148 | guiding the study, which may stand alone, and the supplementary quantitative component 149 | is used to expand certain details of the findings to indicate the validity of the core findings. 150 | 151 | Drageset et al. (2015), PeerJ, DOI 10.7717/peerj.1120 152 | 153 | 3/18 154 | 155 | The qualitative core component in the study comprised a qualitative interview about 156 | life experiences related to pain, grief and loss and psychosocial topics from 18 respondents. 157 | The supplementary component in the study comprised the same 18 respondents, in which 158 | we interviewed the participants face to face using the SF-36 Health Survey subdimensions 159 | bodily pain, vitality, social functioning, role–emotional and mental health; the Hospital 160 | Anxiety and Depression Scale (HADS); and the Social Provisions Scale (SPS). The 161 | supplementary component (findings from the quantitative analysis) enabled us to explore 162 | significant relationships and may inform the qualitative findings. 163 | This study used a simultaneous design (Fig. 1). Once we analyzed the qualitative core 164 | component and completed the supplementary components, we first described the findings 165 | on the core component. We then integrated the final descriptions from the quantitative 166 | components, and these constitute a results narrative on which the discussion is based 167 | (Fig. 1). 168 | This study is part of a study conducted in 2004–2005 (Drageset et al., 2009b), with 169 | follow-up until 2011. At the end of follow-up, 19 NH residents were still alive, and 18 were 170 | included based on the inclusion criteria: aged 65 years and older, cognitively intact, capable 171 | of carrying out a conversation and residing in the NH for at least 6 months. Cognitively 172 | intact was defined as having a Clinical Dementia Rating (CDR) ≤0.5 (Hughes et al., 173 | 1982). CDR was developed as a staging instrument for dementia and is scored as no (0), 174 | questionable (0.5), mild (1), moderate (2) and severe (3) dementia, and the overall level 175 | of dementia is derived by using a standard algorithm (Morris, 1993). Trained nurses who 176 | had observed the residents for at least 4 weeks assessed CDR and were instructed to base 177 | their CDR scoring on mental functioning and not to include physical frailty. The CDR has 178 | shown high interrater reliability for physicians and other health professionals (McCulla et 179 | al., 1989). Exclusion criteria were: lived shorter than 6 months in an NH, CDR score >0.5 180 | and those who had their general health status assessed by a doctor or nurse, who indicated 181 | that the residents could not converse with the researcher. A primary care nurse invited 182 | them to participate. 183 | 184 | Ethical approval 185 | The project involved a sample collected during 2010–2011. We obtained informed 186 | consent. The Western Norway Regional Committee for Medical and Health Research 187 | Ethics and the Norwegian Social Science Data Services approved the study (REK.Vest nr. 188 | 62.03/2009/1550). 189 | 190 | Data collection 191 | Qualitative data 192 | We collected data through individual interviews. We developed a semistructured interview 193 | guide based on our previous research findings. We asked informants about mental health 194 | and physical health (including their experience of depression, anxiety, loss and pain). We 195 | performed interviews in the residents’ room, and they lasted 45–90 min. The interviewer 196 | (first author) conducted conversations in which participants were encouraged to describe 197 | their experience regarding the questions in the interview guide. The respondents’ answers 198 | 199 | Drageset et al. (2015), PeerJ, DOI 10.7717/peerj.1120 200 | 201 | 4/18 202 | 203 | Figure 1 Schematic overview. The left pathway illustrates the core component of the project (qualitative 204 | data). The right pathway illustrates the supplemental components of the project (qualitative data). The 205 | point of interface is the position at which the core and supplemental components meet. The “results 206 | narrative” refers to the write-up of the core-component findings with the addition of the results of the 207 | supplemental components. 208 | 209 | to the questions also led to spontaneous follow-up questions from the interviewer. 210 | The 18 interviews were taped and transcribed verbatim. In all, this resulted in detailed 211 | descriptions. 212 | Quantitative data 213 | We obtained the quantitative data through face-to-face data collection. The 18 interviews 214 | took place in the respondent’s room or at another appropriate location in the NH. The 215 | principal investigator (JD) performed the quantitative interviews: read the questions to the 216 | participants, circled the indicated answer and recorded the demographic information. This 217 | was necessary, since many of the residents have problems holding a pen and have reduced 218 | vision. 219 | 220 | Drageset et al. (2015), PeerJ, DOI 10.7717/peerj.1120 221 | 222 | 5/18 223 | 224 | Assessment instruments 225 | We collected sociodemographic variables such as age, sex, marital status, education level 226 | and comorbidity from patient records. We scored comorbidity using the Functional 227 | Comorbidity Index, a clinically based measure (Groll et al., 2005). This index includes 228 | 18 diagnoses scored “yes = 1” and “no = 0.” A maximum score of 18 indicates the highest 229 | number of comorbid illnesses. 230 | We measured health-related quality of life using the SF-36 (Ware & Sherbourne, 231 | 1992; Ware, 2005). The SF-36 comprises 36 questions along eight dimensions: physical 232 | functioning (10 items), general health (five items), mental health (five items), bodily 233 | pain (two items), role limitation related to physical problems (four items), role limitation 234 | related to emotional problems (three items), social functioning (two items) and vitality 235 | (four items). An additional item, reported health transition, notes changes in general 236 | health during the past year. The response scores for each dimension are added, and the 237 | total is converted to a score on a scale from 0 (poor health) to 100 (optimal health) (Ware, 238 | 2005). In this study, we used the subdimensions bodily pain, vitality, social functioning, 239 | role–emotional and mental health. The SF-36 has been used in numerous studies in 240 | geriatrics and appears to be reliable: Cronbach’s alpha: 0.68–0.94 (Lyons et al., 1994; 241 | Berlowitz et al., 1995; Pit et al., 1996). It has also demonstrated good construct validity 242 | (Lyons et al., 1994) and convergent validity (Andresen et al., 1999). 243 | We used HADS (Zigmond & Snaith, 1983) to assess depression and anxiety symptoms. 244 | HADS is well validated (Bjelland et al., 2002). HADS has seven items for anxiety (HADS-A) 245 | and seven for depression (HADS-D). Each item is scored on a four-point scale from 0 (not 246 | present) to 3 (considerable). The maximum score is 21 on each subscale, and a higher score 247 | indicates a higher symptom load (Zigmond & Snaith, 1983). A score of 8–10 indicates 248 | possible cases of anxiety or depression, and a score ≥11 indicates cases of anxiety or 249 | depression that require further investigation and possibly treatment (Zigmond & Snaith, 250 | 1983). HADS has been translated into Norwegian and has been found to be reliable and 251 | valid for older people (Stordal et al., 2001; Stordal et al., 2003) and reliable and valid among 252 | NH residents (Haugan & Drageset, 2014). 253 | We assessed social support using the revised SPS (Cutrona & Russell, 1987). The scale 254 | contains 24 items, four for each of the six social provisions worked out in detail by Weiss 255 | (1974). Russell et al. (1984) simplified the response format to a four-point rating scale: 256 | “strongly disagree,” “disagree,” “agree” and “strongly agree.” According to Cutrona & 257 | Russell (1987), Andersson & Stevens (1993) and Mancini & Blieszner (1992), four of the 258 | original six subscales were selected: “attachment” (emotional closeness from which one 259 | drives a sense of security); “social integration” (relationships in which the person shares 260 | concerns and common interests); “opportunities for nurturance” (being responsible for 261 | the care of others); and “reassurance of worth” (a sense of competence and esteem). High 262 | scores indicate high social provision. The SPS, with four subdimensions “attachment,” 263 | “social integration,” “nurturance” and “reassurance of worth,” has been used in studies of 264 | older people living in the community (Andersson & Stevens, 1993; Bondevik & Skogstad, 265 | 266 | Drageset et al. (2015), PeerJ, DOI 10.7717/peerj.1120 267 | 268 | 6/18 269 | 270 | 1996; Saevareid et al., 2010) and among NH residents (Bondevik & Skogstad, 1998; 271 | Drageset, 2002; Drageset et al., 2009b). 272 | 273 | Data analysis 274 | Qualitative data 275 | We analyzed the interview data by using elements of qualitative content analysis 276 | (Graneheim & Lundman, 2004; Kvale & Brinkmann, 2009). The analytical process occurred 277 | in six stages (see Table 3 for details): (1) transcribing the interview; (2) open independent 278 | reading of all material to gain an overall impression of the text; (3) identifying meaning 279 | units; (4) categorization; (5) abstracting two subthemes and a theme (Table 3); and (6) 280 | reflection and discussion. 281 | Quantitative data 282 | We used descriptive statistics for the demographic variables and the comorbidity variables. 283 | We applied nonparametric test statistics to test for distributional differences in SF-36 284 | subscales among groups defined by sex (Mann–Whitney U-test) and marital status 285 | (Kruskal–Wallis test). We calculated Spearman correlation coefficients to study associations between comorbidity, age, anxiety, depression, social support dimensions and SF-36 286 | subdimensions: bodily pain, social functioning, role–emotional, vitality and mental health. 287 | 288 | RESULTS 289 | Respondents’ characteristics 290 | Table 1 presents descriptive statistics for the demographic variables and the comorbidity 291 | variables. Of the 19 NH residents, 18 (95%) met the inclusion criteria; 1 (5%) declined to 292 | participate. 293 | Of the 18 respondents, 11 (62%) were women. The mean age was 84.8 years (SD 7.6). 294 | The mean number of comorbid illnesses was 1.9 (median 2.0, SD 1.3, range 0–5). 295 | 296 | Qualitative data 297 | During the interviews, the informants often strived to express their feelings verbally. 298 | Nevertheless, the qualitative data reveal many previous and current life experiences related 299 | to psychosocial aspects and suffering. Among these, the informants described several loss 300 | and traumatic experiences related to death (of parents, siblings, relatives and friends), war, 301 | starving and isolation. During the conversation, the individuals often return to stories 302 | from childhood and upbringing. According to the qualitative analysis, one main theme 303 | was lifelong suffering as a complex psychosocial entity, with two subthemes: “pain from 304 | experience in early life” and “painful experience in recent life” (Table 4). 305 | Such early-life experiences are often related to loss by death, instability and lack of 306 | hope in their upbringing. Several descriptions reflect this psychosocial complexity, and 307 | representative quotations are presented here to give the participants a voice: 308 | • “I have a lifelong grief caused by traumatic experiences from the war.” (P) 309 | • “I feel grief caused by difficult experiences during my childhood.” (Q) 310 | 311 | Drageset et al. (2015), PeerJ, DOI 10.7717/peerj.1120 312 | 313 | 7/18 314 | 315 | Table 1 Characteristics of the respondents. 316 | n 317 | 318 | % 319 | 320 | 18 321 | 322 | 100 323 | 324 | 7 325 | 11 326 | 327 | 38.9 328 | 61.1 329 | 330 | 3 331 | 7 332 | 8 333 | 0 334 | 335 | 16.7 336 | 38.9 337 | 44.4 338 | 0 339 | 340 | 11 341 | 4 342 | 3 343 | 344 | 61.1 345 | 22.2 346 | 16.7 347 | 348 | 8 349 | 4 350 | 4 351 | 352 | 44.4 353 | 33.3 354 | 22.2 355 | 356 | 17 357 | 1 358 | 359 | 94.1 360 | 5.9 361 | 362 | Sex 363 | Male 364 | Female 365 | Age (years) 366 | 65–74 367 | 75–84 368 | 85–94 369 | ≥95 370 | Marital status 371 | Widowed 372 | Married or cohabiting 373 | Unmarried 374 | Education 375 | Lowest: primary school 376 | Middle: <3 years after primary school 377 | Highest: ≥3 years after primary school 378 | Illnessesa 379 | Yes 380 | No 381 | 382 | Notes. 383 | a 384 | Functional Comorbidity Index includes 18 diagnoses scored “yes = 1” and “no = 0.” A maximum score of 18 indicates 385 | the highest number of comorbid illnesses. 386 | 387 | • “Unstable upbringing and hopelessness have been painful.” (F) 388 | The interviewees strongly emphasized earlier painful life experiences. Loss and grief seem 389 | to be especially attached to these. 390 | Current life experiences are also related to loss by death, and lack of social relations, lack 391 | of courage to live and lack of hope are prominent. Many descriptions revealed resignation 392 | and hopelessness: 393 | • “I just sit here.” (O) 394 | • “I am in despair and lonely, but that’s life for us old people, and I cannot do anything 395 | about it.” (F) 396 | • “I feel like a prisoner and several times I wish that I did not exist. I have had enough!” “I 397 | live in a cemetery.” (Q) 398 | • “I am crying all day long.” (A) 399 | • “I lie in bed, feel totally isolated, and cannot take care of myself.” (F) 400 | • “Noise from other people all the time is quite stressful.” (D) 401 | The qualitative data reveal clear patterns and similarities in the descriptions. In their 402 | present life situation, loneliness, despair and depressive thoughts are prominent, and they 403 | express several attempts to endure their situation. 404 | 405 | Drageset et al. (2015), PeerJ, DOI 10.7717/peerj.1120 406 | 407 | 8/18 408 | 409 | Table 2 Means and standard deviation (SD) for each of five subscales of SF-36 according to sociodemographic and comorbid illnesses, and correlation coefficient for anxiety, depression and social 410 | support dimensions (n = 18). 411 | 412 | All 413 | Sexa 414 | Women 415 | Men 416 | P* 417 | Age (years)b 418 | P* 419 | Marital statusc 420 | Widowed 421 | Married 422 | Unmarried 423 | P* 424 | Anxietyb 425 | P* 426 | Depressionb 427 | P* 428 | Attachmentb 429 | P* 430 | Social integrationb 431 | P* 432 | Reassurance of 433 | worthb 434 | P* 435 | Nurturanceb 436 | P* 437 | Grolls indexb,d 438 | P* 439 | 440 | Bodily pain 441 | 442 | Vitality 443 | 444 | Social 445 | functioning 446 | 447 | Role limitations, 448 | emotional 449 | 450 | Mental 451 | health 452 | 453 | 64.1 (27.4) 454 | 455 | 43.9 (12.7) 456 | 457 | 81.2 (17.3) 458 | 459 | 72.2 (36.6) 460 | 461 | 68.4 (13.1) 462 | 463 | 61.7 (28.2) 464 | 61.7 (28.2) 465 | 0.791 466 | −0.14 467 | (0.572) 468 | 469 | 46.8 (11.9) 470 | 40.0 (13.4) 471 | 0.211 472 | 0.125 473 | (0.684) 474 | 475 | 78.4 (17.8) 476 | 85.7 (16.8) 477 | 0.425 478 | 0.10 479 | (0.684) 480 | 481 | 66.7 (42.2)) 482 | 80.9 (26.2) 483 | 0.659 484 | 0.08 485 | (0.745) 486 | 487 | 66.2 (13–2) 488 | 72.0 (13.1) 489 | 0.425 490 | 0.04 491 | (0.883) 492 | 493 | 69.5 (29.4) 494 | 61.2 (31.1) 495 | 48.3 (6.4) 496 | 0.71 497 | −0.56 498 | (0.018) 499 | −0.05 500 | (0.845) 501 | −0.145 502 | (0.566) 503 | 0.391 504 | (0.109) 505 | −0.407 506 | 507 | 45.0 (13.6) 508 | 47.5 (8.7) 509 | 35.0 (13.2) 510 | 0.41 511 | −0.23 512 | (0.385) 513 | −0.23 514 | (0.157) 515 | 0.562 516 | (0.015) 517 | 0.014 518 | (0.957) 519 | 0.334 520 | 521 | 83.0 (16.7) 522 | 81.2 (21.7) 523 | 75.0 (21.7) 524 | 0.83 525 | −0.34 526 | (0.178) 527 | −0.26 528 | (0.309) 529 | 0.257 530 | (0.304) 531 | 0.536 532 | (0.022) 533 | 0.258 534 | 535 | 69.7 (40.7) 536 | 75.0 (38.5) 537 | 77.8 (38.5) 538 | 0.94 539 | −0.58 540 | (0.016) 541 | −0.16 542 | (0.535) 543 | −0.111 544 | (0.661) 545 | −0.108 546 | (0.670) 547 | −0.243 548 | 549 | 68.0 (13.6) 550 | 70.0 (16.5) 551 | 68.0 (10.6) 552 | 0.93 553 | −0.86 554 | (<0.001) 555 | −0.62 556 | (0.007) 557 | 0.214 558 | (0.395) 559 | −0.146 560 | (0.564) 561 | 0.005 562 | 563 | (0.094) 564 | 0.430 565 | (0.075) 566 | −0.412 567 | (0.101) 568 | 569 | (0.175) 570 | 0.035 571 | (0.889) 572 | −0.48 573 | (0.050) 574 | 575 | (0.301) 576 | 0.030 577 | (0.907) 578 | −0.15 579 | (0.555) 580 | 581 | (0.331) 582 | −0.486 583 | (0.041) 584 | −0.40 585 | (0.108) 586 | 587 | (0.983) 588 | −0.125 589 | (0.622) 590 | −0.44 591 | (0.078) 592 | 593 | Notes. 594 | a 595 | Mann–Whitney U test. 596 | b Spearman correlation coefficient. 597 | c 598 | Kruskal–Wallis test. 599 | d Functional comorbidity index. A maximum score of 18 indicates the highest number of comorbid illnesses. 600 | * bold, statistical significance at 0.05. 601 | 602 | • “If you are unable to come into contact with others, you will feel the loneliness strongly 603 | and you also feel invisible.” (P) 604 | The current life experiences also contained several contradictory descriptions: 605 | • “[Life] is very sad, it is terrible, but I have nothing to complain about.” (J) 606 | • “. . . , I just have to accept.” (H) 607 | 608 | Drageset et al. (2015), PeerJ, DOI 10.7717/peerj.1120 609 | 610 | 9/18 611 | 612 | Table 3 Stages of the qualitative analytical process. 613 | (1) Transcription 614 | (2) Open reading 615 | 616 | (3) Identifying meaning units 617 | (4) Categories 618 | 619 | (5) Forming themes 620 | 621 | (6) Reflection and discussion 622 | 623 | Data were transcribed and organized according to the 624 | interview guide 625 | Two co-authors carefully and independently read and 626 | discussed the interview text to obtain an overall impression 627 | of the participants’ experiences 628 | Patterns in the data were identified by dividing the text into 629 | meaning units 630 | Important nuances were discovered by searching for common 631 | and distinctive features as well as variation and agreement 632 | about suitable categories 633 | Two subthemes were formulated 634 | Thereafter, analytical reflection and abstraction were 635 | performed by searching for an overall theme 636 | Dialogue was searched for relevant theory to illuminate and 637 | deepen understanding of the findings 638 | 639 | Table 4 The qualitative content analysis. 640 | Categories 641 | 642 | Subtheme 643 | 644 | Theme 645 | 646 | Earlier life experiences 647 | Loss by death 648 | Instability 649 | Lack of hope 650 | Mental strain 651 | Traumatic events 652 | Present life experiences 653 | Loss by death 654 | Loss of health 655 | Lack of social relationships 656 | Lack of courage to live 657 | Lack of hope 658 | 659 | Painful experiences in earlier life 660 | 661 | Suffering as a lifelong complex psychosocial entity 662 | 663 | Painful experiences in recent life 664 | 665 | The individual stories consistently described existence as a state the informants have to 666 | endure and adapt to. In this process, several expressed that good relationships (staff and 667 | relatives) and mobility are very important. The relationships with health care providers are 668 | especially important. 669 | • “I do not always trust the health care workers, but they are okay.” (F) 670 | Or more explicitly stated: “We need health care workers who care for us.” 671 | 672 | Quantitative data 673 | In general, residents scored highest on role–emotional and social functioning and lowest 674 | on vitality (Table 2). Women reported lower, but not statistically significantly lower, scores 675 | than men on all subdimensions except for vitality and bodily pain. 676 | 677 | Drageset et al. (2015), PeerJ, DOI 10.7717/peerj.1120 678 | 679 | 10/18 680 | 681 | The health-related quality of life subdimensions bodily pain (P = 0.02), role–emotional 682 | (P = 0.02) and mental health (P < 0.001) were negatively associated with anxiety. 683 | Increasing depression scores were negatively associated with mental health (P = 0.007). 684 | Attachment was positively associated with vitality (P = 0.02) and social integration with 685 | social functioning (P = 0.02). Nurturance was negatively associated with role–emotional 686 | (P = 0.04). 687 | Cronbach’s alpha for the SF-36 subscales ranged from 0.60 to 0.85, with role–emotional 688 | showing the highest values and vitality the lowest. 689 | 690 | RESULTS NARRATIVE 691 | The results narrative summarizes the core component findings, with the supplementary 692 | component adding certain information to specific areas (Morse & Niehaus, 2009). Both 693 | data sets showed that suffering is prominent and that anxiety and depression predict 694 | worse mental health. Findings from both the qualitative findings and quantitative data 695 | highlight social relationships as important for mental health and, conversely, lack of social 696 | relationships as a source of suffering. The qualitative data provided many descriptions 697 | of the life situation in an NH in which many difficult experiences throughout a long 698 | life are prominent. As such, the qualitative data provided detailed information about 699 | several psychosocial aspects and experienced suffering. Additional, the supplementary 700 | component, quantitative data, showed that emotional closeness and relationships with 701 | people who share concerns and interests is important. 702 | The combined findings call for several improvements in care among the residents, which 703 | more accurately reflects their concerns aimed at alleviating suffering. 704 | 705 | DISCUSSION 706 | This study among cognitively intact NH residents showed that the individual stories 707 | reveal that psychosocial aspects and the phenomenon of suffering are related to painful 708 | experiences during life. The quantitative data showed that symptoms of both anxiety and 709 | depression were related to mental health. The association between anxiety and depression 710 | and mental health may suggest that more symptoms of both anxiety and depression 711 | contribute to worse mental health. Other studies among NH residents (Smalbrugge et al., 712 | 2005b; Smalbrugge et al., 2006b; Rodriguez-Blazquez et al., 2012) reported associations 713 | between the presence of depression and/or anxiety symptoms and worse well-being. 714 | One explanation for our results could be that most of our respondents were widows or 715 | widowers, have multiple diagnoses and were dependent in the activities of daily living. All 716 | these circumstances may be experienced as losses, contribute to symptoms of depression 717 | (Bland, 2012) and influence mental health (Ferrell & Coyle, 2008) and the experience 718 | of suffering (Kuuppelomaki & Lauri, 1998; Ferrell & Coyle, 2008; Morse, 2011). The 719 | informants also clearly expressed the experience of suffering by telling stories containing 720 | both earlier and current life events. Morse (2011) emphasizes the significance of assisting 721 | the residents in moving from endurance to emotional release when coping with suffering. 722 | Interpersonal encounters seem to play an important role here to help the person who is 723 | 724 | Drageset et al. (2015), PeerJ, DOI 10.7717/peerj.1120 725 | 726 | 11/18 727 | 728 | suffering in this process (Yalom, 2005), and nurses must maintain a culture that includes 729 | such basic elements of nursing. 730 | Symptoms of anxiety were related to the bodily pain subdimension of the health-related 731 | quality of life. This dimension of the SF-36 measures the intensity of bodily pain and 732 | the extent to which bodily pain interferes with normal activities (Ware, 2005). Among 733 | older NH residents, Smalbrugge et al. (2006b) found associations between anxiety and 734 | well-being. But in contrast to our study, the diagnosis of anxiety was reported and the study 735 | did not explicit focus on pain. Pain is a source of suffering (Cassel, 2004; Ferrell & Coyle, 736 | 2008) and a primary source of physical suffering (Kuuppelomaki & Lauri, 1998). 737 | Our study indicated that higher levels of attachment and social integration are 738 | associated with higher levels of vitality and social functioning, or conversely, a lower level 739 | of attachment and social integration corresponds to lower levels of vitality and social 740 | functioning. 741 | The positive relationship between attachment and vitality suggests that the emotional 742 | content of the relationship with significant others is an important component of vitality. 743 | In addition, the stories from the residents underline the importance of social relationships 744 | and mobility as important aspects of this. Our extended findings are in accordance with 745 | other studies that report positive associations between social support and well-being 746 | (Tseng & Wang, 2001; Bergland & Kirkevold, 2005; Drageset et al., 2009b; RodriguezBlazquez et al., 2012). Weiss (1973) and Weiss (1974) emphasizes that significant others 747 | are spouses and very close friends who provide the feeling of intimacy, security and peace, 748 | and a lack of significant others contributes to experiencing negative feeling as emotional 749 | loneliness. Because of the respondents’ advanced age, disability and dependence, they are 750 | more likely to have difficulty in maintaining close social contact. Social and emotional 751 | support seems to be important in combating depression in the general population (Grav et 752 | al., 2012) and loneliness among NH residents (Drageset, Kirkevold & Espehaug, 2010). 753 | The relationship between opportunity for nurturance and emotional role limitations 754 | (whether emotional problems interfered with such social activities as visiting friends 755 | and relatives) suggests that providing more support for others would contribute to 756 | increasing role limitations. Weiss (1974) emphasizes that nurturance differs from the other 757 | provisions by enquiring whether older people themselves provide support. Responsibility 758 | for someone, usually children, gives meaning to an individual’s life in meeting obligations 759 | in various activities. One explanation for our results could be loss of the ability to give the 760 | necessary support: the relationship does not make sense to the extent that one wishes. 761 | The individuals detailed many stories that reveal existential experiences related to 762 | suffering. These findings clearly give nuances in a holistically way and with information 763 | from the results from the quantitative supplementary component the researcher is 764 | able to build synthesis of the qualitative findings to the quantitative results which is 765 | necessary to draw conclusion. This could also clarify clinical significance and contribute 766 | to more clinically meaningful approaches. Such extended findings represent a valuable 767 | contribution in planning individual care. 768 | 769 | Drageset et al. (2015), PeerJ, DOI 10.7717/peerj.1120 770 | 771 | 12/18 772 | 773 | Methodological considerations 774 | There are quantitative studies examining anxiety and depression, social support and the 775 | quality of life, but this type of study has limitations. Suffering is a life phenomenon that 776 | provides deeper understanding and different types of knowledge. Integrating quantitative 777 | and qualitative results using mixed methods could therefore provide more meaningful 778 | findings than one method alone (Tashakkori & Creswell, 2007). 779 | Because we used a cross-sectional study design, we cannot firmly conclude on the 780 | direction of a possible causal effect or preclude that these associations are effects of other 781 | unmeasured determinants. However, the supplementary component can explain and 782 | contribute to deeper knowledge about psychosocial aspects and well-being so that this 783 | relationship appears more clearly. Further, because the study followed a cohort (n = 227, 784 | 30 NHs) of frail cognitively intact NH residents from 2004–2005 to 2011, the sample size 785 | was small at the end of follow-up. Despite the small sample size and low statistical power, 786 | we found meaningful statistical associations that inform the qualitative findings. 787 | As discussed, the research problem is multifaceted and complex. The integrated 788 | research strategy offered by a mixed-methods design therefore enabled us to clarify 789 | different aspects of the phenomena (Richards & Morse, 2007). This tradition maintains 790 | that one method alone will not comprehensively answer our research questions. As 791 | such, both qualitative and quantitative methods are used to collect and analyze the data 792 | (Morse & Niehaus, 2009). In our study, the core component is qualitative data consist of 793 | details and important qualitative date about experiences related to suffering in NH. The 794 | supplementary component (the quantitative results), by clarifying the connection between 795 | anxiety and depression, informed and supported the core component (the qualitative 796 | data), as described by Morse et al. (2006). In this way, the mixed-methods design validated 797 | our findings while conforming to the rules inherent in each paradigm. Further, using a 798 | mixed-methods design with the use of a semistructured qualitative interview may increase 799 | the subjectivity of evaluation and create difficulty in replicating the study. 800 | Two of the authors have skills primarily in the quantitative core method, and two 801 | authors were primarily qualitative researchers. In addition, a statistician was responsible 802 | for the quantitative data analysis. In this way, the researchers represented the different 803 | and overlapping research fields necessary for using a mixed-methods design. In terms 804 | of validity, we believe that our different platforms and expertise represented a critical 805 | contribution in the continuous discussion about possible interpretations during the whole 806 | research process. 807 | 808 | CONCLUSION AND CLINICAL IMPLICATIONS 809 | The individual stories reveal that psychosocial aspects and the phenomenon of suffering 810 | are related to painful experiences during life. Symptoms of anxiety and depression were 811 | negatively associated with mental health, and symptoms of anxiety were associated with 812 | bodily pain. Attachment and social integration were associated with vitality and social 813 | functioning. As demonstrated, the supplementary component informed and supported 814 | the core component and contributes to extending knowledge about the study topic. To 815 | 816 | Drageset et al. (2015), PeerJ, DOI 10.7717/peerj.1120 817 | 818 | 13/18 819 | 820 | improve the situation of residents, more attention should be paid to the residents’ suffering 821 | related to anxiety, depression and relationships. The challenge for health care providers is 822 | to grasp the individual experience of the patients and the meaning these experiences may 823 | have for them. This requires that health care personnel listen to each individual and help 824 | them to find their own strategies to live with the losses. By building on earlier successful 825 | strategies, patients can be helped to understand current suffering. Listening to the patients 826 | in this way requires time, patience and professional competence. A management structure 827 | that focuses on how to meet each resident’s needs individually, such as a care plan for each 828 | patient and a primary contact, is also essential. Further, it is also important that health 829 | care personnel help the individuals to participate in meaningful activities and interactions 830 | with peers, friends and family. Future studies are needed to corroborate or analyze more in 831 | depth the present results about suffering. 832 | 833 | ADDITIONAL INFORMATION AND DECLARATIONS 834 | Funding 835 | Bergen University College and the University of Bergen supported this research. The 836 | funders had no role in study design, data collection and analysis, decision to publish, or 837 | preparation of the manuscript. 838 | 839 | Grant Disclosures 840 | The following grant information was disclosed by the authors: 841 | Bergen University College. 842 | University of Bergen. 843 | 844 | Competing Interests 845 | The authors declare there are no competing interests. 846 | 847 | Author Contributions 848 | • Jorunn Drageset conceived and designed the experiments, performed the experiments, 849 | analyzed the data, contributed reagents/materials/analysis tools, wrote the paper, 850 | prepared figures and/or tables, reviewed drafts of the paper. 851 | • Elin Dysvik and Bodil Furnes conceived and designed the experiments, analyzed the 852 | data, contributed reagents/materials/analysis tools, wrote the paper, prepared figures 853 | and/or tables, reviewed drafts of the paper. 854 | • Birgitte Espehaug analyzed the data, contributed reagents/materials/analysis tools, 855 | wrote the paper, prepared figures and/or tables, reviewed drafts of the paper. 856 | • Gerd Karin Natvig conceived and designed the experiments, wrote the paper, prepared 857 | figures and/or tables, reviewed drafts of the paper. 858 | 859 | Human Ethics 860 | The following information was supplied relating to ethical approvals (i.e., approving body 861 | and any reference numbers): 862 | 863 | Drageset et al. (2015), PeerJ, DOI 10.7717/peerj.1120 864 | 865 | 14/18 866 | 867 | The project involved a sample collected during 2009–2010. We obtained informed 868 | consent. The Western Norway Regional Committee for Medical and Health Research 869 | Ethics and the Norwegian Social Science Data Services approved the study (REK.Vest nr. 870 | 62.03/2009/1550). 871 | 872 | Data Deposition 873 | The following information was supplied regarding the deposition of related data: 874 | According to the Norwegian ACT 2008-06-20 no. 44: Act on medical and health research 875 | (the Health Research Act) regulated in the paragraph 7 Duty of confidentiality and 13 Main 876 | rule on consent, we cannot make the raw data available. 877 | 878 | REFERENCES 879 | Andersson L, Stevens N. 1993. Associations between early experiences with parents and well-being 880 | in old age. Journal of Gerontology 48:109–116 DOI 10.1093/geronj/48.3.P109. 881 | Andresen EM, Gravitt GW, Aydelotte ME, Podgorski CA. 1999. Limitations of the SF-36 in a 882 | sample of nursing home residents. Age and Ageing 28:562–566 DOI 10.1093/ageing/28.6.562. 883 | Bergland A, Kirkevold M. 2005. Resident–caregiver relationships and thriving among nursing 884 | home residents. Research on Nursing and Health 28:365–375 DOI 10.1002/nur.20097. 885 | Berlowitz DR, Du W, Kazis L, Lewis S. 1995. Health-related quality of life of nursing home 886 | residents: differences in patient and provider perceptions. Journal of the American Geriatric 887 | Society 43:799–802 DOI 10.1111/j.1532-5415.1995.tb07055.x. 888 | Bjelland I, Dahl AA, Haug TT, Neckelmann D. 2002. The validity of the hospital anxiety and 889 | depression scale. An updated literature review. Journal of Psychosomal Research 52:69–77 890 | DOI 10.1016/S0022-3999(01)00296-3. 891 | Bland P. 2012. Tackling anxiety and depression in older people in primary care. Practitioner 892 | 256:17–20. 893 | Bondevik M, Skogstad A. 1996. Loneliness among the oldest old, a comparison between residents 894 | living in nursing homes and residents living in the community. International Journal of Aging 895 | and Human Development 43:181–197 DOI 10.2190/9C14-NHUX-XQPL-GA5J. 896 | Bondevik M, Skogstad A. 1998. The oldest old, ADL, social network, and loneliness. Western 897 | Journal of Nursing Research 20:325–343 DOI 10.1177/019394599802000305. 898 | Bradshaw SA, Playford ED, Riazi A. 2012. Living well in care homes: a systematic review of 899 | qualitative studies. Age and Ageing 41:429–440 DOI 10.1093/ageing/afs069. 900 | Cassel JE. 2004. The nature of suffering and the goals of medicine. Oxford: Oxford University Press. 901 | Cobb S. 1979. Social support and health through the life course. In: Riley MW, ed. Aging from 902 | birth to death: interdisciplinary perspectives. Boulder: Westview Press, 93–106. 903 | Cohen S, Lynn U, Gottlieb B. 2000. Social support measurement and intervention: a guide for health 904 | and social scientists. Oxford: Oxford University Press. 905 | Cutrona CE, Russell DW. 1987. The provisions of social relationships and adaptation to 906 | stress. In: Jones WH, Perlman D, eds. Advances in personal relationships. A research annual I. 907 | Greenwich: JAI Press, 37–67. 908 | Daneault S, Lussier V, Mongeau S, Paille P, Hudon E, Dion D, Yelle L. 2004. The nature of 909 | suffering and its relief in the terminally ill: a qualitative study. Journal of Palliative Care 20:7–11. 910 | 911 | Drageset et al. (2015), PeerJ, DOI 10.7717/peerj.1120 912 | 913 | 15/18 914 | 915 | Drageset J. 2002. Loneliness at nursing homes—does a network have any importance for loneliness 916 | among nursing home residents? Nordic Journal of Nursing Research and Clinical Studies/Vård i 917 | Norden 22:9–14 DOI 10.1177/010740830202200202. 918 | Drageset J, Eide GE, Nygaard HA, Bondevik M, Nortvedt MW, Natvig GK. 2009b. The impact of 919 | social support and sense of coherence on health-related quality of life among nursing home 920 | residents—a questionnaire survey in Bergen, Norway. International Journal of Nursing Studies 921 | 46:65–75 DOI 10.1016/j.ijnurstu.2008.07.005. 922 | Drageset J, Eide GE, Ranhoff AH. 2011. Depression is associated with poor functioning in 923 | activities of daily living among nursing home residents without cognitive impairment. Journal 924 | of Clinical Nursing 20:3111–3118 DOI 10.1111/j.1365-2702.2010.03663.x. 925 | Drageset J, Eide GE, Ranhoff AH. 2013. Anxiety and depression among nursing home 926 | residents without cognitive impairment. Scandinavian Journal of Caring Sciences 27:872–881 927 | DOI 10.1111/j.1471-6712.2012.01095.x. 928 | Drageset J, Kirkevold M, Espehaug B. 2010. Loneliness and social support among nursing home 929 | residents without cognitive impairment: a questionnaire survey. International Journal of Nursing 930 | Studies 48:611–619 DOI 10.1016/j.ijnurstu.2010.09.008. 931 | Drageset J, Natvig GK, Eide GE, Bondevik M, Nortvedt MW, Nygaard HA. 2009a. Health-related 932 | quality of life among old residents of nursing homes in Norway. International Journal of Nursing 933 | Practice 15:455–466 DOI 10.1111/j.1440-172X.2009.01794.x. 934 | Ferrell BR, Coyle N. 2008. The nature of suffering and the goals of nursing. Oncology Nursing 935 | Forum 35:241–247 DOI 10.1188/08.ONF.241-247. 936 | Garcia EL, Banegas JR, Perez-Regadera AG, Cabrera RH, Rodriguez-Artalejo F. 2005. Social 937 | network and health-related quality of life in older adults: a population-based study in Spain. 938 | Quality of Life Research 14:511–520 DOI 10.1007/s11136-004-5329-z. 939 | Graneheim UH, Lundman B. 2004. Qualitative content analysis in nursing research: concepts, 940 | procedures and measures to achieve trustworthiness. Nurse Education Today 24:105–112 941 | DOI 10.1016/j.nedt.2003.10.001. 942 | Grav S, Hellzèn O, Romild U, Stordal E. 2012. Association between social support and depression 943 | in the general population: the HUNT study, a cross-sectional survey. Journal of Clinical Nursing 944 | 21:111–120 DOI 10.1111/j.1365-2702.2011.03868.x. 945 | Groll DL, To T, Bombardier C, Wright JG. 2005. The development of a comorbidity index 946 | with physical function as the outcome. Journal of Clinical Epidemiology 58:595–602 947 | DOI 10.1016/j.jclinepi.2004.10.018. 948 | Haugan G, Drageset J. 2014. The hospital anxiety and depression scale—dimensionality, reliability 949 | and construct validity among cognitively intact nursing home patients. Journal of Affective 950 | Disorders 165:8–15 DOI 10.1016/j.jad.2014.04.042. 951 | Hughes CP, Berg L, Danziger WL, Coben LA, Martin RL. 1982. A new clinical scale for the staging 952 | of dementia. British Journal of Psychiatry 140:566–572 DOI 10.1192/bjp.140.6.566. 953 | Kahn RL. 1979. Aging and social support. In: Riley MW, ed. Aging from birth to death: 954 | interdisciplinary perspectives. Boulder: Westview Press, 77–91. 955 | Kuuppelomaki M, Lauri S. 1998. Cancer patients’ reported experiences of suffering. Cancer 956 | Nursing 21:364–369 DOI 10.1097/00002820-199810000-00008. 957 | Kvale S, Brinkmann S. 2009. Interviews: learning the craft of qualitative research interviewing. 958 | Thousand Oaks: Sage Publications. 959 | Linton A, Lach H. 2007. Matteson & McConnell’s gerontological nursing: concepts and practice. 960 | Philadelphia: Saunders. 961 | 962 | Drageset et al. (2015), PeerJ, DOI 10.7717/peerj.1120 963 | 964 | 16/18 965 | 966 | Lyons RA, Perry HM, Beverley N, Littlepage C. 1994. Evidence for the validity of the 967 | short-form 36 questionnaire SF-36 in an elderly population. Age and Ageing 23:182–184 968 | DOI 10.1093/ageing/23.3.182. 969 | Mancini JA, Blieszner R. 1992. Social provisions in adulthood: concept and measurement in close 970 | relationships. Journal of Gerontology 47:14–20 DOI 10.1093/geronj/47.1.P14. 971 | McCulla MM, Coats M, Van Fleet N, Duchek J, Grant E, Morris JC. 1989. Reliability of 972 | clinical nurse specialists in the staging of dementia. Archives of Neurology 46:1210–1211 973 | DOI 10.1001/archneur.1989.00520470070029. 974 | Morris JC. 1993. The Clinical Dementia Rating (CDR): current version and scoring rules. 975 | Neurology 43:2412–2414 DOI 10.1212/WNL.43.11.2412-a. 976 | Morse JM. 2001. Toward a praxis theory of suffering. Advances in Nursing Science 24:47–59 977 | DOI 10.1097/00012272-200109000-00007. 978 | Morse JM. 2011. The praxis theory of suffering. In: Butts JB, Rich KL, eds. Philosophies and theories 979 | in advanced nursing practice. Sudbury: Jones & Bartlett, 569–602. 980 | Morse JM, Niehaus L. 2009. Mixed-method design: principles and procedures. Walnut Creek: Left 981 | Coast Press. 982 | Morse JM, Niehaus L, Wolfe RR, Wilkins S. 2006. The role of the theoretical drive in maintaining 983 | validity in mixed-method research. Qualitative Research in Psychology 3:279–291. 984 | Nygaard HA, Naik M, Ruths S. 2000. Mental svikt hos sykehjemspasienter (Mental impairment 985 | among nursing home residents). Tidsskrift for den Norske Legeforening 120:3113–3116. 986 | Pit SW, Schurink J, Nair BR, Byles J, Heller RF. 1996. Use of the short-form-36 health survey 987 | to assess quality of life among Australian elderly. Australian Journal of Ageing 15:132–135 988 | DOI 10.1111/j.1741-6612.1996.tb00011.x. 989 | Rehnsfeldt A, Eriksson K. 2004. The progression of suffering implies alleviated suffering. 990 | Scandinavian Journal of Caring Sciences 18:264–272 DOI 10.1111/j.1471-6712.2004.00281.x. 991 | Richards L, Morse JM. 2007. Users’ guide to qualitative methods. Thousand Oaks: Sage 992 | Publications. 993 | Rodriguez-Blazquez C, Forjaz MJ, Prieto-Flores ME, Rojo-Perez F, Fernandez-Mayoralas G, 994 | Martinez-Martin P. 2012. Health status and well-being of older adults living in the community 995 | and in residential care settings: are differences influenced by age? Aging and Mental Health 996 | 16:884–891 DOI 10.1080/13607863.2012.684664. 997 | Russell D, Cutrona CE, Rose J, Yurko K. 1984. Social and emotional loneliness: an examination 998 | of Weiss’s typology of loneliness. Journal of Personality and Social Psychology 46:1313–1321 999 | DOI 10.1037/0022-3514.46.6.1313. 1000 | Saevareid HI, Thygesen E, Lindstrom TC, Nygaard HA. 2010. Association between self-reported 1001 | care needs and the allocation of care in Norwegian home nursing care recipients. International 1002 | Journal of Older People Nursing 7:20–28 DOI 10.1111/j.1748-3743.2010.00247.x. 1003 | Sarason BR, Sarason IG, Pierce GR. 1990. Social support: an interactional view. New York: Wiley. 1004 | Selbaek G, Kirkevold O, Engedal K, Selbaek G, Kirkevold O, Engedal K. 2007. The prevalence 1005 | of psychiatric symptoms and behavioural disturbances and the use of psychotropic drugs 1006 | in Norwegian nursing homes. International Journal of Geriatric Psychiatry 22:843–849 1007 | DOI 10.1002/gps.1749. 1008 | Smalbrugge M, Jongenelis L, Pot AM, Beekman AT, Eefsting JA. 2005b. Comorbidity of 1009 | depression and anxiety in nursing home patients. Interational Journal of Geriatric Psychiatry 1010 | 20:218–226 DOI 10.1002/gps.1269. 1011 | 1012 | Drageset et al. (2015), PeerJ, DOI 10.7717/peerj.1120 1013 | 1014 | 17/18 1015 | 1016 | Smalbrugge M, Jongenelis L, Pot AM, Eefsting JA, Ribbe MW, Beekman AT. 2006a. Incidence 1017 | and outcome of depressive symptoms in nursing home patients in the Netherlands. American 1018 | Journal of Geriatric Psychiatry 14:1069–1076 DOI 10.1097/01.JGP.0000224605.37317.88. 1019 | Smalbrugge M, Pot AM, Jongenelis K, Beekman AT, Eefsting JA. 2005a. Prevalence and 1020 | correlates of anxiety among nursing home patients. Journal of Affective Disorders 88:145–153 1021 | DOI 10.1016/j.jad.2005.06.006. 1022 | Smalbrugge M, Pot AM, Jongenelis L, Gundy CM, Beekman AT, Eefsting JA. 2006b. The impact 1023 | of depression and anxiety on well being, disability and use of health care services in nursing 1024 | home patients. International Journal of Geriatric Psychiatry 21:325–332 DOI 10.1002/gps.1466. 1025 | Stordal E, Bjartveit Krüger M, Dahl NH, Krüger Ø, Mykletun A, Dahl AA. 2001. Depression 1026 | in relation to age and gender in the general population: the Nord-Trøndelag Health Study 1027 | (HUNT). Acta Psychiatrica Scandinavica 104:210–216 DOI 10.1034/j.1600-0447.2001.00130.x. 1028 | Stordal E, Bjelland I, Dahl AA, Mykletun A. 2003. Anxiety and depression in individuals with 1029 | somatic health problems: the Nord-Trondelag Health Study (HUNT). Scandinavian Journal of 1030 | Primary Health Care 21:136–141 DOI 10.1080/02813430310002030. 1031 | Tashakkori A, Creswell J. 2007. Exploring the nature of research questions in mixed methods 1032 | research. Journal of Mixed Methods Research 1:207–211 DOI 10.1177/1558689807302814. 1033 | Travis LA, Lyness JM, Shields CG, King DA, Cox C. 2004. Social support, depression, and 1034 | functional disability in older adult primary-care patients. American Journal of Geriatric 1035 | Psychiatry 12:265–271 DOI 10.1097/00019442-200405000-00005. 1036 | Tseng SZ, Wang RH. 2001. Quality of life and related factors among elderly nursing home residents 1037 | in southern Taiwan. Public Health Nursing 18:304–311 DOI 10.1046/j.1525-1446.2001.00304.x. 1038 | Ware JE. 2005. SF-36 Health Survey manual and interpretation guide. Boston: Medical Outcomes 1039 | Trust. 1040 | Ware Jr JE, Sherbourne CD. 1992. The MOS 36-item short-form health survey. SF-36. I. 1041 | Conceptual framework and item selection. Medical Care 30:473–483 1042 | DOI 10.1097/00005650-199206000-00002. 1043 | Weiss RS. 1973. Loneliness. The experience of emotional and social isolation. Cambridge: 1044 | Massachusetts Institute of Technology. 1045 | Weiss RS. 1974. The provisions of social relationships. In: Rubin Z, ed. Doing unto others. 1046 | Englewood Cliffs: Prentice-Hall, 17–26. 1047 | Welsh D, Moore SL, Getzlaf BA. 2012. Meaning in life: the perspective of long-term care residents. 1048 | Research in Gerontological Nursing 5:185–194 DOI 10.3928/19404921-20120605-05. 1049 | Yalom ID. 2005. The theory and practice of group psychotherapy. New York: Basic Books. 1050 | Zigmond AS, Snaith RP. 1983. The hospital anxiety and depression scale. Acta Psychiatrica 1051 | Scandinavica 67:361–370 DOI 10.1111/j.1600-0447.1983.tb09716.x. 1052 | 1053 | Drageset et al. (2015), PeerJ, DOI 10.7717/peerj.1120 1054 | 1055 | 18/18 1056 | 1057 | --------------------------------------------------------------------------------