copyVariable {crunch} R Documentation

## Copy a variable

### Description

Makes a copy of a Crunch variable on the server.

### Usage

copyVariable(x, deep = FALSE, ...)

copy(x, deep = FALSE, ...)


### Arguments

 x a CrunchVariable to copy deep logical: should this be a deep copy, in which there is no dependence on the original variable, or a shallow one, in which the copy is more of a symbolic link? Default is FALSE, meaning symlink. ... Additional metadata to give to the new variable. If not given, the new variable will have a name that is the same as the original but with " (copy)" appended, and its alias will be the old alias with "_copy" appended.

### Details

Copies can be shallow (linked) or deep. Shallow copying is faster and is preferable unless a true hard copy is required. Shallow copies are effectively pointers to the original variable, and then you append data to the original variable or otherwise alter its values, the values in the copy automatically update. This linking may be desirable, but it comes with some limitations. First, you cannot edit the values of the copy independently of the original. Second, some attributes of the copy are immutable: of note, properties of categories cannot be altered independently in the copy, but you can alter Subvariable names and ordering within arrays.

### Value

a VariableDefinition for the copied variable. Assign into a Dataset to make the copy happen.

[Package crunch version 1.30.1 Index]