0

I'm relatively new to R and I'm trying to create some graphs from air quality data. I was able to follow the tutorials and achieve what I want, there is just one thing that does not work for me.

I have a CSV with one column Date, one Time and some other columns with data. I was able to use the selectbydate method to extract certain period. Now what I need to do is combine two or more periods together into one dataset.

So far I have:

library(writexl)
library(openair)

dataSet <- import(file = "dataCSV.csv", file.type = "csv", sep = ";", header.at = 1, data.at = 2, date = "Date", date.format = "%d.%m.%Y", time = "Time", time.format = "%H:%M",quote = "\"")
x <- selectByDate(dataSet, start = "31/8/2018", end = "31/8/2018", hour = 21:23)

I then use "x" for the analysis and it works fine.

However when I try this:

x <- selectByDate(dataSet, start = "31/8/2018", end = "31/8/2018", hour = 21:23)
y <- selectByDate(dataSet, start = "1/9/2018", end = "1/9/2018", hour = 0)
z <- merge(x,y)

And I then try to pass "z" as the dataset later, I get

Error in matrix(unlist(value, recursive = FALSE, use.names = FALSE), nrow = nr,  : 

length of 'dimnames' [2] not equal to array extent

Thanks in advance for any help.

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
Jachym
  • 485
  • 9
  • 21
  • I think you're using merge wrong. How do you want to merge your tables? Do you want to perform an inner join or append x with y. For appending the table, you need to use `rbind` . – Rohit Sep 21 '18 at 05:33
  • Thanks, thats exactly what I wanted :) Rbind instead of merge works just fine! – Jachym Sep 21 '18 at 05:38

0 Answers0