Operational database (RODBC)
Odbcconnect (DSN, uid= "", pwd= "") Establish a connection to the ODBC database
SqlFetch (channel, sqltable) reads a table from an ODBC database into a data frame
SQLQuery (channel, query) submits a query to ODBC and returns the result
Sqlsave (channel, Dataframe, Tablename=table, Append=false, rowname=true) write or update a data frame to a table in an ODBC database
Sqlupdate (channel, Dataframe, Tablename=table, Append=false, Rowname=true, index= "")
Sqldrop (channel, table) delete a table (physical delete)
Sqlclear (channel, table) delete data from a table
Close (channel) Closed connection
Length (object)
Statement Variable[condition] <-expression will only perform an assignment if the value of condition is true.
Eg:leadership$agecat[leadership$age >] <-"Elder"
Rename rename (Dataframe, C (oldname= "NewName", oldname= "NewName", ...)) (Reshape bag)
Sort order (object)
Rank (object) returns the sorted ordinal number
Manipulating data frames using SQL statements (SQLDF): Sqldf (SQL): Use only select statements
NA (not available): Unavailable
NaN (not a number): Non-numeric
Determine if NA:is.na (object)
Remove na value: Na.omit (Object)
apply () function: You can "apply" an arbitrary function to any dimension of a matrix, an array, a data frame
Apply (x, MARGIN, fun, ...)
where x is the data object, MARGIN is the subscript of the dimension, Fun is the function you specify, and ... Includes any arguments that you want to pass to the fun. In a matrix or data frame, margin=1 represents a row, margin=2 represents a column
Stitching strings: Paste0 (str1, str2, ...)
Type conversions:
Logical operators:
Arithmetic operators:
Control Flow:
for (ver in SEQ) statement
while (condition) statement
if (condition) statement Else statement
IfElse (Conditon, STATEMETN1, Statement2)
R language Common functions & R language Other