Re: [R] as.POSIXct character string is not in a standard unambiguous format

2017-04-05 Thread Sebastien Moretti

Hi Ben

Thanks for your answer
I have already tried this, as well as
x <- as.POSIXct(strptime("2002-02-02 02:02", "%Y-%m-%d %H:%M"))
It works! But it does not fix it widely for all tests used during the 
"make check" step at compile time. Unless I patch all of them.


There is something with localtime but I cannot find what.

On another machine with another Linux OS, and the same environmental 
variables

   x <- as.POSIXct("2002-02-02 02:02")
works fine.

Sébastien


Hi,

I can't answer the question about R 3.3.3, but I don't see anything in the 
update notes.

http://mirror.its.dal.ca/cran/doc/manuals/r-release/NEWS.html

In the meantime, would it skirt your issue if you explicitly stated the format?

x <- as.POSIXct("2002-02-02 02:02", format = "%Y-%m-%d %H:%M")

Ben




On Apr 5, 2017, at 11:21 AM, Sebastien Moretti  
wrote:

Hi

I have lots of issues when I try to install R 3.3.3 during the "make check" 
step.

Every time a call to as.POSIXct is done in test scripts, I got the same error 
message:
e.g. x <- as.POSIXct("2002-02-02 02:02")
Error in as.POSIXlt.character(x, tz, ...) :
 character string is not in a standard unambiguous format


It looks to be linked to localtime but when I compiled R 3.3.2  6 months ago, 
the same test scripts were there and succeeded.


Is there an environmental variable to use to change the as.POSIXct behavior?

Regards

--
Sébastien

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] ggplot2 question plot mean/error bars

2017-04-05 Thread PIKAL Petr
Hi

Put geom point call to the end of the commands

p<-ggplot(q3[as.character(q3$D)%in%c("D1","D2"),],aes(x=t,y=b.mean,group=D,col=D,fill=D))
p+  geom_line() + 
geom_errorbar(width=.2,aes(ymin=b.mean-b.se,ymax=b.mean+b.se)) +
  scale_shape_manual(values = c(16,21)) +
   scale_fill_manual(values=c("black","white")) +
   scale_color_manual(values=c("black","black"))+
   geom_point(shape=21,size=4)

Cheers
Petr


-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Santosh
Sent: Wednesday, April 5, 2017 11:06 PM
To: r-help 
Subject: Re: [R] ggplot2 question plot mean/error bars

Dear Rxperts..
Here is the updated code.. to the above example.. how do I make the white
circles as "white filled" so that lines in the circles are not shown.?

Thanks and much appreciated
Santosh

q <-  data.frame(G=rep(paste("G",1:3,sep=""),each=50),D=rep(
paste("D",1:5,sep=""),each=30),a=rep(1:15,each=10),t=rep(
seq(10),15),b=round(runif(150,10,20)))
q$r <- q$b*0.1
q2 <- q[order(q$G,q$D,q$a,q$t),]

  q3 <- 
