Learn R Programming

genvar (version 0.0.2.0)

addobs: add observations to the data set

Description

Add observations to the data set, similar in functionality to Stata's append command

Usage

addobs(obs)

Arguments

obs

one of two possible input types:

  • An R data frame with the same columns as the current dataset.

  • A comma-separated string in the following format: "var1=1,var2=2,var3=3" which inputs a single observation.

Value

returns NULL, invisibly

Examples

Run this code
# NOT RUN {
library(plm)
data(Produc)
use(Produc, clear=TRUE)
keepvar("state year emp unemp")
addobs("state='Puerto Rico',year=1990,emp=100,unemp=5")
listif()
df <- data.frame(state=rep("Puerto Rico", times=2), year=1991:1992,emp=c(102,104),unemp=c(4.9,5.1))
addobs(df)
listif()
# }

Run the code above in your browser using DataLab