cols_pad | R Documentation |
Adds dummy columns to reach the number specified by the user. this is mostly useful to ensure straightforward and easy data updating when using pivot tables in Excel. It allows replacement of the previous data sheet by the new one, without having to take care about the number of columns, which will always be the same.
cols_pad(data, nCols = 100, colPrefix = "x_")
data |
The data frame to which dummy columns will be added. |
nCols |
the total number of columns required : default is 100 |
colPrefix |
A string used as the prefix for the names of dummy columns. |
A data frame with the specified total number of columns.
table <- data.frame(a = 1:5, b = letters[1:5])
extraTable <- cols_pad(table, nCols = 6, colPrefix = "extra_")
print(extraTable)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.