README.md

rarsons

this package is primarily meant to be an r port of parsons, but also contains other things i find useful

the parsons package is named after Lucy Parsons, an incredible labor organizer and anarcha-feminist thinker

Change Log

Functions

querying a database

cstring_gen('DB_Name'
            ,'DB_IP'
            ,'Database'
            ,'Username'
            ,'Pass'
            ,'Port')

generates a variable named 'c_string' to set up a db connection

get_SQL(filepath)

takes a file path to a .sql script as a string, then formats it so it can be read by a query function

db_query(query)

checks to see if the db specified in c_string is open, and opens it if not. then runs a query generated with the get_sql() and returns it as a dataframe

sending data to a google sheet

gsheet_send(df,google_sheet,null_handle)

arguments: df - dataframe in r google_sheet - string of the google sheet name, or url * null_handle - how to handle nulls, passed to write_csv(), usually do "" or 0

Examples

querying a database then sending it to google sheets

 cstring_gen('DB_Name'
            ,'DB_IP'
            ,'Database'
            ,'Username'
            ,'Pass'
            ,'Port')

query <- get_SQL("path/to/file.sql")

table <- db_query(query)

gsheet_send(table,'google_sheet',"")


rwebsterav/rarsons documentation built on Dec. 31, 2019, 9:28 a.m.