as.data.frame(as.matrix(with(q2,aggregate(list(b=b),list(D=D,t=t),function(x)
c(mean=mean(x),sd=sd(x),se=(sd(x)/sqrt(length(x))),stringsAsFactors=F)
  q3$t <- as.numeric(q3$t)
  q3$b.mean <- as.numeric(q3$b.mean)
  q3$b.sd <- as.numeric(q3$b.sd)
  q3$b.se <- as.numeric(q3$b.se)

ggplot(q3[as.character(q3$D)%in%c("D1","D2"),],aes(x=t,y=b.mean,group=D,col=D,fill=D))
+  geom_point(shape=21,size=4) + #,color=IP))
  geom_line() +
  # geom_point(data=ipthd.f[ipthd.f$IP=="Cinacalcet",],fill='white')+
  geom_errorbar(width=.2,aes(ymin=b.mean-b.se,ymax=b.mean+b.se)) +
  scale_shape_manual(values = c(16,21)) +
  # scale_shape(solid = T)+
  # scale_shape_identity() +
  # scale_shape_discrete(solid = T) +
   scale_fill_manual(values=c("black","white")) +
   scale_color_manual(values=c("black","black"))

On Wed, Apr 5, 2017 at 11:50 AM, Santosh  wrote:

> Hello Rxperts..
> I am trying to generate a mean+/- error plot.. using ggplot2.. with filled
> black and white circles and black lines, but no overlap  of lines and
> circles (symbols). Also, with no top and right lines of the plot box. I
> remember having done this before.. unable to reproduce how I did!
>
> Yes, there are many ways of generating the plot.. Would high appreciate it
> if you could help debug this piece of code.
>
> Attaching sample code for your convenience..
> Best,
> Santosh
>
> q <-  data.frame(G=rep(paste("G",1:3,sep=""),each=50),D=rep(
> paste("D",1:5,sep=""),each=30),a=rep(1:15,each=10),t=rep(
> seq(10),15),b=round(runif(150,10,20)))
> q$r <- q$b*0.1
> q2 <- q[order(q$G,q$D,q$a,q$t),]
>
>   q3 <- 
> as.data.frame(as.matrix(with(q2,aggregate(list(b=b),list(D=D,t=t),function(x)
> c(mean=mean(x),sd=sd(x),se=(sd(x)/sqrt(length(x))),stringsAsFactors=F)
>   q3$t <- as.numeric(q3$t)
>   q3$b.mean <- as.numeric(q3$b.mean)
>   q3$b.sd <- as.numeric(q3$b.sd)
>   q3$b.se <- as.numeric(q3$b.se)
>
> ggplot(q3[as.character(q3$D)%in%c("D1","D2"),],aes(x=t,y=b.mean,fill=D,col=D,group=D))
> + geom_point(shape=21,size=4) +
> geom_line() +
> geom_errorbar(width=1,aes(ymin=Mean-SE,ymax=Mean+SE)) +
> geom_errorbar(width=1,aes(ymin=Mean-SE,ymax=Mean+SE)) +
> scale_shape_manual(values = c(16,21)) +
> scale_fill_manual(values=c("black","white")) +
> scale_color_manual(values=c("black","black")) +
> +legend.position = c(.8,.8))
>
>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případn

Re: [R] How can output tables be converted to data files?

2017-04-05 Thread Bert Gunter
Yes. "p" is not "P" .

Re-read the "value" section of the ?rcorr if this is not clear.

-- Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Apr 5, 2017 at 4:22 PM, BR_email  wrote:
> David:
> If I may, I was successful in writing csv files for rcorr, n, but not
> pvalue, which is empty.
> I set digits=5, thinking the small numbers might not show with default
> setting.
> Here's the code I used. Do you see a bug?
> Thanks. Bruce
>
> Y <- rcorr(as.matrix(X))
> digits=5
> write.csv(Y$p, file = "c:/R_data/pvalue.csv",row.names=FALSE, na="") - empty
> write.csv(Y$n, file = "c:/R_data/nsize.csv",row.names=FALSE, na="") - okay
> write.csv(Y$r, file = "c:/R_data/rcorr.csv",row.names=FALSE, na="") - okay
>
>
> David L Carlson wrote:
>>
>> Y <- rcorr(as.matrix(X))
>
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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 -- To UNSUBSCRIBE and more, see
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] plotting gam plots from mgcv package

2017-04-05 Thread Husam El Alqamy
Dear List
I am fitting some GAM models using the package mgcv. When plotting the
response curves of the individual predictors using gam.plot I get a dotted
line of the confidence interval around the fitted line. Does anybody know a
way to make these as grey area around the fitted lined instead of the
dotted lines/ Thanks in advance
Regards

*BCTS*

GIS

*Hossameldin ELALKAMY, **MPhill., PhD.*

*GIS Analyst *

BC Timber Sales |  Prince George

Ministry of Forests, Lands and Natural Resource Operations

P. 250.614.7521 C. 778.896.3229 | 2000 Ospika Blvd.  PG, BC., V2N 4W5



Webpage  | GIS Requests
 |
Profile 

[image: BC FLNRO]

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] How can output tables be converted to data files?

2017-04-05 Thread BR_email

David:
If I may, I was successful in writing csv files for rcorr, n, but not 
pvalue, which is empty.
I set digits=5, thinking the small numbers might not show with default 
setting.

Here's the code I used. Do you see a bug?
Thanks. Bruce

Y <- rcorr(as.matrix(X))
digits=5
write.csv(Y$p, file = "c:/R_data/pvalue.csv",row.names=FALSE, na="") - empty
write.csv(Y$n, file = "c:/R_data/nsize.csv",row.names=FALSE, na="") - okay
write.csv(Y$r, file = "c:/R_data/rcorr.csv",row.names=FALSE, na="") - okay

 


David L Carlson wrote:

Y <- rcorr(as.matrix(X))


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Package Query

2017-04-05 Thread Jim Lemon
Hi Ruchika,
Maybe the hdeco package will help.

Jim


On Wed, Apr 5, 2017 at 2:28 PM, Ruchika Salwan
 wrote:
> Hey,
>
> Is there any package in R that handles graph decomposition? A package
> created specifically for flat/hierarchical decomposition of graphs.
>
> Thanks,
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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 -- To UNSUBSCRIBE and more, see
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] Replying to replies in the forum

2017-04-05 Thread Tunga Kantarcı
Thanks a lot.

On Wed, Apr 5, 2017 at 10:23 PM, Jeff Newmiller
 wrote:
> There is no conclusively client-free solution, which is why it is not in the 
> Posting Guide.
>
> However, as a general rule, start with a fresh email to start a thread, and 
> reply-to-all to the message you want to reply to.  The threading is managed 
> by hidden message ids, not subjects.
> --
> Sent from my phone. Please excuse my brevity.
>
> On April 5, 2017 11:26:27 AM PDT, "Tunga Kantarcı"  
> wrote:
>>My question is specifically about what I should use in the subject
>>line when replying, because I do not trust mail clients, or to myself
>>as I use different clients sometimes. Hence, I wanted to learn a
>>client free solution to correctly send replies. Now, the posting guide
>>is not explicit about this. Hence my question. So what should I type
>>in the subject line if I want to reply to a specific reply, and not to
>>another reply, so that my reply is nested in the reply I want to
>>reply. That I cannot figure out from the posting guide.
>>
>>On Wed, Apr 5, 2017 at 7:46 PM, Marc Schwartz 
>>wrote:
>>>
 On Apr 5, 2017, at 11:41 AM, Tunga Kantarcı
>> wrote:

 OK I cannot figure this out clearly in the guidelines of posting.
>>When
 I reply to a message I should out "Re:" in front of the subject line
 of the original post. So if the subject line of the original post it
 is "this is a post", then I should use "Re: this is a post" in the
 subject line, for my reply to appear under the original post, and
>>not
 in the forum as a new message.

 But then I cannot figure out what subject line I should use to reply
 to a given reply. That is, suppose the original subject line is
>>"this
 is a post" and there are replies under the post, and that I want to
 reply to one of the replies. How I specify in the subject line so
>>that
 my reply appears under the reply of a certain person? Or do I have
>>to
 use the reply features of gmail?

 Meanwhile, why the guidelines is implicit about this?
>>>
>>> Hi,
>>>
>>> There is an R Posting Guide here:
>>>
>>>   https://www.r-project.org/posting-guide.html
>>>
>>> which is a good place to start.
>>>
>>> Generally, if you want to reply to a post and keep the thread intact,
>>always use "reply-all" and that will keep thread participants copied,
>>the post sent to all list subscribers, and the posts in the public
>>archives for future use.
>>>
>>> Most e-mail clients (stand alone or web based) will add the "re:"
>>prefix automatically, if not already present.
>>>
>>> Threads are not kept intact in the list archives based upon the
>>subject line alone, even though some e-mail clients may do so. This is
>>why there can be a change in the subject line when using reply-all and
>>the reply post will be kept with the original thread.
>>>
>>> If, on the other hand, you create a new e-mail and just use "re: the
>>original subject line" in the subject, that will start a new thread in
>>the archive.
>>>
>>> Don't use "reply" only to a post, unless specifically asked, as that
>>will only copy one person, not the list nor the archives, and the
>>communication will only be between you and that person, which is
>>frowned upon.
>>>
>>> Regards,
>>>
>>> Marc
>>>
>>
>>__
>>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>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 -- To UNSUBSCRIBE and more, see
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] How can output tables be converted to data files?

2017-04-05 Thread Bruce Ratner PhD
Thanks, David. 

__
Bruce Ratner PhD



> On Apr 5, 2017, at 5:49 PM, David L Carlson  wrote:
> 
> Data files is pretty vague. If you save the output of a function such as 
> rcorr(), you can extract any of the parts you need. Step 1 is to read the 
> documentation:
> 
> ?rcorr
> 
> Under the section labeled "Value" you will see that rcorr() returns a list 
> with 3 matrices named r, n, and P:
> 
>> Y <- rcorr(as.matrix(X))
>> str(Y)
> List of 3
> $ r: num [1:3, 1:3] 1 -0.934 -0.814 -0.934 1 ...
>  ..- attr(*, "dimnames")=List of 2
>  .. ..$ : chr [1:3] "mpg" "cyl" "disp"
>  .. ..$ : chr [1:3] "mpg" "cyl" "disp"
> $ n: int [1:3, 1:3] 5 5 5 5 5 5 5 5 5
>  ..- attr(*, "dimnames")=List of 2
>  .. ..$ : chr [1:3] "mpg" "cyl" "disp"
>  .. ..$ : chr [1:3] "mpg" "cyl" "disp"
> $ P: num [1:3, 1:3] NA 0.0201 0.0937 0.0201 NA ...
>  ..- attr(*, "dimnames")=List of 2
>  .. ..$ : chr [1:3] "mpg" "cyl" "disp"
>  .. ..$ : chr [1:3] "mpg" "cyl" "disp"
> - attr(*, "class")= chr "rcorr"
>> Y$r
>mpgcyl   disp
> mpg   1.000 -0.9341083 -0.8138289
> cyl  -0.9341083  1.000  0.9342174
> disp -0.8138289  0.9342174  1.000
>> Y$n
> mpg cyl disp
> mpg5   55
> cyl5   55
> disp   5   55
>> Y$P
>mpgcyl   disp
> mpg  NA 0.02010207 0.09368854
> cyl  0.02010207 NA 0.02005248
> disp 0.09368854 0.02005248 NA
> 
> You can save the whole list with save() or write individual matrices as .csv 
> files with write.csv().
> 
> -
> David L Carlson
> Department of Anthropology
> Texas A&M University
> College Station, TX 77840-4352
> 
> 
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of BR_email
> Sent: Wednesday, April 5, 2017 4:09 PM
> To: r-help@r-project.org
> Subject: [R] How can output tables be converted to data files?
> 
> Hi R'ers:
> This code produces: 3x3 rcorr matrix, one-element vector, and 3x3 
> p-value matrix.
> I would like to use these outputs as data files.
> How can these output tables be converted to data files?
> Any assistance is appreciated.
> Thanks. Bruce
> 
> library(Hmisc)
> mtcars5 <- mtcars[sample(1:nrow(mtcars), 5, replace=FALSE),]
> X<- as.matrix(mtcars5[, c(1,2,3)])
> print(X)
> rcorr(as.matrix(X))
> 
> --
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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 -- To UNSUBSCRIBE and more, see
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] help with package ranks

2017-04-05 Thread Jim Lemon
Hi Davide,
The error message is probably due to a zero length dimension in:

W[,ind.positives]

I would look at W (data frame?) to see where this might occur. That
is, does W have a set of proteins with _no_ annotations? Perhaps
manually removing that set will get the function running.

Jim


On Wed, Apr 5, 2017 at 5:14 AM, davide f  wrote:
> Hello, I'm Davide.
> I'm using the package RANKS, in particular the functions do.GBA, do.RW,
> do.RANKS. To the funcs are given 2 different Matrix. One is a a simmetryc
> adjacency Matrix(called "M"), where rows and columns are protein, and the
> other is an annotation Matrix(called "ann"), where protein are rows(the
> same of the first Matrix) and and the annotations are columns.
>
> I write a script in order to filter both the matrices, choosing only
> protein with 5 or more annotations.
>
> To be more specific, using the functions, data=M, labels=ann.
>
> But, running the script, it gives me an error message about the functions
> of interest:
>
> Error in apply(W[, ind.positives], 1, sum) :
>   dim(X) deve avere lunghezza positiva
>
>
> In paritcular it gives me the error during the FOR cycle, when it
> works on the 6th column.
>
>
> How can I resolve it? what is the reason?
>
>
> Thank you in advance, best regards,
>
> Davide.
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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 -- To UNSUBSCRIBE and more, see
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] How can output tables be converted to data files?

2017-04-05 Thread David L Carlson
Data files is pretty vague. If you save the output of a function such as 
rcorr(), you can extract any of the parts you need. Step 1 is to read the 
documentation:

?rcorr

Under the section labeled "Value" you will see that rcorr() returns a list with 
3 matrices named r, n, and P:

> Y <- rcorr(as.matrix(X))
> str(Y)
List of 3
 $ r: num [1:3, 1:3] 1 -0.934 -0.814 -0.934 1 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:3] "mpg" "cyl" "disp"
  .. ..$ : chr [1:3] "mpg" "cyl" "disp"
 $ n: int [1:3, 1:3] 5 5 5 5 5 5 5 5 5
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:3] "mpg" "cyl" "disp"
  .. ..$ : chr [1:3] "mpg" "cyl" "disp"
 $ P: num [1:3, 1:3] NA 0.0201 0.0937 0.0201 NA ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:3] "mpg" "cyl" "disp"
  .. ..$ : chr [1:3] "mpg" "cyl" "disp"
 - attr(*, "class")= chr "rcorr"
