Re: [R] ff package: reading selected columns from csv

2012-07-26 Thread threshold
Dear Jan, thank you for your answer.
I am basically following the code Ive been using with read.table, where 
x.class - c('NULL', 'numeric','NULL','NULL','NULL', 'NULL', 'NULL') 
has been working fine.

Reading all columns works with me but take much longer than allowed time
constrains.. (460 such sets+ time for processing). The number of columns
remains 7 over the whole data set.

Best, Robert
 



--
View this message in context: 
http://r.789695.n4.nabble.com/ff-package-reading-selected-columns-from-csv-tp4637794p4637896.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] ff package: reading selected columns from csv

2012-07-26 Thread threshold
*..plus I get the following message after reading the whole set (all 7
columns):*

 read.csv.ffdf(file=csvfile, header=FALSE, skip=100, first.rows=1000,
 next.rows=1e7, VERBOSE=TRUE)

read.table.ffdf 1..1000 (1000)  csv-read=0.02sec ffdf-write=0.08sec
read.table.ffdf 1001..10001000 (1000)  csv-read=282.16sec
ffdf-write=65.01sec
read.table.ffdf 10001001..20001000 (1000)  csv-read=240.3sec
ffdf-write=63.84sec
read.table.ffdf 20001001..30001000 (1000)  csv-read=213.78sec
ffdf-write=149.2sec
read.table.ffdf 30001001..40001000 (1000)  csv-read=217.36sec
ffdf-write=379.8sec
read.table.ffdf 40001001..50001000 (1000)  csv-read=541.28secError:
cannot allocate vector of size 381.5 Mb
In addition: There were 14 warnings (use warnings() to see them)
 warnings()
Warning messages:
1: In match(levels(x), lev) :
  Reached total allocation of 7987Mb: see help(memory.size)
2: In match(levels(x), lev) :
  Reached total allocation of 7987Mb: see help(memory.size)



--
View this message in context: 
http://r.789695.n4.nabble.com/ff-package-reading-selected-columns-from-csv-tp4637794p4637900.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] ff package: reading selected columns from csv

2012-07-25 Thread threshold
*Dear R users, Ive just started using the ff package.

There is a csv file (~4Gb) with 7 columns and 6e+7 rows. I want to read only
column from the file, skipping the first 100 rows.
Below Ive provided different outcomes, which will clarify my problem
*
 sessionInfo()
R version 2.14.2 (2012-02-29)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
...

attached base packages:
[1] tools stats graphics  grDevices utils datasets  methods  
[8] base 

other attached packages:
[1] ff_2.2-7  bit_1.1-8

##---
## *I want to read the second column only:*
x.class - c('NULL', 'numeric','NULL','NULL','NULL', 'NULL', 'NULL')

##* The following command works fine:*

 read.csv.ffdf(file=csvfile, header=FALSE, skip=100,
 colClasses=x.class, nrows=1e3)
ffdf (all open) dim=c(1000,1), dimorder=c(1,2) row.names=NULL
ffdf virtual mapping
   PhysicalName VirtualVmode PhysicalVmode  AsIs VirtualIsMatrix
V2   V2   doubledouble FALSE   FALSE
   PhysicalIsMatrix PhysicalElementNo PhysicalFirstCol PhysicalLastCol
V2FALSE 11   1
   PhysicalIsOpen
V2   TRUE
ffdf data
  V2
1-0.5412
2-0.5842
3-0.5920
4-0.5451
5-0.5099
6-0.5021
7-0.4943
8-0.5490
:  :
993  -0.4865
994  -0.6584
995  -0.7482
996  -0.8732
997  -0.8303
998  -0.7248
999  -0.5490
1000 -0.4240

*Then I extend nrows by 1, I get warning about number of columns:*

 read.csv.ffdf(file=csvfile, header=FALSE, skip=100,
 colClasses=x.class, nrows=1001)
ffdf (all open) dim=c(1001,1), dimorder=c(1,2) row.names=NULL
ffdf virtual mapping
   PhysicalName VirtualVmode PhysicalVmode  AsIs VirtualIsMatrix
V2   V2   doubledouble FALSE   FALSE
   PhysicalIsMatrix PhysicalElementNo PhysicalFirstCol PhysicalLastCol
V2FALSE 11   1
   PhysicalIsOpen
V2   TRUE
ffdf data
  V2
