sql - R, RPostgreSQL: a vector in a query -


using rpostgresql package have query vector in string:

dbgetquery(con, "select id_table id_user in tmp") 

where tmp should list or vector of length= 10k, how can this? thanks.

you can use paste0. here example take state.abb dataset

valid_state_logic=paste0("(",paste0("'",state.abb,"'", collapse=","),")")  print(valid_state_logic) [1] "('dc','al','ak','az','ar','ca','co','ct','de','fl','ga','hi','id','il','in','ia','ks','ky','la','me','md','ma','mi','mn','ms','mo','mt','ne','nv','nh','nj','nm','ny','nc','nd','oh','ok','or','pa','ri','sc','sd','tn','tx','ut','vt','va','wa','wv','wi','wy')" 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -