# 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
Run the code above in your browser using DataLab