1-0.5412
2-0.5842
3-0.5920
4-0.5451
5-0.5099
6-0.5021
7-0.4943
8-0.5490
:  :
994  -0.6584
995  -0.7482
996  -0.8732
997  -0.8303
998  -0.7248
999  -0.5490
1000 -0.4240
1001 -0.3849
Warning message:
In read.table(file = file, header = header, sep = sep, quote = quote,  :
  cols = 1 != length(data) = 7
 

*Then, going much beyond 1000 brings problems:*
 read.csv.ffdf(file=csvfile, header=FALSE, skip=100,
 colClasses=x.class, nrows=1e4)
Error in read.table(file = file, header = header, sep = sep, quote = quote, 
: 
  more columns than column names

*Question is why? The number of columns does not change in the file...

I will appreciate any help..


Best, Robert

*




--
View this message in context: 
http://r.789695.n4.nabble.com/ff-package-reading-selected-columns-from-csv-tp4637794.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] time my process

2012-03-29 Thread threshold
Dear R users,
given a simple plotting procedure below, how can I make the figures changing
on a slower rate (say every 2 sec)

for(i in 1:100){ts.plot(rnorm(i))} 

Best, robert

--
View this message in context: 
http://r.789695.n4.nabble.com/time-my-process-tp4514836p4514836.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] split date nad time

2011-12-12 Thread threshold
Thanks for help. Ive already sorted this out.
robert

--
View this message in context: 
http://r.789695.n4.nabble.com/split-date-nad-time-tp4164191p4185788.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] not complete character in csv file

2011-12-12 Thread threshold
Dear R users, I got the following problem. Given that

 data[3,2]
[1] 010252

Code:
intro - data.frame()
intro[1,1] - as.character(data[3,2])
write.csv(intro, file='intro.csv')

In 'intro.csv' file I am loosing the 0 in frot of 10252, which I need. Is
there a way to keep the full character saved? R 2.13.2 (64 bit).

Thanks, robert



--
View this message in context: 
http://r.789695.n4.nabble.com/not-complete-character-in-csv-file-tp4185785p4185785.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] not complete character in csv file

2011-12-12 Thread threshold
Indeed in txt it looks fine. Anyway, I must stay without 0 because csv is THE
format.

I got another question. why for 
Table - matrix(0,8,3)
day = Monday
Table[1,1]=day

all other elements become characters too?

Thanks, robert


--
View this message in context: 
http://r.789695.n4.nabble.com/not-complete-character-in-csv-file-tp4185785p4186427.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] not complete character in csv file

2011-12-12 Thread threshold
right,

Table - data.frame(matrix(0,8,3))
day = Monday
Table[1,1]=day 
Table[1,2]=3

works, thanks a lot. robert

--
View this message in context: 
http://r.789695.n4.nabble.com/not-complete-character-in-csv-file-tp4185785p4186639.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] split date nad time

2011-12-06 Thread threshold
Dear R Users,

given that:

 AggDateTime[960:962]
[1] 2011-08-25 23:59:00 BST 2011-08-26 00:00:00 BST
[3] 2011-08-26 00:01:00 BST


 unlist(strsplit(as.character(AggDateTime[960]), , fixed=TRUE))
[1] 2011-08-25 23:59:00  
 unlist(strsplit(as.character(AggDateTime[962]), , fixed=TRUE))
[1] 2011-08-26 00:01:00

Why no time here?
 unlist(strsplit(as.character(AggDateTime[961]), , fixed=TRUE))
[1] 2011-08-26


best, robert




--
View this message in context: 
http://r.789695.n4.nabble.com/split-date-nad-time-tp4164191p4164191.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] split date nad time

2011-12-06 Thread threshold

ok, 

 dput(AggDateTime[960:962]) 
structure(c(1314313140L, 1314313200L, 1314313260L), class = c(POSIXct, 
POSIXt), tzone = )

--
View this message in context: 
http://r.789695.n4.nabble.com/split-date-nad-time-tp4164191p4165378.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] hour in x-axis

2011-11-29 Thread threshold

Dear R useres, got the following problem. Given the AggData (listed below)
I need to plot AggData[,2] vs time (AggData[,1]) for chosen 'rows'. Ive done
already:

plot(AggData[rows,2], xaxt='n')
axis(1,at=seq(1,length(rows),1),sub(,, AggData[rows,1]))

which works, but I need to list only chosen data points, say full hours or
every 60th point, something like:

axis(1,at=seq(1,seq(1,length(rows),60)),sub(, ,
AggData[day.rows[seq(1,length(rows),60)],2]))

but does not work. Could be nice if time on the x-axis is in H:m format (no
seconds).

In the original data time bout is 1 minute, e.g. 17:19:35, 17:20:35,
17:21:35 . Taken every 100th for brevity yields

 (AggData[seq(1,length(rows),100),c(2,7)])

  time value
117:19:3580.68327
101  18:59:3580.97230
201  20:39:3578.30810
301  22:19:3580.41558
401  23:59:3577.01051
501  01:39:3577.19687
601  03:19:3578.20762
701  04:59:3577.13315
801  06:39:3576.29110
901  08:19:3575.32090
1001 09:59:3585.32890
1101 11:39:3579.86978
1201 13:19:3583.32418
1301 14:59:3578.26018
1401 16:39:3579.06434


Thanks in advance.
Best, robert




--
View this message in context: 
http://r.789695.n4.nabble.com/hour-in-x-axis-tp4120142p4120142.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] detect subset in series

2011-11-16 Thread threshold
Dear R Users, I am curious whether there is any simple solution o my problem.

My example 'series':
series - c(1,1,1,0,1,0,0,1,1,0,0,0,0,1)

My 'subset' of interest:
subset - c(0,0,0,0)

Is there any function which tells me that the subset exists in my series,
and gives me position where in series is starts. In provided example the
subset exists and covers the elements 10:13 of the 'series'.

Thanks a lot , robert

--
View this message in context: 
http://r.789695.n4.nabble.com/detect-subset-in-series-tp4076285p4076285.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] detect subset in series

2011-11-16 Thread threshold
Thanks for the answer. I found that smth like below works

subset - c(1,0,0)
series - c(1,1,1,0,1,0,0,1,1,0,0,0,0,1)

subset1 - paste(subset, collapse='')
series1 - paste(series, collapse='')

xx - gregexpr(subset1, series1, fixed=TRUE)
as.numeric(xx[[1]]) ## yields the first element numbers in series
[1] 5 9

--
View this message in context: 
http://r.789695.n4.nabble.com/detect-subset-in-series-tp4076285p4076644.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] heatmap

2011-10-18 Thread threshold
Dear R users, need help with my heatmap. I will really approciate some help.

Given the matrix:
 head(x)
  A   B C D time
[1,]  0   8 0 01
[2,]  0 160 0 02
[3,]  0 175 0 03
[4,]  0 253 0 04
[5,] 79 212 0 05
[6,]  6 105 0 06

and call:

## Heatmap --

library(RColorBrewer)
rc - grey((nrow(x):1)/nrow(x))
heatmap(data.matrix(x[,1:4]), Rowv=NA, Colv=NA, scale='none',labCol=NULL,
revC=TRUE, col = brewer.pal(9,'Greys'),
ylab='time',margins=c(6,5), cexRow=1.5, cexCol=1.5, RowSideColors =
rc)

I end up with something like attached 'heatmap'.

How can I change my call to:
1) most important: there are black strips on the right-hand side, these are
the row numbers packed one on another. How to put there time points over,
say, 500 sec epochs (1,500, 1000...)
2) put a scale on the colour key on the left-hand side, and replace the
whole key on the right-hand side
3) have 'A'B'C'D' labels in horizontal orientation; replace 'time' label on
the left side
4) put frame around the plot


