Displaying 20 results from an estimated 6000 matches similar to: "error: unused arguments"
2007 Jul 03
2
vertically concatenating data frames
Hi,
what is the recommended way to vertically concatenate 2 data frames with
the same column names but different number of rows?
My problem is something along these lines:
df1 <- data.frame(var1=var1,var2=var2,var3=var3) # nrow(df1)=1000
df2 <- data.frame(var1=var4,var2=var5,var3=var6) # nrow(df2)=2000
I tried df <- c(df1,df2), no success. stack does not seem to be
appropriate
2007 Jul 12
2
lead
Hi,
is there any function in R that shifts elements of a vector to the
opposite direction of what Lag() of the Hmisc package does? (something
like, Lag(x, shift = -1) )
Thanks
Zava
--------------------------------------------------------
This is not an offer (or solicitation of an offer) to buy/se...{{dropped}}
2007 Jul 17
2
poor rbind performance
Hi
I rbind data frames in a loop in a cumulative way and the performance
detriorates very quickly.
My code looks like this:
for( k in 1:N)
{
filename <- paste("/tmp/myData_",as.character(k),".txt",sep="")
myDataTmp <- read.table(filename,header=TRUE,sep=",")
if( k == 1) {
myData <- myDataTmp
}
else{
myData
2007 Jun 14
2
connecting to DB2 database
Hi,
i am trying to connect to a DB2 server using the DBI library.
getData <- function()
{
driver <- dbDriver("DB2")
conn <- dbConnect(driver,"server","uname","pword")
data <- dbSendquery(conn, "select etc.")
}
When I run the function, i get the error
> data <- getData()
Error in
2007 Jul 05
1
converting list to an array
Hi,
I have a list myList (see below) that consists of id's $'7',....,$'10'
and each id has an individual array, the length of which can vary from
id to id.
How can I convert this list into an array, ie. stacking the individual
arrays into one large array?
Thanks
Zava
myList:
$`7`
[1] 20050201 20050301 20050401 20050501
$`8`
[1] 20050201 20050301 20050401
2007 Jul 02
1
compute time span in months between two dates
Hi,
I am just starting to play with R. What is the recommended manner for
calculating time spans between 2 dates? In particular, should I be using
the "chron" or the "date" package (so far I just found how to calculate
a timespan in terms of days)?
Thanks
Zava
--------------------------------------------------------
This is not an offer (or solicitation of an offer) to
2007 Jul 05
1
generating lower triangular matrix
Hi,
I would like to generate below triangular matrix for some a.
0
0
0
0
0
0
1
0
0
0
0
0
a
1
0
0
0
0
a^2
a
1
0
0
0
a^3
a^2
a
1
0
0
a^4
a^3
a^2
a
1
0
What's an efficient way to do this? (this matrix being KxK, K very
large)
Thanks
Zava
--------------------------------------------------------
This is not an offer (or solicitation of an offer) to buy/se...{{dropped}}
2007 Jul 18
1
passing a parameter to a file from command line
Hi,
I have a file fileFoo.R, say that contains these two lines, invoking
function foo that is specified in "foo_details.R":
source("foo_details.R")
foo(parameter1)
I want to specify and pass parameter1 in my command line when invoking R
in linux: R --no-save <fileFoo.R.
How can I do that?
And how can I retrieve the value of parameter1 in my fileFoo.R function
2007 Oct 12
2
Plotting question
I am constructing plots ( regular not lattice ) and my initial command
is
par(mar=c(3,4,2,2), mfcol=c(5,2))
and then I create 10 plots on the page. It looks great but the plots on
the page go in the order
1 6
2 7
3 8
4 9
5 10
Where the numbers denote decile breakdowns.
Is there an easy way to make them go from left to right so
1 2
3 4
5 6
7 8
9 10
I could try
2009 Jun 19
1
using garchFit() to fit ARMA+GARCH model with exogeneous variables
Hello -
Here's what I'm trying to do. I want to fit a time series y with
ARMA(1,1) + GARCH(1,1), there are also an exogeneous variable x which I
wish to include, so the whole equation looks like:
y_t - \phi y_{t-1} = \sigma_t \epsilon_t + \theta \sigma_{t-1}
\epsilon_{t-1} + c x_t where \epsilon_t are i.i.d. random
variables
\sigma_t^2 = omega + \alpha \sigma_{t-1}^2 + \beta
2007 Oct 18
2
How to avoid conversion to factors (data frame to zoo)
Hi all,
I was trying to convert a data frame to a zoo object so I can use some
time series functions like lag(). But it seems then everything became a
factor, so I have to convert it back to numeric to run the correct
regressions. Is there a way to avoid it? Here is an example:
#############################
a <- data.frame(nn =as.character(c("a", "b", "c",
2007 Oct 11
6
confusion with R syntax
I just noticed something by accident with R syntax that I'm sure is
correct but I don't understand it. If I have
a simple numeric vector x and I subscript it, it seems that I can then
subscript a second time with TRUE
or FALSE, sort of like a 2 dimensional array in C. Does someone know if
this is documented somewhere
Because it's neat but I never knew it existed. To me it seems like a
2006 Nov 14
2
putting a column name on a zoo object
does anyone know how to put a column name on a zoo object. I think achim
and gabor are off line or they have gotten totally tired of me
an decided to ignore me ( which is totalyy understandable ).
logbidask<-log((aggfxdata[,"bid"] + aggfxdata[,"ask"])/2.0)
logbidask doesn't have a name and I can't figure out how to get one on
it ?
aggfxdata is a zoo object.
2007 Aug 15
3
Formula in lm inside lapply
I am trying to run separate regressions for different groups of
observations using the lapply function. It works fine when I write the
formula inside the lm() function. But I would like to pass formulae into
lm(), so I can do multiple models more easily. I got an error message
when I tried to do that. Here is my sample code:
#generating data
x1 <- rnorm(100,1)
x2 <- rnorm(100,1)
y <-
2006 Nov 12
7
I think a simple question
I have index ( of a vector ) values of say
tempin<-c(1 31 61 91 121 all the way upto 1411)
What I want is a function that takes in a number say, x = 5, and gives
me an new vector
of
tempout<-1 6 31 36 91 96 121 126 .......... 1411 1416
This can't be so hard but I can't get it and I've honestly tried.
Obviously, tempin + 5 gives me the missing values but I
2007 Jun 12
3
Panel data
Dear all R users,
I have a small doubt about panel data analysis. My basic understanding on Panel data is a type of data that is collected over time and subjects. Vector Autoregressive Model (VAR) model used on this type of data. Therefore can I say that, one of statistical tools used for analysis of panel data is VAR model? If you clarify my doubt I will be very grateful.
Thanks and regards,
2007 Apr 16
1
Names in vector occurring in another vector
I have a vector of character strings such as
mainnames<-c("CAD","AUD") and another vector say
checknames<-c("CAD.l1","AUD.l1","JPY.l1","EUR.l1","CAD.l2","AUD.l2","JPY
.l2","EUR.l2")
I want a new vector of character strings that is just
2007 Aug 24
4
Turning a logical vector into its indices without losing its length
I have the code below which gives me what I want for temp based on
logvec but I was wondering if there was a shorter way ( i.e :
a one liner ) without having to initialize temp to zeros. This is
purely for learning purposes. Thanks.
logvec <- c(TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE)
temp<-numeric(length(invec))
temp[invec]<-which(invec)
temp
[1] 1 0 0 4 0 0 7 0
obviously, the
2007 Jun 14
0
connecting to db2 via RJDBC
Hello,
I seem to have issues with setting the driver:
My code:
library(RJDBC)
getStatic <- function()
{
# set driver
driverClass <-
JDBC("com.ibm.db2.jcc.DB2Driver","someClassPath.jar","'")
conn <- dbConnect(driverClass,"serverName")
etc etc
}
I get this error
> data <-getData()
2007 May 21
1
Sample correlation coefficient question NOT R question
This is a statistics question not an R question. When calculating the
sample correlation coefficient cor(x_t,y_t) between say
two variables, x_t and y_t t=1,.....n ( one can assume that the
variables are in time but I don't think this really matters
for the question ), does someone know where I can find any piece of
literature that says that each (x_j,y_j) pair has
To be independent from the