R language Common functions & R language Other

Source: Internet
Author: User
Tags arithmetic operators

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.