read.csv.sql(file, sql = "select * from file", header = TRUE, sep = ",", row.names, eol, skip, filter, dbname = tempfile(), drv = "SQLite", ...)
read.csv2.sql(file, sql = "select * from file", header = TRUE, sep = ";", row.names, eol, skip, filter, dbname = tempfile(), drv = "SQLite", ...)
read.csv
.file
.read.csv
.read.csv
.read.csv
.read.csv2.sql
it is by default the following on non-Windows systems: tr , .
. This translates all commas in the file to dots. On Windowsqldf
except that the default is tempfile()
.read.csv.sql
and
read.csv2.sql
is SQLite.
Note that the H2 database has a builtin SQL function,
CSVREAD
, which can be used in place ofsqldf
.SQLite
to read the file
which are intended for speed and therefore
not as flexible as in R. For example, it does not
recognize quoted fields as special but will regard the quotes as
part of the field. See the
sqldf
help for more information.
read.csv2.sql
is like read.csv.sql
except
the default sep
is ";"
and the default filter
translates
all commas in the file to decimal points (i.e. to dots).
On Windows, if the filter
argument is used and if Rtools is detected
in the registry then the Rtools bin directory is added to the search path
facilitating use of those tools without explicitly setting any the path.write.table(iris, "iris.csv", sep = ",", quote = FALSE, row.names = FALSE)
iris2 <- read.csv.sql("iris.csv",
sql = "select * from file where Sepal.Length > 5")
Run the code above in your browser using DataLab