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:

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 decreasing = FALSE

file

the name of the csv file where to write the data

dateformat

format to be used for date. Its default value is %Y-%m-%d

eyecodes

codification for right and left eye, respectively. By default in visualField uses 'OD' and 'OS' for right and left eye respectively, but it is common to receive csv files with the codes 'R' and 'L'. The code 'OU' for both eyes is also allowed eyecodes should be equal to 'c("OD", "OS")' or 'c("R", "L")'. By default it is 'eyecodes = c("OD", "OS", "OU")'

...

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 'first' or 'last' indicating that only the first few n visits per subject 'id' and 'eye' are to be selected. Default is 'last'.

n

number of visits to select. Default value is 1, but it is ignored if sel is an index array

td

total-deviation (TD) values

pd

pattern-deviation (PD) values

g

global indices

Details

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

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

[Package visualFields version 1.0.1 Index]