as I keep on doing it, in the "environment" the view_scoreinfo, which is supposed to be a table, is listed down as a "list", the number of the list under it keeps on increasing. Why is this happening ??? Can someone help ??
what you're running into is view_scoreinfo is not a local data frame. It's a lazy dataframe which is a pointer to a table on the server but no data has been returned to your computer. You can read about that here: https://dbplyr.tidyverse.org/articles/dbplyr.html
it's really worth reading the intro to dbplyr so you have a mental model of what's going on. The high level view is that you can set up your operations using dplyr and then when you call collect dbplyr actually writes sql and returns the desired results to R. So you could do something like this:
I am facing another issue. I was using tbl function to save the view as a table, it is in the "dplyr" package. I am getting another error in this command!!!!
view_scoreinfo <-tbl(Postab,"VIEW_SCOREINFO_ALL")
I am getting the following error,
Error in UseMethod("tbl") :
no applicable method for 'tbl' applied to an object of class "Microsoft SQL Server"
Yesterday this function was working absolutely fine. Not able to find a function in dbplyr which works the same way as tbl.
Hey, I found the error,
I had to install both dplyr as well dbplyr before running the code that I had shared earlier.
view_scoreinfo <-tbl(Postab,"VIEW_SCOREINFO_ALL")
But I am running in another problem.
Error: 'SELECT TOP 6 "rnk"
FROM "VIEW_SCOREINFO_ALL"'
nanodbc/nanodbc.cpp:1587: 08S01: [Microsoft][ODBC SQL Server Driver]Communication link failure
I am getting the above error when I running the below code:
head(select(view_scoreinfo,rnk))
rnk is a column in the view_scoreinfo in which I have saved the view from the database.
I also ran a different command and got the same error.
view_scoreinfo %>% filter(view_scoreinfo$rnk==1)
above is the command.
Error: 'SELECT TOP 10 *
FROM "VIEW_SCOREINFO_ALL"
WHERE ( = 1.0)'
nanodbc/nanodbc.cpp:1587: 08S01: [Microsoft][ODBC SQL Server Driver]Communication link failure