##- Heatmap2 -
I did not try with ggplot, but tried with 'heatmap.2':

heatmap.2(data.matrix(x[,1:4]), Rowv=NA, Colv=NA, dendrogram='none',
scale='none', labRow=FALSE, cexRow=1,cexCol=1,
  col = brewer.pal(9,'Greys'), density.info='none', key.size=1,
trace='none')

and got heatmap2 attached
if heatmap.2 is something you suggest, then the same questions apply + one
more:

5) how to change 'Color Key' label and put it along the rows

Best, robert


http://r.789695.n4.nabble.com/file/n3915575/heatmap.png 
http://r.789695.n4.nabble.com/file/n3915575/heatmap2.png 

--
View this message in context: 
http://r.789695.n4.nabble.com/heatmap-tp3915575p3915575.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] date and time

2011-10-14 Thread threshold
Dear R users, 

I got date and time as two separate characters 
[1] 2008-04-11
[1] 22:00:00

which correspond to my starting point in time domain.

Now I need to produce series over, 5 sec epochs up to end point, say:
[1] 2008-04-12
[1] 23:00:00

So something like
2008-04-11 22:00:00
2008-04-11 22:00:05
2008-04-11 22:00:10
.
.
.
2008-04-12 23:00:00

Is there any strightforward way to do it? Any suggestions?

Best, robert


--
View this message in context: 
http://r.789695.n4.nabble.com/date-and-time-tp3905358p3905358.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] censoring symbols on survfit plot

2011-02-17 Thread threshold

Hi, when ploting Kaplan-Meier estimate curves as below, the censoring symbols
(crosses) to not change thickness along the lines 
plot(survfit(surv ~ I(x=cut.off) ),lty=c(1,2), lwd=2)

is there any strightforward way to make it happen? thanks
robert

-- 
View this message in context: 
http://r.789695.n4.nabble.com/censoring-symbols-on-survfit-plot-tp3311283p3311283.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] postscript window size

2010-11-06 Thread threshold

Dear R users, simple figure: 