> Y$r
mpgcyl   disp
mpg   1.000 -0.9341083 -0.8138289
cyl  -0.9341083  1.000  0.9342174
disp -0.8138289  0.9342174  1.000
> Y$n
 mpg cyl disp
mpg5   55
cyl5   55
disp   5   55
> Y$P
mpgcyl   disp
mpg  NA 0.02010207 0.09368854
cyl  0.02010207 NA 0.02005248
disp 0.09368854 0.02005248 NA

You can save the whole list with save() or write individual matrices as .csv 
files with write.csv().

-
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352


-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of BR_email
Sent: Wednesday, April 5, 2017 4:09 PM
To: r-help@r-project.org
Subject: [R] How can output tables be converted to data files?

Hi R'ers:
This code produces: 3x3 rcorr matrix, one-element vector, and 3x3 
p-value matrix.
I would like to use these outputs as data files.
How can these output tables be converted to data files?
Any assistance is appreciated.
Thanks. Bruce

library(Hmisc)
mtcars5 <- mtcars[sample(1:nrow(mtcars), 5, replace=FALSE),]
X<- as.matrix(mtcars5[, c(1,2,3)])
print(X)
rcorr(as.matrix(X))

--

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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 -- To UNSUBSCRIBE and more, see
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] system call removes special characters from text output

2017-04-05 Thread stephen sefick
Don,

Thank you for your reply. I found no problems in the perl script, but I
found that I had inadvertently swapped file names in my call to system("
script.pl file1 file2") works as expected system(script.pl file2 file1)
produces the output that formed my original query.

Thanks so much, and I learned to not code after 10 PM.
kindest regards,

Stephen

On Wed, Apr 5, 2017 at 4:06 PM, MacQueen, Don  wrote:

> I can't reproduce this.
>
> On my system, the contents of an executable file named tmp.pl:
>
> #! /opt/local/bin/perl
> print "[A/B]\n";
>
> At a shell prompt:
>
> [72]% ./tmp.pl
> [A/B]
>
> Inside R:
>
> > system(' ./tmp.pl')
> [A/B]
>
>
> --
> Don MacQueen
>
> Lawrence Livermore National Laboratory
> 7000 East Ave., L-627
> Livermore, CA 94550
> 925-423-1062
>
>
> On 4/3/17, 8:57 PM, "R-help on behalf of stephen sefick" <
> r-help-boun...@r-project.org on behalf of ssef...@gmail.com> wrote:
>
> Hello,
>
> I am writing an R package, and I am using system() to call a perl
> script.
> The output of the perl script is correct except for "[A/B]" is output
> as
> "AB". Can someone explain this behavior. I would like to try and fix
> this.
> many thanks,
>
> Stephen Sefick
>
> --
> Let's not spend our time and resources thinking about things that are
> so
> little or so large that all they really do for us is puff us up and
> make us
> feel like gods.  We are mammals, and have not exhausted the annoying
> little
> problems of being mammals.
>
> -K. Mullis
>
> "A big computer, a complex algorithm and a long time does not equal
> science."
>
>   -Robert Gentleman
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>
>
>


-- 
Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like gods.  We are mammals, and have not exhausted the annoying little
problems of being mammals.

-K. Mullis

"A big computer, a complex algorithm and a long time does not equal
science."

  -Robert Gentleman

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] How can output tables be converted to data files?

2017-04-05 Thread BR_email

Hi R'ers:
This code produces: 3x3 rcorr matrix, one-element vector, and 3x3 
p-value matrix.

I would like to use these outputs as data files.
How can these output tables be converted to data files?
Any assistance is appreciated.
Thanks. Bruce

library(Hmisc)
mtcars5 <- mtcars[sample(1:nrow(mtcars), 5, replace=FALSE),]
X<- as.matrix(mtcars5[, c(1,2,3)])
print(X)
rcorr(as.matrix(X))

--

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] system call removes special characters from text output

2017-04-05 Thread MacQueen, Don
I can't reproduce this.

On my system, the contents of an executable file named tmp.pl:

#! /opt/local/bin/perl
print "[A/B]\n";

At a shell prompt:

[72]% ./tmp.pl
[A/B]

Inside R:

> system(' ./tmp.pl')
[A/B]


-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062


On 4/3/17, 8:57 PM, "R-help on behalf of stephen sefick" 
 wrote:

Hello,

I am writing an R package, and I am using system() to call a perl script.
The output of the perl script is correct except for "[A/B]" is output as
"AB". Can someone explain this behavior. I would like to try and fix this.
many thanks,

Stephen Sefick

-- 
Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like gods.  We are mammals, and have not exhausted the annoying little
problems of being mammals.

-K. Mullis

"A big computer, a complex algorithm and a long time does not equal
science."

  -Robert Gentleman

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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 -- To UNSUBSCRIBE and more, see
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] ggplot2 question plot mean/error bars

2017-04-05 Thread Santosh
Dear Rxperts..
Here is the updated code.. to the above example.. how do I make the white
circles as "white filled" so that lines in the circles are not shown.?

