I was wondering if there is a way to take a “cross-product” from data frames with non-numeric entries. I have a one-column df.RICS data frame with rows as records (length 235) and another df.dates with dates as records (length 3004). I need a data frame with each date matched with each row in df.RICS:
dates 1 2004-04-23 2 2004-04-24 3 2004-04-25 4 2004-04-26 5 2004-04-27 6 2004-04-28 7 2004-04-29 8 2004-04-30 9 2004-05-01 10 2004-05-02 RICS 1 AA.N 2 AAP 3 AAP.N 4 AAPL.O 5 ABGL.L
Is it possible to use expand.grid (df.RICS, df.dates) without converting to numeric values?
Now all I have is:
> expand.grid(datesAsVec, RICSAsVec, stringsAsFactors = TRUE) Var1 Var2 1 2004-04-23 AA.N Warning message: In format.data.frame(x, digits = digits, na.encode = FALSE) : corrupt data frame: columns will be truncated or padded with NAs
source share