## -- Attaching packages ---------------------------------------------------------------- tidyverse 1.2.1 --
## √ ggplot2 3.2.1 √ purrr 0.3.3
## √ tibble 2.1.3 √ dplyr 0.8.3
## √ tidyr 0.8.3 √ stringr 1.4.0
## √ readr 1.3.1 √ forcats 0.4.0
## Warning: package 'ggplot2' was built under R version 3.6.2
## Warning: package 'purrr' was built under R version 3.6.1
## Warning: package 'dplyr' was built under R version 3.6.1
## -- Conflicts ------------------------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(reshape2)
##
## Attaching package: 'reshape2'
## The following object is masked from 'package:tidyr':
##
## smiths
attach(ToothGrowth)
mydata <- dcast(ToothGrowth, len ~ supp)
## Using dose as value column: use value.var to override.
## Aggregation function missing: defaulting to length
data <- cbind(ToothGrowth[1:30, ], ToothGrowth[31:60, ])
data <- data.frame(dose = data[, 3], VC = data[, 1], OJ = data[, 4])
================ Jiaxiang Li 2020-02-20
这里有重复数据,但是都是10行,对称的,这里加一列index即可,使得 key(s) 唯一不重复。
因此 keys 唯一了。