Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in import... : could not find function "import" #320

Closed
manleiva opened this issue Jan 23, 2023 · 1 comment
Closed

Error in import... : could not find function "import" #320

manleiva opened this issue Jan 23, 2023 · 1 comment

Comments

@manleiva
Copy link

I have a problem with import function in ‘openair’ version 2.14
Xcode Version 14.2
R version 4.2.2
RStudio Versión 2022.12.0+353

The code give the problem is

FileAsHIS<-import("dis-As-qco-QNTIII.csv", file.type = "csv", sep = ";", na.strings=c("NA", "NV","NaN"), date = "Date")
Error in import("dis-As-qco-QNTIII.csv", file.type = "csv", sep = ";", : could not find function "import"

Some ideas?

Manuel

The data are
dateCD;Date;MES;ANNO;As;As_ng
2/1/2010;2/1/2010 23:00;1;2010;;NA
5/1/2010;5/1/2010 23:00;1;2010;;NA
8/1/2010;8/1/2010 23:00;1;2010;;NA
11/1/2010;11/1/2010 23:00;1;2010;;NA
14/1/2010;14/1/2010 23:00;1;2010;;NA
17/1/2010;17/1/2010 23:00;1;2010;;NA
20/1/2010;20/1/2010 23:00;1;2010;;NA
23/1/2010;23/1/2010 23:00;1;2010;;NA
26/1/2010;26/1/2010 23:00;1;2010;;NA
29/1/2010;29/1/2010 23:00;1;2010;;NA
1/2/2010;1/2/2010 23:00;2;2010;;NA
4/2/2010;4/2/2010 23:00;2;2010;;NA
7/2/2010;7/2/2010 23:00;2;2010;;NA
10/2/2010;10/2/2010 23:00;2;2010;;NA
13/2/2010;13/2/2010 23:00;2;2010;;NA
16/2/2010;16/2/2010 23:00;2;2010;;NA
19/2/2010;19/2/2010 23:00;2;2010;;NA
22/2/2010;22/2/2010 23:00;2;2010;;NA
25/2/2010;25/2/2010 23:00;2;2010;;NA
28/2/2010;28/2/2010 23:00;2;2010;;NA
3/3/2010;3/3/2010 23:00;3;2010;;NA

@manleiva manleiva changed the title import issue import issue Error in import... : could not find function "import" Jan 23, 2023
@manleiva manleiva changed the title import issue Error in import... : could not find function "import" Error in import... : could not find function "import" Jan 23, 2023
@jack-davison
Copy link
Collaborator

Hi Manuel,

import() was removed from openair in the most recent update; there are now so many tools provided in base R and extension packages (e.g., readr for reading data and lubridate for handling dates) that there wasn't cause to maintain import() any further.

However, you should be able to read in your data using purely Base R by using code along these lines:

# read data
data <-
  read.delim(file = "dis-As-qco-QNTIII.csv",
             sep = ";",
             na.strings = c("NA", "NV", "NaN"))

# format "Date" as date
data$Date <- as.POSIXct(data$Date, format = "%d/%m/%Y %H:%M") 
      dateCD                Date MES ANNO As As_ng
1   2/1/2010 2010-01-02 23:00:00   1 2010 NA    NA
2   5/1/2010 2010-01-05 23:00:00   1 2010 NA    NA
3   8/1/2010 2010-01-08 23:00:00   1 2010 NA    NA
4  11/1/2010 2010-01-11 23:00:00   1 2010 NA    NA
5  14/1/2010 2010-01-14 23:00:00   1 2010 NA    NA
6  17/1/2010 2010-01-17 23:00:00   1 2010 NA    NA
7  20/1/2010 2010-01-20 23:00:00   1 2010 NA    NA
8  23/1/2010 2010-01-23 23:00:00   1 2010 NA    NA
9  26/1/2010 2010-01-26 23:00:00   1 2010 NA    NA
10 29/1/2010 2010-01-29 23:00:00   1 2010 NA    NA
11  1/2/2010 2010-02-01 23:00:00   2 2010 NA    NA
12  4/2/2010 2010-02-04 23:00:00   2 2010 NA    NA
13  7/2/2010 2010-02-07 23:00:00   2 2010 NA    NA
14 10/2/2010 2010-02-10 23:00:00   2 2010 NA    NA
15 13/2/2010 2010-02-13 23:00:00   2 2010 NA    NA
16 16/2/2010 2010-02-16 23:00:00   2 2010 NA    NA
17 19/2/2010 2010-02-19 23:00:00   2 2010 NA    NA
18 22/2/2010 2010-02-22 23:00:00   2 2010 NA    NA
19 25/2/2010 2010-02-25 23:00:00   2 2010 NA    NA
20 28/2/2010 2010-02-28 23:00:00   2 2010 NA    NA
21  3/3/2010 2010-03-03 23:00:00   3 2010 NA    NA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants