[R] Help on np package - how to set the data into a panel format

John Kane jrkrideau at inbox.com
Sat Jul 13 17:30:38 CEST 2013


We really need to see the data, I think.

You can use the function dput(), see ?dput

dput(filename) will give you a formatted output that you can just  copy and paste into an e-mail. An R-help reader can just copy and paste that into R and have an exact copy of your data set.

John Kane
Kingston ON Canada


> -----Original Message-----
> From: serenamasino at gmail.com
> Sent: Sat, 13 Jul 2013 12:30:34 +0100
> To: r-help at r-project.org
> Subject: [R] Help on np package - how to set the data into a panel format
> 
> Hi,
> 
> I am new to R and am a STATA user. I am using R as I need the np package
> to
> perform a local linear non parametric regression on a panel data of
> countries. My data contains 138 countries, each observed for 31 years,
> from
> 1981 to 2011.
> 
> I am aware of the panel package in R which sets the data in panel format
> telling R which one is the "id" and which one is the "time" variable. I
> am
> not sure however what to use to set the data into a panel format when
> using
> the np package.
> 
> What I have done so far was to
> 
> read.csv ("C:/folder/filename.csv")
> 
> then i explore it
> str(filename)
> 
> and my country variable appears as a "factor", which I think is good
> right?
> Because it means that is a string to which R has attached a value.Year
> instead appears as "int".
> 
> Now, how can I tell R that the data has repeated country cross sections
> for
> 31 years and so that the data should be treated as a panel of 138
> countries
> observed each for 31 consecutive years?
> 
> Many Thanks in advance for your help, and apologies if this is a very
> basic
> question, I have tried looking it up in a number of places but all I came
> by was the panel package instructions and I am not sure whether they can
> transfer to the np package too.
> 
> Best,
> Serena
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

____________________________________________________________
GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys
Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails



More information about the R-help mailing list