Title: | Extract and Summarise Data from Published Figures |
---|---|
Description: | High-throughput, flexible and reproducible extraction of data from figures in primary research papers. metaDigitise() can extract data and / or automatically calculate summary statistics for users from box plots, bar plots (e.g., mean and errors), scatter plots and histograms. |
Authors: | Joel Pick [aut], Shinichi Nakagawa [aut], Daniel Noble [aut, cre] |
Maintainer: | Daniel Noble <[email protected]> |
License: | GPL (>=2) |
Version: | 1.0.1 |
Built: | 2024-11-12 03:55:26 UTC |
Source: | https://github.com/daniel1noble/metadigitise |
asks user what variable(s) is depending on plot type
ask_variable(plot_type)
ask_variable(plot_type)
plot_type |
plot_type |
Function for bulk editing previous data extraction through 'metaDigitise'
bulk_edit(dir, summary = TRUE, cex)
bulk_edit(dir, summary = TRUE, cex)
dir |
parent directory |
summary |
logical; whether summary is returned |
cex |
relative size of text and points in replotting |
Joel Pick
Prompts user to enter axis coordinates, and their values. Modified from the digitize package
cal_coords(plot_type, cex, ...)
cal_coords(plot_type, cex, ...)
plot_type |
plot type |
cex |
size of points |
... |
further arguments passed to or from other methods. |
Converts x and y coordinates from original plot coords to actual coords using previous identified coordinates. Modified from digitise package
calibrate(raw_data, calpoints, point_vals, log_axes, ...)
calibrate(raw_data, calpoints, point_vals, log_axes, ...)
raw_data |
The raw data |
calpoints |
The calibration points |
point_vals |
The point values |
log_axes |
whether x or y is logged |
... |
further arguments passed to or from other methods |
prints a vector as a number list of items with a certain number of columns
cat_matrix(x, cols)
cat_matrix(x, cols)
x |
vector |
cols |
number of columns |
Transforms symmetrical confidence interval to standard deviation
CI95_to_sd(CI, n)
CI95_to_sd(CI, n)
CI |
Interval difference from the mean |
n |
Sample Size |
Returns vector of standard deviations
Joel Pick
CI95_to_sd(CI = 2, n = 10)
CI95_to_sd(CI = 2, n = 10)
Converts, pre-calibrated points clicked into a meaningful dataframe
convert_group_data(cal_data, plot_type)
convert_group_data(cal_data, plot_type)
cal_data |
Calibrated data |
plot_type |
The type of plot |
Conversion of extracted data from histogram
convert_histogram_data(cal_data)
convert_histogram_data(cal_data)
cal_data |
The calibration data |
Delete groups from scatterplots
delete_group(raw_data)
delete_group(raw_data)
raw_data |
data |
Function will gather important directory details about calibration files and figures needed for processing
dir_details(dir)
dir_details(dir)
dir |
the path name to the directory / folder where the files are located |
Daniel Noble - [email protected]
# temporary directory tmp_dir <- tempdir() setup_calibration_dir(paste0(tmp_dir, "/")) # Simulate data set.seed(103) x <- rnorm(20,0,1) y <- rnorm(20,0,1) means <- c(mean(x),mean(y)) ses <- c(sd(x)/sqrt(length(x))*1.96, sd(y)/sqrt(length(y))*1.96) #Generate mock figures png(filename = paste0(tmp_dir,"/mean_error.png"), width = 480, height = 480) plot(means, ylim = c(min(means-ses)-0.1,max(means+ses)+0.1), xlim=c(0.5,2.5), xaxt="n", pch=19, cex=2, ylab="Variable +/- SE", xlab="Treatment", main="Mean Error") arrows(1:length(means),means+ses, 1:length(means), means-ses, code=3, angle=90, length=0.1) axis(1,1:length(means),names(means)) dev.off() png(filename = paste0(tmp_dir, "/boxplot.png"), width = 480, height = 480) boxplot(x,y, main="Boxplot") dev.off() png(filename = paste0(tmp_dir, "/histogram.png"),width = 480, height = 480) hist(c(x,y), xlab= "variable", main="Histogram") dev.off() png(filename = paste0(tmp_dir, "/scatterplot.png"), width = 480, height = 480) plot(x,y, main="Scatterplot") dev.off() #Obtain details on directory structure that are used for metaDigitise data <- dir_details(tmp_dir)
# temporary directory tmp_dir <- tempdir() setup_calibration_dir(paste0(tmp_dir, "/")) # Simulate data set.seed(103) x <- rnorm(20,0,1) y <- rnorm(20,0,1) means <- c(mean(x),mean(y)) ses <- c(sd(x)/sqrt(length(x))*1.96, sd(y)/sqrt(length(y))*1.96) #Generate mock figures png(filename = paste0(tmp_dir,"/mean_error.png"), width = 480, height = 480) plot(means, ylim = c(min(means-ses)-0.1,max(means+ses)+0.1), xlim=c(0.5,2.5), xaxt="n", pch=19, cex=2, ylab="Variable +/- SE", xlab="Treatment", main="Mean Error") arrows(1:length(means),means+ses, 1:length(means), means-ses, code=3, angle=90, length=0.1) axis(1,1:length(means),names(means)) dev.off() png(filename = paste0(tmp_dir, "/boxplot.png"), width = 480, height = 480) boxplot(x,y, main="Boxplot") dev.off() png(filename = paste0(tmp_dir, "/histogram.png"),width = 480, height = 480) hist(c(x,y), xlab= "variable", main="Histogram") dev.off() png(filename = paste0(tmp_dir, "/scatterplot.png"), width = 480, height = 480) plot(x,y, main="Scatterplot") dev.off() #Obtain details on directory structure that are used for metaDigitise data <- dir_details(tmp_dir)
Edit group points in scatterplots
edit_group(raw_data, group_id, calpoints, cex, ...)
edit_group(raw_data, group_id, calpoints, cex, ...)
raw_data |
data |
group_id |
group_id |
calpoints |
The calibration points |
cex |
point size |
... |
other functions to pass to internal_redraw |
Function for editing previous data extraction through 'metaDigitise'
edit_metaDigitise(object)
edit_metaDigitise(object)
object |
an R object of class ‘metaDigitise’ |
Data.frame
Joel Pick
Enter sample sizes for a group
enter_N(raw_data, ...)
enter_N(raw_data, ...)
raw_data |
raw_data |
... |
Pass additional arguments |
Joel Pick
Transforms error to standard deviation
error_to_sd(error, n, error_type = c("se", "CI95", "sd", NA))
error_to_sd(error, n, error_type = c("se", "CI95", "sd", NA))
error |
some form of error |
n |
Sample Size |
error_type |
type of error measured |
Returns vector of standard errors
Joel Pick
Function for extracting the data from a metaDigitise list and creating either summary data or a list of the raw data.
extract_digitised(list, summary = TRUE)
extract_digitised(list, summary = TRUE)
list |
A list of objects returned from metaDigitise |
summary |
A logical 'TRUE' or 'FALSE' indicating whether metaDigitise should print summary statistics from each figure and group. |
The function will return a data frame with the data across all the digitised files
extracts filename from filepath
filename(x)
filename(x)
x |
filepath |
Function will get file information from the directory and the calibration files. It will also exclude files that have already been processed, as is judged by the match between file names in the calibration folder and the imported details object
get_notDone_file_details(dir)
get_notDone_file_details(dir)
dir |
Path name to the directory / folder where the figure files are located. |
Returns a list containing details on the images names and their paths, the calibration file names (or files already completed) as well as the paths to these files.
Daniel Noble - [email protected]
# temporary directory tmp_dir <- tempdir() # Simulate data set.seed(103) x <- rnorm(20,0,1) y <- rnorm(20,0,1) means <- c(mean(x),mean(y)) ses <- c(sd(x)/sqrt(length(x))*1.96, sd(y)/sqrt(length(y))*1.96) #Generate mock figures png(filename = paste0(tmp_dir,"/mean_error.png"), width = 480, height = 480) plot(means, ylim = c(min(means-ses)-0.1,max(means+ses)+0.1), xlim=c(0.5,2.5), xaxt="n", pch=19, cex=2, ylab="Variable +/- SE", xlab="Treatment", main="Mean Error") arrows(1:length(means),means+ses, 1:length(means), means-ses, code=3, angle=90, length=0.1) axis(1,1:length(means),names(means)) dev.off() png(filename = paste0(tmp_dir, "/boxplot.png"), width = 480, height = 480) boxplot(x,y, main="Boxplot") dev.off() png(filename = paste0(tmp_dir, "/histogram.png"),width = 480, height = 480) hist(c(x,y), xlab= "variable", main="Histogram") dev.off() png(filename = paste0(tmp_dir, "/scatterplot.png"), width = 480, height = 480) plot(x,y, main="Scatterplot") dev.off() #Obtain file names that are incomplete within the tmp directory data <- get_notDone_file_details(tmp_dir)
# temporary directory tmp_dir <- tempdir() # Simulate data set.seed(103) x <- rnorm(20,0,1) y <- rnorm(20,0,1) means <- c(mean(x),mean(y)) ses <- c(sd(x)/sqrt(length(x))*1.96, sd(y)/sqrt(length(y))*1.96) #Generate mock figures png(filename = paste0(tmp_dir,"/mean_error.png"), width = 480, height = 480) plot(means, ylim = c(min(means-ses)-0.1,max(means+ses)+0.1), xlim=c(0.5,2.5), xaxt="n", pch=19, cex=2, ylab="Variable +/- SE", xlab="Treatment", main="Mean Error") arrows(1:length(means),means+ses, 1:length(means), means-ses, code=3, angle=90, length=0.1) axis(1,1:length(means),names(means)) dev.off() png(filename = paste0(tmp_dir, "/boxplot.png"), width = 480, height = 480) boxplot(x,y, main="Boxplot") dev.off() png(filename = paste0(tmp_dir, "/histogram.png"),width = 480, height = 480) hist(c(x,y), xlab= "variable", main="Histogram") dev.off() png(filename = paste0(tmp_dir, "/scatterplot.png"), width = 480, height = 480) plot(x,y, main="Scatterplot") dev.off() #Obtain file names that are incomplete within the tmp directory data <- get_notDone_file_details(tmp_dir)
Extracts data from a directory that has been previously digitised using metaDigitise()
getExtracted(dir, summary = TRUE)
getExtracted(dir, summary = TRUE)
dir |
The directory where figures have already been digitised. There |
summary |
Logical indicating whether summarised (default) or calibrated data should be returned. |
Returns a data frame (summary = TRUE) or a list with slots for each plot type (summary = FALSE)
# Make some mock metaDigitise object mock_metaDig <- list( image_file = "./image.png", flip=FALSE, rotate=0, plot_type="mean_error", variable="y", calpoints = data.frame(x=c(0,0),y=c(0,100)), point_vals = c(1,2), entered_N=TRUE, raw_data = data.frame(id=rep("control",2), x=c(60,60), y=c(75,50), n=rep(20,2)), knownN = NULL, error_type="sd", processed_data=data.frame( id=as.factor("control"), mean=1.5, error=0.25, n=20, variable="y", stringsAsFactors = FALSE) ) class(mock_metaDig) <- 'metaDigitise' # write image file to tmpdir() dir <- tempdir() # Setup directory as it would be if digitised images existed setup_calibration_dir(dir) # Save the digitised data saveRDS(mock_metaDig, file = paste0(dir, "/caldat/", "image")) #metaDigitise figures data <- getExtracted(dir)
# Make some mock metaDigitise object mock_metaDig <- list( image_file = "./image.png", flip=FALSE, rotate=0, plot_type="mean_error", variable="y", calpoints = data.frame(x=c(0,0),y=c(0,100)), point_vals = c(1,2), entered_N=TRUE, raw_data = data.frame(id=rep("control",2), x=c(60,60), y=c(75,50), n=rep(20,2)), knownN = NULL, error_type="sd", processed_data=data.frame( id=as.factor("control"), mean=1.5, error=0.25, n=20, variable="y", stringsAsFactors = FALSE) ) class(mock_metaDig) <- 'metaDigitise' # write image file to tmpdir() dir <- tempdir() # Setup directory as it would be if digitised images existed setup_calibration_dir(dir) # Save the digitised data saveRDS(mock_metaDig, file = paste0(dir, "/caldat/", "image")) #metaDigitise figures data <- getExtracted(dir)
Gets values needed to calibrate axis coordinated. Modified from the digitize package
getVals(calpoints, ...)
getVals(calpoints, ...)
calpoints |
Calibration points |
... |
further arguments passed to or from other methods. |
Pooled mean of a set of group means
grandMean(mean, n)
grandMean(mean, n)
mean |
Mean |
n |
Sample size |
Returns vector of pooled mean
Joel Pick
grandMean(mean = 10, n = 30)
grandMean(mean = 10, n = 30)
Pooled standard deviation of a set of groups
grandSD(mean, sd, n, equal = FALSE)
grandSD(mean, sd, n, equal = FALSE)
mean |
Mean |
sd |
standard deviation |
n |
Sample size |
equal |
Logical: Whether to calculate pooled SD assuming groups have the same means (TRUE) or different means (FALSE) |
Returns vector of pooled mean
Joel Pick
grandSD(mean = 10, sd = 3, n = 40)
grandSD(mean = 10, sd = 3, n = 40)
Extraction of data from scatterplots
group_scatter_extract( edit = FALSE, raw_data = data.frame(stringsAsFactors = TRUE), cex, ... )
group_scatter_extract( edit = FALSE, raw_data = data.frame(stringsAsFactors = TRUE), cex, ... )
edit |
logical; whether in edit mode |
raw_data |
raw data |
cex |
point size |
... |
arguments passed to internal_redraw |
Extraction of data from histograms
histogram_extract(edit = FALSE, raw_data = data.frame(), calpoints, cex, ...)
histogram_extract(edit = FALSE, raw_data = data.frame(), calpoints, cex, ...)
edit |
logical; whether in edit mode |
raw_data |
raw data |
calpoints |
The calibration points |
cex |
point size |
... |
arguments to pass to internal_redraw |
Imports metaDigitise() calibration files from a directory that is partially or fully digitised already
import_metaDigitise(dir, summary)
import_metaDigitise(dir, summary)
dir |
The directory where figures have already been digitised |
summary |
Logical indicating whether the imported data should be returned in summarised form ('TRUE') or not ('FALSE') |
Returns a list (summary = FALSE) or data frame (summary = TRUE)
Daniel Noble - [email protected]
Extracts points from a single figure and processes data
internal_digitise(image_file, plot_type = NULL, cex)
internal_digitise(image_file, plot_type = NULL, cex)
image_file |
Image file |
plot_type |
Type of plot from "mean_error","boxplot","scatterplot" or"histogram". Function will prompt if not entered by user. |
cex |
point size for replotting |
List of user inputs and transformed data from digitisation
Joel Pick
Redraws figure and extraction data
internal_redraw( image_file, flip = FALSE, rotate = 0, plot_type = NULL, variable = NULL, cex = NULL, calpoints = NULL, point_vals = NULL, raw_data = NULL, rotation = TRUE, calibration = TRUE, points = TRUE, ... )
internal_redraw( image_file, flip = FALSE, rotate = 0, plot_type = NULL, variable = NULL, cex = NULL, calpoints = NULL, point_vals = NULL, raw_data = NULL, rotation = TRUE, calibration = TRUE, points = TRUE, ... )
image_file |
Image filename |
flip |
whether to flip figure |
rotate |
how much to rotate figure |
plot_type |
plot_type |
variable |
variable |
cex |
relative size of points and text |
calpoints |
The calibration points |
point_vals |
The point values |
raw_data |
The raw data |
rotation |
logical, should figure be rotated |
calibration |
logical, should calibration be redrawn |
points |
logical, should points be redrawn |
... |
further arguments passed to or from other methods. |
Checks whether a integer is even
is.even(x)
is.even(x)
x |
integer value |
Logical (TRUE or FALSE) indicating whether value is an even number or not
Checks whether value is a whole number
is.wholenumber(x, tol = .Machine$double.eps^0.5)
is.wholenumber(x, tol = .Machine$double.eps^0.5)
x |
object to be tested |
tol |
tolerance |
Logical value (TRUE or FALSE)
Checks whether a character is a number
isNumeric(x)
isNumeric(x)
x |
character to be tested |
Logical (TRUE or FALSE) indicating whether value is numeric or not
prints a vector as a number list of items with a certain number of columns
knownN(plot_type, processed_data, knownN = NULL, ...)
knownN(plot_type, processed_data, knownN = NULL, ...)
plot_type |
plot type |
processed_data |
raw_data |
knownN |
previously entered N |
... |
arguments from other calls |
Loads metaDigitise calibration / data files from a directory containing a set of figures that are partially or fully digitised already.
load_metaDigitise(doneCalFiles, names)
load_metaDigitise(doneCalFiles, names)
doneCalFiles |
The metaDigitise objects that have already been completed in the directory |
names |
The names of the finished metaDigitise objects |
Returns a list of metaDigitised objects that have already been completed
Daniel Noble - [email protected]
Wrapper function for locator, with more control over point size etc
locator_mD(nPoints = 1, line = TRUE, cex = 1, col = "red", ...)
locator_mD(nPoints = 1, line = TRUE, cex = 1, col = "red", ...)
nPoints |
number of points in a sequence |
line |
logical; plot lines between points |
cex |
size of points |
col |
colour of points |
... |
further arguments passed to or from other methods. |
Plots clicked points, and returns their x.y coordinates as a data.frame
Ask user for information about whether axes are on log scale
logAxes(...)
logAxes(...)
... |
further arguments passed to or from other methods. |
Extraction of data from boxplots of mean_error plots, from multiple groups
MB_extract( edit = FALSE, plot_type, entered_N, raw_data = data.frame(stringsAsFactors = TRUE), cex, ... )
MB_extract( edit = FALSE, plot_type, entered_N, raw_data = data.frame(stringsAsFactors = TRUE), cex, ... )
edit |
logical; whether in edit mode |
plot_type |
The type of plot |
entered_N |
ask for sample sizes? |
raw_data |
raw data |
cex |
point size |
... |
further arguments to MB_extract |
Single or batch processing of figures with .png, .jpg, .tiff, .pdf extensions within a set directory. metaDigitise() consolidates the data and exports the data for each image and image type. It can also summarise the data, provide the raw data (if scatterplots) and automatically imports previously finished data and merges it with newly digitised data. metaDigitise() also allows users to check their calibration along with editing previous digitisations.
metaDigitise(dir, summary = TRUE, cex = 1)
metaDigitise(dir, summary = TRUE, cex = 1)
dir |
the path name to the directory / folder where the files are located |
summary |
whether the digitised data should be returned as a summary (TRUE) or as a concatenated list of similar types. |
cex |
relative size of points and text in replotting of digitisation. Default is 1. |
metaDigitise() can be used on a directory with a whole host of different figure types (mean and error, scatter plots, box plots and histograms) and file types (.jpeg, .png, .tiff, .pdf). There are three major options provided to users:
If the "1: Process new images" option is chosen, it will automatically cycle through all figures not already completed within a directory in order, prompting the user for specific information as they go. At the end of each figure users will be asked if they would like to continue or not, providing flexibility to leave a job should should they need to. As figures are digitised it will automatically write metaDigitise() object files (in .RDS format containing processed and calibration data along with directory and file details), into a special caldat/ folder within the directory. Importantly, as new files are added to a directory that has already been "completed", metaDigitise() will recognize these unfinished files and only cycle through the digitisation of these new files. This easily allows users to pick up from where they left off. It will also automatically re-merge completed figure with any newly digitised figures at the end of this process keeping everything together throughout the process.
If the "2: Import existing data" is chosen, all existing files that have already been digitised will be automatically imported from the given directory.
Finally, metaDigitise is built for ease of editing and reproducibility in mind. Hence, if "3: Edit existing data" is chosen by the user then users will have the options to "1: Cycle through images" (that are complete), overlaying digitisations with each figure and asking whether they would like to edit each figure or "2: Choose specific file to edit" allowing editing for a specific file. Here a list of all files are provided and the user simply needs to pick the one in the console they would like to view. Alternatively, the "3: Enter previously omitted sample sizes" option allows the user to go back and enter sample sizes that they may not have had on hand at the time of digitisation. This means that, so long as the caldat/ folder along with respective images are maintained, anyone using metaDigitise() can simply import existing digitisations, modify them and fix them. This folder can then be shared with colleagues to allow them to reproduce any data extraction.
A data frame or list containing the raw digitised data or the processed, summary statistics from the digitised data
Joel Pick - [email protected]
Daniel Noble - [email protected]
# temporary directory tmp_dir <- tempdir() # Simulate data set.seed(103) x <- rnorm(20,0,1) y <- rnorm(20,0,1) means <- c(mean(x),mean(y)) ses <- c(sd(x)/sqrt(length(x))*1.96, sd(y)/sqrt(length(y))*1.96) #Generate mock figures png(filename = paste0(tmp_dir,"/mean_error.png"), width = 480, height = 480) plot(means, ylim = c(min(means-ses)-0.1,max(means+ses)+0.1), xlim=c(0.5,2.5), xaxt="n", pch=19, cex=2, ylab="Variable +/- SE", xlab="Treatment", main="Mean Error") arrows(1:length(means),means+ses, 1:length(means), means-ses, code=3, angle=90, length=0.1) axis(1,1:length(means),names(means)) dev.off() png(filename = paste0(tmp_dir, "/boxplot.png"), width = 480, height = 480) boxplot(x,y, main="Boxplot") dev.off() png(filename = paste0(tmp_dir, "/histogram.png"),width = 480, height = 480) hist(c(x,y), xlab= "variable", main="Histogram") dev.off() png(filename = paste0(tmp_dir, "/scatterplot.png"), width = 480, height = 480) plot(x,y, main="Scatterplot") dev.off() #metaDigitise figures ## Not run: data <- metaDigitise(tmp_dir) ## End(Not run)
# temporary directory tmp_dir <- tempdir() # Simulate data set.seed(103) x <- rnorm(20,0,1) y <- rnorm(20,0,1) means <- c(mean(x),mean(y)) ses <- c(sd(x)/sqrt(length(x))*1.96, sd(y)/sqrt(length(y))*1.96) #Generate mock figures png(filename = paste0(tmp_dir,"/mean_error.png"), width = 480, height = 480) plot(means, ylim = c(min(means-ses)-0.1,max(means+ses)+0.1), xlim=c(0.5,2.5), xaxt="n", pch=19, cex=2, ylab="Variable +/- SE", xlab="Treatment", main="Mean Error") arrows(1:length(means),means+ses, 1:length(means), means-ses, code=3, angle=90, length=0.1) axis(1,1:length(means),names(means)) dev.off() png(filename = paste0(tmp_dir, "/boxplot.png"), width = 480, height = 480) boxplot(x,y, main="Boxplot") dev.off() png(filename = paste0(tmp_dir, "/histogram.png"),width = 480, height = 480) hist(c(x,y), xlab= "variable", main="Histogram") dev.off() png(filename = paste0(tmp_dir, "/scatterplot.png"), width = 480, height = 480) plot(x,y, main="Scatterplot") dev.off() #metaDigitise figures ## Not run: data <- metaDigitise(tmp_dir) ## End(Not run)
Will re-order the processed data such that similar types of data are organised into a single list defined by their plot type.
order_lists(list, plot_types)
order_lists(list, plot_types)
list |
The list of metaDigitise objects that have already been finished within the caldat/ folder |
plot_types |
The list of plot types extracted from metaDigitised objects |
Returns a list ordered by the plot type
Daniel Noble - [email protected]
Re-plots figure and extraction data
## S3 method for class 'metaDigitise' plot(x, cex = NULL, ...)
## S3 method for class 'metaDigitise' plot(x, cex = NULL, ...)
x |
an R object of class ‘metaDigitise’ |
cex |
size of points |
... |
further arguments passed to or from other methods. |
Joel Pick
Extracts or edits point of a digitisation
point_extraction(object, edit = FALSE)
point_extraction(object, edit = FALSE)
object |
Object |
edit |
Logical (TRUE or FALSE) indicating whether a point would like to be edited |
Prints instructions for calibration. Modified from the digitize package
print_cal_instructions(plot_type, ...)
print_cal_instructions(plot_type, ...)
plot_type |
plot type |
... |
further arguments passed to or from other methods. |
Print method for class ‘metaDigitise’
## S3 method for class 'metaDigitise' print(x, ...)
## S3 method for class 'metaDigitise' print(x, ...)
x |
an R object of class ‘metaDigitise’ |
... |
further arguments passed to or from other methods. |
Joel Pick
Processes points clicked into a meaningful dataframe
process_data(object)
process_data(object)
object |
object from metaDigitise |
Batch processes image files within a set directory, consolidates the data and exports the data for each image and type
process_new_files(dir, summary = TRUE, cex)
process_new_files(dir, summary = TRUE, cex)
dir |
the path name to the directory / folder where the files are located |
summary |
summary = TRUE or FALSE is most relevant as it will print a simple summary statistics that are the same across all files |
cex |
relative size of points and text in replotting of digitisation. |
Joel Pick - [email protected]
Daniel Noble - [email protected]
# temporary directory tmp_dir <- tempdir() # Simulate data set.seed(103) x <- rnorm(20,0,1) y <- rnorm(20,0,1) means <- c(mean(x),mean(y)) ses <- c(sd(x)/sqrt(length(x))*1.96, sd(y)/sqrt(length(y))*1.96) #Generate mock mean error plot png(filename = paste0(tmp_dir,"/mean_error.png"), width = 480, height = 480) plot(means, ylim = c(min(means-ses)-0.1,max(means+ses)+0.1), xlim=c(0.5,2.5), xaxt="n", pch=19, cex=2, ylab="Variable +/- SE", xlab="Treatment", main="Mean Error") arrows(1:length(means),means+ses, 1:length(means), means-ses, code=3, angle=90, length=0.1) axis(1,1:length(means),names(means)) dev.off() ## Not run: #metaDigitise figures data <- process_new_files(paste0(tmp_dir, "/"), summary = TRUE, cex = 2) ## End(Not run)
# temporary directory tmp_dir <- tempdir() # Simulate data set.seed(103) x <- rnorm(20,0,1) y <- rnorm(20,0,1) means <- c(mean(x),mean(y)) ses <- c(sd(x)/sqrt(length(x))*1.96, sd(y)/sqrt(length(y))*1.96) #Generate mock mean error plot png(filename = paste0(tmp_dir,"/mean_error.png"), width = 480, height = 480) plot(means, ylim = c(min(means-ses)-0.1,max(means+ses)+0.1), xlim=c(0.5,2.5), xaxt="n", pch=19, cex=2, ylab="Variable +/- SE", xlab="Treatment", main="Mean Error") arrows(1:length(means),means+ses, 1:length(means), means-ses, code=3, angle=90, length=0.1) axis(1,1:length(means),names(means)) dev.off() ## Not run: #metaDigitise figures data <- process_new_files(paste0(tmp_dir, "/"), summary = TRUE, cex = 2) ## End(Not run)
Converts a range to a standard deviation
range_to_sd(min, max, n)
range_to_sd(min, max, n)
min |
Minimum value |
max |
Maximum value |
n |
Sample size |
Returns vector of standard deviation
Joel Pick
range_to_sd(min = 3, max = 8, n = 40)
range_to_sd(min = 3, max = 8, n = 40)
plots calibration data on graph
redraw_calibration( plot_type, variable, calpoints, point_vals, image_details, cex )
redraw_calibration( plot_type, variable, calpoints, point_vals, image_details, cex )
plot_type |
plot_type |
variable |
variable |
calpoints |
The calibration points |
point_vals |
The point values |
image_details |
image_details |
cex |
relative size of points and text |
plots clicked data on graph
redraw_points(plot_type, raw_data, image_details, cex)
redraw_points(plot_type, raw_data, image_details, cex)
plot_type |
plot_type |
raw_data |
The raw data |
image_details |
image_details |
cex |
relative size of points and text |
Rotates/flips imported figures
redraw_rotation(image, flip, rotate)
redraw_rotation(image, flip, rotate)
image |
Image object from magick::image_read |
flip |
whether to flip figure |
rotate |
how much to rotate figure |
Calculate the mean from the box plots
rqm_to_mean(min, LQ, median, UQ, max, n)
rqm_to_mean(min, LQ, median, UQ, max, n)
min |
Minimum value |
LQ |
Lower 75th quartile |
median |
Median |
UQ |
Upper 75th quartile |
max |
Maximum value |
n |
Sample size |
Returns vector of mean
Joel Pick
rqm_to_mean(min = 2, LQ = 3, median = 5, UQ = 6, max = 9, n = 30)
rqm_to_mean(min = 2, LQ = 3, median = 5, UQ = 6, max = 9, n = 30)
Calculate the standard deviation from box plots
rqm_to_sd(min, LQ, UQ, max, n)
rqm_to_sd(min, LQ, UQ, max, n)
min |
Minimum value |
LQ |
Lower 75th quartile |
UQ |
Upper 75th quartile |
max |
Maximum value |
n |
Sample size |
Returns vector of standard deviation
Joel Pick
rqm_to_sd(min = 2, LQ = 3, UQ = 6, max = 9, n = 30)
rqm_to_sd(min = 2, LQ = 3, UQ = 6, max = 9, n = 30)
Transforms standard error to standard deviation
se_to_sd(se, n)
se_to_sd(se, n)
se |
Standard Error of the mean |
n |
Sample Size |
Returns vector of standard errors
Joel Pick
se_to_sd(se = 5, n = 10)
se_to_sd(se = 5, n = 10)
Function will check whether the calibration directory has been setup and if not, create one.
setup_calibration_dir(dir)
setup_calibration_dir(dir)
dir |
Path name to the directory / folder where the files are located. |
Returns a caldat/ folder within the directory where all metaDigitise objects are stored.
Daniel Noble - [email protected]
# temporary directory tmp_dir <- tempdir() #Create the calibration folder in the directory specified that is used to store files. setup_calibration_dir(paste0(tmp_dir, "/"))
# temporary directory tmp_dir <- tempdir() #Create the calibration folder in the directory specified that is used to store files. setup_calibration_dir(paste0(tmp_dir, "/"))
Takes points user defined points from a single group mean_error plot or boxplot, in a set order, and returns them.
single_MB_extract(plot_type, cex)
single_MB_extract(plot_type, cex)
plot_type |
Type of plot |
cex |
point size |
Function that allows user to interface with function to specific each type of plot prior to digitising
specify_type()
specify_type()
The function will return the type of plot specified by the user and feed this argument back into metDigitise
Daniel Noble - [email protected]
Joel Pick - [email protected]
Summary method for class ‘metaDigitise’
## S3 method for class 'metaDigitise' summary(object, ...)
## S3 method for class 'metaDigitise' summary(object, ...)
object |
an R object of class ‘metaDigitise’ |
... |
further arguments passed to or from other methods. |
Data.frame
Joel Pick
asks user for base of logarithm, accept numeric or "e"
user_base(...)
user_base(...)
... |
arguments passed to other functions |
Gets values needed to calibrate axis coordinated. Modified from the digitize package
user_calibrate(object)
user_calibrate(object)
object |
metaDigitise object |
asks user for count
user_count(question)
user_count(question)
question |
question |
asks user for numeric
user_numeric(question)
user_numeric(question)
question |
question |
asks user for option from specified list
user_options(question, allowed_answers)
user_options(question, allowed_answers)
question |
question |
allowed_answers |
allowed answers |
Rotates/flips imported figures according to user input, in order to align them properly. Asks the user after each change if further alteration is required
user_rotate_graph(image_file)
user_rotate_graph(image_file)
image_file |
Image filename |
asks user for option from specified list
user_unique(question, previous_answers)
user_unique(question, previous_answers)
question |
question |
previous_answers |
allowed answers |