0
我正在從R終端下列R-腳本,繪圖窗口,但沒有情節 - R的debian的拉伸
library(xts)
library(csv)
library(graphics)
dt <- data.frame(read.csv("/home/russellb/tmp.csv", header=TRUE, sep=','));
df <- xts(dt[-c[1], as.Date(dt$Datum));
print(head(df[,2]));
plot(df[,2])
我拿到我的[R控制檯下面,
Amount$
2016-03-03 630200
2016-03-04 2971100
2016-03-05 3023800
2016-03-06 1669300
2016-03-07 1704900
2016-03-08 1415500
沒有錯誤或警告消息。
繪圖窗口出現,但沒有繪製數據,繪圖窗口爲空,標題爲「R Graphics:Device 2(ACTIVE)」。
當我鍵入,
x11()
在R控制檯
,會出現一個圖形窗口,當我鍵入以下,
plot(1:100)
我得到的窗口中繪製的數據。
我嘗試在腳本中添加x11()
但沒有任何運氣。我正在R-3.3.3我Debian的拉伸9.1
我sessionInfo()
輸出如下,
R version 3.3.3 (2017-03-06)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lattice_0.20-34 csv_0.5 xts_0.10-0 zoo_1.8-0
loaded via a namespace (and not attached):
[1] grid_3.3.3
dput的輸出(頭(DAT))
structure(list(Datum = structure(c(505L, 504L, 503L,
502L, 501L, 500L), .Label = c("2016-03-03", "2016-03-04", "2016-03-05",
"2016-03-06", "2016-03-07", "2016-03-08", "2016-03-09", "2016-03-10",
"2016-03-11", "2016-03-12", "2016-03-13", "2016-03-14", "2016-03-15",
"2016-03-16", "2016-03-17", "2016-03-18", "2016-03-19", "2016-03-20",
...
"2017-07-17", "2017-07-18", "2017-07-19", "2017-07-20", "2017-07-21",
"2017-07-22", "2017-07-23"), class = "factor"), Amount = c(1700500L,
2286600L, 3018700L, 2012100L, 2357600L, 1983500L), DM50 = c(230L,
294L, 454L, 267L, 316L, 270L), DM10 = c(226L, 399L, 364L, 330L,
371L, 298L), DM5 = c(516L, 699L, 636L, 573L, 676L, 549L), DM1 = c(665L, 681L, 667L, 606L, 686L, 610L)), .Names = c("Datum", Amount", "X50", "X10", "X5", "X1"), row.names = c(NA, 6L), class = "data.frame")
任何幫助將不勝感激。
您應該發佈'dput(head(dt))'的輸出。目前還不清楚你的數據框裏有什麼。在列名中看到「$」是非常奇怪的。 –
我的'print(head(df [,2]))'輸出表示數據已正確加載。但沒有繪製。謝謝@ 42- – RussellB
加了info @ 42- – RussellB