how to read a database in R?

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

how to read a database in R?

anikaM
Hello,

I have a database DGN-WB_0.5.db is there is a way to explore its
content in R? I don't know anything about this data base.

Thanks
Ana

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: how to read a database in R?

Jeff Newmiller
Too little information to tell. I googled the file name though and pages about genetics came up... perhaps you should ask in the Bioconductor support area.

On January 31, 2020 3:02:16 PM PST, Ana Marija <[hidden email]> wrote:

>Hello,
>
>I have a database DGN-WB_0.5.db is there is a way to explore its
>content in R? I don't know anything about this data base.
>
>Thanks
>Ana
>
>______________________________________________
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: how to read a database in R?

Hasan Diwan-2
In reply to this post by anikaM
Ms Marija,
Would you happen to know which program created it? If not, you can try the
Unix file command, if you have access to that. -- H

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: how to read a database in R?

Ivan Krylov
In reply to this post by anikaM
On Fri, 31 Jan 2020 17:02:16 -0600
Ana Marija <[hidden email]> wrote:

> I have a database DGN-WB_0.5.db is there is a way to explore its
> content in R?

My psychic debugging powers tell me that it's an SQLite database, so
the answer to your question is: yes, it should be possible to both find
out the schema and run SQL queries on your file from R.

--
Best regards,
Ivan

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: how to read a database in R?

anikaM
Hi Ivan

Thanks for getting back to me. Can you please share with me some code I
would use to see what is in my database?

On Sat, 1 Feb 2020 at 06:19, Ivan Krylov <[hidden email]> wrote:

> On Fri, 31 Jan 2020 17:02:16 -0600
> Ana Marija <[hidden email]> wrote:
>
> > I have a database DGN-WB_0.5.db is there is a way to explore its
> > content in R?
>
> My psychic debugging powers tell me that it's an SQLite database, so
> the answer to your question is: yes, it should be possible to both find
> out the schema and run SQL queries on your file from R.
>
> --
> Best regards,
> Ivan
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: how to read a database in R?

John Kane-3
Hi Ana
Stolen from https://gist.github.com/jwolfson/72bc7d7fd8d339955b38
I cannot remember if you will need to install any other packages besides
RSQLite

library(RSQLite)
filename <- "your_db_file.db"
sqlite.driver <- dbDriver("SQLite")
db <- dbConnect(sqlite.driver,
                dbname = filename)

