addobs: add observations to the data set

Description Usage Arguments Value Examples

Description

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

Usage

1
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

1
2
3
4
5
6
7
8
9
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()

genvar documentation built on Jan. 21, 2020, 9:07 a.m.