Thanks and much appreciated
Santosh

q <-  data.frame(G=rep(paste("G",1:3,sep=""),each=50),D=rep(
paste("D",1:5,sep=""),each=30),a=rep(1:15,each=10),t=rep(
seq(10),15),b=round(runif(150,10,20)))
q$r <- q$b*0.1
q2 <- q[order(q$G,q$D,q$a,q$t),]

  q3 <- 
as.data.frame(as.matrix(with(q2,aggregate(list(b=b),list(D=D,t=t),function(x)
c(mean=mean(x),sd=sd(x),se=(sd(x)/sqrt(length(x))),stringsAsFactors=F)
  q3$t <- as.numeric(q3$t)
  q3$b.mean <- as.numeric(q3$b.mean)
  q3$b.sd <- as.numeric(q3$b.sd)
  q3$b.se <- as.numeric(q3$b.se)

ggplot(q3[as.character(q3$D)%in%c("D1","D2"),],aes(x=t,y=b.mean,group=D,col=D,fill=D))
+  geom_point(shape=21,size=4) + #,color=IP))
  geom_line() +
  # geom_point(data=ipthd.f[ipthd.f$IP=="Cinacalcet",],fill='white')+
  geom_errorbar(width=.2,aes(ymin=b.mean-b.se,ymax=b.mean+b.se)) +
  scale_shape_manual(values = c(16,21)) +
  # scale_shape(solid = T)+
  # scale_shape_identity() +
  # scale_shape_discrete(solid = T) +
   scale_fill_manual(values=c("black","white")) +
   scale_color_manual(values=c("black","black"))

On Wed, Apr 5, 2017 at 11:50 AM, Santosh  wrote:

> Hello Rxperts..
> I am trying to generate a mean+/- error plot.. using ggplot2.. with filled
> black and white circles and black lines, but no overlap  of lines and
> circles (symbols). Also, with no top and right lines of the plot box. I
> remember having done this before.. unable to reproduce how I did!
>
> Yes, there are many ways of generating the plot.. Would high appreciate it
> if you could help debug this piece of code.
>
> Attaching sample code for your convenience..
> Best,
> Santosh
>
> q <-  data.frame(G=rep(paste("G",1:3,sep=""),each=50),D=rep(
> paste("D",1:5,sep=""),each=30),a=rep(1:15,each=10),t=rep(
> seq(10),15),b=round(runif(150,10,20)))
> q$r <- q$b*0.1
> q2 <- q[order(q$G,q$D,q$a,q$t),]
>
>   q3 <- 
> as.data.frame(as.matrix(with(q2,aggregate(list(b=b),list(D=D,t=t),function(x)
> c(mean=mean(x),sd=sd(x),se=(sd(x)/sqrt(length(x))),stringsAsFactors=F)
>   q3$t <- as.numeric(q3$t)
>   q3$b.mean <- as.numeric(q3$b.mean)
>   q3$b.sd <- as.numeric(q3$b.sd)
>   q3$b.se <- as.numeric(q3$b.se)
>
> ggplot(q3[as.character(q3$D)%in%c("D1","D2"),],aes(x=t,y=b.mean,fill=D,col=D,group=D))
> + geom_point(shape=21,size=4) +
> geom_line() +
> geom_errorbar(width=1,aes(ymin=Mean-SE,ymax=Mean+SE)) +
> geom_errorbar(width=1,aes(ymin=Mean-SE,ymax=Mean+SE)) +
> scale_shape_manual(values = c(16,21)) +
> scale_fill_manual(values=c("black","white")) +
> scale_color_manual(values=c("black","black")) +
> +legend.position = c(.8,.8))
>
>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] as.POSIXct character string is not in a standard unambiguous format

2017-04-05 Thread Ben Tupper
Hi,

I can't answer the question about R 3.3.3, but I don't see anything in the 
update notes. 

http://mirror.its.dal.ca/cran/doc/manuals/r-release/NEWS.html

In the meantime, would it skirt your issue if you explicitly stated the format?

x <- as.POSIXct("2002-02-02 02:02", format = "%Y-%m-%d %H:%M")

Ben



> On Apr 5, 2017, at 11:21 AM, Sebastien Moretti  
> wrote:
> 
> Hi
> 
> I have lots of issues when I try to install R 3.3.3 during the "make check" 
> step.
> 
> Every time a call to as.POSIXct is done in test scripts, I got the same error 
> message:
> e.g. x <- as.POSIXct("2002-02-02 02:02")
> Error in as.POSIXlt.character(x, tz, ...) :
>  character string is not in a standard unambiguous format
> 
> 
> It looks to be linked to localtime but when I compiled R 3.3.2  6 months ago, 
> the same test scripts were there and succeeded.
> 
> 
> Is there an environmental variable to use to change the as.POSIXct behavior?
> 
> Regards
> 
> --
> Sébastien
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Replying to replies in the forum

2017-04-05 Thread Marc Schwartz

> On Apr 5, 2017, at 1:26 PM, Tunga Kantarcı  wrote:
> 
> My question is specifically about what I should use in the subject
> line when replying, because I do not trust mail clients, or to myself
> as I use different clients sometimes. Hence, I wanted to learn a
> client free solution to correctly send replies. Now, the posting guide
> is not explicit about this. Hence my question. So what should I type
> in the subject line if I want to reply to a specific reply, and not to
> another reply, so that my reply is nested in the reply I want to
> reply. That I cannot figure out from the posting guide.





Hi,

Perhaps I am confused.

If you have a copy of the post that you want to reply to in any modern e-mail 
client (desktop or web based), you can just use reply-all. The subject line 
will be retained, and if not already present, which would be the case for the 
first post in the thread, the "Re:" prefix will be added. 

The e-mails of those participating in that particular post will also be 
retained, as will the list e-mail address.

Are you referring to a situation where you no longer have a copy of the post 
that you want to reply to in your e-mail client, so that you cannot just use 
reply-all to that specific post?

If so, that is a more cumbersome process...

Regards,

Marc

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Replying to replies in the forum

2017-04-05 Thread Jeff Newmiller
There is no conclusively client-free solution, which is why it is not in the 
Posting Guide. 

However, as a general rule, start with a fresh email to start a thread, and 
reply-to-all to the message you want to reply to.  The threading is managed by 
hidden message ids, not subjects. 
-- 
Sent from my phone. Please excuse my brevity.

On April 5, 2017 11:26:27 AM PDT, "Tunga Kantarcı"  
wrote:
>My question is specifically about what I should use in the subject
>line when replying, because I do not trust mail clients, or to myself
>as I use different clients sometimes. Hence, I wanted to learn a
>client free solution to correctly send replies. Now, the posting guide
>is not explicit about this. Hence my question. So what should I type
>in the subject line if I want to reply to a specific reply, and not to
>another reply, so that my reply is nested in the reply I want to
>reply. That I cannot figure out from the posting guide.
>
>On Wed, Apr 5, 2017 at 7:46 PM, Marc Schwartz 
>wrote:
>>
>>> On Apr 5, 2017, at 11:41 AM, Tunga Kantarcı
> wrote:
>>>
>>> OK I cannot figure this out clearly in the guidelines of posting.
>When
>>> I reply to a message I should out "Re:" in front of the subject line
>>> of the original post. So if the subject line of the original post it
>>> is "this is a post", then I should use "Re: this is a post" in the
>>> subject line, for my reply to appear under the original post, and
>not
>>> in the forum as a new message.
>>>
>>> But then I cannot figure out what subject line I should use to reply
>>> to a given reply. That is, suppose the original subject line is
>"this
>>> is a post" and there are replies under the post, and that I want to
>>> reply to one of the replies. How I specify in the subject line so
>that
>>> my reply appears under the reply of a certain person? Or do I have
>to
>>> use the reply features of gmail?
>>>
>>> Meanwhile, why the guidelines is implicit about this?
>>
>> Hi,
>>
>> There is an R Posting Guide here:
>>
>>   https://www.r-project.org/posting-guide.html
>>
>> which is a good place to start.
>>
>> Generally, if you want to reply to a post and keep the thread intact,
>always use "reply-all" and that will keep thread participants copied,
>the post sent to all list subscribers, and the posts in the public
>archives for future use.
>>
>> Most e-mail clients (stand alone or web based) will add the "re:"
>prefix automatically, if not already present.
>>
>> Threads are not kept intact in the list archives based upon the
>subject line alone, even though some e-mail clients may do so. This is
>why there can be a change in the subject line when using reply-all and
>the reply post will be kept with the original thread.
>>
>> If, on the other hand, you create a new e-mail and just use "re: the
>original subject line" in the subject, that will start a new thread in
>the archive.
>>
>> Don't use "reply" only to a post, unless specifically asked, as that
>will only copy one person, not the list nor the archives, and the
>communication will only be between you and that person, which is
>frowned upon.
>>
>> Regards,
>>
>> Marc
>>
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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 -- To UNSUBSCRIBE and more, see
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] ggplot2 question plot mean/error bars

2017-04-05 Thread Santosh
Hello Rxperts..
I am trying to generate a mean+/- error plot.. using ggplot2.. with filled
black and white circles and black lines, but no overlap  of lines and
circles (symbols). Also, with no top and right lines of the plot box. I
remember having done this before.. unable to reproduce how I did!

Yes, there are many ways of generating the plot.. Would high appreciate it
if you could help debug this piece of code.

Attaching sample code for your convenience..
Best,
Santosh

q <-
 
data.frame(G=rep(paste("G",1:3,sep=""),each=50),D=rep(paste("D",1:5,sep=""),each=30),a=rep(1:15,each=10),t=rep(seq(10),15),b=round(runif(150,10,20)))
q$r <- q$b*0.1
q2 <- q[order(q$G,q$D,q$a,q$t),]

  q3 <-
as.data.frame(as.matrix(with(q2,aggregate(list(b=b),list(D=D,t=t),function(x)
c(mean=mean(x),sd=sd(x),se=(sd(x)/sqrt(length(x))),stringsAsFactors=F)
  q3$t <- as.numeric(q3$t)
  q3$b.mean <- as.numeric(q3$b.mean)
  q3$b.sd <- as.numeric(q3$b.sd)
  q3$b.se <- as.numeric(q3$b.se)

ggplot(q3[as.character(q3$D)%in%c("D1","D2"),],aes(x=t,y=b.mean,fill=D,col=D,group=D))
+ geom_point(shape=21,size=4) +
geom_line() +
geom_errorbar(width=1,aes(ymin=Mean-SE,ymax=Mean+SE)) +
geom_errorbar(width=1,aes(ymin=Mean-SE,ymax=Mean+SE)) +
scale_shape_manual(values = c(16,21)) +
scale_fill_manual(values=c("black","white")) +
scale_color_manual(values=c("black","black")) +
+legend.position = c(.8,.8))

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Yield to maturity calculation - bndyield equivalent of MATLAB in R

2017-04-05 Thread Tunga Kantarcı
OK this confused me. I thought object oriented coding should be
preferred because it allows cleaner, more efficient coding. But your
reply suggests it should be preferred because "R" is more efficient in
that way. Anyhow, this thread should indeed not become a discussion
point for this and I should read about it.


On Wed, Apr 5, 2017 at 7:28 PM, Marc Schwartz  wrote:
>
>> On Apr 5, 2017, at 11:34 AM, Tunga Kantarcı  wrote:
>>
>> Thanks a lot Marc, for informing that R is object oriented, implying
>> that one should always try to vectorise the code (although I am not so
>> clear why this should be the case) but also for all the references you
>> provide.
>
>
>
> Hi,
>
> The reason for taking an object oriented approach using vectorized code, is 
> that frequently, the R code that you write is internally calling compiled C 
> code to perform the actual iterations over the object structure. Thus, being 
> that compiled C code is much faster than interpreted R code, there is 
> significant efficiency to be achieved by taking an object oriented approach 
> to key operations.
>
> In addition, when used, a single line of vectorized code and/or a vectorized 
> function can replace multiple lines of code in a different language. Thus, 
> from a coding efficiency and readability standpoint, it is far more efficient.
>
> Regards,
>
> Marc
>

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Replying to replies in the forum

2017-04-05 Thread Tunga Kantarcı
My question is specifically about what I should use in the subject
line when replying, because I do not trust mail clients, or to myself
as I use different clients sometimes. Hence, I wanted to learn a
client free solution to correctly send replies. Now, the posting guide
is not explicit about this. Hence my question. So what should I type
in the subject line if I want to reply to a specific reply, and not to
another reply, so that my reply is nested in the reply I want to
reply. That I cannot figure out from the posting guide.

On Wed, Apr 5, 2017 at 7:46 PM, Marc Schwartz  wrote:
>
>> On Apr 5, 2017, at 11:41 AM, Tunga Kantarcı  wrote:
>>
>> OK I cannot figure this out clearly in the guidelines of posting. When
>> I reply to a message I should out "Re:" in front of the subject line
>> of the original post. So if the subject line of the original post it
>> is "this is a post", then I should use "Re: this is a post" in the
>> subject line, for my reply to appear under the original post, and not
>> in the forum as a new message.
>>
>> But then I cannot figure out what subject line I should use to reply
>> to a given reply. That is, suppose the original subject line is "this
>> is a post" and there are replies under the post, and that I want to
>> reply to one of the replies. How I specify in the subject line so that
>> my reply appears under the reply of a certain person? Or do I have to
>> use the reply features of gmail?
>>
>> Meanwhile, why the guidelines is implicit about this?
>
> Hi,
>
> There is an R Posting Guide here:
>
>   https://www.r-project.org/posting-guide.html
>
> which is a good place to start.
>
> Generally, if you want to reply to a post and keep the thread intact, always 
> use "reply-all" and that will keep thread participants copied, the post sent 
> to all list subscribers, and the posts in the public archives for future use.
>
> Most e-mail clients (stand alone or web based) will add the "re:" prefix 
> automatically, if not already present.
>
> Threads are not kept intact in the list archives based upon the subject line 
> alone, even though some e-mail clients may do so. This is why there can be a 
> change in the subject line when using reply-all and the reply post will be 
> kept with the original thread.
>
> If, on the other hand, you create a new e-mail and just use "re: the original 
> subject line" in the subject, that will start a new thread in the archive.
>
> Don't use "reply" only to a post, unless specifically asked, as that will 
> only copy one person, not the list nor the archives, and the communication 
> will only be between you and that person, which is frowned upon.
>
> Regards,
>
> Marc
>

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Yield to maturity calculation - bndyield equivalent of MATLAB in R

2017-04-05 Thread Marc Schwartz
Bert,

Good distinction...

For clarification, I was referring to the "whole object approach" versus an 
"object oriented" approach.

Regards,

Marc


> On Apr 5, 2017, at 12:43 PM, Bert Gunter  wrote:
> 
> ... Probably need to distinguish "whole object approach" from "object
> oriented" approach. They are different and almost orthogonal in R. R
> tutorials discuss such matters, and there are many good ones on the
> Web, including the "Intro to R" tutorial that ships with R. The OP
> should spend some time with one or more to learn more about this. This
> list cannot provide such extended explanation.
> 
> Cheers,
> Bert
> 
> 
> Bert Gunter
> 
> "The trouble with having an open mind is that people keep coming along
> and sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
> 
> 
> On Wed, Apr 5, 2017 at 10:28 AM, Marc Schwartz  wrote:
>> 
>>> On Apr 5, 2017, at 11:34 AM, Tunga Kantarcı  wrote:
>>> 
>>> Thanks a lot Marc, for informing that R is object oriented, implying
>>> that one should always try to vectorise the code (although I am not so
>>> clear why this should be the case) but also for all the references you
>>> provide.
>> 
>> 
>> 
>> Hi,
>> 
>> The reason for taking an object oriented approach using vectorized code, is 
>> that frequently, the R code that you write is internally calling compiled C 
>> code to perform the actual iterations over the object structure. Thus, being 
>> that compiled C code is much faster than interpreted R code, there is 
>> significant efficiency to be achieved by taking an object oriented approach 
>> to key operations.
>> 
>> In addition, when used, a single line of vectorized code and/or a vectorized 
>> function can replace multiple lines of code in a different language. Thus, 
>> from a coding efficiency and readability standpoint, it is far more 
>> efficient.
>> 
>> Regards,
>> 
>> Marc
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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 -- To UNSUBSCRIBE and more, see
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] Replying to replies in the forum

2017-04-05 Thread Marc Schwartz

> On Apr 5, 2017, at 11:41 AM, Tunga Kantarcı  wrote:
> 
> OK I cannot figure this out clearly in the guidelines of posting. When
> I reply to a message I should out "Re:" in front of the subject line
> of the original post. So if the subject line of the original post it
> is "this is a post", then I should use "Re: this is a post" in the
> subject line, for my reply to appear under the original post, and not
> in the forum as a new message.
> 
> But then I cannot figure out what subject line I should use to reply
> to a given reply. That is, suppose the original subject line is "this
> is a post" and there are replies under the post, and that I want to
> reply to one of the replies. How I specify in the subject line so that
> my reply appears under the reply of a certain person? Or do I have to
> use the reply features of gmail?
> 
> Meanwhile, why the guidelines is implicit about this?

Hi,

There is an R Posting Guide here:

  https://www.r-project.org/posting-guide.html

which is a good place to start.

Generally, if you want to reply to a post and keep the thread intact, always 
use "reply-all" and that will keep thread participants copied, the post sent to 
all list subscribers, and the posts in the public archives for future use. 

Most e-mail clients (stand alone or web based) will add the "re:" prefix 
automatically, if not already present.

Threads are not kept intact in the list archives based upon the subject line 
alone, even though some e-mail clients may do so. This is why there can be a 
change in the subject line when using reply-all and the reply post will be kept 
with the original thread.

If, on the other hand, you create a new e-mail and just use "re: the original 
subject line" in the subject, that will start a new thread in the archive.

Don't use "reply" only to a post, unless specifically asked, as that will only 
copy one person, not the list nor the archives, and the communication will only 
be between you and that person, which is frowned upon.

Regards,

Marc

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Yield to maturity calculation - bndyield equivalent of MATLAB in R

2017-04-05 Thread Bert Gunter
... Probably need to distinguish "whole object approach" from "object
oriented" approach. They are different and almost orthogonal in R. R
tutorials discuss such matters, and there are many good ones on the
Web, including the "Intro to R" tutorial that ships with R. The OP
should spend some time with one or more to learn more about this. This
list cannot provide such extended explanation.

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Apr 5, 2017 at 10:28 AM, Marc Schwartz  wrote:
>
>> On Apr 5, 2017, at 11:34 AM, Tunga Kantarcı  wrote:
>>
>> Thanks a lot Marc, for informing that R is object oriented, implying
>> that one should always try to vectorise the code (although I am not so
>> clear why this should be the case) but also for all the references you
>> provide.
>
>
>
> Hi,
>
> The reason for taking an object oriented approach using vectorized code, is 
> that frequently, the R code that you write is internally calling compiled C 
> code to perform the actual iterations over the object structure. Thus, being 
> that compiled C code is much faster than interpreted R code, there is 
> significant efficiency to be achieved by taking an object oriented approach 
> to key operations.
>
> In addition, when used, a single line of vectorized code and/or a vectorized 
> function can replace multiple lines of code in a different language. Thus, 
> from a coding efficiency and readability standpoint, it is far more efficient.
>
> Regards,
>
> Marc
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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 -- To UNSUBSCRIBE and more, see
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] Yield to maturity calculation - bndyield equivalent of MATLAB in R

2017-04-05 Thread Marc Schwartz

> On Apr 5, 2017, at 11:34 AM, Tunga Kantarcı  wrote:
> 
> Thanks a lot Marc, for informing that R is object oriented, implying
> that one should always try to vectorise the code (although I am not so
> clear why this should be the case) but also for all the references you
> provide.



Hi,

The reason for taking an object oriented approach using vectorized code, is 
that frequently, the R code that you write is internally calling compiled C 
code to perform the actual iterations over the object structure. Thus, being 
that compiled C code is much faster than interpreted R code, there is 
significant efficiency to be achieved by taking an object oriented approach to 
key operations. 

In addition, when used, a single line of vectorized code and/or a vectorized 
function can replace multiple lines of code in a different language. Thus, from 
a coding efficiency and readability standpoint, it is far more efficient.

Regards,

Marc

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Replying to replies in the forum

2017-04-05 Thread Tunga Kantarcı
OK I cannot figure this out clearly in the guidelines of posting. When
I reply to a message I should out "Re:" in front of the subject line
of the original post. So if the subject line of the original post it
is "this is a post", then I should use "Re: this is a post" in the
subject line, for my reply to appear under the original post, and not
in the forum as a new message.

But then I cannot figure out what subject line I should use to reply
to a given reply. That is, suppose the original subject line is "this
is a post" and there are replies under the post, and that I want to
reply to one of the replies. How I specify in the subject line so that
my reply appears under the reply of a certain person? Or do I have to
use the reply features of gmail?

Meanwhile, why the guidelines is implicit about this?

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Yield to maturity calculation - bndyield equivalent of MATLAB in R

2017-04-05 Thread Tunga Kantarcı
Thanks a lot Marc, for informing that R is object oriented, implying
that one should always try to vectorise the code (although I am not so
clear why this should be the case) but also for all the references you
provide.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] taking a small piece of large tiff

2017-04-05 Thread Michael Sumner
On Wed, 5 Apr 2017 at 20:13 jim holtman  wrote:

> if you have 8GB of memory it should be easy to handle.
>
>
>
TIFF is a container format and may be compressed internally, and so could
expand out  as a matrix it might be very many times larger than the file
size implies.

(Follow Ben's advice and use raster, which in turn uses rgdal to read
TIFF/GeoTIFF. It's ridiculously good).


Something like

library(raster)
r <- raster("/path/to/myfile.tif")
print(r)  ## to see the units of the extent

## enter the singleton-values for xmin/xmax/ymin/ymax that you want here:
b <- crop(r, extent(xmin, xmax, ymin, ymax))

Note that the extent values must be in the coordinate system used by the
raster itself, it might be in longitude-latitude or in some
"eastings-northings" map projection (CRS, or coordinate reference system).
The print out of print(r) will tell you, and projection(r) if you need to
use it directly.

There's no need to do your own transformations from world-space to pixel
index space. but the price of that convenience is you have to interact with
the data via the raster package's design and interfaces. You can get a
matrix out but it's well worth learning the higher level abstractions
available as well.


Cheers, Mike.



> Jim Holtman
> Data Munger Guru
>
> What is the problem that you are trying to solve?
> Tell me what you want to do, not how you want to do it.
>
>
> On Wed, Apr 5, 2017 at 3:23 AM, Louisa Reynolds
>  wrote:
> > Ok. I have a tiff of size over 2GB. It covers a sixth of the Earth's
> surface and I'm trying to cut a UK piece out of it. The tiff I start with
> seems to be too large for R to handle.
> >
> >
> > Sent from my iPhone
> >
> >> On 4 Apr 2017, at 18:37, jim holtman  wrote:
> >>
> >> How big is 'large'?
> >>
> >> Jim Holtman
> >> Data Munger Guru
> >>
> >> What is the problem that you are trying to solve?
> >> Tell me what you want to do, not how you want to do it.
> >>
> >>
> >> On Tue, Apr 4, 2017 at 7:47 AM, Louisa Reynolds via R-help
> >>  wrote:
> >>> Dear Forum
> >>> I am trying to cut out a small section of a very large 2-dimensional
> grayscale image as a tiff in R, but it is having difficulty handling such
> large files.  I have looked at bigmemory and ff packages but it is unclear
> how I can use these packages with tiffs. Can anyone please suggest
> something? I have tried tiff and rtiff libraries.
> >>> Thanks in advance.
> >>>[[alternative HTML version deleted]]
> >>>
> >>> __
> >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >>> 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 -- To UNSUBSCRIBE and more, see
> 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.
>
-- 
Dr. Michael Sumner
Software and Database Engineer
Australian Antarctic Division
203 Channel Highway
Kingston Tasmania 7050 Australia

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] differential use of R version

2017-04-05 Thread ce

Maybe you can use .libPaths to choose a different library

.libPaths("/myhome/Documents/R/R-3.0.2/library")

Or /usr/bin/R command in linux is a shell script, you can edit some paths and 
make it work. ( I haven't tried it though) 


-Original Message-
From: "Bogdan Tanasa" [tan...@gmail.com]
Date: 04/04/2017 10:47 PM
To: "r-help" 
Subject: [R] differential use of R version

Dear all,

please could you advise me on the following :

on a server, in a folder "x86_64-redhat-linux-gnu-library", i have 2
versions of R (below), with the corresponding BioC libraries :

> 3.2
> 3.3

how could i preferentially use an R version or the other (with the related
BioC libraries) ?

thank you,

-- bogdan

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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 -- To UNSUBSCRIBE and more, see
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] as.POSIXct character string is not in a standard unambiguous format

2017-04-05 Thread Sebastien Moretti

Hi

I have lots of issues when I try to install R 3.3.3 during the "make 
check" step.


Every time a call to as.POSIXct is done in test scripts, I got the same 
error message:

e.g. x <- as.POSIXct("2002-02-02 02:02")
Error in as.POSIXlt.character(x, tz, ...) :
  character string is not in a standard unambiguous format


It looks to be linked to localtime but when I compiled R 3.3.2  6 months 
ago, the same test scripts were there and succeeded.



Is there an environmental variable to use to change the as.POSIXct behavior?

Regards

--
Sébastien

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] taking a small piece of large tiff

2017-04-05 Thread Ben Tupper
Hi,

You'll get a lot of help if you take this question to the R-sig-geo list 

https://stat.ethz.ch/mailman/listinfo/r-sig-geo

In the meantime, you might want to try reading this using raster::raster() and 
then cropping to your desired region. Here's a discussion that may help you...

https://stat.ethz.ch/pipermail/r-sig-geo/2010-July/008838.html

You will find many other useful bits using Rseek.org - try 
http://rseek.org/?q=subset+large+geotif

Cheers,
Ben

> On Apr 5, 2017, at 3:23 AM, Louisa Reynolds via R-help  
> wrote:
> 
> Ok. I have a tiff of size over 2GB. It covers a sixth of the Earth's surface 
> and I'm trying to cut a UK piece out of it. The tiff I start with seems to be 
> too large for R to handle. 
> 
> 
> Sent from my iPhone
> 
>> On 4 Apr 2017, at 18:37, jim holtman  wrote:
>> 
>> How big is 'large'?
>> 
>> Jim Holtman
>> Data Munger Guru
>> 
>> What is the problem that you are trying to solve?
>> Tell me what you want to do, not how you want to do it.
>> 
>> 
>> On Tue, Apr 4, 2017 at 7:47 AM, Louisa Reynolds via R-help
>>  wrote:
>>> Dear Forum
>>> I am trying to cut out a small section of a very large 2-dimensional 
>>> grayscale image as a tiff in R, but it is having difficulty handling such 
>>> large files.  I have looked at bigmemory and ff packages but it is unclear 
>>> how I can use these packages with tiffs. Can anyone please suggest 
>>> something? I have tried tiff and rtiff libraries.
>>> Thanks in advance.
>>>   [[alternative HTML version deleted]]
>>> 
>>> __
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> 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 -- To UNSUBSCRIBE and more, see
> 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.

Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Package Query

2017-04-05 Thread Jeff Newmiller
There is a package called sos that helps you answer such questions yourself. 
There are also Task View pages on CRAN that help you identify useful packages. 
-- 
Sent from my phone. Please excuse my brevity.

On April 4, 2017 9:28:32 PM PDT, Ruchika Salwan  
wrote:
>Hey,
>
>Is there any package in R that handles graph decomposition? A package
>created specifically for flat/hierarchical decomposition of graphs.
>
>Thanks,
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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 -- To UNSUBSCRIBE and more, see
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] Package Query

2017-04-05 Thread Bert Gunter
On the rseek.org   search site,

"graph decomposition"

brought up what looked like some relevant hits. So search there if you
haven't done so already.

-- Bert




Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Tue, Apr 4, 2017 at 9:28 PM, Ruchika Salwan
 wrote:
> Hey,
>
> Is there any package in R that handles graph decomposition? A package
> created specifically for flat/hierarchical decomposition of graphs.
>
> Thanks,
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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 -- To UNSUBSCRIBE and more, see
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] differential use of R version

2017-04-05 Thread Rui Barradas

Hello,

Unless you have strong reasons why not, use the most recent one, R 3.3.

Hope this helps,

Rui barradas

Em 05-04-2017 03:47, Bogdan Tanasa escreveu:

Dear all,

please could you advise me on the following :

on a server, in a folder "x86_64-redhat-linux-gnu-library", i have 2
versions of R (below), with the corresponding BioC libraries :


3.2
3.3


how could i preferentially use an R version or the other (with the related
BioC libraries) ?

thank you,

-- bogdan

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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 -- To UNSUBSCRIBE and more, see
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] taking a small piece of large tiff

2017-04-05 Thread Louisa Reynolds via R-help
Ok. I have a tiff of size over 2GB. It covers a sixth of the Earth's surface 
and I'm trying to cut a UK piece out of it. The tiff I start with seems to be 
too large for R to handle. 


Sent from my iPhone

> On 4 Apr 2017, at 18:37, jim holtman  wrote:
> 
> How big is 'large'?
> 
> Jim Holtman
> Data Munger Guru
> 
> What is the problem that you are trying to solve?
> Tell me what you want to do, not how you want to do it.
> 
> 
> On Tue, Apr 4, 2017 at 7:47 AM, Louisa Reynolds via R-help
>  wrote:
>> Dear Forum
>> I am trying to cut out a small section of a very large 2-dimensional 
>> grayscale image as a tiff in R, but it is having difficulty handling such 
>> large files.  I have looked at bigmemory and ff packages but it is unclear 
>> how I can use these packages with tiffs. Can anyone please suggest 
>> something? I have tried tiff and rtiff libraries.
>> Thanks in advance.
>>[[alternative HTML version deleted]]
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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 -- To UNSUBSCRIBE and more, see
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] Package Query