postscript(file=~/Desktop/figure.ps, horizontal=T, width=20, height=10)
par(mfcol=c(2,5))
plot(rnorm(100), type='l')
plot(rnorm(100), type='l')
plot(rnorm(100), type='l')
plot(rnorm(100), type='l')
plot(rnorm(100), type='l')
##-
plot(rnorm(100), type='l')
plot(rnorm(100), type='l')
plot(rnorm(100), type='l')
plot(rnorm(100), type='l')
plot(rnorm(100), type='l')
dev.off()

Does not resize when saved on Desktop. I could ignore 'width' and 'height',
and the same result. Particular figures plot(rnorm()) are too rectangular,
when I want to have them more like squares (stretched horizontally).  

Working on Ubuntu and need to paste 'figure.ps' into latex (Kile). 
Thanks a lot, robert

-- 
View this message in context: 
http://r.789695.n4.nabble.com/postscript-window-size-tp3030514p3030514.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] legend

2010-09-27 Thread threshold

Thanks David, works fine! 
robert
-- 
View this message in context: 
http://r.789695.n4.nabble.com/legend-tp2550747p2715250.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] legend

2010-09-22 Thread threshold

Hi,
there is a function to plot survival curves:

library(survival)
plot.KM - function(survival, x, x_cut.off, main='', label='')
{
plot(survfit(survival ~ I(x = x_cut.off)), main=main)
legend('bottomleft', c(expression(label = x_cut.off),expression(label 
x_cut.off)))
}

Now, I need to determine as the argument what appears in the legend. I want
plot.KM(survival, x, x_cut.off=0.5, main='', label='ABC')
but what I get is ('label  x_cut.off') in legend instead of 'ABC0.5'.
Symbol '=' should be in mathematical form. will appreciate any help.

robert


-- 
View this message in context: 
http://r.789695.n4.nabble.com/legend-tp2550747p2550747.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] xlab with text and expression

2010-09-14 Thread threshold

One more question, given that
plot(rnorm(1),rnorm(1), ylab=expression(a~b = 3), cex.lab=1.2)

then sign = seems to be smaller than the rest, seems like cex.lab=1.2
affects only the text in ylab. 

1) Is there any way to alter its size to follow the size of the whole
expression? It works nice for legend but not for ylab.
2) Is there any other way to put text into expression? since if you put
ylab=expression(a:~b = 3) then an additional space pops up between 'a' and
':'.

thanks a lot, robert
-- 
View this message in context: 
http://r.789695.n4.nabble.com/xlab-with-text-and-expression-tp2535732p2538502.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] shade area between 'ablines'

2010-09-13 Thread threshold


Hi, want to shade the area between dotted lines:

x=c(1,5);y=c(1,5)
plot(y~x, type='n')
abline(v=c(2,3), lty=2)

sometnig simple needed. tried with polygon 

thx, robert
-- 
View this message in context: 
http://r.789695.n4.nabble.com/shade-area-between-ablines-tp2537352p2537352.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] shade area between 'ablines'

2010-09-13 Thread threshold

Thanks for replying, indeed works. 
I forgot to mention that I am looking for a 'transparent shading' s.t. the
plot symbols are still visible on the shaded area.
robert
-- 
View this message in context: 
http://r.789695.n4.nabble.com/shade-area-between-ablines-tp2537352p2537479.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] xlab with text and expression

2010-09-11 Thread threshold

Dear R users, say
plot(rnorm(1)~rnorm(1), xlab=paste('abc', expression(x=1)), 
I want proper sign of weak inequality not just '='

will appreciate!
robert
-- 
View this message in context: 
http://r.789695.n4.nabble.com/xlab-with-text-and-expression-tp2535732p2535732.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] xlab with text and expression

2010-09-11 Thread threshold

thanks a lot!
-- 
View this message in context: 
http://r.789695.n4.nabble.com/xlab-with-text-and-expression-tp2535732p2535785.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] legend with lines and points

2010-05-04 Thread threshold

Hi, say there are x and y given as:

level   x   y
3   0.112   0.012
2   0.432   0.111
1   0.415   0.053
3   0.380.005
2   0.607   0.01
1   NA  NA
3   0.572   0.01
2   0.697   0.039
1   0.377   0.006
3   NA  NA
2   0.571   0.003
1   0.646   0.014
3   0.063   0.024
2   0.115   0.017
1   0.035   0.042
3   0.426   0

I did the following plot:

plot(y ~ x, pch=c(1,2,3), col=c('red', 'green', 'blue'));
abline(lm(y ~ x), col='red');
lines(lowess.na(y,x), col='blue')
abline(lm(y~x),col='red')
legend('topright',c('Top','Middle','Bottom'), col=c('red', 'green',
'blue'),pch=c(1,2,3)) 
legend('right',c('linear','LOWESS'), col=c('red','blue'),lty=c(1,2))

where:
lowess.na - function(x, y) {  #do lowess with missing data
x1 - subset(x,(!is.na(x)) (!is.na(y)))
  y1 - subset(y, (!is.na(x)) (!is.na(y)))
  lowess.na - lowess(x1~y1)
  }

I want ONE legend to involve points (empirical) and lines from linear and
lowess fit together. I guess it is simple but.

best, robert




-- 
View this message in context: 
http://r.789695.n4.nabble.com/legend-with-lines-and-points-tp2125971p2125971.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] retrieve from function

2010-02-19 Thread threshold

Hi, say I got the function:
 x=function(nbr){y-rnorm(nbr);y1 - mean(y);plot(y)}

how can I retrieve value of y1, when I need it. 

I don't want:
 x=function(nbr){y-rnorm(nbr);y1 - mean(y);plot(y)}
 y1

I want someting like:
x$y1 and then I get the value

Many thanks, robert





-- 
View this message in context: 
http://n4.nabble.com/retrieve-from-function-tp1561972p1561972.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] retrieve from function

2010-02-19 Thread threshold

Thank you for response. The problem is that using return(y1) in my function
formula always returns y1, but what I want is to return it only when I wish,
like p.value in
t.test(rnorm(100),rnorm(100))$p.value

robert
-- 
View this message in context: 
http://n4.nabble.com/retrieve-from-function-tp1561972p1562012.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] 3dscatter for linux

2009-05-13 Thread threshold

Hi, do you have any suggestions how to make 3D scatterplot, BUT under linux.
Worth mentioning is the fact that 'scatterplot3d' does not load under Ubuntu
8.10.
Do you know any alternatives?? I tried cloud or persp but X,Y and Z axes are
emprical in my case, and cannot be replaced by any seq(...).
Thanks in advance, robert
 
-- 
View this message in context: 
http://www.nabble.com/3dscatter-for-linux-tp23521603p23521603.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] function return output

2009-01-16 Thread threshold

Hi, I wrote the function which outputs a matrix 'c' and a single value 'd',
as follows (simplified example):
procedure - function(a,b){
...
list(c,d)
}
now I want to use 'c' and 'd' in code as follows:
d - matrix(0,1,1)
value - procedure(a,b)
and d[1,1] - value[2] breaks telling that:
Error in d[1, 1] : incorrect number of dimensions
What I did wrong??, best, robert



-- 
View this message in context: 
http://www.nabble.com/function-return-output-tp21496413p21496413.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] re ad.table

2008-12-19 Thread threshold

Hi , I want to use the read.table to the following example 'data.txt' format:
a   b  c  d  e  f
SPX LSZ 100 C   0   34.4
SPX LSZ 100 P   0   1.3
SPX LSZ 105 C   0   30.3
SPX LSZ 105 P   0   1.85
SPX LSZ 110 C   0   26.4

and I want to have the columns a,b,d read as the 'character' data, a the
remaining columns as 'numeric'. What I did was:
read.table(data.txt,header=T,
colClasses=c(character,character,numeric,character,
numeric,numeric), but I could not get what I want, since all values were
in the 'character' format. I will apprecaite any suggestions.
best, robert
-- 
View this message in context: 
http://www.nabble.com/read.table-tp21090550p21090550.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] match

2008-12-02 Thread threshold

Hi, I would like to check which rows of 'types.prev' matrix pop up in
'types', following R in-built procedure. I tried 'match' function but it
works in case of the one dimensional vectors.
Will appreciate any suggestions. 
best, robert 

 types
 edateK  
 [1,] 20060819 12.5 
 [2,] 20060819 17.5 
 [3,] 20060819 22.5 
 [4,] 20070217 12.5 
 [5,] 20060617 10.0 
 [6,] 20060617 15.0 
 [7,] 20060520 12.5 
 [8,] 20060520 15.0 
 [9,] 20060520 17.5 
[10,] 20061118 10.0 
[11,] 20061118 12.5 
[12,] 20061118 15.0 
[13,] 20061118 17.5 

 types.prev
 edateK  
 [1,] 20060819 10.0 
 [2,] 20060819 12.5 
 [3,] 20060819 17.5 
 [4,] 20070217 10.0 
 [5,] 20070217 12.5 
 [6,] 20070217 15.0 
 [7,] 20060617 10.0 
 [8,] 20060617 12.5 
 [9,] 20060617 15.0 
[10,] 20060617 20.0
[11,] 20060520 10.0
[12,] 20060520 12.5
[13,] 20060520 17.5
[14,] 20061118 12.5
[15,] 20061118 15.0
[16,] 20061118 17.5


-- 
View this message in context: 
http://www.nabble.com/match-tp20799206p20799206.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] ts.plot

2008-07-06 Thread threshold

Hi, my question concerns the following (guess) easy case. I have daily data
over 5-year period say
199017.24
199018.19
199019.22
.
.
199120.11
199120.26
199122.2
.
.
199420.05
199424.64
199426.34
and I want to make ts.plot of the 2nd column with respect to year of
occurrence (1st col) at axis X. Could you please give me a hint how to do
it? I really appreciate any help

best, robert
-- 
View this message in context: 
http://www.nabble.com/ts.plot-tp18305087p18305087.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] optimization setup

2008-05-30 Thread threshold


Thanks for all your replies and sorry for a negligence in my examples. They
are very simplified to reflect very roughly the structure of the case I deal
with, which is too complicated to be quoted here. 

What I deal with is:
1) 'theta' which is vector with length 2, being known to me (eg.
theta=c(1,2))
2) 'x' which represents my empirical data (I know as well), 
3) 'theta1' is a vector with length 2 I don't know, which suppose to
minimize my objective function f3 (see below)

