% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sync.R
\name{sync}
\alias{sync}
\title{Synchronize REDCap Data}
\usage{
sync(
  project_names = NULL,
  save_datasets = TRUE,
  hard_check = FALSE,
  hard_reset = FALSE
)
}
\arguments{
\item{project_names}{character vector of project project_names previously
setup. If NULL, will get all from \code{get_projects()}}

\item{save_datasets}{Logical (TRUE/FALSE). If TRUE, saves datasets to
directory.}

\item{hard_check}{Will check REDCap even if not due (see \code{sync_frequency}
parameter from \code{setup_project()})}

\item{hard_reset}{Logical that forces a fresh update if TRUE. Default is
\code{FALSE}.}
}
\value{
Invisibly returns last project object (R6 \link{REDCapSyncProject} class)
}
\description{
Syncs with REDCap via \code{project} object that user defined with
\link{setup_project}
}
\details{
Syncs all projects by default but can be used to hands-free sync one or
defined set projects. This is not intended to return project object. User
should use \code{load_project("project_name")}. However, by default will invisibly
return the last project in the set of project_names.
}
\examples{
\dontrun{
# if you setup 3 projects "ONE", "TWO", "THREE" using [setup_project()]...
sync() # will check all three projects for updates if due for sync
sync("TWO") # will only check and sync project TWO
project <- sync("TWO") # can also be used for invisible return ...
sync(c("ONE","THREE")) # will only check and sync projects ONE and THREE
project <- sync(c("ONE","THREE")) # invisible return of THREE ...
}
}
\seealso{
\code{vignette("REDCapSync", package = "REDCapSync")}
\code{vignette("Cache", package = "REDCapSync")}
\link{setup_project} for initializing projects
\link{project} for using the project objects
}
