Functions of esProc/R/Python/Perl in Structured Data Process by Comparison :Chapter 11.Appending Records

esProc

    insert(0,value1:col1,value2:col2,……)        //It is very simple to complete it only with one statement

Perl

    push(@tbl,[1,”name”,99]);

Python

    tbl.append([1,”name”,99])

R

Appending a record to data frame in R will get you into a little more trouble, as a data frame with exactly same column names must be made up of the records to be appended, and then the two data frames are merged into one by using appropriate function.

    dd<- data.frame(name=c(‘Mr A’, ‘Mr B’, ‘Mr C’), subject=rep(1, 3), score=c(69, 71, 92))

    dd1 <- data.frame(name=c(‘Ms C’, ‘Ms D’), score=c(93, 99), subject=c(2, 2))

    dd2 <- rbind(dd, dd1)        #To merge the two data frames, whose column names must be fully consistent, but their column sequences can be different

2014-07-02_150501

Advertisements

About datathinker

a technical consultant on Database performance optimization, Database storage expansion, Off-database computation. personal blog at: datakeywrod, website: raqsoft
This entry was posted in Structured Data Process and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s