0
我在R中使用Sparklines軟件包,並使用reshapeExt()函數來準備數據集,但遇到了一個非常非常奇怪的問題。該數據集是這樣的:R Sparklines軟件包錯誤
Company time value
1 Microsoft 1990 11
2 Time Warner 1990 22
3 Verizon 1990 33
4 Microsoft 1991 44
5 Time Warner 1991 55
6 Verizon 1991 66
7 Microsoft 1992 77
8 Time Warner 1992 88
9 Verizon 1992 99
然後我跟着教程示例運行這些行:
example <- example[,c("Company","value","time")]
example$time <- as.numeric (as.character (example$ time))
dat <- reshapeExt (example , idvar =" Company " , varying = list (2))
令人費解的是,R給了我這個爲 「逸」:
Company time value Company
1 Microsoft 1 11 1
2 Time Warner 1 22 2
3 Verizon 1 33 3
4 Microsoft 1 44 4
5 Time Warner 1 55 5
6 Verizon 1 66 6
7 Microsoft 1 77 7
8 Time Warner 1 88 8
9 Verizon 1 99 9
時間列全部變爲1,沒有明顯的原因。當我在https://web.warwick.ac.uk/statsdept/user2011/TalkSlides/Contributed/18Aug_0950_FocusVI_4-ReportingData_2-Kowarik.pdf第18頁實施示例時不會發生這種情況 - 此處發生了什麼?
任何幫助