2017-04-05 Thread Ruchika Salwan
Hey,

Is there any package in R that handles graph decomposition? A package
created specifically for flat/hierarchical decomposition of graphs.

Thanks,

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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 with package ranks

2017-04-05 Thread davide f
Hello, I'm Davide.
I'm using the package RANKS, in particular the functions do.GBA, do.RW,
do.RANKS. To the funcs are given 2 different Matrix. One is a a simmetryc
adjacency Matrix(called "M"), where rows and columns are protein, and the
other is an annotation Matrix(called "ann"), where protein are rows(the
same of the first Matrix) and and the annotations are columns.

I write a script in order to filter both the matrices, choosing only
protein with 5 or more annotations.

To be more specific, using the functions, data=M, labels=ann.

But, running the script, it gives me an error message about the functions
of interest:

Error in apply(W[, ind.positives], 1, sum) :
  dim(X) deve avere lunghezza positiva


In paritcular it gives me the error during the FOR cycle, when it
works on the 6th column.


How can I resolve it? what is the reason?


Thank you in advance, best regards,

Davide.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Yield to maturity calculation - bndyield equivalent of MATLAB in R

2017-04-05 Thread Marc Schwartz

> On Apr 5, 2017, at 8:00 AM, Tunga Kantarcı  wrote:
> 
> I have the MATLAB code pasted below that calculates yields to maturity.
> 
> IRR = zeros(length(c),length(M))
> 
> The ith row and jth column is the price of the bond with coupon c(i)
> and maturity M(j).
> 
> for i = 1:3
>for j = 1:3
>if j == 1
>IRR(i,j) =
> bndyield(mPricecon(i,j),c_org(i),'07-Apr-2016','07-Apr-2026');
>elseif j == 2
>IRR(i,j) =
> bndyield(mPricecon(i,j),c_org(i),'07-Apr-2016','07-Apr-2036');
>elseif j == 3
>IRR(i,j) =
> bndyield(mPricecon(i,j),c_org(i),'07-Apr-2016','07-Apr-2046');
>end
>end
> end;
> 
> mPricecon represents the prices calculated from zero coupon bond
> prices, and c_org represents the coupon payments. This then gives IRR.
> 
> I need to convert this MATLAB code to R code, and ideally one to one.
> The problem is that bndyield is a MATLAB function and there does not
> seem be an exact equivalent in R. What is the best way to go?


