| cpcol | R Documentation | 
cpcol copies columns in a data frame.
cpcol(d, on, nn, i = NULL, 
    regexp = FALSE, multi = FALSE)| d | data frame | 
| on | original column name (or part of it, or a regexpr) | 
| nn | desired column name (or part of it, or a regexpr) | 
| i | optional column index that must match the column with the name
denoted by  | 
| regexp | logical flag indicating whether  | 
| multi | logical flag indicating whether to change multiple coumns at once | 
Tomas Sieger
rencol
tmp<-data.frame(a=1:2,b=2:3)
cpcol(tmp,'a','a2')
# copy with explicit column idx check
cpcol(tmp,'a','a2',1)
# copy all columns starting with 'a.' as 'b.'
tmp<-data.frame(a.x=1:2,a.b=2:3)
cpcol(tmp,'a.','b.',multi=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.