[R] how to read a database in R?

John Kane jrkr|de@u @end|ng |rom gm@||@com
Sat Feb 1 15:55:23 CET 2020


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 <sokovic.anamarija using gmail.com> 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 <krylov.r00t using gmail.com> wrote:
>
> > On Fri, 31 Jan 2020 17:02:16 -0600
> > Ana Marija <sokovic.anamarija using gmail.com> 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]]
>
> ______________________________________________
> R-help using r-project.org 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]]



More information about the R-help mailing list