[R] Using Aggregate() with FUN arguments, which require more than one input variables

2012-01-17 Thread RNoob
Dear all,

I am trying to apply the aggregate() function to calculate correlations for
subsets of a dataframe. My argument x is supposed to consist of 2 numerical
vectors, which represent x and y for the cor() function. 

The following error results when calling the aggregate function: Error in
FUN(X[[1L]], ...) : supply both 'x' and 'y' or a matrix-like 'x'. I think
the subsets aggregate puts into cor() are sort of list types and therefore
can't be handled by cor().

Can anyone provide me with a solution?

Regards,
RNoob

--
View this message in context: 
http://r.789695.n4.nabble.com/Using-Aggregate-with-FUN-arguments-which-require-more-than-one-input-variables-tp4303936p4303936.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] Using Aggregate() with FUN arguments, which require more than one input variables

2012-01-18 Thread RNoob

as.matrix()  will not help here. I will get the same error message.

And also, I don't need correlation matrices. I simply need a vector of
correlations. I will show you some code and data I am using.

Here you can see my main dataframe:

> head(test)

 industry   datetestvar   retf1
1 Industrials 2004-12-31 1174382477 -0.02240908
2 Industrials 2005-01-31 1101039133  0.08080221
3 Industrials 2005-02-28 1211723486  0.05646877
4 Industrials 2005-03-31 1253428861 -0.05743186
5 Industrials 2005-04-30 1152846793 -0.02928415
6 Industrials 2005-05-31 1070386589  0.05865941

Now I want to take column "industry" or "date" or both - whatever - as
grouping columns for correlations between testvar and retf1 as follows:

*> numbers <- test[,c("testvar","retf1")]*

> head(numbers)
 testvar   retf1
1 1174382477 -0.02240908
2 1101039133  0.08080221
3 1211723486  0.05646877
4 1253428861 -0.05743186
5 1152846793 -0.02928415
6 1070386589  0.05865941


*> groups <- test[,"industry"]*

> head(groups)
[1] "Industrials" "Industrials" "Industrials" "Industrials" "Industrials"
[6] "Industrials"

> head(unique(groups))
[1] "Industrials""Telecommunications" "Financials"
[4] "Utilities"  "ConsumerGoods"  "OilandGas"

*AND NOW:*

*> aggregate(numbers,by=list(groups),FUN="cor")*

Fehler in FUN(X[[1L]], ...) : supply both 'x' and 'y' or a matrix-like 'x'

So my desired output is a vector of correlations between subsets of x =
"testvar"  and y = "retf1". The length of the resulting vector will be
length(unique(groups)).

I think this draws a clearer picture to you. Sorry for not precisely
pointing it out in my first post.

Thanks and Regards!








--
View this message in context: 
http://r.789695.n4.nabble.com/Using-Aggregate-with-FUN-arguments-which-require-more-than-one-input-variables-tp4303936p4306048.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] Using Aggregate() with FUN arguments, which require more than one input variables

2012-01-18 Thread RNoob
Great!

Thanks.

--
View this message in context: 
http://r.789695.n4.nabble.com/Using-Aggregate-with-FUN-arguments-which-require-more-than-one-input-variables-tp4303936p4306170.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


[R] Lag vector of dates by vector of days

2012-02-01 Thread RNoob
Dear All,

I am looking for a function to get lagged dates from an input vector of
dates, whereas the lag is specified by another vector. Each date is lagged
by a different number of days. (specified in vector n)

Example: 

input <-  as.Date( c( "2002-01-30", "2002-02-24", "2002-03-31") )

n <-  c(10, 20, 31)
  
Desired Result:

"2002-02-09"
"2002-03-16"
"2002-05-01"

Can anyone help me with this?

Thanks in advance,

RNoob


--
View this message in context: 
http://r.789695.n4.nabble.com/Lag-vector-of-dates-by-vector-of-days-tp4348530p4348530.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


[R] Is it possible to run multiple instances of Tinn-R?

2012-02-13 Thread RNoob
Dear All,

is there anyone using Tinn R, who knows if it's possible to run more than
one instance of Tinn R on one machine? I'd like to run more than one R
process (R Term) at a time from Tinn R.

Any help will be appreciated.

Thanks.

--
View this message in context: 
http://r.789695.n4.nabble.com/Is-it-possible-to-run-multiple-instances-of-Tinn-R-tp4383244p4383244.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


[R] Using Internals via their compiled sources

2008-07-14 Thread rnoob

Hello,
I wish to use the compiled version of a particular function( mean(x) to be
exact ) and I can't use the source files as I am told by my boss I am to
assume that users will not have the source files available to them. So this
is my question: how do I find out which lib which particular source file is
placed into? I have tried
R.dll,Rblas.dll,Rlapack.dll,stats.dll,methods.dll,Rzlib.dll and a host of
others. I tried using "rcmd shlib myfile.c .dll" but I still get
file not found errors.

If it helps mean(x) is found in names.c which leads to do_summary which
leads to summary.c and all of these require various .h files.


Thanks,
TJ
-- 
View this message in context: 
http://www.nabble.com/Using-Internals-via-their-compiled-sources-tp18437781p18437781.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.