Hi,

First, from a high-level view, you rarely want to convert code from another 
language to R on a one-to-one or line by line basis. R's underlying philosophy 
is to take a whole object approach to solving problems by using vectorized 
code, rather than loops, much less nested loops, albeit, sometimes there are 
exceptions.

An initial step would be to use Google or rseek.org , the 
latter being a dedicated R search resource, where you can use keywords such as 
" R Yield to Maturity" to identify possible solutions, CRAN packages that may 
make sense and prior discussions in the list archives.

I am not in finance, so would defer to others with specific knowledge in the 
domain, but another resource would be CRAN Task Views:

  https://cran.r-project.org/web/views/ 

where there are Econometrics and Finance views that have focused resources with 
links to CRAN packages that may be relevant (more so the latter view). From the 
latter view, the fBonds package on CRAN seems to be possibly relevant:

  https://cran.r-project.org/web/packages/fBonds/index.html 


as does the jrvFinance package:

  https://cran.r-project.org/web/packages/jrvFinance/

with some others having 'yield' as keyword in their descriptions.

Also, there are a number of domain specific R e-mail lists, including one for 
Finance:

  https://stat.ethz.ch/mailman/listinfo/r-sig-finance 


and you would avail yourself of a focused audience in the domain using that 
list, as opposed to R-Help for these types of questions.