Here come the structure of the functions:
f1-function(theta, theta1)
{theta[1]+theta[2]+theta1[1]}

f2-function(theta, x, theta1)
{f1(theta, theta1)*exp(x)*theta1[2]}

function to be optimized with respect to theta1:
f3-function(theta1)
{f1(theta, theta1)-f2(theta,x,theta1)} 

Again, I know vector 'theta' and 'x', and I look for (vector) 'theta1' which
minimize f3

Question are:
1) whether, given the case I deal with, the functions I provided are
specified correctly. If not what is the correct form? 
2) how should I write my optim function with starting values for theta1
equal to 1.1 and 2.1. What I did was:
optim(par=c(1.1, 2.1), f3) but it did not work well with error message: 
Error in f1(theta, theta1) : argument theta1 is missing, with no default

Thank you for your help and time 
robert

 







Ray Brownrigg-2 wrote:
 
 
 Did you copy-paste that error message?
 
 I get:
 
 optim(par=c(1,1), f3)
 Error in f1(theta, theta1) : object theta not found
 
 
 You seem to be confusing your formal and actual parameters.
 
 When you invoke f3 (within optim()), theta is not defined within f3().
 
 Ray
 
 On Fri, 30 May 2008, threshold wrote:
 Hi, thanks for your replay the previous post of mine. Let me ask you one
 more question similar to the previous one, based on a naive example:

 f1-function(theta, theta1)
 {theta[1]+theta[2]+theta1[1]}

 f2-function(theta, x, theta1)
 {f1(theta, theta1)*exp(x)*theta1[2]}

 function to be optimized with respect to theta1:
 f3-function(theta1)
 {f1(theta, theta1)-f2(theta,x,theta1)}
 optim(par=c(1,1), f3)

 If I do so I get:
 Error in f1(theta, theta1) : argument theta1 is missing, with no
 default
 What I did wrong? I guess I miss something basic...
 Thanks in advance, robert

 Ray Brownrigg-2 wrote:
  On Wed, 23 Apr 2008, threshold wrote:
  Hi, here comes my problem, say I have the following functions (example
  case) #
  function1 - function (x, theta)
  {a - theta[1] ( 1 - exp(-theta[2]) ) * theta[3] )
   b - x * theta[1] / theta[3]^2
   return( list( a = a, b = b )) }
  #---
  function2-function (x, theta)
  {P - function1(x, theta)
c - P$a * x * exp(-theta[2])
d - P$b * exp(x)
q - theta[1] / theta[3]
res - c + d + q; res}
 
  # Function to be optimized
  function3 - function(theta1,theta2,theta3) {
  n - length(data)
  -sum( function2(x = data[2:n], theta = c(theta1, theta2, theta3) ))}
  # 'data' is my input ts class object
 
 #---
 --- 
 
  Then I want to maximize function3 with respect to theta(s) (given some
  starting values)
 
  fit-optim(par=c(theta1=1, theta2=1.2, theta3=.2), fn=function3)
 
  I get the following:
  Error in function1(x, theta) :
argument theta2 is missing, with no default
 
  Where I made a mistake? I will appreciate any help ...
 
  r
 
  Your function to be optimised must be a function of a single parameter
  (which
  may be a vector).
 
  So you should have something like:
  # Function to be optimized
  function3 - function(thetas) {
n - length(data)
-sum( function2(x = data[2:n], theta = thetas))
  }
 
  [Not tested, your provided code has typos].
 
  Ray
 
  __
  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-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.
 
 

-- 
View this message in context: 
http://www.nabble.com/optimization-setup-tp16825410p17556348.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] Ubuntu rJava

2008-05-29 Thread threshold

Hi I am using ubuntu 8.04 and faced some problems when installing rJava. What
I did first was install.packages(rJava) but I could not proceed since:
checking Java support in R... configure: error: absent
R was configured without Java support. Please run
R CMD javareconf
as root to add Java support to R.

afterwards I took Alt+F2 and typed: gksudo R CMD javareconf 

..however I was not able to install rJava on my comp. will be very gratefull
for any suffestions.

In general I want to make package gWidgets working

