On Thu, 28 May 2009 12:00:02 -0300 Sebastián Goinheix
<goinheix(a)gmail.com> wrote:
SG> Like "egen" of STATA, for example: egen equivh=sum(equiv),
SG> by(correlat anio).
You could alternatively use the interface to R (given R is installed on
your computer). Taken the example by Riccardo Lucchetti with those
data:
hhnum indnum x y
1 1 6.4 1
1 2 3.3 4
1 3 8.6 4
2 1 0.6 3
3 1 1.1 1
3 2 6.5 0
you open an R console from within gretl (tools). The current data are
then automatically imported as gretldata. You can then use the
aggregate function:
agg1<-aggregate(gretldata,by=list(hh=gretldata$hhnum),FUN=mean)
gretl.export(agg1)
The last command saves agg1.csv in the .gretl directory from where you
can import the data. Hence you want an aggregation per year and
household the function would be like:
agg1<-aggregate(gretldata,by=list(hh=gretldata$hhnum,yr=gretldata$year),FUN=mean)
When you have a more complex aggregation, like if you combine mean and
sd functions there is a nice command summaryBy in the doBy package.
See the gretl guide section 26.4 for data handling between gretl and R.
There you see also an example how to involve R commands in gretl script.
hth
Stefan
PS close the r console with q(), you dont need to save the workspace.