Hopefully this will get you moving forward.

Regards,

Marc Schwartz


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Yield to maturity calculation - bndyield equivalent of MATLAB in R

2017-04-05 Thread Tunga Kantarcı
I have the MATLAB code pasted below that calculates yields to maturity.

IRR = zeros(length(c),length(M))

The ith row and jth column is the price of the bond with coupon c(i)
and maturity M(j).

for i = 1:3
for j = 1:3
if j == 1
IRR(i,j) =
bndyield(mPricecon(i,j),c_org(i),'07-Apr-2016','07-Apr-2026');
elseif j == 2
IRR(i,j) =
bndyield(mPricecon(i,j),c_org(i),'07-Apr-2016','07-Apr-2036');
elseif j == 3
IRR(i,j) =
bndyield(mPricecon(i,j),c_org(i),'07-Apr-2016','07-Apr-2046');
end
end
end;

mPricecon represents the prices calculated from zero coupon bond
prices, and c_org represents the coupon payments. This then gives IRR.

I need to convert this MATLAB code to R code, and ideally one to one.
The problem is that bndyield is a MATLAB function and there does not
seem be an exact equivalent in R. What is the best way to go?

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] taking a small piece of large tiff

2017-04-05 Thread jim holtman
if you have 8GB of memory it should be easy to handle.


Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.


