change_xml_path: Set the user name in the path of observed data overlay XML...

View source: R/change_xml_path.R

change_xml_pathR Documentation

Set the user name in the path of observed data overlay XML files and fixed trial design XML files

Description

change_xml_path changes the path of XML files that are included in simulations, which can be useful if one person originally created the workspace and a separate person then wants to run the files since the XML file paths on SharePoint include the users's name. Please note that this changes the file path and not the file name. UNDER CONSTRUCTION.

Usage

change_xml_path(
  sim_workspace_files = NA,
  new_sim_workspace_files = NA,
  workspace_objects = NA,
  new_xml_path = "only change user",
  save_workspaces = TRUE
)

Arguments

sim_workspace_files

the set of workspace files to modify; must end in ".wksz" if you're specifying individual files. Leave as NA to change all the workspaces in the current folder or set to "recursive" to change all the workspaces in the current folder and all the subfolders below it. BE CAREFUL. This function changes workspaces, so please be certain you're making the changes you want. We recommend keeping a backup copy of the original workspaces until you're sure the new ones are set up how you want.

new_sim_workspace_files

optionally specify the new workspace file names to use. If left as NA, the original workspace will be overwritten. Otherwise, specify a character vector of file names to use, e.g., new_sim_workspace_files = c("new file 1.wksz", "new file 2.wksz")

workspace_objects

instead of workspace files, specify a list of R objects for the workspaces you wish to modify. The overall object should be a list, even if it has a length of 1, but each item in the list should be of the class "XMLInternalDocument", e.g., the R object you get when you run XML::xmlTreeParse(...) on a workspace file. If you're not sure what we mean here, you probably don't want this option; it's mainly for internal use in the package.

new_xml_path

specify the new path for the XML files. Options:

"only change user" (default)

leaves intact all of the path except for the user name, which is useful when, say, Lisa has made a workspace on SharePoint but Hannah would now like to run those files

state the new folder path

useful when you want complete control over the folder location. Don't include the XML file name – only the folder where it's located, enclosed with quotes. It should contain ONLY forward slashes, so the usual way of specifying paths in R. We'll fix it to be Windows compliant for you.

save_workspaces

TRUE (default) or FALSE for whether to actually save the workspaces. Set this to FALSE if you would instead like to have the workspaces be returned as an R object (generally when you're piping this function into another one).

Value

saves workspace files or returns an R object of workspaces

Examples

# None yet


shirewoman2/Consultancy documentation built on Feb. 18, 2025, 10 p.m.