best, robert
-- 
View this message in context: 
http://www.nabble.com/Ubuntu-rJava-tp17532637p17532637.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] optimization setup

2008-05-29 Thread threshold

Hi, thanks for your replay the previous post of mine. Let me ask you one more
question similar to the previous one, based on a naive example:

f1-function(theta, theta1)
{theta[1]+theta[2]+theta1[1]}

f2-function(theta, x, theta1)
{f1(theta, theta1)*exp(x)*theta1[2]}

function to be optimized with respect to theta1:
f3-function(theta1)
{f1(theta, theta1)-f2(theta,x,theta1)}
optim(par=c(1,1), f3)

If I do so I get: 
Error in f1(theta, theta1) : argument theta1 is missing, with no default
What I did wrong? I guess I miss something basic... 
Thanks in advance, robert





Ray Brownrigg-2 wrote:
 
 On Wed, 23 Apr 2008, threshold wrote:
 Hi, here comes my problem, say I have the following functions (example
 case) #
 function1 - function (x, theta)
 {a - theta[1] ( 1 - exp(-theta[2]) ) * theta[3] )
  b - x * theta[1] / theta[3]^2
  return( list( a = a, b = b )) }
 #---
 function2-function (x, theta)
 {P - function1(x, theta)
   c - P$a * x * exp(-theta[2])
   d - P$b * exp(x)
   q - theta[1] / theta[3]
   res - c + d + q; res}

 # Function to be optimized
 function3 - function(theta1,theta2,theta3) {
 n - length(data)
 -sum( function2(x = data[2:n], theta = c(theta1, theta2, theta3) ))}
 # 'data' is my input ts class object
 #--


 Then I want to maximize function3 with respect to theta(s) (given some
 starting values)

 fit-optim(par=c(theta1=1, theta2=1.2, theta3=.2), fn=function3)

 I get the following:
 Error in function1(x, theta) :
   argument theta2 is missing, with no default

 Where I made a mistake? I will appreciate any help ...

 r
 
 Your function to be optimised must be a function of a single parameter
 (which 
 may be a vector).
 
 So you should have something like:
 # Function to be optimized
 function3 - function(thetas) {
   n - length(data)
   -sum( function2(x = data[2:n], theta = thetas))
 }
 
 [Not tested, your provided code has typos].
 
 Ray
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/optimization-setup-tp16825410p17543578.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] number of trading days

2008-05-21 Thread threshold

Hi, I work on the date format: mmdd. I would like to calculate the number
of (working or trading) days between two of such specified dates in specific
year at US stock exchange OR at least with respect to 252-days year.

What I did so far was the conversion (example):
x-20060213; y-20060402 # refering to January 13 and April 2, 2006
x1 - as.Date(as.character(x), %Y%m%d)
y1 - as.Date(as.character(y), %Y%m%d)
# nuber of calendar days
nr_cal-diff(rbind(x1,y1))

best regards, robert




-- 
View this message in context: 
http://www.nabble.com/number-of-trading-days-tp17364148p17364148.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] optimization setup

2008-04-22 Thread threshold

Hi, here comes my problem, say I have the following functions (example case)
#
function1 - function (x, theta) 
{a - theta[1] ( 1 - exp(-theta[2]) ) * theta[3] )
 b - x * theta[1] / theta[3]^2
 return( list( a = a, b = b )) }
#---
function2-function (x, theta) 
{P - function1(x, theta)
  c - P$a * x * exp(-theta[2])
  d - P$b * exp(x)
  q - theta[1] / theta[3]
  res - c + d + q; res}

# Function to be optimized
function3 - function(theta1,theta2,theta3) {
n - length(data)
-sum( function2(x = data[2:n], theta = c(theta1, theta2, theta3) ))}
# 'data' is my input ts class object
#--

Then I want to maximize function3 with respect to theta(s) (given some
starting values) 

fit-optim(par=c(theta1=1, theta2=1.2, theta3=.2), fn=function3)

I get the following:
Error in function1(x, theta) : 
  argument theta2 is missing, with no default

Where I made a mistake? I will appreciate any help ...

r
-- 
View this message in context: 
http://www.nabble.com/optimization-setup-tp16825410p16825410.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] Change the core code

2008-04-21 Thread threshold

HI, pretty basic question: is that possible to change the code of the
function within library? If so what should I do? I work on R linux (ubuntu),
thanks a lot


-- 
View this message in context: 
http://www.nabble.com/Change-the-core-code-tp16808285p16808285.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] R-Latex question

2008-03-11 Thread threshold

Hi, maybe my question is not typical. I want to make R table-kind output to
be readable immediately in Latex but I am struggling with symbol '\' needed
for instance in '\hline'. For example when 'Table' is a matrix class object:

cat(,Table[1,1], ,Table[1,2], \n);flush.console() 
cat(\hline \n);flush.console()
cat(,Table[2,1], ,Table[2,2], \n);flush.console() 

etc, to have specific output which I can paste (or save) in latex readible
format.

but '\' was not accepted by R. Is there any way to over come this obstacle
or maybe other way to 'implement' R table output into latex format

thank you in advance
rob 
-- 
View this message in context: 
http://www.nabble.com/R-Latex-question-tp15980281p15980281.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] standard errors

2008-02-28 Thread threshold

Hi, guess my problem has simple solution. 
I want to extract ONLY Std. Errors of Max. Lik. estimates
(my_fit-mle(object,...)), the same as I can do with estimates by:
x-as. matrix(coef(my_fit)).
I could not find any function similar to 'coef(my_fit)', which extracts only
Standard Errors. So far all I can do is to type: summary(my_fit) and then
get the whole output (with Standard Eroros involved).

thank you in advance and best wishes, robert

-- 
View this message in context: 
http://www.nabble.com/standard-errors-tp15734141p15734141.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] surface plot

2008-01-24 Thread threshold

Hi, there is following issue, which I encounter when doing data analysis. Say
we have data in form of the matrix x:

 x
 [,1] [,2] [,3]
[1,]  0.14   10
[2,]  0.25   11
[3,]  0.15   12
[4,]  0.16   13
[5,]  0.24   14
[6,]  0.35   16

now I want to do surface plot of x[,3] with respect to axes OX:x[,1] and OY:
x[,2] in ascending orders of course. 
Thanks in advance, best
rob

-- 
View this message in context: 
http://www.nabble.com/surface-plot-tp15064443p15064443.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] sorting

2008-01-20 Thread threshold

Hi, I want to sort my matrix according to (any) selected column. For example
given matrix:
 x
 [,1] [,2] [,3]
[1,]347
[2,]258
[3,]169

I want to sort the first column in ascending order and make the other
columns follow the 'new order' like:

 x1
 [,1] [,2] [,3]
[1,]169
[2,]258
[3,]347

thank in advance for help.

best




-- 
View this message in context: 
http://www.nabble.com/sorting-tp14983068p14983068.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] matrix graph

2007-12-11 Thread threshold

Hi All, simple question: 
do you know how to graph the following object/matrix in a 'surface manner':

  [,1] [,2] [,3][,4]   [,5][,6]
[1,] -0.154 -0.065 0.129 0.637 0.780 0.221
[2,]  0.236  0.580 0.448 0.729 0.859 0.475
[3,]  0.401  0.506 0.310 0.650 0.822 0.448
[4,]  0.548  0.625 0.883 0.825 0.945 0.637
[5,]  0.544  0.746 0.823 0.877 0.861 0.642
[6,]  0.262  0.399 0.432 0.620 0.711 0.404

will be very grateful for hints.

rob
-- 
View this message in context: 
http://www.nabble.com/matrix-graph-tp14282791p14282791.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] 3D array

2007-12-03 Thread threshold

Hi, I deal with 3D array say:

, , 1

 [,1] [,2] [,3] [,4] [,5]
[1,]147   10   13
[2,]258   11   14
[3,]369   12   15

, , 2

 [,1] [,2] [,3] [,4] [,5]
[1,]   16   19   22   25   28
[2,]   17   20   23   26   29
[3,]   18   21   24   27   30

, , 3

 [,1] [,2] [,3] [,4] [,5]
[1,]   31   34   37   40   43
[2,]   32   35   38   41   44
[3,]   33   36   39   42   45

I want to calculate means in the cells with respect to dimention 3rd so for
example (1+16+31)/3 or (15+30+45)/3  AND avoid taking zeros into account.

I did it with a loop but I guess there is the other more straightforward
method. will be very grateful for help...

best, rob
-- 
View this message in context: 
http://www.nabble.com/3D-array-tf4940356.html#a14142187
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] cumsum

2007-11-03 Thread threshold

Hi, my problem belongs to the basic ones. I want to get cumulated sum over
the matrix columns by one command (if such exists). Ordinary R's cumsum(x)
when x is:
 [,1] [,2]
[1,]15
[2,]26
[3,]37
[4,]48

yields:  1  3  6 10 15 21 28 36
I want:
 [,1] [,2]
[1,]15
[2,]3   11
[3,]6   18
[4,]   10   26
Is there any command to do so??

best, robert



-- 
View this message in context: 
http://www.nabble.com/cumsum-tf4742648.html#a13562053
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] jEdit for R

2007-10-24 Thread threshold

Hi,
I just installed jEdit but have no clue, whether I can run my code a'la
ctrl-R directly from jEdit script, or should source it from R command
line, after saving it first in jEdit.

thanks for any help,
rob
-- 
View this message in context: 
http://www.nabble.com/jEdit-for-R-tf4684065.html#a13384782
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.