数値以外のエントリを持つデータ フレームの「クロス積」を取る方法があるかどうか疑問に思っていました。エントリとして文字列 (長さ 235) を持つ単一列のデータ フレーム df.RICS と、エントリとして日付 (長さ 3004) を持つ別の df.dates があります。各日付が 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
数値に変換せずに expand.grid(df.RICS, df.dates) を使用できますか?
現在、私が持っているのは次のとおりです。
> 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