2
I have a list of 12 DF's
that I need to put together in a single DF
. The structure of all is equal, only differing the name of the second column, so the basic structure is: Column 1 is the date and Column 2 the name of the object.
The DF's
have different number of lines for the available dates of each series.
I tried to use the function full_join
package dplyr
, but only worked with 2 objects at a time. The cbind
does not work because data have different line numbers.
Example:
library(dplyr)
x <- data.frame(data = seq.Date(from = as.Date("2009-07-01"), to = as.Date("2015-08-31"),
length.out = as.Date("2015-08-31") - as.Date("2009-07-01")), x = c(1:2252))
y <- data.frame(data = seq.Date(from = as.Date("2009-07-01"), to = as.Date("2017-09-15"),
length.out = as.Date("2017-09-15") - as.Date("2009-07-01")), y = c(1:2998))
z <- data.frame(data = seq.Date(from = as.Date("2010-07-01"), to = as.Date("2017-09-15"),
length.out = as.Date("2010-09-15") - as.Date("2009-07-01")), z = c(1:441))
dados <- full_join(x, y, z)
Returns the following error:
Erro: `by` must be a (named) character vector, list, or NULL for natural joins (not recommended in production code), not a `data.frame` object
I noticed that at the time of joining the dates, some data have equal dates, but are appearing with
NA
.– Alexandre Sanches
Try converting the dates to Character before joining. The Date is a "rounded" POSIX display, two equal dates can match different numerical values.
– Carlos Eduardo Lagosta