Re: [R] I need to change from character to numeric?

2008-08-29 Thread Samuel Bächler
I am reading numeric data as below but the problem is the object ndata1 and nd1 have characters instead of numeric values. I want to keep it as numeric. Why the type has changed from numeric to character and how to avoid this problem? help(as.numeric) Your variable rdata1 has probably chara

Re: [R] SparseM

2008-08-27 Thread Samuel Bächler
Hi Heike library(SparseM,lib.loc=my.lib.loc) Error in packageDescription(pkg)$Version : $ operator is invalid for atomic vectors In addition: Warning message: In packageDescription(pkg) : no package 'SparseM' was found Error : .onLoad failed in 'loadNamespace' for 'SparseM' Error: package/n

Re: [R] sqlQuery with date attribute

2008-08-13 Thread Samuel Bächler
Hi Many GetReturn<-function(code,date) { db<-"C:/Test.mdb" channel<-odbcConnectAccess(db) ssql<-paste("select * from tblCalendarDate Where CalendarID =",code,"and DateRebal >=",date) print(ssql)# so as i can see what ssql contains mydata<-sqlQuery(channel,ssql) mydata } [snip] This is th

Re: [R] Switch two rows in a matrix

2008-08-07 Thread Samuel Bächler
Hi Zhang Hi all, I have a 4 by 4 matrix, and I want to switch row 2 and row 3 first, then switch column 2 and column 3. Is there an easy way to do it? The following is a tedious way to get what I want. But I wonder if there is a way to simplify this. '> a=matrix(rnorm(16),4,4) '> b=a[c(2,1

Re: [R] Impulse response analysis within package vars

2008-08-07 Thread Samuel Bächler
Thank you Bernhard, just rescale the result. Please note that *unit change* refers to the error term. By the same token you can also rescale the impulse responses by making use of the standard deviation of the residuals. Best, Bernhard > Hi Everyone > > > var.2c<-VAR(Canada,p=2,type="const

Re: [R] problem running R

2008-08-07 Thread Samuel Bächler
Dear all, I am new to R and very basic idea about it. While running some codes i am getting following error: "Error in m[indexMax] : invalid subscript type 'list'" What code did you enter? I am not sure about this error. Any way to correct it. ___

[R] Impulse response analysis within package vars

2008-08-07 Thread Samuel Bächler
Hi Everyone > var.2c <- VAR(Canada,p=2,type="const") > irf.rw.e <- irf(var.2c,impulse="rw",response=c("e")) ...makes *vars* to compute the orthogonalised impulse responses to a *unit* change in variable rw. Now, if I want to compute the the orthogonalised impulse responses to a *0.25* change in