search for: hack12bat

Displaying 3 results from an estimated 3 matches for "hack12bat".

2020 Oct 08
0
Lahman Baseball Data Using R DBI Package
...;t like column names that start with a number. If you try to access an R-dataframe column named 2B or 3B with the familiar "$" notation, you'll get an error: > library(DBI) > library(RSQLite) > con2 <- dbConnect(SQLite(), "~/R_Dir/lahmansbaseballdb.sqlite") > Hack12Batting <- dbGetQuery(con2,"SELECT * FROM batting WHERE yearID = 2018 AND AB >600 ORDER BY AB DESC") > Hack12Batting$AB [1] 664 661 639 632 632 632 626 623 620 618 617 613 606 605 602 > Hack12Batting$3B Error: unexpected numeric constant in "Hack12Batting$3" How to han...
2020 Oct 08
1
Lahman Baseball Data Using R DBI Package
...rt with a number. If you try to access an R-dataframe column named > 2B or 3B with the familiar "$" notation, you'll get an error: > > > library(DBI) > > library(RSQLite) > > con2 <- dbConnect(SQLite(), "~/R_Dir/lahmansbaseballdb.sqlite") > > Hack12Batting <- dbGetQuery(con2,"SELECT * FROM batting WHERE yearID = > 2018 AND AB >600 ORDER BY AB DESC") > > Hack12Batting$AB > [1] 664 661 639 632 632 632 626 623 620 618 617 613 606 605 602 > > Hack12Batting$3B > Error: unexpected numeric constant in "Hack12Ba...
2020 Oct 03
1
Lahman Baseball Data Using R DBI Package
The double quotes are required by SQL if a name is not of the form letter-followed-by-any-number-of-letters-or-numbers or if the name is a SQL keyword like 'where' or 'select'. If you are doing this from a function, you may as well quote all the names. -Bill On Fri, Oct 2, 2020 at 6:18 PM Philip <herd_dog at cox.net> wrote: > The \?2B\? worked. Have no idea why. Can