df_append | R Documentation |
Update a 'data.frame' object with new data. Can be used to append new updated time series data to an existing dataframe, where each observation is indexed by a unique timestamp/identifier in a key column.
df_append(old, new, key = "time", keep.attr = "timestamp")
old |
data.frame object containing existing data. |
new |
data.frame object containing new data. |
key |
[default 'time'] column name used as key, provided as a character string. |
keep.attr |
[default 'timestamp'] name of an attribute in ‘new’ to retain, if present, provided as a character string. |
Can be used to update price dataframes retrieved by
oanda
. The function is designed to update existing data
with new values as they become available. As opposed to
df_merge
, the data in ‘new’ will overwrite the data
in ‘old’ rather than create duplicates.
A data.frame of the existing data appended with the new data. If the data in ‘new’ contains data with the same value for the key column as ‘old’, the data in ‘new’ will overwrite the data in ‘old’.
If the attribute specified by ‘keep.attr’ is present in ‘new’, this is retained. All other non-required attributes are dropped.
data1 <- sample_ohlc_data[1:8, ]
data1
data2 <- sample_ohlc_data[7:10, ]
data2
df_append(data1, data2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.