Ваши данные трудно читать в этом формате;Вот воспроизводимая версия:
DF <-
structure(list(Date = structure(c(15311, 15311, 15311, 15311,
15311, 15312, 15312, 15312, 15312, 15312), class = "Date"), fileSystem = structure(c(5L,
2L, 4L, 1L, 3L, 5L, 2L, 4L, 1L, 3L), .Label = c("/data", "/opt",
"/ora", "/tmp", "/var"), class = "factor"), FreeSpace = c(99.785,
30.494, 55.643, 37.846, 0.578, 99.785, 30.494, 55.643, 37.846,
0.578)), .Names = c("Date", "fileSystem", "FreeSpace"), row.names = c(NA,
-10L), class = "data.frame")
Я также покажу примеры с ggplot2
:
library("ggplot2")
library("scales")
Это использует огранку сетки, а не перенос, как в ответе @ EDi.Один не более прав, чем другой;это зависит от того, что вы хотите.
ggplot(DF, aes(x=Date, y=FreeSpace)) +
geom_point() +
geom_line() +
scale_x_date(breaks=date_breaks("1 day")) +
facet_grid(fileSystem~.)
![enter image description here](https://i.stack.imgur.com/RK9Bn.png)
Ваш другой вопрос был о том, как изменить данные.
library("reshape2")
DF.wide <- dcast(DF, Date~fileSystem, value.var="FreeSpace")
, что дает
> DF.wide
Date /data /opt /ora /tmp /var
1 2011-12-03 37.846 30.494 0.578 55.643 99.785
2 2011-12-04 37.846 30.494 0.578 55.643 99.785
Отдельные столбцы могут быть построены по желанию, затем.