Generate a local proxy dataframe to enable local auto-completion in RStudio
Source:R/local-proxy.R
dh.localProxy.Rd
If you have a remote dataframe on the servers, it can be challenging to remember variable names when writing code. Because the dataframes are on remote servers, auto-complete won't work in RStudio. The purpose of this function is to create a local object that has the same structure as the remote data frame and enables the use of autocomplete when writing DataSHIELD code.
Arguments
- df
Character specifying a server-side data frame.
- conns
DataSHIELD connections object.
- checks
Logical; if TRUE checks are performed prior to running the function. Default is TRUE.
Value
Creates a local proxy dataframe. Stops function if df
doesn't exist
or contains variables with inconsistent class across cohorts.
Details
If you have a dataframe "D" with columns LAB_TSC, DIS_CVA and DIS_DIAB, normally you would need to write:
ds.summary("D$LAB_TSC")
with the variable name spelled correctly
(no autocomplete!) and remember quotation marks. However after running this
function you can type:
ds.summary(D$
and hit tab, and the list of variables will be displayed.
Choose one and hit enter to finish up with:
ds.summary(D$LAB_TSC)
- no quotation marks needed either!