addSuffixToColumns | R Documentation |
Add Suffix to Column Names
addSuffixToColumns(data, suffix, except = NULL)
data |
data frame |
suffix |
suffix to be added to each column name except the columns given
in |
except |
names of columns to which no suffix is to be given |
data
with renamed columns
d1 <- data.frame(id = 1, a = 2, b = 3)
d2 <- data.frame(id = 1, c = 2, d = 3)
# Using merge the origin of the column gets lost
merge(d1, d2)
# Add a suffix before merging
merge(
addSuffixToColumns(d1, ".first", except = "id"),
addSuffixToColumns(d2, ".second", except = "id"),
by = "id"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.