## Some operations
dbListTables(db)
mytable <- dbReadTable(db,"your_table_name"

Best of luck


On Sat, 1 Feb 2020 at 07:53, Ana Marija <[hidden email]> wrote:

> Hi Ivan
>
> Thanks for getting back to me. Can you please share with me some code I
> would use to see what is in my database?
>
> On Sat, 1 Feb 2020 at 06:19, Ivan Krylov <[hidden email]> wrote:
>
> > On Fri, 31 Jan 2020 17:02:16 -0600
> > Ana Marija <[hidden email]> wrote:
> >
> > > I have a database DGN-WB_0.5.db is there is a way to explore its
> > > content in R?
> >
> > My psychic debugging powers tell me that it's an SQLite database, so
> > the answer to your question is: yes, it should be possible to both find
> > out the schema and run SQL queries on your file from R.
> >
> > --
> > Best regards,
> > Ivan
> >
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


--
John Kane
Kingston ON Canada

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: how to read a database in R?

anikaM
Hi John,

I tried it but this is what I got:

> library(RSQLite)
> filename <- "DGN-WB_0.5.db"
> sqlite.driver <- dbDriver("SQLite")
> db <- dbConnect(sqlite.driver,
+                 dbname = filename)
Warning message:
Couldn't set synchronous mode: disk I/O error
Use `synchronous` = NULL to turn off this warning.

Please advise,
Ana

On Sat, Feb 1, 2020 at 8:55 AM John Kane <[hidden email]> wrote:

>
> Hi Ana
> Stolen from https://gist.github.com/jwolfson/72bc7d7fd8d339955b38
> I cannot remember if you will need to install any other packages besides RSQLite
>
> library(RSQLite)
> filename <- "your_db_file.db"
> sqlite.driver <- dbDriver("SQLite")
> db <- dbConnect(sqlite.driver,
>                 dbname = filename)
>
> ## Some operations
> dbListTables(db)
> mytable <- dbReadTable(db,"your_table_name"
>
> Best of luck
>
>
> On Sat, 1 Feb 2020 at 07:53, Ana Marija <[hidden email]> wrote:
>>
>> Hi Ivan
>>
>> Thanks for getting back to me. Can you please share with me some code I
>> would use to see what is in my database?
>>
>> On Sat, 1 Feb 2020 at 06:19, Ivan Krylov <[hidden email]> wrote:
>>
>> > On Fri, 31 Jan 2020 17:02:16 -0600
>> > Ana Marija <[hidden email]> wrote:
>> >
>> > > I have a database DGN-WB_0.5.db is there is a way to explore its
>> > > content in R?
>> >
>> > My psychic debugging powers tell me that it's an SQLite database, so
>> > the answer to your question is: yes, it should be possible to both find
>> > out the schema and run SQL queries on your file from R.
>> >
>> > --
>> > Best regards,
>> > Ivan
>> >
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
>
> --
> John Kane
> Kingston ON Canada

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: how to read a database in R?

John Kane-3
What happens if you run "dbListTables(db) "?
That is a warning not an error.

I am a real novice with data bases so I may not be of much help but do you
know where the db file came from?

When I suggested the code above. i checked that ii worked on a sqlite file
I had, and hoped that Ivan's miraculous inspiration  was correct.  It could
possibly be some other db type

I will attach my sample db here and if it makes it through, you should be
able to load it if RSQLite is functioning on your machine.

On Sat, 1 Feb 2020 at 10:10, Ana Marija <[hidden email]> wrote:

> Hi John,
>
> I tried it but this is what I got:
>
> > library(RSQLite)
> > filename <- "DGN-WB_0.5.db"
> > sqlite.driver <- dbDriver("SQLite")
> > db <- dbConnect(sqlite.driver,
> +                 dbname = filename)
> Warning message:
> Couldn't set synchronous mode: disk I/O error
> Use `synchronous` = NULL to turn off this warning.
>
> Please advise,
> Ana
>
> On Sat, Feb 1, 2020 at 8:55 AM John Kane <[hidden email]> wrote:
> >
> > Hi Ana
> > Stolen from https://gist.github.com/jwolfson/72bc7d7fd8d339955b38
> > I cannot remember if you will need to install any other packages besides
> RSQLite
> >
> > library(RSQLite)
> > filename <- "your_db_file.db"
> > sqlite.driver <- dbDriver("SQLite")
> > db <- dbConnect(sqlite.driver,
> >                 dbname = filename)
> >
> > ## Some operations
> > dbListTables(db)
> > mytable <- dbReadTable(db,"your_table_name"
> >
> > Best of luck
> >
> >
> > On Sat, 1 Feb 2020 at 07:53, Ana Marija <[hidden email]>
> wrote:
> >>
> >> Hi Ivan
> >>
> >> Thanks for getting back to me. Can you please share with me some code I
> >> would use to see what is in my database?
> >>
> >> On Sat, 1 Feb 2020 at 06:19, Ivan Krylov <[hidden email]> wrote:
> >>
> >> > On Fri, 31 Jan 2020 17:02:16 -0600
> >> > Ana Marija <[hidden email]> wrote:
> >> >
> >> > > I have a database DGN-WB_0.5.db is there is a way to explore its
> >> > > content in R?
> >> >
> >> > My psychic debugging powers tell me that it's an SQLite database, so
> >> > the answer to your question is: yes, it should be possible to both
> find
> >> > out the schema and run SQL queries on your file from R.
> >> >
> >> > --
> >> > Best regards,
> >> > Ivan
> >> >
> >>
> >>         [[alternative HTML version deleted]]
> >>
> >> ______________________________________________
> >> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >
> >
> >
> > --
> > John Kane
> > Kingston ON Canada
>


--
John Kane
Kingston ON Canada
______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.