Hi All,
I am very new R and I am working with a database. I have been able to connect with the database using the below code.
install.packages("odbc")
library(odbc)
con <- dbConnect(odbc::odbc(),
Server = "Serverlink",
Database = "name",
UID = "username",
PWD = "password",
Driver="SQL Server"
)
then saved one of the views of the db as a table in R. using the below code.
install.packages("dbplyr")
library(dbplyr)
#to save the table in R
view_scoreinfo <-tbl(con,"view_name")
To get an understanding of datatypes I started to list down the class of all variables. It was showing "NULL" as a result for all of them.
So I started converting all of them one by to the required datatype.
view_scoreinfo$GroupId <- as.factor(view_scoreinfo$GroupId)
class(view_scoreinfo$GroupId)
view_scoreinfo$block <- as.factor(view_scoreinfo$block)
class(view_scoreinfo$block)
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 ??
Best,
Kumar Ashwarya