我是R.的新手.这是我的具体问题.假设我正在使用下面这个名为"data"的数据集.我的标题是state,type和value.
structure(list(state = structure(c(1L, 1L, 1L, 1L, 2L, 2L), .Label = c("AK",
"AL"), class = "factor"), type = structure(c(2L, 2L, 1L, 1L,
2L, 1L), .Label = c(" D", " R"), class = "factor"), value = c(100L,
200L, 100L, 150L, 100L, 150L)), .Names = c("state", "type", "value"
), class = "data.frame", row.names = c(NA, -6L))
state type value
1 AK R 100
2 AK R 200
3 AK D 100
4 AK D 150
5 …Run Code Online (Sandbox Code Playgroud)