Q about RSQLite

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Q about RSQLite

Wensui Liu
Happy new year, dear listers,

I have a question about Rsqlite.

when I fetch the data out of sqlite database, there is something like '\r\n'
at the end of last column. Here is the example:
   Sepal_Length Sepal_Width Petal_Length Petal_Width    Species
1           5.1         3.5          1.4         0.2 setosa\r\n
2           4.9         3.0          1.4         0.2 setosa\r\n
3           4.7         3.2          1.3         0.2 setosa\r\n
4           4.6         3.1          1.5         0.2 setosa\r\n
5           5.0         3.6          1.4         0.2 setosa\r\n
6           5.4         3.9          1.7         0.4 setosa\r\n
7           4.6         3.4          1.4         0.3 setosa\r\n
8           5.0         3.4          1.5         0.2 setosa\r\n
9           4.4         2.9          1.4         0.2 setosa\r\n
10          4.9         3.1          1.5         0.1 setosa\r\n

Any idea?

Thank you so much

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Q about RSQLite

Pfaff, Bernhard Dr.
Hello Liu,

this might be caused by NA entries in your SQLite table. Have a look at the
following code:


(test <- data.frame(matrix(c(1:10, NA, NA), ncol=2, nrow=6)))
con <- dbConnect(SQLite(), dbname = "test.db")
dbWriteTable(con, "test", test, type="BLOB", overwrite=TRUE)
d1 <- dbReadTable(con, "test")
dbDisconnect(con)
d1


HTH,
Bernhard  

-----Urspr√ľngliche Nachricht-----
Von: Wensui Liu [mailto:[hidden email]]
Gesendet: Samstag, 31. Dezember 2005 07:09
An: [hidden email]
Betreff: [R] Q about RSQLite

Happy new year, dear listers,

I have a question about Rsqlite.

when I fetch the data out of sqlite database, there is something like '\r\n'
at the end of last column. Here is the example:
   Sepal_Length Sepal_Width Petal_Length Petal_Width    Species
1           5.1         3.5          1.4         0.2 setosa\r\n
2           4.9         3.0          1.4         0.2 setosa\r\n
3           4.7         3.2          1.3         0.2 setosa\r\n
4           4.6         3.1          1.5         0.2 setosa\r\n
5           5.0         3.6          1.4         0.2 setosa\r\n
6           5.4         3.9          1.7         0.4 setosa\r\n
7           4.6         3.4          1.4         0.3 setosa\r\n
8           5.0         3.4          1.5         0.2 setosa\r\n
9           4.4         2.9          1.4         0.2 setosa\r\n
10          4.9         3.1          1.5         0.1 setosa\r\n

Any idea?

Thank you so much

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
*****************************************************************
Confidentiality Note: The information contained in this mess...{{dropped}}

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Q about RSQLite

bogdan romocea
In reply to this post by Wensui Liu
Check the way you imported the data / the SQLite documentation. The
\r\n that you see (you're on Windows, right?) is used to indicate the
end of the data lines in the source file - \r is a carriage return,
and \n is a new line character.


> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Wensui Liu
> Sent: Saturday, December 31, 2005 1:09 AM
> To: [hidden email]
> Subject: [R] Q about RSQLite
>
>
> Happy new year, dear listers,
>
> I have a question about Rsqlite.
>
> when I fetch the data out of sqlite database, there is
> something like '\r\n'
> at the end of last column. Here is the example:
>    Sepal_Length Sepal_Width Petal_Length Petal_Width    Species
> 1           5.1         3.5          1.4         0.2 setosa\r\n
> 2           4.9         3.0          1.4         0.2 setosa\r\n
> 3           4.7         3.2          1.3         0.2 setosa\r\n
> 4           4.6         3.1          1.5         0.2 setosa\r\n
> 5           5.0         3.6          1.4         0.2 setosa\r\n
> 6           5.4         3.9          1.7         0.4 setosa\r\n
> 7           4.6         3.4          1.4         0.3 setosa\r\n
> 8           5.0         3.4          1.5         0.2 setosa\r\n
> 9           4.4         2.9          1.4         0.2 setosa\r\n
> 10          4.9         3.1          1.5         0.1 setosa\r\n
>
> Any idea?
>
> Thank you so much
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html