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

Uncategorized 797 0

esProc

    tbl.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

FAVOR (0)
Leave a Reply
Cancel
Icon

Hi,You need to fill in the Username and Email!

  • Username (*)
  • Email (*)
  • Website