ez.append: append a row to an exisiting data frame

View source: R/frame.R

ez.appendR Documentation

append a row to an exisiting data frame

Description

could be slow, commonly use together with ez.header

Usage

ez.append(df, newrow, print2scr = TRUE)

Arguments

df

df to be appended

newrow

a list, e.g., list("Ted", 25) <– use list can preserve element data type

print2scr

whether to print the new row to string (auto separated by tab), default TRUE

Value

returns a new df, old passed df does not change

Note

although passing in newrow as a vector is fine, c(char,numeric) converts everything to char, bit when saving in excel, num formated as text

See Also

ez.header

Examples

# typical use:
results = ez.header(variable=character(),class=character(),n=numeric())
vars=colnames(x)
for (var in vars) {
    var=
    cls=
    n=
    results = ez.append(results,list(var,cls,n))
}
ez.savex(results,'x.xlsx')

jerryzhujian9/ezmisc documentation built on March 9, 2024, 12:44 a.m.