Bringing sql-server query results into a dataFrame in R -
assuming have working connection , able pull in whole tables sql-server r without problems. issue trying bring in results of query r after merging date , time columns in sql 1 datetime column in r plus 2 other columns
have ddate, ttime, price, qty. in database. want bring in data r dataframe in 3 r fields timedate field time stamp price , quantity.
i tried code didn't work, conn open connection:
sqlfetch(conn,"select convert(datetime,ddate + ' ' + ttime,20) trantime, price, qty mytable order ddate, ttime")
any appreciated.
pull data sql in xml format adding xml auto end of sql reuest:
select convert(datetime,ddate + ' ' + ttime,20) trantime, price, qty mytable order ddate, ttime xml auto
result this
<mytable trantime="10" price="17" qty="34" />
use xml package r (will give options extract data )
library(xml) file <- xmlparse(xmldata )
Comments
Post a Comment