On Wed, Apr 5, 2017 at 3:23 AM, Louisa Reynolds
 wrote:
> Ok. I have a tiff of size over 2GB. It covers a sixth of the Earth's surface 
> and I'm trying to cut a UK piece out of it. The tiff I start with seems to be 
> too large for R to handle.
>
>
> Sent from my iPhone
>
>> On 4 Apr 2017, at 18:37, jim holtman  wrote:
>>
>> How big is 'large'?
>>
>> Jim Holtman
>> Data Munger Guru
>>
>> What is the problem that you are trying to solve?
>> Tell me what you want to do, not how you want to do it.
>>
>>
>> On Tue, Apr 4, 2017 at 7:47 AM, Louisa Reynolds via R-help
>>  wrote:
>>> Dear Forum
>>> I am trying to cut out a small section of a very large 2-dimensional 
>>> grayscale image as a tiff in R, but it is having difficulty handling such 
>>> large files.  I have looked at bigmemory and ff packages but it is unclear 
>>> how I can use these packages with tiffs. Can anyone please suggest 
>>> something? I have tried tiff and rtiff libraries.
>>> Thanks in advance.
>>>[[alternative HTML version deleted]]
>>>
>>> __
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> 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 -- To UNSUBSCRIBE and more, see
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] differential use of R version

2017-04-05 Thread Bogdan Tanasa
Thank you Rui. I have been using a package (TitanCNA) in BioC on an older
version of R (3.3.1);
now after switching to R3.3.3, I am getting an error (below), and I do not
know how to fix it. Any suggestions are welcome.

Error in `[<-.data.frame`(`*tmp*`, indRef, "refCount", value = NULL) :
  replacement has length zero

On Wed, Apr 5, 2017 at 2:52 AM, Rui Barradas  wrote:

> Hello,
>
> Unless you have strong reasons why not, use the most recent one, R 3.3.
>
> Hope this helps,
>
> Rui barradas
>
>
> Em 05-04-2017 03:47, Bogdan Tanasa escreveu:
>
>> Dear all,
>>
>> please could you advise me on the following :
>>
>> on a server, in a folder "x86_64-redhat-linux-gnu-library", i have 2
>> versions of R (below), with the corresponding BioC libraries :
>>
>> 3.2
>>> 3.3
>>>
>>
>> how could i preferentially use an R version or the other (with the related
>> BioC libraries) ?
>>
>> thank you,
>>
>> -- bogdan
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posti
>> ng-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.