digitizr: a wrapper for the magick package, focussed on extracting data...

View source: R/digitizr.R

digitizrR Documentation

a wrapper for the magick package, focussed on extracting data from images containing graphs

Description

a wrapper for the magick package, focussed on extracting data from images containing graphs

Usage

digitizr(
  inputfilename = NULL,
  outputfilename = NULL,
  xvarname = NULL,
  yvarname = NULL,
  xmin = NULL,
  xmax = NULL,
  ymin = NULL,
  ymax = NULL,
  yscalemax = NULL,
  threshold = NULL,
  mygraphsize = 1000
)

Arguments

inputfilename

Name of the input image file. This file should contain only the graph area, not the axes, titles or legends.

outputfilename

Name to be used for the output image file (PNG format).

xvarname

Name to be used for the x variable.

yvarname

Name to be used for the y variable.

xmin

Minimum x value.

xmax

Maximum x value.

ymin

Minimum y value.

ymax

Maximum y value.

yscalemax

Maximum value to be used for the y-scale.

threshold

The threshold is a percentage written as a character string, e.g. "70%". Some experimentation might be needed to find the value that works best.

mygraphsize

The graph size in pixels.

Examples

myinputfile <- system.file("extdata", "ari.png", package = "humblr")
extracted_data <- digitizr(inputfilename=myinputfile, outputfilename="extracted_data_graph.png", xvarname="año", yvarname="millones de pasajeros", xmin=2020, xmax=2050, ymin=0.928253, ymax=4.159696, yscalemax=5, threshold="70%")


alexmitrani/humblr documentation built on April 4, 2022, 8:29 a.m.