Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 19个变量的月度相关性_R - Fatal编程技术网

R 19个变量的月度相关性

R 19个变量的月度相关性,r,R,我有以下21列的数据集-19个变量,月和日期作为日期类型列 目的是分析相关性如何随时间变化,计算一个月内总结的变量之间的每日相关性。例如,查看随时间变化的“月度相关性”。(X轴作为月份类型) +------------+---------+-----+-----+--------+---------+-------------+ |日期|月份| AOV | ASP |点击|流量|印象| +------------+---------+-----+-----+--------+---------

我有以下21列的数据集-19个变量,月和日期作为日期类型列

目的是分析相关性如何随时间变化,计算一个月内总结的变量之间的每日相关性。例如,查看随时间变化的“月度相关性”。(X轴作为月份类型)


+------------+---------+-----+-----+--------+---------+-------------+
|日期|月份| AOV | ASP |点击|流量|印象|
+------------+---------+-----+-----+--------+---------+-------------+
| 2017-01-01 | 2017-01 | 50  | 6   | 700    | 10000   | 4500        |
+------------+---------+-----+-----+--------+---------+-------------+
| 2017-01-02 | 2017-01 | 55  | 7   | 800    | 20000   | 4600        |
+------------+---------+-----+-----+--------+---------+-------------+
| 2017-02    | 2017-02 | 58  | 8   | 700    | 4599    | 2300        |
+------------+---------+-----+-----+--------+---------+-------------+

目前我有以下代码,但我只能同时比较两个变量

ddply(corr,"Month",summarise,corr=cor(AOV,ASP))
我得到下表


+---------+------------+
|月份|
+---------+------------+
| 2017-1  | 0.4958738  |
+---------+------------+
| 2017-10 | 0.8527522  |
+---------+------------+
| 2017-11 | -0.2751771 |
+---------+------------+
|2017-12 |不适用|
+---------+------------+
| 2017-2  | 0.6596346  |
+---------+------------+
| 2017-3  | 0.6399969  |
+---------+------------+
| 2017-4  | 0.7926245  |
+---------+------------+
| 2017-5  | 0.6429613  |
+---------+------------+
| 2017-6  | 0.3824414  |
+---------+------------+
| 2017-7  | 0.9154873  |
+---------+------------+
| 2017-8  | 0.7235767  |
+---------+------------+
| 2017-9  | 0.8264006  |
+---------+------------+

我一直在使用combn创建组合集,但我不太确定如何将其与ddply一起使用。我有171对组合

combn(corr,2,simplify = F)
您只需执行以下操作:
cor(你的数据帧)

不要像这样复制粘贴你的数据。请提供一个。你能详细说明一下吗?你能解释一下你在做什么以及这是如何工作的吗?这只会给你总体的相关性,但我想跟踪相关性超时。嗨,安杰洛,如上所述,如果你能做出一个允许我和其他人帮助的回答。