Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One can go directly into SQLITE using read.csv.sql() OR read.csv2.sql() from the sqldf package.</p> <p>From the online manual:</p> <p><a href="http://code.google.com/p/sqldf/#Example_13._read.csv.sql_and_read.csv2.sql" rel="noreferrer">Link</a></p> <blockquote> <p>Example 13. read.csv.sql and read.csv2.sql read.csv.sql is an interface to sqldf that works like read.csv in R except that it also provides an sql= argument and not all of the other arguments of read.csv are supported. It uses (1) SQLite's import facility via RSQLite to read the input file into a temporary disk-based SQLite database which is created on the fly. (2) Then it uses the provided SQL statement to read the table so created into R. As the first step imports the data directly into SQLite without going through R it can handle larger files than R itself can handle as long as the SQL statement filters it to a size that R can handle. Here is Example 6c redone using this facility:</p> </blockquote> <pre><code># Example 13a. library(sqldf) write.table(iris, "iris.csv", sep = ",", quote = FALSE, row.names = FALSE) iris.csv &lt;- read.csv.sql("iris.csv", sql = "select * from file where Sepal_Length &gt; 5") # Example 13b. read.csv2.sql. Commas are decimals and ; is sep. library(sqldf) Lines &lt;- "Sepal.Length;Sepal.Width;Petal.Length;Petal.Width;Species 5,1;3,5;1,4;0,2;setosa 4,9;3;1,4;0,2;setosa 4,7;3,2;1,3;0,2;setosa 4,6;3,1;1,5;0,2;setosa " cat(Lines, file = "iris2.csv") iris.csv2 &lt;- read.csv2.sql("iris2.csv", sql = "select * from file where Sepal_Length &gt; 5") </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload