vfdesc {visualFields} | R Documentation |
Visual field dataset
Description
The main object of the visualFields package is a table with
a specific format and fields that are mandatory for their management and
processing (mainly statistical analysis). Each record (row) in the table
contains data for a single visual field test. The mandatory fields specify
subject (by its ID code), eye, and test date and time. There are required
fields statistical and reliability analyses (e.g., age for the determination
of total-deviation and pattern-deviation values, and for global indices and
fpr, fnr, fl for the proportion of false positives, false negative, and
fixation losses). The rest of mandatory fields are sensitivity or deviation
data for each visual field test location. (The number of fields for
tested locations varies with the location map, 54 for the 24-2, 76 for the
30-2, 68 for the 10-2, etc.). Check section Structure of visual fields data
below for details about the required structure of the table contatining the
visual fields datasets.
The following functions carry out analysis on visual fields data:
vfdesc
descriptive summary of a visual field datasetvfsort
sort visual field datavfisvalid
check if a table with visual field data is properly formatted and valid for analysisvfread
read a csv file with visual field datavfwrite
write a csv file with visual field datavfjoin
joins two visual field datasetsvffilter
filters elements from a visual field dataset with matching conditions. This function is just a wrapper fordplyr
's functionfilter
vfselect
select visual field data by index or the first or lastn
visits per subject and eyegettd
computes total-deviation (TD) values and probability valuesgettdp
computes total-deviation (TD) probability valuesgetpd
computes pattern-deviation (PD) valuesgetpdp
computes pattern-deviation (PD) probability valuesgetgh
computes the general height (GH) from the TD tablesgetgl
computes visual fields global indicesgetglp
computes computes visual fields global indices probability values
Usage
vfdesc(vf)
vfsort(vf, decreasing = FALSE)
vfisvalid(vf)
vfread(file, dateformat = "%Y-%m-%d", eyecodes = c("OD", "OS", "OU"), ...)
vfwrite(
vf,
file,
dateformat = "%Y-%m-%d",
eyecodes = c("OD", "OS", "OU"),
...
)
vfjoin(vf1, vf2)
vffilter(vf, ...)
vfselect(vf, sel = "last", n = 1)
gettd(vf)
gettdp(td)
getpd(td)
getpdp(pd)
getgh(td)
getgl(vf)
getglp(g)
Arguments
vf |
visual field data |
decreasing |
sort decreasing or increasing?
Default is increasing, that is |
file |
the name of the csv file where to write the data |
dateformat |
format to be used for date. Its default value
is |
eyecodes |
codification for right and left eye, respectively.
By default in visualField uses ' |
... |
arguments to be passed to or from methods |
vf1 , vf2 |
the two visual field data objects to join or merge |
sel |
it can be two things, an array of indices to select from visual field data
or a string with the values ' |
n |
number of visits to select. Default value is 1, but it is ignored if
|
td |
total-deviation (TD) values |
pd |
pattern-deviation (PD) values |
g |
global indices |
Details
vfselect
when selecting the last or first few visual fields per subject and eye, if that subject and eye has fewer thann
visits, then all visits are returned
Value
vfdesc
returns descriptive statistics of a visual field dataset
vfsort
returns a sorted visual field dataset
vfisvalid
returns TRUE
or FALSE
vfread
returns a visual field dataset
vfwrite
No return value
vfjoin
returns a visual field dataset
vffilter
returns a visual field dataset
vfselect
returns a visual field dataset
gettd
returns a visual field dataset with total deviation values
gettdp
returns a visual field dataset with total deviation probability values
getpd
returns a visual field dataset with pattern deviation values
getpdp
returns a visual field dataset with pattern deviation probability values
getgh
returns the general height of visual fields tests
getgl
returns visual fields global indices
getglp
returns probability values of visual fields global indices
Structure of visual fields data
Visual fields data is the central object used in visualFields. It is a table of visual field data collected with the same perimeter, background and stimulus paradigm (e.g., static automated perimetry or frequency-doubling perimetry), stimulus size (e.g., Goldmann size III), grid of visual field test locations (e.g., 24-2), and psychophysical testing strategy (e.g., SITA standard). Normative values can be obtained from appropriate datasets with data for healthy eyes and these normative values can then be used to generate statistical analyses and visualizations of data for patients with retinal or visual anomalies.
Each record correspond to a specific test for an eye of a subject taken on a specific date at a specific time. Visual field data must have the following columns
id
an id uniquely identifying a subject. This field is mandatoryeye
should be "OD" for right eye or "OS" for left eye. This field is mandatorydate
test date. This field is mandatorytime
test time. This field is mandatoryage
age of the patient on the test date. This field is required to obtain total-deviation, pattern-deviation values, and other age-dependent local and global indicestype
type of subject, Could be a healthy subject (ctr for control) or a patient with glaucoma (pwg) or a patient with idiopatic intraocular hypertension (iih) or other. This field is no required for management or statistical analysis.fpr
false positive rate. This field is no required for management or statistical analysis.fnr
false negative rate. This field is no required for management or statistical analysis.fl
fixation losses. This field is no required for management or statistical analysis.l1..ln
sensitivity, total-deviation, or pattern-deviation values for each location. For analysis with visualFields there should be as many columns as coordinates in the location map set in the visualFields environment. These fields are mandatory.
Examples
# get dataset description from visual field table
vfdesc(vfctrSunyiu24d2)
# sort dataset
vfsort(vfctrSunyiu24d2[c(5, 4, 10, 50, 30),])
# check if a visualField is valid
vf <- vfctrSunyiu24d2
vfisvalid(vf) # valid visual field data
vf$id[5] <- NA
vfisvalid(vf) # invalid visual field data
# write and read visual field data
vf <- vfctrSunyiu24d2
tf <- tempfile("vf")
vfwrite(vf, file = tf) # save current locmap in a temp file
head(vfread(tf)) # read the temp file
# join visual fields datasets
vfjoin(vfctrSunyiu24d2, vfpwgRetest24d2)
# visual field subselection
vffilter(vf, id == 1) # fields corresponding to a single subject
vffilter(vf, id == 1 & eye == "OD") # fields for a single subject's right eye
unique(vffilter(vf, eye == "OS")$eye) # only left eyes
vffilter(vfjoin(vfctrSunyiu24d2, vfpwgRetest24d2), type == "ctr") # get only controls
vffilter(vfjoin(vfctrSunyiu24d2, vfpwgRetest24d2), type == "pwg") # get only patients
# select visual fields by index
vfselect(vfctrSunyiu24d2, sel = c(1:4, 150))
# select last few visual fields per subject and eye
vfselect(vfpwgRetest24d2, sel = "last")
# select first few visual fields per subject and eye
vfselect(vfpwgRetest24d2, sel = "first")
vfselect(vfpwgRetest24d2, sel = "first", n = 5) # get the last 5 visits
# compute visual field statistics
vf <- vfpwgSunyiu24d2
td <- gettd(vf) # get TD values
tdp <- gettdp(td) # get TD probability values
pd <- getpd(td) # get PD values
pdp <- getpdp(pd) # get PD probability values
gh <- getgh(td) # get the general height
g <- getgl(vf) # get global indices
gp <- getglp(g) # get global indices probability values