[R] Data

Paul Hiemstra paul.hiemstra at knmi.nl
Wed Sep 21 14:49:23 CEST 2011


 On 09/20/2011 10:28 PM, barb wrote:
> Hey everybody,
>
> i am using the rugarch-package and its great! 
> I have a pretty easy problem, but i just dont get it, so thanks if you can
> help me. 
>
> Normally i use: 
> /
> data(DATANAME)
> spec = ugarchspec()
> fit = ugarchfit(data = x[,1], spec = spec)
> fit
>
> slotNames(fit)
>
> names(fit at fit)
> coef(fit)
> infocriteria(fit)
> likelihood(fit)
> nyblom(fit)
> signbias(fit)
> head(as.data.frame(fit))
> head(sigma(fit))
> head(residuals(fit))
> head(fitted(fit))
> gof(fit,c(20,30,40,50))
> uncmean(fit)
> uncvariance(fit)
> plot(fit,which="all")/
>  
> I want to use my data now. 
>
> I figured out how to load excel sheets. 
>
> setwd("C:/Users/UserofComputer/Desktop")
> data <- read.csv2("Dataname.csv",header=T)
> attach(data)

You do not need to attach 'data', this makes the columns of data
available as objects, which is generally not needed. Just refer to the
columns as data$column_name.

> x <- CGE[200:1]
> dx <- diff(log(x))
>
> How is my "Dataname" now safed?
> I cant use it as data(dataname) unfortunately. 

The information in Dataname.csv is now in the object data, see
summary(data) or str(data). Btw, data is also an R function. Redefining
data is not regarded as good programming practice. Furthermore, the use
of the data function (as I've used it) is primarily to load datasets
which have been packaged along side R. As you've already loaded the
dataset using read.csv2, the data(dataname) command is not needed.

It seems to me that, no insult intended, you do not know what you are
doing. I would recommend you either read some more online introductory
material [1], buy some R books, do some kind of R course or find someone
that can tutor you. The kind of assistance you need is hard to give via
a mailing list. Again, I do not mean to be harsh (we where all R noobs
at some stage).

good luck,
Paul

[1] see e.g. http://cran.r-project.org/manuals.html and
http://cran.r-project.org/other-docs.html

>
> Where is my mistake?
>
> Thank you
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Data-tp3828343p3828343.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.


-- 
Paul Hiemstra, Ph.D.
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494

http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770



More information about the R-help mailing list