Title: | Improved Access for Blind Users |
---|---|
Description: | Blind users do not have access to the graphical output from R without printing the content of graphics windows to an embosser of some kind. This is not as immediate as is required for efficient access to statistical output. The functions here are created so that blind people can make even better use of R. This includes the text descriptions of graphs, convenience functions to replace the functionality offered in many GUI front ends, and experimental functionality for optimising graphical content to prepare it for embossing as tactile images. |
Authors: | A. Jonathan R. Godfrey [aut, cre]
|
Maintainer: | A. Jonathan R. Godfrey <[email protected]> |
License: | GPL-2 |
Version: | 1.1.0 |
Built: | 2025-02-07 04:29:55 UTC |
Source: | https://github.com/ajrgodfrey/brailler |
Blind users do not have access to the graphical output from R without printing the content of graph windows to an embosser of some kind. This is not as immediate as is required for efficient access to statistical output. The functions here are created so that blind people can make even better use of R. This includes the text descriptions of graphs, convenience functions to replace the functionality offered in many GUI front ends, and experimental functionality for optimising graphical content to prepare it for embossing as tactile images.
Package: | BrailleR |
Type: | Package |
Version: | 1.0.2 |
Date: | 2023-07-07 |
License: | GPL-2 |
A. Jonathan R. Godfrey Volker Sorge, Debra Warren, Timothy P. Bilton and James Thompson with other contributions.
Maintainer: A. Jonathan R. Godfrey <[email protected]>
Godfrey, A.J.R. (2013) “Statistical Software from a Blind Person's Perspective: R is the Best, but we can make it better”, The R Journal 5(1), pp73-79.
Creates the necessary XML file for a graph object (as long as it has a class assigned)
AddXML(x, file)
AddXML(x, file)
x |
a graph object for which a method exists |
file |
The XML file to be created. |
It will create a xml file which has useful information for creating a accessible svg graph experience. However for it to work properly the SVGThis
and BrowseSVG
function must also be used. As can be seen in the examples it takes a bit of verbose code to use this function. To create easy exploration webpages of a graph use MakeAccessibleSVG
.
NULL. This function is solely for the purpose of creating XML files in the current working directory or in a path of the user's choosing.
Volker Sorge, A. Jonathan R. Godfrey and James Thompson
P. Dengler et al. (2011) Scalable vector graphics (SVG) 1.1, second edition. W3C recommendation, W3C. http://www.w3.org/TR/2011/REC-XML11-20110816/
library(ggplot2) library(grid) # Create a simple histogram plot simpleHist = data.frame(x=rnorm(1e2)) |> ggplot(aes(x=x)) + geom_histogram() # Open a new PDF device, but #discard the output instead of saving it to a file pdf(NULL) # Plot the ggplot object on the current device simpleHist # Force the plot to be drawn on the device, #even though the output is being discarded grid.force() # Export the plot to an XML file AddXML(simpleHist, file = "histogram.xml") # Close the current PDF graphic device dev.off() #Cleaning up afterwards unlink("histogram.xml")
library(ggplot2) library(grid) # Create a simple histogram plot simpleHist = data.frame(x=rnorm(1e2)) |> ggplot(aes(x=x)) + geom_histogram() # Open a new PDF device, but #discard the output instead of saving it to a file pdf(NULL) # Plot the ggplot object on the current device simpleHist # Force the plot to be drawn on the device, #even though the output is being discarded grid.force() # Export the plot to an XML file AddXML(simpleHist, file = "histogram.xml") # Close the current PDF graphic device dev.off() #Cleaning up afterwards unlink("histogram.xml")
Creates the necessary details that feed into the text descriptions in the VI() function and into the descriptions used in the accessible online versions of the graphs.
Augment(x)
Augment(x)
x |
a graph object for which a method exists, or the current graphics device if set to NULL. |
Ought to be treated as an internal function and not used interactively.
The input object is returned with additions to the object. This does not break the S3 class.
A. Jonathan R. Godfrey and Volker Sorge
x=rnorm(1000) MyHist=Augment(hist(x)) MyHist
x=rnorm(1000) MyHist=Augment(hist(x)) MyHist
Fix up all those annoying typos that come up far too often.
AutoSpellCheck(file)
AutoSpellCheck(file)
file |
A vector of files to be checked |
The word list of typos and their corrections is called ‘AutoSpellList.csv’ and is stored in the user's MyBrailleR folder. The file can be updated to meet the user's specific needs. It should not be over-written by a new installation of BrailleR.
NULL. This function only affects external files.
A. Jonathan R. Godfrey
This function is a wrapper to the standard boxplot()
function in the graphics package. It adds detail to the stored object so that a better text description can be formulated using the VI()
method in the BrailleR package.
boxplot(x, ...)
boxplot(x, ...)
x |
a numeric variable. |
... |
additional arguments passed on to the plotting function. |
This function masks the function of the same name in the graphics package. The base R implementation does create an object, but does not give it a class attribute, the object does not store all graphical arguments that are passed to the boxplot()
function. The functionality should be no different at all for anyone who is not using the VI()
function to gain a more detailed text description of the boxplot. See the help page for the graphics::boxplot()
function to get a more complete description of boxplot creation.
An object of class boxplot. This class is just a placeholder for the contents of the object used to create a boxplot which would otherwise not be stored in a usable format. The class is not intended for the user; it is a tool that enables the BrailleR package to deliver a readable text version of the plot.
I would love to see this function become redundant. This will happen if the extra functionality is included in the boxplot()
function in the graphics package. This should be possible as the user experience will not be any different, no matter if the user is blind or sighted.
A. Jonathan R. Godfrey
The problem of not including class attributes for graphs was identified in: Godfrey, A.J.R. (2013) ‘Statistical Software from a Blind Person's Perspective: R is the Best, but we can make it better’, The R Journal 5(1), pp73-79.
The base R implementation of the boxplot
function should be consulted; see the entry in the graphics package
x=rnorm(1000) op = par(mfcol=c(2,1)) # the stamdard boxplot function returns MyBoxplot=graphics::boxplot(x, main="Example boxplot (graphics package)", horizontal=TRUE) MyBoxplot # while this version returns MyBoxplot=boxplot(x, main="Example boxplot (BrailleR package)", horizontal=TRUE) MyBoxplot par(op) # The VI() method then uses the extra information stored VI(MyBoxplot)
x=rnorm(1000) op = par(mfcol=c(2,1)) # the stamdard boxplot function returns MyBoxplot=graphics::boxplot(x, main="Example boxplot (graphics package)", horizontal=TRUE) MyBoxplot # while this version returns MyBoxplot=boxplot(x, main="Example boxplot (BrailleR package)", horizontal=TRUE) MyBoxplot par(op) # The VI() method then uses the extra information stored VI(MyBoxplot)
Visit the BrailleR Project home page for updates, instructions on how to join the mailing list which we call BlindRUG and get the latest downloads; or the Let's Use R Now (LURN) home page to read an online manual for using R. Other commonly used websites can be accessed quickly from the R prompt using the other convenience functions.
BrailleRHome() BrailleRInAction() LURN(BlindVersion = getOption("BrailleR.VI")) Google() google() R4DS() r4ds() WriteRHome()
BrailleRHome() BrailleRInAction() LURN(BlindVersion = getOption("BrailleR.VI")) Google() google() R4DS() r4ds() WriteRHome()
BlindVersion |
Use the version of Let's Use R Now tailored to an audience of blind users. |
Google is a key resource, and so should be the R for Data Science book.
NULL. These functions are for opening a web page and nothing will result in the R session.
A. Jonathan R. Godfrey
The first argument to this function must be a call to create a graph, such as a histogram. Instead of opening a new graphics device, the graph will be created in a pdf file, with all text being presented using a braille font. The function is somewhat experimental as the best braille font is not yet confirmed, and a number of examples need to be tested on a variety of embossers before full confidence in the function is given.
BRLThis(x, file)
BRLThis(x, file)
x |
the call to create a graph |
file |
A character string giving the filename where the image is to be saved. |
The user's chosen braille font must be installed. This might include the default font shipped as part of the package.
Nothing within the R session, but a pdf file will be created in the user's working directory.
A. Jonathan R. Godfrey. with contributions from JooYoung Seo and TK Lee.
Creates a single HTML file that embeds an SVG diagram and its XML annotations. Then launches a browser tab to allow viewing and interactive exploration of the SVG diagram.
BrowseSVG(file="test", key=TRUE, footer = TRUE, view=interactive(), ggplot_object = NULL)
BrowseSVG(file="test", key=TRUE, footer = TRUE, view=interactive(), ggplot_object = NULL)
file |
the filename for the HTML file; this should correspond to basename of an existing SVG and its XML annotations |
key |
include key for explorer's keyboard commands in webpage |
footer |
Whether the footer should be showed at bottom of webpage |
view |
launch in browser; this is the default when running in an interactive session |
ggplot_object |
This is the plot that the svg and XML are based off. If it is included than there will be the VI and the Describe information in the webpage. |
A HTML file is written in the current working directory. This HTML file will have the embeded svg and xml files as well as the javascript (diagcess) to help with the exploration of the graph. Note that it is required that you already have a svg and xml file in the current directory for it to work.
It is much easier however to just use the MakeAccessibleSVG
function directly which does it all for you
NULL. This function exists for its side effects only.
Volker Sorge and James A. Thompson
MakeAccessibleSVG, SVGThis, AddXML
library(ggplot2) simpleHist = data.frame(x=rnorm(1e2)) |> ggplot(aes(x=x)) + geom_histogram() file = "histogram" pdf(NULL) # create non-displaying graphics device for SVGThis and AddXML svgfile = SVGThis(simpleHist, paste0(file, ".svg"),createDevice=FALSE) xmlfile = AddXML(simpleHist, paste0(file, ".xml")) dev.off() # destroy graphics device, now that we're done with it BrowseSVG(file) #Cleaing up from BrowseSVG unlink(paste0(file, ".svg")) unlink(paste0(file, ".xml")) unlink(paste0(file, ".html"))
library(ggplot2) simpleHist = data.frame(x=rnorm(1e2)) |> ggplot(aes(x=x)) + geom_histogram() file = "histogram" pdf(NULL) # create non-displaying graphics device for SVGThis and AddXML svgfile = SVGThis(simpleHist, paste0(file, ".svg"),createDevice=FALSE) xmlfile = AddXML(simpleHist, paste0(file, ".xml")) dev.off() # destroy graphics device, now that we're done with it BrowseSVG(file) #Cleaing up from BrowseSVG unlink(paste0(file, ".svg")) unlink(paste0(file, ".xml")) unlink(paste0(file, ".html"))
Investigate an object, especially useful at any stage in a pipe chain.
CheckIt(x, ...) check_it(x, ...) what_is(x, ...) WhatIs(x, ...)
CheckIt(x, ...) check_it(x, ...) what_is(x, ...) WhatIs(x, ...)
x |
The object to be investigated and passed out again. |
... |
extra parameters to be passed on. |
The VI() functionality returns a character vector and is not useful inside a pipe chain. In effect, WhatIs() just adds the pipe chain convenience to the VI() tool, while CheckIt() looks at the structure of the data object. The latter is perhaps more useful if you are uncertain that the pipe chain is delivering what you hoped for.
These functions intentionally return (invisibly of course) the original input object so that they can be used within a pipe chain, as is commonly used by the Tidyverse.
A. Jonathan R. Godfrey
require(dplyr) airquality %>% CheckIt() %>% arrange(Ozone) %>% head()
require(dplyr) airquality %>% CheckIt() %>% arrange(Ozone) %>% head()
A blind user may not see the white space characters surrounding text or numbers in a csv file. These corrupt analyses and are annoying to fix.
CleanCSV(file)
CleanCSV(file)
file |
A vector of files to be checked |
Spits out the csv file in clean form, as well as a back up copy of the original file.
NULL. This function only affects external files.
A. Jonathan R. Godfrey
The chosen data object (data.frame, matrix, or vector) is stored in a temporary csv file. The file is opened while the R terminal/console is suspended until the <enter> key is pressed. This should be done once the spreadsheet software has been closed so that the temporary file is removed and the data object gets updated from the edited csv file. The user must save the csv file if changes are made.
DataViewer(x, Update = FALSE, New = NULL, Filename = NULL)
DataViewer(x, Update = FALSE, New = NULL, Filename = NULL)
x |
an object of class data.frame, matrix, or vector. A check is made for this condition. |
Update |
Logical. Will changes made in the spreadsheet editor be returned to the R session. |
New |
If Update=TRUE, the original object will be replaced unless a name for a new object is given. N.B. the default is to overwrite the original object. |
Filename |
Provide a filename if desired. N.B. this does not guarantee that the csv file will be kept. Do not use this function as a shortcut for saving csv files. |
The following steps should be taken if the intention is to view and possibly edit a data.frame, matrix, or vector:
There are a few quirks with respect to variables that could be interpreted as factors. The process of updating is to write a csv file using code write.csv() and then read it back using code read.csv() after it has been edited. Users must be aware that factors may not register as such, or that character vectors may be interpreted as factors.
If code Update=TRUE and code New=NULL, the original data object is overwritten. To create a new object the user must specify code New.
A. Jonathan R. Godfrey [email protected]
data(airquality) DataViewer(airquality, Update=TRUE, New="NewAirQuality")
data(airquality) DataViewer(airquality, Update=TRUE, New="NewAirQuality")
Functions that have become redundant courtesy of development outside the BrailleR package.
GetPython27(...) GetWxPython27(...) MakeAllInOneSlide(...) MakeSlidy(...) MakeSlideShow(...)
GetPython27(...) GetWxPython27(...) MakeAllInOneSlide(...) MakeSlidy(...) MakeSlideShow(...)
... |
cover for unnecessary arguments going to deprecated functions. |
These functions are redundant.
A message is printed to inform the user if they are called.
NULL.
A. Jonathan R. Godfrey, is responsible for the deprecation.
A function to help describe what a graph model would look like, to a vision impaired person.
Describe(x, VI=FALSE, ...) ## S3 method for class 'histogram' Describe(x, VI=FALSE, ...) ## S3 method for class 'ggplot' Describe(x,VI=FALSE, whichLayer=NULL, ...)
Describe(x, VI=FALSE, ...) ## S3 method for class 'histogram' Describe(x, VI=FALSE, ...) ## S3 method for class 'ggplot' Describe(x,VI=FALSE, whichLayer=NULL, ...)
x |
any R object |
VI |
Should |
whichLayer |
Only used with Describe.ggplot, if NULL will either display the layer if ggplot has one layer, ask user for input if it is an interactive session or print out all of the layers |
... |
other arguments, currently ignored |
Describe() is for explaining how a given type of graph appears to a sighted person and is intended for use by blind people who do not know how the graph looks. There is room to add hints for displaying the graphs in a more visually appealing manner.
The text description will only be generic to the plot type and not specific information for specific information see VI()
.
Unlike VI()
and ggplot Describe needs to be explicitly called to show its output.
A description in the format of a list. It will have the title, general info and RHints. If multiple layers of a ggplot are being described then it will be a list of descriptions for each layer.
A. Jonathan R. Godfrey and James A. Thompson
# Base R scatter = FittedLinePlot(NULL, x = rnorm(1e2), y = rnorm(1e2)) Describe(scatter) hist = hist(rnorm(1e3)) Describe(hist) # ggplot if(require(ggplot2)){ simplePoint = ggplot(NULL, aes(rnorm(1e2), rnorm(1e2))) + geom_point() Describe(simplePoint) }
# Base R scatter = FittedLinePlot(NULL, x = rnorm(1e2), y = rnorm(1e2)) Describe(scatter) hist = hist(rnorm(1e3)) Describe(hist) # ggplot if(require(ggplot2)){ simplePoint = ggplot(NULL, aes(rnorm(1e2), rnorm(1e2))) + geom_point() Describe(simplePoint) }
A method for creating dotplots. The functions call the stripchart
command from the graphics package and assign the output to have the class dotplot
.
dotplot(x, ...) ## S3 method for class 'formula' dotplot(x, ...)
dotplot(x, ...) ## S3 method for class 'formula' dotplot(x, ...)
x |
a vector or formula, where the right hand side of the formula is a factor. |
... |
other graphical parameters including those passed to |
This function was created as a result of being unable to assign all graphical parameters that are created when a formula is used in stripchart
. Users not intending to use the VI
method should use stripchart
instead.
An object of class dotplot. This class is just a placeholder for the contents of the object used to create a boxplot which would otherwise not be stored in a usable format. The class is not intended for the user; it is a tool that enables the BrailleR package to deliver a readable text version of the plot.
A. Jonathan R. Godfrey
This function is dependent on the stripchart
function from the graphics package. Consult its help page for more information.
VI(with(airquality, dotplot(Ozone~Month)))
VI(with(airquality, dotplot(Ozone~Month)))
Convenience functions for setting package options based on experimentation using specific embossers.
Premier100()
Premier100()
These functions are only relevant for owners of the specified embossers. Ownership of these models means the user has access to fonts that are licenced to the user.
The Premier 100 embosser uses standard 11 by 11.5 inch fanfold braille paper. Printing in landscape or portrait is possible.
Nothing. The functions are only used to set package options.
A. Jonathan R. Godfrey.
#Premier100() # Specify use of the Premier 100 embosser. #ChooseEmbosser() # reset to default: using no embosser.
#Premier100() # Specify use of the Premier 100 embosser. #ChooseEmbosser() # reset to default: using no embosser.
Simple wrapper functions to make it easier to replace the text in a file, possibly due to spelling errors, but perhaps to replace default text in a template file.
FindReplace(file, find, replace) Rnw2Rmd(file) UseTemplate(file, find=NULL, replace=NULL) UseTemplateList(newfile, fileList, find=NULL, replace=NULL)
FindReplace(file, find, replace) Rnw2Rmd(file) UseTemplate(file, find=NULL, replace=NULL) UseTemplateList(newfile, fileList, find=NULL, replace=NULL)
file , fileList
|
The external (text) file, template, or list of templates to be updated. |
newfile |
the file to write output to |
find |
The text to remove. |
replace |
The text to insert. |
The FindReplace function is purely intended for use on an external file whereas UseTemplate is intended to take a template file from within the BrailleR package and return the updated text to the calling environment.
Rnw2Rmd tries to replace Standard LaTeX commands and Sweave chunk headers with R markdown ones. It is NOT comprehensive, but it does get a long way towards a useful markdown file.
Obviously the specified file must exist for these functions to work.
FindReplace will replace the existing file with the updated version while UseTemplate will return a character string which will usually be pushed out to an R script or R markdown file.
A. Jonathan R. Godfrey
UseTemplate("DTGroupSummary.R") UseTemplate("DTGroupSummary.R", "DataName", "MyData")
UseTemplate("DTGroupSummary.R") UseTemplate("DTGroupSummary.R", "DataName", "MyData")
A cut back version of example() for obtaining the text used in examples on help pages without running those examples. The function is intended to help write markdown/Sweave documents.
GetExampleText(topic, package = NULL, lib.loc = NULL, character.only = FALSE, outFile="")
GetExampleText(topic, package = NULL, lib.loc = NULL, character.only = FALSE, outFile="")
topic |
name or literal character string: the online help topic the examples of which should be run. |
package |
a character vector giving the package names to look into for the topic, or NULL (the default), when all packages on the search path are used. |
lib.loc |
a character vector of directory names of R libraries, or NULL. The default value of NULL corresponds to all libraries currently known. If the default is used, the loaded packages are searched before the libraries. |
character.only |
a logical indicating whether topic can be assumed to be a character string. |
outFile |
an optional filename to save the results into. The default is to use a temporary file. |
The example() code was hacked back to form this utility function. It is probably a little heavy for what is needed but it works sufficiently at the time of creation.
a vector of character strings each element being one line of the examples from the corresponding help topic.
The work of Martin Maechler and others got tampered with by A. Jonathan R. Godfrey
You may wish to compare this with example
cat(paste(GetExampleText(mean), collapse="\n"))
cat(paste(GetExampleText(mean), collapse="\n"))
An interactive question-and-answer interface suitable for blind users wanting to set the options for using the BrailleR package.
GetGoing()
GetGoing()
Defaults are offered for all questions so that pressing <Enter> means no changes are made. Users answer yes/no questions as TRUE or FALSE respectively; the short form T or F is also allowed.
The user can also choose to perform various setup tasks using this interface.
NULL. This function is a tool for executing other functions that will set options and setup the package according to the user's wants.
A. Jonathan R. Godfrey
All options being set through this function have specific functions that achieve the same ends. For example, see GoSighted
for the options that are binary settings, or SetAuthor
for options requiring a specific character or numeric value to be chosen.
The setup functionality can be reviewed at MakeBatch
.
Anyone wishing to make use any of the WriteR applications must have pandoc installed.
Users that do not have Python and wxPython installed cannot use the WriteR application file as provided by the BrailleR package. This command gets an installer that can run independently of Python.
Downloaded files will be saved into the user's MyBrailleR folder.
Get7zip() GetCygwin(x64 = TRUE) GetPandoc() GetPython(x64 = TRUE) GetPython3(x64 = TRUE) GetRStudio() GetWriteR() GetWxPython() GetWxPython3()
Get7zip() GetCygwin(x64 = TRUE) GetPandoc() GetPython(x64 = TRUE) GetPython3(x64 = TRUE) GetRStudio() GetWriteR() GetWxPython() GetWxPython3()
x64 |
Use the 64 bit version if appropriate. |
This function assumes you have a current internet connection because it downloads a File.
The functions will download and install the chosen application. The installers are stored in the user's MyBrailleR folder.
NULL. The downloaded file is saved in the user's MyBrailleR folder.
Use of this function assumes you are happy for a file to be downloaded and saved on your hard drive. You can go to your MyBrailleR folder and delete the executable at any time.
A. Jonathan R. Godfrey, building on the installr package by Tal Galili
Allows the output from VI.ggplot to be searched and replaced based on a search pattern.
## S3 method for class 'VIgraph' grep(pattern, x, ...) ## S3 method for class 'VIgraph' gsub(pattern, replacement, x, ...)
## S3 method for class 'VIgraph' grep(pattern, x, ...) ## S3 method for class 'VIgraph' gsub(pattern, replacement, x, ...)
pattern |
Regular expression for matching, as per |
replacement |
Replacement text, as per |
x |
object returned by |
... |
other arguments passed on to |
The BrailleR package redefines the grep
and gsub
functions as
generic functions (that dispatch on the x
argument),
with base::grep
and base::gsub
as the default methods.
This grep.VIgraph
method behaves like base::grep
with value=TRUE
(i.e., it returns the matched values, not the indices).
Returns a new object of the same type as that returned by VI.ggplot, but with the text component restricted to only those lines that matched the pattern or with the text component replaced.
Debra Warren and Paul Murrell
if (require(ggplot2)) { grep("axis", VI(qplot(1,1))) gsub("labels", "tick labels", VI(qplot(1,1))) }
if (require(ggplot2)) { grep("axis", VI(qplot(1,1))) gsub("labels", "tick labels", VI(qplot(1,1))) }
This function is a wrapper to the standard hist()
function in the graphics package. It adds detail to the stored object so that a better text description can be formulated using the VI()
method in the BrailleR package.
hist(x, ...)
hist(x, ...)
x |
a numeric variable. |
... |
additional arguments passed on to the plotting function. |
This function masks the function of the same name in the graphics package. Even though the base R implementation does create an object of class histogram, the object does not store all graphical arguments that are passed to the hist()
function. The functionality should be no different at all for anyone who is not using the VI()
function to gain a more detailed text description of the histogram. See the help page for the graphics::hist() function to get a more complete description of histogram creation.
An object of class histogram as per the hist()
function from the graphics package, with the addition of any calls to the main title or axis labels.
A. Jonathan R. Godfrey
Godfrey, A.J.R. (2013) ‘Statistical Software from a Blind Person's Perspective: R is the Best, but we can make it better’, The R Journal 5(1), pp73-79.
The base R implementation of the hist
function should be consulted, using the entry in the graphics package
x=rnorm(1000) # the stamdard hist function returns MyHist=graphics::hist(x, xlab="random normal values", main="Example histogram (graphics package)") MyHist # while this version returns MyHist=hist(x, xlab="random normal values", main="Example histogram (BrailleR package)") MyHist # The VI() method then uses the extra information stored VI(MyHist)
x=rnorm(1000) # the stamdard hist function returns MyHist=graphics::hist(x, xlab="random normal values", main="Example histogram (graphics package)") MyHist # while this version returns MyHist=hist(x, xlab="random normal values", main="Example histogram (BrailleR package)") MyHist # The VI() method then uses the extra information stored VI(MyHist)
A substitute for the history function from the utils package.
history(max.show = 25, reverse = FALSE, pattern, ...)
history(max.show = 25, reverse = FALSE, pattern, ...)
max.show |
The maximum number of lines to show. Inf will give all of the currently available history. |
reverse |
logical. If true, the lines are shown in reverse order. Note: this is not useful when there are continuation lines. |
pattern |
A character string to be matched against the lines of the history. When supplied, only unique matching lines are shown. |
... |
Arguments to be passed to grep when doing the matching. |
This function exists because the standard history function in the utils package opens the internal pager that cannot be used by a blind person's screen reading software.
Nothing is returned to the workspace. This function exists for the creation and viewing of the temporary file that holds the list of commands issued in the current workspace.
Duncan Murdoch, with testing by A. Jonathan R. Godfrey.
the original history
function.
Some functions that probably weren't really necessary, but proved useful at some stage.
FindCSSFile(file) InQuotes(x) nNonMissing(x)
FindCSSFile(file) InQuotes(x) nNonMissing(x)
x |
an object that is of the form needed by the internal function concerned. |
file |
a filename to look for in the user's css folder or locally. |
These should be fairly obvious from the name of the function
A. Jonathan R. Godfrey
Template email messages have been created to help you send feedback to the package creator or to join the Blind R Users Group email list. The BlindRUG email list is a forum where we can discuss issues about using R as a blind person. List traffic is light. You can join and leave as you see fit.
JoinBlindRUG() ThankYou()
JoinBlindRUG() ThankYou()
You will get an email prepared in your selected email client. If you're wanting to join the BlindRUG list, just press send without editing that message at all. Pretty soon, the server will send you a message that you will need to reply to in order to finalise the subscription. Once you have joined the list you will be sent an initial welcome message.
If you are sending in feedback, then please do tell me how you heard about BrailleR and where you are studying or working.
NULL. These functions are intended for their side effects.
A. Jonathan R. Godfrey
Creates the necessary SVG and XML files for a graph object (as long as graph type is supported). Then turns them into a html file and opens it for viewing (if a interactive session) in your browser.
MakeAccessibleSVG(x, file = paste0(deparse(substitute(x)), "-SVG"), view=interactive(), cleanup = TRUE, ...) ## S3 method for class 'ggplot' MakeAccessibleSVG(x, file = paste0(deparse(substitute(x)), "-SVG"), view=interactive(), cleanup = TRUE, VI_and_Describe = TRUE, ...)
MakeAccessibleSVG(x, file = paste0(deparse(substitute(x)), "-SVG"), view=interactive(), cleanup = TRUE, ...) ## S3 method for class 'ggplot' MakeAccessibleSVG(x, file = paste0(deparse(substitute(x)), "-SVG"), view=interactive(), cleanup = TRUE, VI_and_Describe = TRUE, ...)
x |
a graph object for which a method exists |
file |
The shared name for the SVG, XML and HTML files to be created. It will also be the title of the html webpage. |
view |
launch in browser; this is the default when in interactive session |
cleanup |
Whether the function should remove the svg and xml files after they have bee embedded into the hmtml file. |
VI_and_Describe |
Whether to include the VI and Describe outputs in the built webpage. |
... |
arguments passed on to other methods/functions |
This function can be thought of as just a shortcut for quickly creating a SVG webpage for exploration. Each individual step can be done with the SVGThis()
, AddXML()
and BrowseSVG()
functions. Using this is currently the quickest workflow for accessing the SVG features of BrailleR.
More information can be found in the Exploring graphs vignette.
It has support for some of the base plots however you can consider this support deprecated.
NULL. This function is solely for the purpose of creating SVG and XML files and displaying them
A. Jonathan R. Godfrey, Volker Sorge and James A. Thompson
P. Dengler et al. (2011) Scalable vector graphics (SVG) 1.1, second edition. W3C recommendation, W3C. http://www.w3.org/TR/2011/REC-XML11-20110816/
#Base R #boxplot = boxplot(rnorm(1e4)) #MakeAccessibleSVG(boxplot, view = F) #attach(airquality) #scatter = ScatterPlot(x=Wind, y=Ozone, pch=4, base=TRUE) #detach(airquality) #MakeAccessibleSVG(scatter) #ggplot2 library(ggplot2) tsplot = TimeSeriesPlot(airquality, x=airquality$Temp) MakeAccessibleSVG(tsplot) barChart = ggplot(Orange, aes(x = Tree)) + geom_bar() MakeAccessibleSVG(barChart) histogram = ggplot(attenu, aes(x=dist)) + geom_histogram() histogram MakeAccessibleSVG(histogram) # Cleaning up unlink("barChart-SVG.html") unlink("histogram-SVG.html") unlink("tsplot-SVG.html")
#Base R #boxplot = boxplot(rnorm(1e4)) #MakeAccessibleSVG(boxplot, view = F) #attach(airquality) #scatter = ScatterPlot(x=Wind, y=Ozone, pch=4, base=TRUE) #detach(airquality) #MakeAccessibleSVG(scatter) #ggplot2 library(ggplot2) tsplot = TimeSeriesPlot(airquality, x=airquality$Temp) MakeAccessibleSVG(tsplot) barChart = ggplot(Orange, aes(x = Tree)) + geom_bar() MakeAccessibleSVG(barChart) histogram = ggplot(attenu, aes(x=dist)) + geom_histogram() histogram MakeAccessibleSVG(histogram) # Cleaning up unlink("barChart-SVG.html") unlink("histogram-SVG.html") unlink("tsplot-SVG.html")
Make a pandoc options file for use with a named R markdown file.
MakeAllFormats(RmdFile, BibFile = "")
MakeAllFormats(RmdFile, BibFile = "")
RmdFile |
The name of the R markdown file to be converted. |
BibFile |
Name of the bibtex database file to include. |
The options are based on the current best set of possible outcomes. The two html file options use different representations of any mathematical equations. The Microsoft Word file uses the native equation format which is not accessible for blind people using screen readers.
Nothing in the R console/terminal. The function is used for its side effects in the working directory.
A. Jonathan R. Godfrey.
Convenience function for creating batch files that can be used under Windows to process R scripts, R markdown, and quarto files. The main idea is that a user can click on the batch files within Windows Explorer to get the desired task done faster.
MakeBatch(file=NULL, static = FALSE) MakeAdminBatch()
MakeBatch(file=NULL, static = FALSE) MakeAdminBatch()
file |
A character string for the file to be processed. The file need not yet exist. The extension must be one of Qmd, R, or Rmd. |
static |
Should a fixed version of R be used? It will be the current version if set to TRUE or allowed to vary with new installations. |
These batch files are not for use in an R session. They do need to be created in an interactive session though. They are to provide users a means to process R scripts, quarto and Rmarkdown documents without needing to open an R session thereafter.
If a file is specified, the function will create a single batch file that will process the file appropriately. Processing an R script will generate a Rout file, while an Rmd file is converted into HTML. Quarto files are tied to two batch files; one renders the document and should be used first, while the other is for the continuous previewing of the document in a browser.
If no file is specified, the MakeBatch() function creates various files in the current working directory to show how the tools can be used.
Files starting with the word test are for testing the batch files. An R script and an Rmarkdown file were created as well as the batch files that will process them into a Rout file and an HTML document respectively. Pressing <enter> on these test*.bat files will process the test files appropriately.
The other three batch files (ending in .bat) and any created using MakeAdminBatch() need to be moved to a folder on the user's path so that they can be called from anywhere. They could also be manually edited to suit the user's needs.
The path.txt file shows the user what folders are already on the path list. The user can review this list and decide to alter the system variable if they so choose. The path.txt file has no value otherwise.
NULL. The user is informed about the files that are created by way of message().
Once the RBatch.bat file has been moved to the desired folder that is included in the path for your system you can follow the steps below to get full value from this functionality.
1. Open windows explorer, and browse to the folder containing the test files.
2. Select the test.R script.
3. Under the File menu, look for the item Open with... (This might already be a submenu for some users; if so, the last item is Choose default program.)
4. We are going to choose to use a program on our computer. Do not go looking on the internet to see which program we need.
5. You may be able to write a description of the file type. This is an R script but it may not yet be registered as such. Providing this detail is optional.
6. When given the chance to browse for the program to open the test.R script, browse to the folder where you placed Rbatch.bat and select it.
7. When you select OK, the test.R script will be processed by RBatch.bat and a new file test.Rout will be created.
8. Open test.Rout in any text editor you like. This file has the appearance of an R session window except for some processing time detail at the end. You will be able to read the commands that were originally in test.R as well as the output from these commands.
A. Jonathan R. Godfrey with testing by JooYoung Seo
The Rnw files used for vignettes use Linux style line breaks that make reading vignette source files difficult for Windows users. A Python script is called which converts the line breaks and saves the vignette source in the user's MyBrailleR folder.
MakeReadable(pkg)
MakeReadable(pkg)
pkg |
The package to investigate for vignette source files. |
Must have Python 3.8 installed for this function to work.
Nothing in the workspace. All files are stored in a vignettes folder within MyBrailleR.
A. Jonathan R. Godfrey
Time-saving functions that help create files in more useful formats for later use.
History2Rmd(file = "History.Rmd") History2Qmd(file = "History.Qmd") R2Rmd(ScriptFile) R2Qmd(ScriptFile) ProcessAllMd(dir =".") ProcessAllRmd(dir =".", method = "render") RemoveBOM(file)
History2Rmd(file = "History.Rmd") History2Qmd(file = "History.Qmd") R2Rmd(ScriptFile) R2Qmd(ScriptFile) ProcessAllMd(dir =".") ProcessAllRmd(dir =".", method = "render") RemoveBOM(file)
dir |
The directory to find files. |
file |
the name of the file to be created or modified. |
method |
The method used to process Rmd files; one of "render" or "knit2html". |
ScriptFile |
the R script to be processed into the R markdown file. |
The History2Rmd() function was intended for turning a short interactive R session into an R markdown file. Lines of code are all separated into distinct code chunks in the Rmd file. the resulting file will need to be edited if commands have spanned more than one line.
The R2Rmd() function does try to limit the number of blank lines copied from the R script into the Rmarkdown file. The Rmd file may need some editing.
Once all Rmd files have been edited, the user can have all the Rmd files in a folder processed using ProcessAllRmd(). A similar function ProcessAllMd() exists to process any plain markdown files which do not need knitting.
NULL. These functions are for creating files in the current working directory.
A. Jonathan R. Godfrey
These functions were inspired by the spin
functionality of the knitr package. You may wish to move onto using it for more features.
Writes the single command “library(BrailleR)” to a .First() function in .Rprofile in the current working directory. This forces the BrailleR package to be automatically loaded when R is opened in this working directory.
MakeRprofile(Overwrite = FALSE)
MakeRprofile(Overwrite = FALSE)
Overwrite |
Logical: Should an existing .Rprofile file be overwritten? |
Nothing. This function is used for its side effect of creation of a file in the current working directory. A warning message is created if the file exists and Overwrite=FALSE.
A. Jonathan R. Godfrey.
These functions used to take a set of Rmd files in alphabetical order and makes them a set of linked HTML files or a single slidy presentation suitable for delivering a presentation., or a single plain HTML file suitable for distribution They have been overtaken by bookdown, pkgdown, rmarkdown, etc.
An R script for a new function is created in the working directory. It includes Roxygen commented lines for the documentation with sensible defaults where possible.
NewFunction(FunctionName, args = NULL, NArgs = 0)
NewFunction(FunctionName, args = NULL, NArgs = 0)
FunctionName |
The name of the function and file to create. |
args |
a vector of argument names |
NArgs |
an integer number of arguments to assign to the function. |
A file is saved in the current working directory that has a template for a function with a set of arguments (if supplied). The file still needs serious editing before insertion into a package.
No objects are created in the workspace. The only outcome is the template file and a message to let the user know the job was completed.
A. Jonathan R. Godfrey.
Many standard Windows tools can be opened from the Run dialogue, but this starts them in the standard locations, when R users may want them opened or saved in the current working directory.
Notepad(file = "")
Notepad(file = "")
file |
A character string for the file to be opened; it will be created if it does not yet exist. |
If a file specified does not yet exist in the current folder, the standard notepad editor asks the user if a new file is wanted.
NULL. The functions are for their external effects only. Control is still available in the R console/terminal.
A. Jonathan R. Godfrey
A convenience function that creates an analysis for a continuous response variable with one grouping factor. The function creates a number of graphs and tables relevant for the analysis.
OneFactor(Response, Factor, Data = NULL, HSD = TRUE, AlphaE = 0.05, Filename = NULL, Folder = NULL, VI = getOption("BrailleR.VI"), Latex = getOption("BrailleR.Latex"), View = getOption("BrailleR.View"), Modern=TRUE)
OneFactor(Response, Factor, Data = NULL, HSD = TRUE, AlphaE = 0.05, Filename = NULL, Folder = NULL, VI = getOption("BrailleR.VI"), Latex = getOption("BrailleR.Latex"), View = getOption("BrailleR.View"), Modern=TRUE)
Response |
Name of the continuous response variable. |
Factor |
The grouping factor. |
Data |
The data.frame that contains both the response and the factor. |
HSD |
Logical: Should Tukey's HSD be evaluated for the data? |
AlphaE |
The family-wise Type I error rate for Tukey's HSD calculations. |
Filename |
Name of the Rmarkdown and HTML files to be created. A default will be created that uses the names of the variables if this is left set to NULL. |
Folder |
Name of the folder to store graph and LaTeX files. A default will be created based on the name of the data.frame being used. |
VI |
Logical: Should the VI method for blind users be employed? |
Latex |
Logical: Should the tabulated sections be saved in LaTeX format? |
View |
Logical: Should the HTML file be opened for inspection? |
Modern |
Logical: Should the graphics be created using ggplot? |
This function writes an R markdown file that is knitted into HTML and purled into an R script. All graphs are saved in subdirectories in png, eps, pdf and svg formats. Tabulated results are stored in files suitable for importing into LaTeX documents.
This function is used for creation of the files saved in the working directory and a few of its subdirectories.
A. Jonathan R. Godfrey and Timothy P. Bilton
Other convenience functions can be investigated via their help pages. See UniDesc
, OnePredictor
, and TwoFactors
DIR = getwd() setwd(tempdir()) data(airquality) library(dplyr) library(knitr) # the following line returns an error: ## OneFactor("Ozone", "Month", airquality, View=FALSE) # so we make a copy of the data.frame, and fix that: airquality2 = airquality |> mutate(Month = as.factor(Month)) # and now all is good to try: OneFactor("Ozone", "Month", airquality2) # N.B. Various files and a folder were created in a temporary directory. # Please investigate them to see how this function worked. setwd(DIR)
DIR = getwd() setwd(tempdir()) data(airquality) library(dplyr) library(knitr) # the following line returns an error: ## OneFactor("Ozone", "Month", airquality, View=FALSE) # so we make a copy of the data.frame, and fix that: airquality2 = airquality |> mutate(Month = as.factor(Month)) # and now all is good to try: OneFactor("Ozone", "Month", airquality2) # N.B. Various files and a folder were created in a temporary directory. # Please investigate them to see how this function worked. setwd(DIR)
A convenience function for generating exploratory graphs and numeric summaries, regression analysis output, and the residual analysis of the simple linear model.
OnePredictor(Response, Predictor, Data = NULL, Filename = NULL, Folder = NULL, VI = getOption("BrailleR.VI"), Latex = getOption("BrailleR.Latex"), View = getOption("BrailleR.View"), Modern=TRUE)
OnePredictor(Response, Predictor, Data = NULL, Filename = NULL, Folder = NULL, VI = getOption("BrailleR.VI"), Latex = getOption("BrailleR.Latex"), View = getOption("BrailleR.View"), Modern=TRUE)
Response |
Name of the continuous response variable. |
Predictor |
Name of the continuous response variable. |
Data |
The data.frame that contains both the response and the factor. |
Filename |
Name of the Rmarkdown and HTML files to be created. A default will be created that uses the names of the variables if this is left set to NULL. |
Folder |
Name of the folder to store graph and LaTeX files. A default will be created based on the name of the data.frame being used. |
VI |
Logical: Should the VI method for blind users be employed? |
Latex |
Logical: Should the tabulated sections be saved in LaTeX format? |
View |
Logical: Should the HTML file be opened for inspection? |
Modern |
Logical: Should the graphics be created using ggplot? |
This function writes an R markdown file that is knitted into HTML and purled into an R script. All graphs are saved in subdirectories in png, eps, pdf and svg formats. Tabulated results can be stored in files suitable for importing into LaTeX documents.
This function is used for creation of the files saved in the working directory and a few of its subdirectories.
A. Jonathan R. Godfrey and Timothy P. Bilton
Other convenience functions can be investigated via their help pages. See UniDesc
, OneFactor
, and TwoFactors
if(require(nortest)){ # used in a dependent function's Rmd file library(knitr) DIR = getwd() setwd(tempdir()) data(airquality) OnePredictor("Ozone", "Wind", airquality) # N.B. Various files and a folder were created in a temporary directory. # Please investigate them to see how this function worked. setwd(DIR) }
if(require(nortest)){ # used in a dependent function's Rmd file library(knitr) DIR = getwd() setwd(tempdir()) data(airquality) OnePredictor("Ozone", "Wind", airquality) # N.B. Various files and a folder were created in a temporary directory. # Please investigate them to see how this function worked. setwd(DIR) }
A set of convenience functions to alter the settings that control how much output is generated and displayed by other BrailleR functions.
GoBlind() GoSighted() GoAdvanced() GoNovice() LatexOn() LatexOff() ViewOn() ViewOff()
GoBlind() GoSighted() GoAdvanced() GoNovice() LatexOn() LatexOff() ViewOn() ViewOff()
The function names should be fairly self explanatory. GoBlind()
and GoSighted()
control use of the VI()
method which provides extra information about graphical objects for the assistance of blind users; GoAdvanced
(less verbose) and GoNovice()
(more verbose) control how much output a user will be given; ViewOn()
and ViewOff()
are for the automatic opening of HTML
pages created by BrailleR functions; and LatexOn()
and LatexOff()
control the production of tables into LaTeX via the xtable package.
Nothing is returned. These functions are only used for their side effects.
A. Jonathan R. Godfrey
See these settings applied as default arguments to UniDesc
Convert all files in the current working directory of one type into another type using Pandoc.
PandocAll(intype = "docx", outtype = "html")
PandocAll(intype = "docx", outtype = "html")
intype , outtype
|
File formats denoted using the standard extensions. |
This will over-write existing files. It was intended to take MS Word files and convert to HTML, but other conversions are possible. See the pandoc documentation for full details.
Files will be created in the current working directory. CRAN policy says you must have been informed that this is happening. This help file is your warning.
A. Jonathan R. Godfrey
Extensive guidance on using pandoc is available
A blind user often has difficulty reading the content provided in pdf files. This tool is quite experimental at this stage.
pdf2html(pdffile, htmlfile=sub(".pdf", ".html", pdffile), HeadingLevels=4, PageTag="h6")
pdf2html(pdffile, htmlfile=sub(".pdf", ".html", pdffile), HeadingLevels=4, PageTag="h6")
pdffile |
A pdf file to be converted. |
htmlfile |
The filename for the resulting html; default is to change the file extension. |
HeadingLevels |
The depth of heading level to include; tags h1, h2, h3... are used. |
PageTag |
Which tag to use for replacing page numbers; default is h6, but any tag could be used. |
A Python 2.7 module is the basis for the conversion. Some post-processing can be done to further enhance the readability of the resulting html file.
Logical: Has the conversion completed. Note that this does not mean the result is totally useful as this will depend on the quality of the input file.
A. Jonathan R. Godfrey
These functions save a transcript of your commands and their output to a script file.
They work as combinations of sink
and history
with a
couple of extra bells and whistles.
txtStart(file, commands=TRUE, results=TRUE, append=FALSE, cmdfile, visible.only=TRUE) txtOut(Filename=NULL) txtStop() txtComment(txt,cmdtxt) txtSkip(expr)
txtStart(file, commands=TRUE, results=TRUE, append=FALSE, cmdfile, visible.only=TRUE) txtOut(Filename=NULL) txtStop() txtComment(txt,cmdtxt) txtSkip(expr)
file |
Text file to save transcript in |
Filename |
A filename to be given for the |
commands |
Logical, should the commands be echoed to the transcript file |
results |
Logical, should the results be saved in the transcript file |
append |
Logical, should we append to |
cmdfile |
A filename to store commands such that it can be
|
visible.only |
Should non-printed output be included, not currently implemented. |
txt |
Text of a comment to be inserted into |
cmdtxt |
Text of a comment to be inserted into |
expr |
An expression to be executed without being included in
|
These functions are used to create transcript/command files of your R session. In the original TeachingDemos package from which the functions were obtained, there are 3 sets of functions. Those starting with "txt",those starting with "etxt", and those starting with wdtxt.
The "txt" functions create a plain text transcript while the "etxt" functions create a text file with extra escapes and commands so that it can be post processed with enscript (an external program) to create a postscript file and can include graphics as well. The postscript file can be converted to pdf or other format file. The "wdtxt" functions will insert the commands and results into a Microsoft Word document.
Users wishing to have the additional functionality that the "etxt" and "wdtxt" functions provide are advised to make use of the TeachingDemos package.
If results
is TRUE and commands
is FALSE then the result
is similar to the results of sink
. If commands
is true as well then the results will show both the commands
and results similar to the output on the screen. If both
commands
and results
are FALSE then pretty much
the only thing these functions will accomplish is to waste some
computing time.
If cmdfile
is
specified then an additional file is created with the commands
used (similar to the history
command), this file can be
used with source
or copied and
pasted to the terminal.
The Start function specifies the file/directory to create and starts the transcript, The prompts are changed to remind you that the commands/results are being copied to the transcript. The Stop function stops the recording and resets the prompts.
The txtOut function is a short cut for the txtStart command that uses the current date and time in the filenames for the transcript and command files. This function is not part of the TeachingDemos package.
The R parser strips comments and does some reformatting so the
transcript file may not match exactly with the terminal
output. Use the txtComment
functions to add a comment. This will show up as a line offset
by whitespace in the transcript file.
If cmdtxt
is specified then that line
will be inserted into cmdfile
preceded by a hash symbol so it
will be skipped if sourced or copied.
The txtSkip
function will run the
code in expr
but will not include the commands or
results in the transcript file (this can be used for side
computations, or requests for help, etc.).
Most of these commands do not return anything of use. The exception is:
txtSkip
returns the value of expr
.
These commands do not do any fancy formatting of output, just what you
see in the regular terminal window. If you want more formatted output
then you should look into Sweave
or the use of markdown documents..
Do not use these functions in combination with the R2HTML package or sink
.
Greg Snow, [email protected] is the original author, but Jonathan Godfrey [email protected] is responsible for the implementation in the BrailleR package (including the txtOut()
function), and should therefore be your first point of contact with any problems. If you find the functions useful, you may wish to send a vote of thanks in Greg's direction.
sink
, history
,
Sweave
, the odfWeave package, the R2HTML package, the
R2wd package
## Not run: txtStart() txtComment('This is todays transcript') date() x <- rnorm(25) summary(x) stem(x) txtSkip(?hist) hist(x) Sys.Date() Sys.time() ## End(Not run)
## Not run: txtStart() txtComment('This is todays transcript') date() x <- rnorm(25) summary(x) stem(x) txtSkip(?hist) hist(x) Sys.Date() Sys.time() ## End(Not run)
It is easier to run a script if we know the packages will be installed if this additional step is necessary. Installation uses the RStudio mirror of CRAN.
Require(pkg)
Require(pkg)
pkg |
the package to be loaded/installed. |
logical: to say that the package has been successfully loaded (invisible)
A. Jonathan R. Godfrey
require from the base package
This function is a wrapper to the standard plott()
function in the graphics package. It is tailored to generating a scatter plot, and adds detail to the stored object so that a better text description can be formulated using the VI()
method in the BrailleR package. The function will become redundant once all other BrailleR functionality is working well with ggplot style graphics.
ScatterPlot(.data, x, y, base=FALSE, ...) FittedLinePlot(.data, x, y, line.col=2, base=FALSE, ...)
ScatterPlot(.data, x, y, base=FALSE, ...) FittedLinePlot(.data, x, y, line.col=2, base=FALSE, ...)
.data |
the data.frame from which variables are drawn. Ignored if using base graphics. |
x , y
|
numeric variables. N.B. you must explicitly specify them by naming the arguments. |
base |
Use base style graphics. Default is to use ggplot2 instead. |
line.col |
colour to be used for the fitted line; col is used to modify the colour of the points. |
... |
additional arguments passed on to the plotting function. |
These wrapper functions will draw the graphics plots for a set of points. The only difference is that the fitted line is added for the FittedLinePlot()
The original style used base graphics. Given the improved interaction of ggplot graphics for BrailleR users, the preferred style from v0.33.0 onwards was the ggplot style.
Either:
1. An object of class scatterplot of fittedlineplot, with the addition of any calls to the main title or axis labels being explicitly stored even if a zero length character string, or
2. a ggplot object.
A. Jonathan R. Godfrey
Godfrey, A.J.R. (2013) ‘Statistical Software from a Blind Person's Perspective: R is the Best, but we can make it better’, The R Journal 5(1), pp73-79.
attach(airquality) op = par(mfcol=c(3,2)) plot(x=Wind, y=Ozone, pch=4) test1 = ScatterPlot(x=Wind, y=Ozone, pch=4, base=TRUE) test1 #does the plot method work? plot(x=Wind,y= Ozone) abline(coef(lm(Ozone~Wind)), col=4) test2 = FittedLinePlot(x=Wind, y=Ozone, line.col=4, base=TRUE) test2 #does the plot method work? par(op) detach(airquality)
attach(airquality) op = par(mfcol=c(3,2)) plot(x=Wind, y=Ozone, pch=4) test1 = ScatterPlot(x=Wind, y=Ozone, pch=4, base=TRUE) test1 #does the plot method work? plot(x=Wind,y= Ozone) abline(coef(lm(Ozone~Wind)), col=4) test2 = FittedLinePlot(x=Wind, y=Ozone, line.col=4, base=TRUE) test2 #does the plot method work? par(op) detach(airquality)
Retrieve the output from the last n top level calls, or the hole current session. These functions are designed to cater for situations where the output scrolls off the screen and is no longer accessible to a screen reader user.
GrabLast(file = "", n=1) SessionLog(file = "", n=NULL) ShowMe(file = NULL, n=1)
GrabLast(file = "", n=1) SessionLog(file = "", n=NULL) ShowMe(file = NULL, n=1)
file |
a filename; if left unspecified, the output is printed in the console |
n |
the number of calls to retrieve |
A stack of top level calls and the resulting output is stored, courtesy of a setting established on package load. These functions retrieve elements from that stack. The ShowMe() function automatically opens the file created for immediate viewing.
NULL, invisibly; not the output which is either printed to the console or the file specified
Gabe Becker and some very minor edits from A. Jonathan R. Godfrey
Some package options have arguments which need validation. Setting the default significance level for analyses was the first function of this kind. Setting the name of the user to be inserted into documents was the second. Others are detailed further below.
ChooseEmbosser(Embosser = "none", Permanent = interactive(), Local = interactive()) ChooseStyle(css = "BrailleR.css", Permanent = interactive(), Local = interactive()) ChooseSlideStyle(css = "JGSlides.css", Permanent = interactive(), Local = interactive()) ResetDefaults(Local = interactive()) SetAuthor(name = "BrailleR", Permanent = interactive(), Local = interactive()) SetBRLPointSize(pt, Permanent = FALSE, Local = interactive()) SetPaperHeight(Inches, Permanent = FALSE, Local = interactive()) SetPaperWidth(Inches, Permanent = FALSE, Local = interactive()) SetLanguage(Language = "en_us", Permanent = interactive(), Local = interactive()) SetMakeUpper(Upper, Permanent = interactive(), Local = interactive()) SetPValDigits(digits, Permanent = interactive(), Local = interactive()) SetSigLevel(alpha, Permanent = interactive(), Local = interactive())
ChooseEmbosser(Embosser = "none", Permanent = interactive(), Local = interactive()) ChooseStyle(css = "BrailleR.css", Permanent = interactive(), Local = interactive()) ChooseSlideStyle(css = "JGSlides.css", Permanent = interactive(), Local = interactive()) ResetDefaults(Local = interactive()) SetAuthor(name = "BrailleR", Permanent = interactive(), Local = interactive()) SetBRLPointSize(pt, Permanent = FALSE, Local = interactive()) SetPaperHeight(Inches, Permanent = FALSE, Local = interactive()) SetPaperWidth(Inches, Permanent = FALSE, Local = interactive()) SetLanguage(Language = "en_us", Permanent = interactive(), Local = interactive()) SetMakeUpper(Upper, Permanent = interactive(), Local = interactive()) SetPValDigits(digits, Permanent = interactive(), Local = interactive()) SetSigLevel(alpha, Permanent = interactive(), Local = interactive())
alpha |
The level of alpha to be used for analyses. Must be between zero and one or a warning is given and the option is not changed. |
css |
a cascading style sheet file to be inserted in HTML documents created by convenience functions. The file must be placed in the css folder within the MyBrailleR folder created by the user when prompted, for this to work. |
digits |
The number of decimal places to display. Must be an integer greater than one or a warning is given and the option is not changed. |
Embosser |
the name of the embosser to be used for tactile images. Not all embossers will be immediately supported by the package. The supported embossers are listed in the relevant section below. Please contact the package maintainer to introduce a new embosser to the list of supported models. |
Inches |
The size of the area to use for embossing. This should be the size of the embossed area not the actual size of the paper itself. |
Language |
The character string for the language files to be used in spell checking. |
Local |
Should the local copy of BrailleROptions be updated? |
name |
a character string to be used for author details in various file writing functions. |
Permanent |
Should the change be made permanent? Set to FALSE for a temporary change. |
pt |
The point size of the chosen braille font. |
Upper |
Should the initial letter of variable names be capitalised in captions and filenames? Logical, initially set to TRUE. |
More convenience functions for BrailleR users. Most are self explanatory, but the following details should be noted.
The Choose...() functions are used for establishing default parameters for other details. The ChooseStyle() command can be used to alter the appearance of HTML output by way of cascading style sheets. You can create your own css file and add it to your user folder called MyBrailleR before calling this function.
The ChooseEmbosser() will look for the default settings recommended for particular types of embosser. Initial testing was done on a Tiger Premier 100 embosser manufactured by ViewPlus Inc. The default paper size is 11 by 11.5 inches, but the recommended embossing area for graphics is 10 by 10 inches. Please submit your preferences for any embosser to the package maintainer.
The Set..() commands will let the user specify any desired value for the options as long as it is valid: Options assumed to be character strings are checked to be so, integers must be integers and a proportion must be between zero and one.
SetPaperHeight and SetPaperWidth are temporary changes by default because some types of images are not meant to use the maximum area set down by the original default settings for an embosser. Careful experimentation may be required to get optimal results. If permanent changes are desired, then please contact the package maintainer to explain why you have made these changes so that we can help other users get the best from a wide range of embossers.
SetPValDigits() is used for rounding purposes to avoid the use of scientific notation. It is not used for determining significance.
NULL. These functions set package options.
A. Jonathan R. Godfrey
# SetSigLevel(5) # not a valid alpha SetSigLevel(0.05, Local=FALSE) # valid alpha value SetAuthor(Local=FALSE) SetAuthor("Jonathan Godfrey", Local=FALSE)
# SetSigLevel(5) # not a valid alpha SetSigLevel(0.05, Local=FALSE) # valid alpha value SetAuthor(Local=FALSE) SetAuthor("Jonathan Godfrey", Local=FALSE)
Creates a permanent folder called MyBrailleR if the user agrees. Windows users can open this file easily using MyBrailleR().
SetupBrailleR() MyBrailleR()
SetupBrailleR() MyBrailleR()
The user can establish a permanent MyBrailleR folder if the BrailleR package is loaded in an interactive session. If only used in batch mode, the user will only be able to use the default BrailleR settings.
The path to the folder is returned invisibly.
A. Jonathan R. Godfrey with suggestions from Henrik Bengtsson and Brian Ripley.
Allows the list of data points listed by VI.ggplot to be sorted by x or y values, ascending or descending. Currently only implemented for geom_points. This function is experimental and has not been extensively tested.
## S3 method for class 'VIgraph' sort(x, decreasing = FALSE, by = "x", ...)
## S3 method for class 'VIgraph' sort(x, decreasing = FALSE, by = "x", ...)
x |
object returned by |
decreasing |
logical: should the sort be decreasing |
by |
value on which to sort, "x" or "y" |
... |
further arguments passed to |
Returns a new object of the same type as that returned by VI.ggplot, but with data re-ordered.
Debra Warren and Paul Murrell
if (require(ggplot2)) { sort(VI(qplot(x=1:5, y=c(2,5,1,4,3))), decreasing=TRUE, by="y") }
if (require(ggplot2)) { sort(VI(qplot(x=1:5, y=c(2,5,1,4,3))), decreasing=TRUE, by="y") }
An terminal-based interface for dealing with words that appear to be misspelled in the specified files. Files for lists of words to ignore at local and global levels are augmented, or replacement text can be supplied.
SpellCheck(file)
SpellCheck(file)
file |
A vector of files to be checked |
A backup file is created before any changes are made. This file is not overwritten each time the spell checking is done so it may end up becoming out of date. Users can delete the backup file anytime.
NULL. This function is intended to affect only external files.
A. Jonathan R. Godfrey
Check spelling using hunspell. A new print method is also used.
SpellCheckFiles(file = ".", ignore = character(), local.ignore = TRUE, global.ignore = TRUE) ## S3 method for class 'wordlist' print(x, ...)
SpellCheckFiles(file = ".", ignore = character(), local.ignore = TRUE, global.ignore = TRUE) ## S3 method for class 'wordlist' print(x, ...)
file |
The filename of an individual file, or an individual folder. |
ignore |
The character vector of words to be ignored by hunspell |
local.ignore |
Use a local file of words to be ignored. This file has the same name as the file with .ignore.txt tacked on the end and is colocated with the file being checked. If the file argument is set to a folder then the local.ignore can be set to the name of a file in the current working directory. |
global.ignore |
Use the global word list called words.ignore.txt found in the MyBrailleR folder |
x |
the object to be printed |
... |
other parameters pass to the print method |
The global list of words to be ignored needs to be saved in the user's MyBrailleR folder. It can be updated as often as the user likes. It should have one word per line, and contain no space, tab or punctuation characters.
A list object with each item of the list being the findings from spell checking each file. The words not found in the dictionary are given as well as the line numbers where they were found.
A. Jonathan R. Godfrey wrote these functions but leaned heavily on functions found in the devtools package.
The hunspell package and functions therein.
Base graphics are created using a series of calls to C routines. This function gathers the names of these calls and the values of the arguments as supplied. Names of the arguments are then added. The display list must be retrieved before the graphics device is closed, but this could be stored for later summarisation.
## S3 method for class 'recordedplot' summary(object, ...)
## S3 method for class 'recordedplot' summary(object, ...)
object |
the display list created by recordPlot(). |
... |
necessary argument for the method; currently ignored |
The outcome of this command must be further processed to give it context.
A named list of named vectors. Names of list elements are the C function calls used in plotting the graph on the graphics device; the names for the vectors are dependent on which C functions are called, but are the argument names as per the R function most closely associated with that C call.
Deepayan Sarkar with minor edits from A. Jonathan R. Godfrey
to fix
plot(x=c(1:20), y=runif(20)) abline(h=0.5) p = recordPlot() summary(p) rm(p)
plot(x=c(1:20), y=runif(20)) abline(h=0.5) p = recordPlot() summary(p) rm(p)
Converts a graph object (as long as it has a class assigned) to an SVG file that can be viewed using a browser (not IE). At present, the SVG needs manual editing using the Tiger Transformer software before viewing in the Tiger Player.
SVGThis(x, file = "test.svg", ...) ## S3 method for class 'ggplot' SVGThis(x, file = "test.svg", createDevice = TRUE, ...)
SVGThis(x, file = "test.svg", ...) ## S3 method for class 'ggplot' SVGThis(x, file = "test.svg", createDevice = TRUE, ...)
x |
a graph object for which a method exists |
file |
The SVG file to be created. |
createDevice |
Whether this function should creates it own none displaying device and print the graph on it. If FALSE will print the graph on the current device. |
... |
Arguments to be passed to the methods. |
Most of the work of the function is done gridSVG::grid.export
function. After this there is a rewrite of the SVG so that it can work better with the XML and create a easy accessible experience of the graph.
The produced SVG can also be used as just that a SVG. However note that quite possibly some rewriting will of been done. The rewriting does not change how the graph looks.
To view your graph as a accessible svg you can use the MakeAccessibleSVG()
function.
The Cairo SVG device found in the gr.devices package does not create a structured SVG file that includes the semantics of the graphic being displayed. The SVG created by the gridSVG package does meet this need, but only works on graphs drawn using the grid package. Any graph created using functions from the more common graphics package can be converted to the grid package system using the gridGraphics package.
NULL. This function is solely for the purpose of creating SVG files in the current working directory or in a path of the user's choosing.
A. Jonathan R. Godfrey, Paul Murrell and James Thompson
P. Murrell and S. Potter (2014) “The gridSVG package” The R Journal 6/1, pp. 133-143. http://journal.r-project.org/archive/2014-1/RJournal_2014-1_murrell-potter.pdf
P. Murrell (2015) “The gridGraphics package”, The R Journal 7/1 pp. 151-162. http://journal.r-project.org/archive/2015-1/murrell.pdf
P. Dengler et al. (2011) Scalable vector graphics (SVG) 1.1, second edition. W3C recommendation, W3C. http://www.w3.org/TR/2011/REC-SVG11-20110816/
# Save a custom ggplot object to an SVG file library(ggplot2) p = ggplot(mtcars, aes(x=wt, y=mpg)) + geom_point() SVGThis(p) # Cleaning up afterwards unlink("test.svg")
# Save a custom ggplot object to an SVG file library(ggplot2) p = ggplot(mtcars, aes(x=wt, y=mpg)) + geom_point() SVGThis(p) # Cleaning up afterwards unlink("test.svg")
Prepares an analysis of a data set with one response and three predictors that are all factors. Interactions between the Three factors are also allowed for. The function creates a number of graphs and tables relevant for the analysis.
ThreeFactors(Response, Factor1, Factor2, Factor3, Data = NULL, Filename = NULL, Folder = NULL, VI = getOption("BrailleR.VI"), Latex = getOption("BrailleR.Latex"), View = getOption("BrailleR.View"), Modern=TRUE)
ThreeFactors(Response, Factor1, Factor2, Factor3, Data = NULL, Filename = NULL, Folder = NULL, VI = getOption("BrailleR.VI"), Latex = getOption("BrailleR.Latex"), View = getOption("BrailleR.View"), Modern=TRUE)
Response |
Name of the continuous response variable. |
Factor1 , Factor2 , Factor3
|
Name the three factors to be included. |
Data |
Name the data.frame that includes the three variables of interest. |
Filename |
Name of the Rmarkdown and HTML files to be created. A default will be created that uses the names of the variables if this is left set to NULL. |
Folder |
Name of the folder to store graph and LaTeX files. A default will be created based on the name of the data.frame being used. |
VI |
Logical: Should the VI method for blind users be employed? |
Latex |
Logical: Should the tabulated sections be saved in LaTeX format? |
View |
Logical: Should the HTML file be opened for inspection? |
Modern |
Logical: Should the graphics be created using ggplot? |
to complete
This function is used for creation of the files saved in the working directory and a few of its subdirectories.
A. Jonathan R. Godfrey and Timothy P. Bilton
The OneFactor
script was the basis for this function;.
DIR = getwd() setwd(tempdir()) TestData=data.frame(Resp=sample(54), expand.grid(F1=c("a","b","c"), F2=c("d","e","f"), F3=c("g","h","i"), rep=c(1,2))) attach(TestData) ThreeFactors(Resp,F1,F2,F3) detach(TestData) rm(TestData) # N.B. Various files and a folder were created in a temporary directory. # Please investigate them to see how this function worked. setwd(DIR)
DIR = getwd() setwd(tempdir()) TestData=data.frame(Resp=sample(54), expand.grid(F1=c("a","b","c"), F2=c("d","e","f"), F3=c("g","h","i"), rep=c(1,2))) attach(TestData) ThreeFactors(Resp,F1,F2,F3) detach(TestData) rm(TestData) # N.B. Various files and a folder were created in a temporary directory. # Please investigate them to see how this function worked. setwd(DIR)
This function is a wrapper to the standard plott()
function in the graphics package. It is tailored to generating a time series plot, and adds detail to the stored object so that a better text description can be formulated using the VI()
method in the BrailleR package. The function will become redundant once all other BrailleR functionality is working well with ggplot style graphics.
TimeSeriesPlot(.data, x, time=NULL, base=FALSE, ...)
TimeSeriesPlot(.data, x, time=NULL, base=FALSE, ...)
.data |
the data.frame from which variables are drawn. Ignored if using base graphics. |
x |
a numeric variable. N.B. when using base or non ts data you must explicitly specify them by naming this argument. |
base |
Use base style graphics. Default is to use ggplot2 instead. |
time |
a numeric or date variable. Only used by ggplot. This will be the values plotted along the x axis. If it is left at |
... |
additional arguments passed on to the plotting function. |
This function was originally designed to be a wrapper that would draw the base graphics plot for a time series. The saved object can be plotted later with a call to plot
.
From v0.33.0 onwards, the function can complete the original intention, but the ggplot2 package's improved interaction with BrailleR means this is the now the preferred style of plot. This plot wont be plotted by default so you need to expressly call the plot or print method.
Either:
1. An object of class tsplot, with the addition of any calls to the main title or axis labels being explicitly stored even if a zero length character string, or
2. A ggplot object.
A. Jonathan R. Godfrey and James A. Thompson
Godfrey, A.J.R. (2013) ‘Statistical Software from a Blind Person's Perspective: R is the Best, but we can make it better’, The R Journal 5(1), pp73-79.
# with base attach(airquality) op = par(mfcol=c(3,2)) plot(as.ts(Wind), ylab="Wind", col=4) test1 = TimeSeriesPlot(x=Wind, col=4, base=TRUE) test1 #does the plot method work? plot(as.ts(Ozone), ylab="Ozone") test2 = TimeSeriesPlot(x=Ozone, base=TRUE) test2 # does the plot method work? par(op) detach(airquality) # with ggplot if(require(ggplot2)){ basic = TimeSeriesPlot(airquality, x=airquality$Temp) basic # ts data withTitle = TimeSeriesPlot(UKDriverDeaths, main = "UK driver deaths", sub = "For the month Januaray") withTitle withLabs = TimeSeriesPlot(sunspots, ylab="Number of spots", xlab="Year") withLabs }
# with base attach(airquality) op = par(mfcol=c(3,2)) plot(as.ts(Wind), ylab="Wind", col=4) test1 = TimeSeriesPlot(x=Wind, col=4, base=TRUE) test1 #does the plot method work? plot(as.ts(Ozone), ylab="Ozone") test2 = TimeSeriesPlot(x=Ozone, base=TRUE) test2 # does the plot method work? par(op) detach(airquality) # with ggplot if(require(ggplot2)){ basic = TimeSeriesPlot(airquality, x=airquality$Temp) basic # ts data withTitle = TimeSeriesPlot(UKDriverDeaths, main = "UK driver deaths", sub = "For the month Januaray") withTitle withLabs = TimeSeriesPlot(sunspots, ylab="Number of spots", xlab="Year") withLabs }
Prepares an analysis of a data set with one response and two predictors that are both factors. An interaction between the two factors is also allowed for. The function creates a number of graphs and tables relevant for the analysis.
TwoFactors(Response, Factor1, Factor2, Inter = FALSE, HSD = TRUE, AlphaE = getOption("BrailleR.SigLevel"), Data = NULL, Filename = NULL, Folder = NULL, VI = getOption("BrailleR.VI"), Latex = getOption("BrailleR.Latex"), View = getOption("BrailleR.View"), Modern=TRUE)
TwoFactors(Response, Factor1, Factor2, Inter = FALSE, HSD = TRUE, AlphaE = getOption("BrailleR.SigLevel"), Data = NULL, Filename = NULL, Folder = NULL, VI = getOption("BrailleR.VI"), Latex = getOption("BrailleR.Latex"), View = getOption("BrailleR.View"), Modern=TRUE)
Response |
Name of the continuous response variable. |
Factor1 , Factor2
|
Name the two factors to be included. |
Inter |
Logical: Should the interaction of the two factors be included? |
HSD |
Logical: Should Tukey's HSD be evaluated for the data? |
AlphaE |
The family-wise Type I error rate for Tukey's HSD calculations. |
Data |
Name the data.frame that includes the three variables of interest. |
Filename |
Name of the Rmarkdown and HTML files to be created. A default will be created that uses the names of the variables if this is left set to NULL. |
Folder |
Name of the folder to store graph and LaTeX files. A default will be created based on the name of the data.frame being used. |
VI |
Logical: Should the VI method for blind users be employed? |
Latex |
Logical: Should the tabulated sections be saved in LaTeX format? |
View |
Logical: Should the HTML file be opened for inspection? |
Modern |
Logical: Should the graphics be created using ggplot? |
to complete
This function is used for creation of the files saved in the working directory and a few of its subdirectories.
Timothy P. Bilton and A. Jonathan R. Godfrey
The OneFactor
script was the basis for this function;.
DIR = getwd() setwd(tempdir()) if(require(dplyr)){ TG <- ToothGrowth |> mutate(dose = as.factor(dose)) # Without interaction TwoFactors('len','supp','dose',Data=TG, Inter=FALSE) # With two-way interaction TwoFactors('len', 'supp', 'dose', Data=TG, Inter=TRUE) rm(TG); rm(TG) # N.B. Various files and a folder were created in a temporary directory. # Please investigate them to see how this function worked. } setwd(DIR)
DIR = getwd() setwd(tempdir()) if(require(dplyr)){ TG <- ToothGrowth |> mutate(dose = as.factor(dose)) # Without interaction TwoFactors('len','supp','dose',Data=TG, Inter=FALSE) # With two-way interaction TwoFactors('len', 'supp', 'dose', Data=TG, Inter=TRUE) rm(TG); rm(TG) # N.B. Various files and a folder were created in a temporary directory. # Please investigate them to see how this function worked. } setwd(DIR)
A set of methods that will (once coded) extract the most relevant information from a graphical object (or implied set of graphical objects) and display the interpreted results in text form.
The method includes representations of summary methods that are more suitable for blind useRs. For example, the method for a data.frame uses a single line for each variable instead of the normal column layout used by the summary
method.
This is the help page for the VI() functions that are not fully functional or below par in some way.
This will vary according to the needs of vision impaired useRs and the specific objects that need to be interpreted.
In general, the output is a series of text strings printed in the console/terminal window in addition to the embedded command's normal functionality.
These functions do not create objects as do many R commands. Manipulations on the objects created by regular R expressions will need those regular expressions issued in addition to those of the VI family of functions.
Jonathan Godfrey
This function is a convenience function for analyzing univariate data. It provides histograms, boxplots and tabulated results for normality tests as well as those for skewness and kurtosis. The intended use of this function is principally for a blind user of R who also has the advantage of retrieving textual descriptions of the graphs created along the way, via the VI()
methods.
UniDesc(Response = NULL, ResponseName = as.character(match.call()$Response), Basic = TRUE, Graphs = TRUE, Normality = TRUE, Tests = TRUE, Title = NULL, Filename = NULL, Folder = ResponseName, Process = TRUE, VI = getOption("BrailleR.VI"), Latex = getOption("BrailleR.Latex"), View = getOption("BrailleR.View"), PValDigits=getOption("BrailleR.PValDigits"))
UniDesc(Response = NULL, ResponseName = as.character(match.call()$Response), Basic = TRUE, Graphs = TRUE, Normality = TRUE, Tests = TRUE, Title = NULL, Filename = NULL, Folder = ResponseName, Process = TRUE, VI = getOption("BrailleR.VI"), Latex = getOption("BrailleR.Latex"), View = getOption("BrailleR.View"), PValDigits=getOption("BrailleR.PValDigits"))
Response |
The numeric vector to be analyzed. This must be specified as a variable that is directly available in the workspace, not as a data.frame$variable construct. |
ResponseName |
This is the same as Response but use quote marks around it. Exactly one of Response or ResponseName must be specified. |
Basic |
logical, asking for basic numeric summary measures |
Graphs |
logical, indicating if the graphs are to be created. These will be eps files suitable for insertion in LaTeX documents, pdf files for more general use, and SVG for easier use by blind users. |
Normality |
logical, asking if the various normality tests offered in the nortest package should be used |
Tests |
logical, should skewness and kurtosis tests be performed. |
Title |
the title of the R markdown document being created. NULL leads to a default string being chosen. |
Filename |
Specify the name of the R markdown and html files (without extensions). |
Folder |
the folder where results and graph files will be saved. |
Process |
logical, should the R markdown file be processed? |
VI |
logical, should the VI method be used to give added text descriptions of graphs? This is most easily set via the package options. |
Latex |
logical, Should the xtable package be used to convert the tabulated results into LaTeX tables? This is most easily set via the package options. |
View |
logical, should the resulting HTML file be opened in a browser? This is most easily set via the package options. |
PValDigits |
Integer. The number of decimal places to use for p values. This is most easily set via the package options. |
Saves an R markdown file, (and then if Process=TRUE
) an R script file, and an html file (which may be opened automatically) in the current working folder. Graphs are saved in png, eps, pdf, and SVG formats (if requested) in (optionally) a subfolder of the current working directory.
A. Jonathan R. Godfrey [email protected]
if(require(nortest)){ # used in the Rmd file, not the UniDesc function DIR = getwd() setwd(tempdir()) Ozone=airquality$Ozone UniDesc(Ozone) rm(Ozone) # N.B. Various files and a folder were created in a temporary directory. # Please investigate them to see how this function worked. setwd(DIR) }
if(require(nortest)){ # used in the Rmd file, not the UniDesc function DIR = getwd() setwd(tempdir()) Ozone=airquality$Ozone UniDesc(Ozone) rm(Ozone) # N.B. Various files and a folder were created in a temporary directory. # Please investigate them to see how this function worked. setwd(DIR) }
Either grabs the specified label or sets it to a newly specified value. In this case the graph is re-drawn and the graph object is updated.
UpdateGraph(object, ...) Main(graph, label = NULL) XLab(graph, label = NULL) YLab(graph, label = NULL)
UpdateGraph(object, ...) Main(graph, label = NULL) XLab(graph, label = NULL) YLab(graph, label = NULL)
graph , object
|
The graph object to be updated. |
label |
the text to be used in place of the current text label. Use of the default NULL leads to the extraction of the current value and no updating is done. |
... |
the set of parameters to be altered. |
Specify the label to be an empty text string if the desire is to delete the current label.
The graph object will be updated in the global environment if a new value is assigned.
A. Jonathan R. Godfrey
attach(airquality) op = par(mfcol=c(3,2)) #test1 = TimeSeriesPlot(x=Wind, col=4, base=TRUE) #XLab(test1, "Day") # check the change is permanent by doing another change #test1 |> Main("titles are important") # nice that the pipe works! #test2 = TimeSeriesPlot(x=Ozone, base=TRUE) # using the update method #update(test2, main="important title", sub="subtitles aren't always present", ylab="Ozone (ppb)") # finally, change the graph to use different plotting characters/line types #update(test2) # to fix par(op) detach(airquality)
attach(airquality) op = par(mfcol=c(3,2)) #test1 = TimeSeriesPlot(x=Wind, col=4, base=TRUE) #XLab(test1, "Day") # check the change is permanent by doing another change #test1 |> Main("titles are important") # nice that the pipe works! #test2 = TimeSeriesPlot(x=Ozone, base=TRUE) # using the update method #update(test2, main="important title", sub="subtitles aren't always present", ylab="Ozone (ppb)") # finally, change the graph to use different plotting characters/line types #update(test2) # to fix par(op) detach(airquality)
A method that extracts the most relevant information from a graphical object (or implied set of graphical objects) and display the interpreted results in text or HTML form.
The method includes representations of summary methods that are more suitable for blind users. For example, the method for a data.frame uses a single line for each variable instead of the normal column layout used by the summary
method.
VI(x, Describe=FALSE, ...) ## S3 method for class 'histogram' VI(x, Describe=FALSE, ...) ## S3 method for class 'aov' VI(x, Describe=FALSE, ...) ## S3 method for class 'htest' VI(x, Describe=FALSE, digits = getOption("digits"), ...) ## S3 method for class 'lm' VI(x, Describe=FALSE, ...) ## S3 method for class 'ggplot' VI(x, Describe=FALSE, threshold=10, template=system.file("whisker/VIdefault.txt", package="BrailleR"), ...)
VI(x, Describe=FALSE, ...) ## S3 method for class 'histogram' VI(x, Describe=FALSE, ...) ## S3 method for class 'aov' VI(x, Describe=FALSE, ...) ## S3 method for class 'htest' VI(x, Describe=FALSE, digits = getOption("digits"), ...) ## S3 method for class 'lm' VI(x, Describe=FALSE, ...) ## S3 method for class 'ggplot' VI(x, Describe=FALSE, threshold=10, template=system.file("whisker/VIdefault.txt", package="BrailleR"), ...)
x |
any R object |
Describe |
Should the |
digits |
number of decimal places to show |
threshold |
Only for ggplot. Maximum number of data items that should be individually listed in the output. |
template |
Only for ggplot. Template file, in mustache format, to be used in creating the text |
... |
other arguments, currently ignored |
VI() is intended to extract the specific details for the particular graph or output.
It will provide the information as a printout to the console/terminal window.
Nothing is returned when working with most of the functions functionality.
The VI.lm()
method is the first to move away from this idea and use a process that builds on the UniDesc()
function. In this case, the method creates an R markdown file and compiles it into HTML. The HTML document is opened if the R session is interactive.
VI.ggplot
returns a structure containing a hierarchical representation of the graph as well as the text description as a character vector. When run interactively, the text
description is printed.
The VI.lm
method fails if you use the one line VI(lm(...))
even if the model is named using VI(Model1 <- lm(...))
. It does work if two explicit commands are used. For example Model1 = lm(...)
followed by VI(Model1)
.
The ggplot2 package contains many layers and not all of them have a VI output yet. However most of the commonly used ones do. Regardless the VI output should be considered experimental with some results being potentially misleading.
A. Jonathan R. Godfrey, Debra Warren, Sophie Banks, Tony Hirst, Timothy P. Bilton and James A. Thompson
# Base R RandomX=rnorm(500) PlottedFig=hist(RandomX) VI(PlottedFig) # ggplot if(require(ggplot2)){ ggplot(economics_long, aes(date, value01, colour = variable)) + geom_line() + ggtitle('dummy title') }
# Base R RandomX=rnorm(500) PlottedFig=hist(RandomX) VI(PlottedFig) # ggplot if(require(ggplot2)){ ggplot(economics_long, aes(date, value01, colour = variable)) + geom_line() + ggtitle('dummy title') }
Copy files from the package folders to the current working directory and write a markdown file that contains the links to all accessible SVG files in the current directory.
ViewSVG(file = "index")
ViewSVG(file = "index")
file |
The file basename to be used. This file will be made in the current directory. |
This will create a html file that has a list of the available svg in the current directory. This only supports the current working directory at the moment. However this is planned on changing in the future. To make the files you can use the MakeAccessibleSVG()
function
NULL. This function exists for its side effects only.
A. Jonathan R. Godfrey and James A. Thompson
Godfrey, A.J.R. (2013) ‘Statistical Software from a Blind Person's Perspective: R is the Best, but we can make it better’, The R Journal 5(1), pp73-79.
library(ggplot2) # Make a few svg webpages tsplot = TimeSeriesPlot(airquality, x=airquality$Temp) MakeAccessibleSVG(tsplot, file = "tsplot") barChart = ggplot(Orange, aes(x = Tree)) + geom_bar() MakeAccessibleSVG(barChart, file = "barChart") histogram = ggplot(attenu, aes(x=dist)) + geom_histogram() histogram MakeAccessibleSVG(histogram, file="histogram") # Display the 'home' page ViewSVG() # Cleaning up afterwards # Created by the MakeAccessibleSVG (xml and svg are auto deleted) unlink("histogram.html") unlink("barChart.html") unlink("tsplot.html") unlink("index.html") # Created by the ViewSVG function
library(ggplot2) # Make a few svg webpages tsplot = TimeSeriesPlot(airquality, x=airquality$Temp) MakeAccessibleSVG(tsplot, file = "tsplot") barChart = ggplot(Orange, aes(x = Tree)) + geom_bar() MakeAccessibleSVG(barChart, file = "barChart") histogram = ggplot(attenu, aes(x=dist)) + geom_histogram() histogram MakeAccessibleSVG(histogram, file="histogram") # Display the 'home' page ViewSVG() # Cleaning up afterwards # Created by the MakeAccessibleSVG (xml and svg are auto deleted) unlink("histogram.html") unlink("barChart.html") unlink("tsplot.html") unlink("index.html") # Created by the ViewSVG function
count the number of points that fall into various sized subparts of a scatter plot. The graphing region can be split into cells based on a uniform or normal marginal distribution separately for the x and y variables.
WhereXY(x, y = NULL, grid = c(4, 4), xDist = "uniform", yDist = xDist, addmargins=TRUE)
WhereXY(x, y = NULL, grid = c(4, 4), xDist = "uniform", yDist = xDist, addmargins=TRUE)
x , y
|
vectors of x coordinates. If y is not specified, the function expects x to be a two-column matrix with x and y values in columns 1 and 2 respectively. |
grid |
pair of values to specify the way the graph is to be split into parts. Specify x and then y. |
xDist , yDist
|
the distribution the variables might be expected to follow. The default is to consider uniformly distributed but any alternative text will lead to an assumption of both margins being normally distributed. |
addmargins |
logical: should sums be added to both rows and columns. |
A text description of the number of points in each subregion of the scatter plot. The table of counts can then be compared to the expected number of points in each subregion.
A. Jonathan R. Godfrey
x=rnorm(50) y=rnorm(50) WhereXY(x,y) WhereXY(x,y, c(3,4)) WhereXY(x,y, xDist="other")
x=rnorm(50) y=rnorm(50) WhereXY(x,y) WhereXY(x,y, c(3,4)) WhereXY(x,y, xDist="other")
Which files in a folder (and its subfolders) include/exclude a given text string
WhichFile(String, Folder, fixed = TRUE, DoesExist = TRUE)
WhichFile(String, Folder, fixed = TRUE, DoesExist = TRUE)
String |
The text string or regular expression being sought. |
Folder |
The head folder to start searching in. |
fixed |
Fixed text string or if FALSE, a regular expression that will be passed to grep(). |
DoesExist |
If TRUE, it shows the files that do include the text string of interest; if FALSE, files that lack the search string are returned. |
Finding a given search string in a pile of text files is time-consuming. Finding which files lack that search string is even harder.
A vector of filenames returned as character strings.
This search uses readLines() which throws plenty of warnings if the files being searched across do not all end in a blank line.
A. Jonathan R. Godfrey in response to a request from CRAN to add missing text to help documentation.
The WriteR application was written in wxPython so that blind users can process Rmarkdown documents. This functionality is offered because RStudio is not an accessible application for screen reader users.
WriteR(file = NULL, math = c("webTeX", "MathJax")) TestPython() TestWX() PrepareWriteR(Author = getOption("BrailleR.Author"))
WriteR(file = NULL, math = c("webTeX", "MathJax")) TestPython() TestWX() PrepareWriteR(Author = getOption("BrailleR.Author"))
Author |
Your name as you want it to appear in the default text that starts your R markdown documents. |
file |
The filename you want started. Not implemented yet. |
math |
The style for mathematical content in HTML documents created using LaTeX input. Not yet implemented. |
WriteR needs python and wxPython to run. Error handling for users without these packages installed is not yet incorporated in these functions. Please use TestWX()
because it calls TestPython()
as its first test.
The PrepareWriteR()
function writes the settings file (called WriteROptions) for WriteR and copies the files that were part of the BrailleR installation into the current working directory. You will be able to run the WriteR application from there, or move to a folder of your choosing.
NULL. The WriteR
function is for your convenience and not for doing any work inside an R session. The TestWX()
function prints results but returns nothing. The TestPython()
function returns a logical to say Python can be seen by your system.
You must have Python and the associated wxPython installation on your system to use the WriteR application.
A. Jonathan R. Godfrey
Determine what the current graphics device has on it so the blind user can be sure they have something they want, or find out what it might be that is contained in a graphics device.
WTF() wtf()
WTF() wtf()
Text describing what BrailleR was able to detect in the graphics window.
A. Jonathan R. Godfrey and Paul Murrell.
attach(airquality) hist(Ozone) WTF() plot(Ozone~Wind) WTF() detach(airquality)
attach(airquality) hist(Ozone) WTF() plot(Ozone~Wind) WTF() detach(airquality)