Hi Cindy,
Take a look at the following. This should help get you started.
http://www.stat.umn.edu/~charlie/rc/
rcoder
cindy Guo wrote:
>
> Hi, everyone,
>
> I need to use a C library. But since I have little experience in C, I want
> to call this C library in R and progra
Hi Daniel,
Thanks for your reply. I experimented with various options since my poet and
eventually tried use="pairwise.complete.obs" which seemed to do the trick.
Thanks,
rcoder
Daniel Malter wrote:
>
> Hi,
>
> the argument use should be: use="p" (for pai
no complete element pairs
Is there something I'm not including in the 'cor' parentheses? I apologise
for not including the true original data frames.
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/cor%28%29-btwn-columns-in-two-matrices---no-complete-element-
is
satisfied, but the data rows do not overlap at all.
rcoder wrote:
>
> Hi everyone,
>
> I'm trying to calculate correlation coefficients between corresponding
> columns in two matrices with identical dimensions but different data. The
> problem is that the matrices c
ror is generated:
Error in if mat[j,k] !=0 { :missing value where TRUE/FALSE needed
I'm not sure how to resolve this.
Thanks,
rcoder
Henrik Bengtsson (max 7Mb) wrote:
>
> FYI,
>
> there is an isZero() in the R.utils package that allows you to specify
> the prec
eros##
for (j in 1:5000)
{
for (k in 1:2000)
{
if(mat[j,k]!=0 & !is.NaN(mat[j,k])) {mat_zeroless[j,k]<-mat[j,k]}
}
}
##Code End
Error in if (mat[j,k] !=0 & !is.NaN(mat[j,k])) { :missing value where
TRUE/FALSE needed
I'm not sure how to resolve this.
rcoder
Thank you all for your replies. This is all very useful information for me!
Ted, thank you very much for the extra explanation and example.
Many thanks,
rcoder
Ted.Harding-2 wrote:
>
> On 13-Aug-08 16:45:27, rcoder wrote:
>> Hi everyone,
>> I'm trying to cre
Dear Henrique,
This is exactly what I need. Thank you very much for your help!
rcoder
Henrique Dallazuanna wrote:
>
> Try this:
>
> x <- data.frame(Dates = seq(as.Date('2008-01-01'),
> as.Date
le of the
syntax for incorporating an AND in a conditional IF statement.
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/conditional-IF-with-AND-tp18966890p18966890.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r
, but the operation
did not fill the results matrix. Coulc anyone offer any advice to assist
with this operation?
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/merging-data-sets-to-match-data-to-date-tp18962197p18962197.html
Sent from the R help mailing list archive at
something similar to
an !all(is.na() construct)?
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/ignoring-zeros-or-converting-to-NA-tp18948979p18948979.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-p
Don't worry, I got it:
for(x in seq(1,100,5)) {
print(x)
}
where the step size is 5.
rcoder
rcoder wrote:
>
> Hi everyone,
>
> Is there a way to vary the increment size in a for loop? For e.g. when
> incrementing in steps greater than unity.
>
> Thanks,
>
Hi everyone,
Is there a way to vary the increment size in a for loop? For e.g. when
incrementing in steps greater than unity.
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/increment-size-in-for-loop-tp18893893p18893893.html
Sent from the R help mailing list archive
lieve there is nothing wrong
with the code. I was just wondering if this is normal program execution
speed for such an operation on a P4 with 2GB RAM?
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/long-run-time-for-loop-operation---matrix-fill-tp18876372p18876372.html
Sent fro
Hi Gary,
Thanks for your reply. This works fine. Is there any way to send the ACF
data to a matrix, so I could analyse the data in excel for e.g.?
Thanks,
rcoder
Ling, Gary (Electronic Trading) wrote:
>
> Hi, here is one possible solution ...
> -gary
>
&
, but the titles suggested the acf was
calculated between adjacent columns in the matrix, which is something I was
puzzled about.
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/using-acf%28%29-for-multiple-columns-tp18858672p18858672.html
Sent from the R help mail
k] vs [j:(j+1),k) in the regression statement - forcing successive slope
data to overwrite cell locations containing intercept data.
Also, the full code takes an awfully long time to run. Would anyone be able
to suggest a way for mee to speed it up - perhaps in the regression
algorithm?
Than
Hi,
I guess my question is really more about the nested for loop construct and
whether it is doing what I intend it to do in my code in the previous post.
I would be grateful if anyone who has used nested loops could let me know if
I am doing something wrong.
Thanks,
rcoder
rcoder wrote
Thanks for your reply Gabor.
As I already have a dates column in my dataframe (in column row.names), is
it possible to preserve this whilst still making a data set suitable for
rollapply()?
Thanks,
rcoder
Gabor Grothendieck wrote:
>
> If its regular you can convert it to ts or zoo
t)
for (j in 1:5) #1st nested loop
{
PmatWt[j,]<-Pmult[j,]*mult_col[j,]
}
#rolling regression analysis...
for (k in 1:maxcol) #2nd nested loop
{
sel_col<-PmatWt[,k]
if(!all(is.na(sel_col))) {Preg[,k]<-coef(lm(tt~
offset = offset, singular.ok = singular.ok, ...) :
0 (non-NA) cases
Can anyone see what I am doing incorrectly? I hope the example code helps.
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/rollingRegression%28%29-aplied-between-vector-and-matrix-tp18788824p18788
matrix into a time series
matrix, I lose the dates in the row.names column. I just want to know if
anyone could suggest a way to get around this problem, i.e. keep the
row.names column in place, and use the rollapply() statement as above.
Thanks,
rcoder
--
View this message in context:
http://ww
arguments in the parentheses? One way
would be to introduce an if statement, but is this the only way?
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/rollapply%28%29-to-portions-of-a-matrix-tp18761906p18761906.html
Sent from the R help mailing list archive
help files and examples. Any suggestions would be grately appreciated.
Many thanks,
rcoder
Gabor Grothendieck wrote:
>
> That's good. Try this:
>
> 1. put set.seed(1) at the top of the code to make it reproducible.
>
> 2. replace body of loop with:
>sel_col<-S
rce matrix:
for (i in 1:10)
{
sel_col<-SourceMat[col(SourceMat)==i] #selecting the correct column
in the matrix in turn
ResultMat[,i]<-coef(lm(tt~sel_col, na.action=NULL))
}
##Code end
I would be grateful for any suggestions to avoid this p
)==i] #selecting the correct column in the
matrix in turn
SourceMat[,i]<-coef(lm(tt~sel_col), na.action=NULL)
}
Thanks,
rcoder
Gabor Grothendieck wrote:
>
> Read the last line of every message to r-help.
>
> On Tue, Jul 29, 2008 at 6:15 PM, rcoder <
urceMat)==i]#selecting the correct column in the
matrix in
turn
SourceMat[,i]<-coef(lm(tt~sel_col), na.action=NULL)
}
Thanks,
rcoder
rcoder wrote:
>
> Hi everyone,
>
> I'm having trouble applying the Cor() function to two matrices, both of
>
rollapply(), the
columns are not recognised and the regression breaks down. Is there a more
robust way to reference the columns I need, so that I can apply the
regression across the matrix; 'by.column', but every other column?
Thanks,
rcoder
--
View this message in context:
http://www.
Hi Gabor,
Thanks for your reply. Assuming I have a time series that is ready made
(i.e. not constructed it using a zoo function) will the procedure below
still retain the dates in the matrix?
Thanks,
rcoder
quote author="Gabor Grothendieck">
rollapply along an index:
library(
complete element pairs
Does anyone know how I can apply a correlation, ignoring any NAs?
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/correlation-between-matrices---both-with-some-NAs-tp18721853p18721853.html
Sent from the R help mailin
rcoder wrote:
>
> Hi everyone,
>
> Is there a way to perform a rollapply operation on a time series data
> matrix and preserve the time frame? Currently, when I apply rollapply in
> its standart form, the date column is no longer present in the o/p matrix.
>
> Thanks,
Hi everyone,
Is there a way to perform a rollapply operation on a time series data matrix
and preserve the time frame? Currently, when I apply rollapply in its
standart form, the date column is no longer present in the o/p matrix.
Thanks,
rcoder
--
View this message in context:
http
Hi everyone,
Using the rolling regression function - rollingRegression(formula, data,
width, ...) - is there a way to output only selected coefficients to a
results matrix. For e.g. if I only wanted the slope coefficients to be
recorded, how would I go about doing this?
Thanks,
Michael
--
View
Hi everyone,
I want to perform an operation on a matrx that outputs the product of
successive pairs of rows. For example: calculating the product between rows
1 & 2; 3 & 4; 5 & 6...etc.
Does anyone know of any readily available functions that can do this?
Thanks,
rcoder
-
oduct of sequential rows in a preceeding
matrix: i.e. rows 1*2 -> row 1 in o/p matrix; rows2*3-> row 2; rows
4*5->row3 etc.
Thanks,
rcoder
stephen sefick wrote:
>
> how about rollapply in the zoo package?
>
> On Fri, Jul 25, 2008 at 8:37 AM, rcoder <[EMAIL PROTECT
Hi Achim,
Thanks for your reply. rollmean and rollmax functions exist, but is there
anything for returning the minima on a rolling basis? I know there is no
rollmin in the zoo library.
Thanks,
rcoder
Achim Zeileis wrote:
>
> On Thu, 24 Jul 2008, rcoder wrote:
>
>> Hi ev
separate
matrix.
On a separate matter, I have a matrix containing data on which perform a
regresssion over a rolling time period. Is there a convenient way I can do
this for each column, and then save the gradient to an o/p matrix?
Thanks,
rcoder
--
View this message in context:
http
#now calculate respective ranges for
data matrix
mm[,n]<-range(mat[,n],na.rm=T) #inserts min/max values into sc
matrix
for (m in 1:nr) {
sc[m,n]<-100*(mat[m,n]-mm[1,n])/(mm[2,n]-mm[1,n]) #re-scaling onto
percentile ranking
}
would be grateful for any suggestions on this slight modification.
Otherwise, I can make do with my version.
Thanks,
rcoder
rcoder wrote:
>
> Thank you Ben! This is very clear.
> rcoder
>
>
> Ben Tupper wrote:
>>
>>
>> On Jul 15, 2008, at 5:16 PM, rcoder
Thank you Ben! This is very clear.
rcoder
Ben Tupper wrote:
>
>
> On Jul 15, 2008, at 5:16 PM, rcoder wrote:
>
>>
>> Hi Ben,
>> Yes, this is more or less what I want to do. I want to apply this
>> data in
>> columns in a matrix, and insert the re
,
rcoder
Ben Tupper wrote:
>
>
> On Jul 15, 2008, at 8:16 AM, rcoder wrote:
>
>>
>> Hi everyone,
>>
>> I want to score a set of data (-ve to +ve) using a 0-10 scale. I
>> have the
>> data in an R matrix, so I need to add another column, containing
Hi everyone,
I want to score a set of data (-ve to +ve) using a 0-10 scale. I have the
data in an R matrix, so I need to add another column, containing the scores
and resave.
I would be grateful for suggestions on how best to do this.
Thanks,
rcoder
--
View this message in context:
http
Hi everyone,
I want to score a set of data (-ve to +ve) using a 0-10 scale. I have the
data in an R matrix, so I need to add another column, containing the scores
and resave.
I would be grateful for suggestions on how best to do this.
Thanks,
rcoder
--
View this message in context:
http
This is great! Thank you very much Gabor.
rcoder
Gabor Grothendieck wrote:
>
> See ?lag and in zoo ?lag.zoo. Both pages have
> examples. Using lag.zoo here it is with your data:
>
> Lines <- "Date Apples Oranges Pears
> 1/7 2 3
e?
Thanks,
rcoder
Gabor Grothendieck wrote:
>
> If its a zoo or ts time series you can use the lag function.
>
> On Wed, Jul 9, 2008 at 2:57 PM, rcoder <[EMAIL PROTECTED]> wrote:
>>
>> Hi everyone,
>>
>> I have some data in a matrix, and I want to shift
you don't have code, at least provide a before/after version of
> the matrix that you would like. It is easy to use indexing to move
> stuff around, we just have to know what is it that you want to move.
>
> On Wed, Jul 9, 2008 at 2:57 PM, rcoder <[EMAIL PROTECTED]> wrote:
>
location?
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/shifting-data-in-matrix-by-n-rows-tp18368420p18368420.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch
47 matches
Mail list logo