I'll try to pinch hit for Ista since he appears to be busy at the moment. His advice about removing NAs in Vars 4-6 is correct, as usual; here's one way to do it. Call this the split-reshape-combine approach :)
library(reshape2)
library(ggplot2)
# try() is the name of a common function in R, so rename
Try = read.csv(file="Data.csv", header = TRUE, sep = ",")
Try$Date = as.Date(Try$Date, format='%d/%m/%Y')
# Create two sub-data frames: one for the first three variables,
# another for the latter three, both including Date
try0 <- Try[, 1:4]
try1 <- Try[, c(1, 5:7)]
# logical vector to determine if any of Var4-Var6 are nonzero
# in a given row of try1; use this for subsetting below
v <- apply(try1[, -1], 1, function(x) any(!
is.na(x)))
trym0 <- melt(try0, id = "Date") # 738 x 3
trym1 <- melt(try1[v, ], id = "Date") # 45 x 3
# Note: variable has different levels in trym0 and trym1
# The two data frames have the same variables, so rbind them
trym <- rbind(trym0, trym1)
# redefine the factor 'variable' to get all of the levels from both
trym$variable <- factor(trym$variable)
# Now plot...
qplot(Date, value, data=trym, colour = variable, size = I(1.2)) + geom_line() +
Observe that you still get a gap in the line plot of Var4, but that's because it has missing values for three years where Vars 5 and 6 do not. The gap is informative. You see the same thing in Var1, but it's less obvious due to the data density. I reduced the point size to reduce overlap of the points - if you like the original point size, just get rid of the argument in qplot(). (size = 1.3 will give you visually larger points).
Dennis