2016-12-04 53 views
-3

我是A R初学者重塑长格式的宽幅通过“” COUNT” ..我怎样才能使它?

我有一个数据帧如下下面

enter image description here

我想重塑数据帧以上这样的..通过“数据框格式”

enter image description here

我知道我可以通过“表函数”使它表(incomegr = edu.q $ incomegr,edu.q $ langgr) 但这种格式是'table'not'dataframe'

即,我想让每个'incomegr','Gr9','Gr8' 作为数据帧列。

我该怎么做?

+0

什么是在预期输出 – akrun

+1

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-值列例 – Shape

回答

0

我们可以使用

as.data.frame.matrix(table(incomegr=edu.q$incomegr,edu.q$langgr))