Re: [R] [FORGED] Re: How create columns for squared values from previous columns?

2017-04-28 Thread Mike C
Thanks Rolf.
I was just a bit frustrated that R wouldn't generate dummy variable names on 
the fly.

Also, another question, if I want to put column 5 at column 3,

dat[, 3:5] <- dat[, c(5,3,4)]

It does not work, why?


From: Rolf Turner 
Sent: Friday, April 28, 2017 10:48:42 PM
To: C W
Cc: r-help
Subject: Re: [FORGED] Re: [R] How create columns for squared values from 
previous columns?

On 29/04/17 13:21, C W wrote:
> I came up with this solution,
>
>> cbind(dat, dat[, 1:3]^2)
>X1 X2 X3 X4  X5  X1
> X2X3
> 1  0.72776481 -1.1332612 -1.9857503 0.46189400 -0.09016379 0.529641625
> 1.28428102 3.9432044
> 2  0.05126592  0.2858707  0.9075806 1.27582713 -0.49438507 0.002628194
> 0.08172203 0.8237026
> 3 -0.40430146  0.5457195 -1.1924042 0.15025594  1.99710475 0.163459669
> 0.29780978 1.4218277
> 4  1.40746971 -1.2279416  0.3296075 0.84411774 -0.52371619 1.980970990
> 1.50784058 0.1086411
> 5 -0.53841150  0.4750082 -0.4705148 0.05591914 -0.31503500 0.289886944
> 0.22563275 0.2213842
> 6  0.90691210  0.7247171  0.8244184 0.73328097 -1.05284737 0.822489552
> 0.52521494 0.6796657
>
> But, you would NOT ONLY get undesired variable names, BUT ALSO duplicated
> names. I suppose I can use paste() to solve that?
>
> Any better ideas?

Well, if the names bizzo is your only worry, you could hit the result
with data.frame() *after* cbinding on the squared terms:

dat <- matrix(rnorm(30),ncol=5)
dat <- cbind(dat,dat[,1:3]^2)
dat <- data.frame(dat)
names(dat)

And as you indicate, the names of a data frame are easily adjusted.

I wouldn't lose sleep over it.

cheers,

Rolf Turner

P.S. You could also do

 names(dat) <- make.unique(names(dat))

to your original idea, to get rid of the lack of uniqueness.  The result
is probably "undesirable" but.

R. T.

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

[[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] read list of binary files and explore them

2017-04-28 Thread Bert Gunter
 ?readBin  (a search on "read binary files R" or similar would have found this).

and please spend some time with the R import/export manual + tutorials
to learn how to manipulate data in R. This list expects you to make an
effort to do your own work before posting. See the posting guide below
for details.

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 Fri, Apr 28, 2017 at 9:13 PM, Ragia .  wrote:
>
> Dear group,
>
> I have  list of  4-byte float type files, the files are named f00, f01, f02 
> till f99
>
>
> kindly how can I read and explore them in R, merge the readings in a table or 
> data frame
>
> thanks in advance,
>
>
> Ragia A. Ibrahim
>
>
>
> [[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] [FORGED] Re: How create columns for squared values from previous columns?

2017-04-28 Thread Rolf Turner

On 29/04/17 13:21, C W wrote:

I came up with this solution,


cbind(dat, dat[, 1:3]^2)

   X1 X2 X3 X4  X5  X1
X2X3
1  0.72776481 -1.1332612 -1.9857503 0.46189400 -0.09016379 0.529641625
1.28428102 3.9432044
2  0.05126592  0.2858707  0.9075806 1.27582713 -0.49438507 0.002628194
0.08172203 0.8237026
3 -0.40430146  0.5457195 -1.1924042 0.15025594  1.99710475 0.163459669
0.29780978 1.4218277
4  1.40746971 -1.2279416  0.3296075 0.84411774 -0.52371619 1.980970990
1.50784058 0.1086411
5 -0.53841150  0.4750082 -0.4705148 0.05591914 -0.31503500 0.289886944
0.22563275 0.2213842
6  0.90691210  0.7247171  0.8244184 0.73328097 -1.05284737 0.822489552
0.52521494 0.6796657

But, you would NOT ONLY get undesired variable names, BUT ALSO duplicated
names. I suppose I can use paste() to solve that?

Any better ideas?


Well, if the names bizzo is your only worry, you could hit the result 
with data.frame() *after* cbinding on the squared terms:


dat <- matrix(rnorm(30),ncol=5)
dat <- cbind(dat,dat[,1:3]^2)
dat <- data.frame(dat)
names(dat)

And as you indicate, the names of a data frame are easily adjusted.

I wouldn't lose sleep over it.

cheers,

Rolf Turner

P.S. You could also do

names(dat) <- make.unique(names(dat))

to your original idea, to get rid of the lack of uniqueness.  The result 
is probably "undesirable" but.


R. T.

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

__
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] Opencpu and caching

2017-04-28 Thread Jake Stone
OK, thanks for the info
 I apologize. I must have misread or misremembered.

I have found the answer btw. R
Cache serves the said purpose perfectly.




On Apr 28, 2017 6:58 PM, "Jeff Newmiller"  wrote:

A) The https://www.opencpu.org/help.html page recommends a Google Group and
Stack Overflow. If you were "told" otherwise, it was probably because they
thought you needed to learn R, which would be off topic for their support
areas.

B) The R mailing lists Posting Guide says that questions about contributed
packages such as opencpu belong on their respective support areas. I can't
even find any other mentions of opencpu in the archives other than "check
it out".

C) If your question is purely about R, go ahead and ask on the appropriate
R mailing list (quite possibly this one), but phrase it in terms of R and
don't drag in Java or some server architecture that is off topic. To
emphasize this we strongly recommend creating a minimal reproducible
example ("reprex"). There are websites that describe what this means[1][2],
and an R package (called reprex) to help you verify that other people will
in fact be able to run your example at least to the point where it
generates the error you are dealing with.

So, if you need to learn enough R in order to ask your question coherently
in the OpenCPU support areas, maybe you should start with some R
documentation and learn the language?

[1] http://stackoverflow.com/questions/5963269/how-to-make-
a-great-r-reproducible-example

[2] http://adv-r.had.co.nz/Reproducibility.html
--
Sent from my phone. Please excuse my brevity.

On April 28, 2017 5:34:37 PM PDT, Jake Stone  wrote:
>Opencpu website recommends this site.
>You might want to clarify with them.
>
>
>
>On Apr 28, 2017 5:23 PM, "Jeff Newmiller" 
>wrote:
>
>> You have already been told this is the wrong list for these
>questions. Go
>> ask in the OpenCPU support areas.
>>
>> My very limited understanding of OpenCPU is that what you are asking
>for
>> is specifically not supported. You need to setup your own function
>that
>> does everything before it returns.
>> --
>> Sent from my phone. Please excuse my brevity.
>>
>> On April 28, 2017 4:42:15 PM PDT, Jake Stone 
>wrote:
>> >I am new to opencpu. My specialty is java. I use R for very specific
>> >analyses.
>> >
>> >*PROBLEM*
>> >My understanding is that each API call to opencpu opens a new R
>> >session.
>> >My function will classify the data input using the predict method of
>a
>> >linear discriminant analysis (lda from MASS package).
>> >The initial linear discriminant analysis on 10+ cases and 150+
>> >factor
>> >levels takes time (over 30 seconds). This function returns a list.
>> >The subsequent prediction function is quick and returns a simple
>> >vector.
>> >
>> >
>> >*APPROACH*
>> >I run one opencpu function to run the initial lda. This only needs
>to
>> >run
>> >once.
>> >I want my second function to ONLY run the predict function. This is
>> >possible if the lda is held as a global variable.
>> >My understanding is that global variables are not possible in
>opencpu.
>> >So I
>> >will have to cache the lda on the file system.
>> >In sum, I need to run the lda just once and hold the analysis (a
>list)
>> >either in memory or on the file system. I then retrieve the lda
>> >analysis
>> >when predict is called.
>> >
>> >*QUESTION*
>> >Which approach is best, and how to implement?
>> >1. I could use an opencpu function that creates and returns the lda.
>> >Then
>> >when I call a prediction, I could retrieve the lda object (a list)
>from
>> >the
>> >file system. But how do I retrieve the list from the file system.
>How
>> >does opencpu even know where it is?
>> >2. I could use r.cache package. I haven't used this package before
>but
>> >the
>> >docs suggest it is a solution. Will this work?
>> >
>> >Any advice would be deeply appreciated.
>> >
>> >best
>> >jake
>> >
>> >   [[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.
>>

[[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] Opencpu and caching

2017-04-28 Thread Jeff Newmiller
A) The https://www.opencpu.org/help.html page recommends a Google Group and 
Stack Overflow. If you were "told" otherwise, it was probably because they 
thought you needed to learn R, which would be off topic for their support 
areas. 

B) The R mailing lists Posting Guide says that questions about contributed 
packages such as opencpu belong on their respective support areas. I can't even 
find any other mentions of opencpu in the archives other than "check it out".

C) If your question is purely about R, go ahead and ask on the appropriate R 
mailing list (quite possibly this one), but phrase it in terms of R and don't 
drag in Java or some server architecture that is off topic. To emphasize this 
we strongly recommend creating a minimal reproducible example ("reprex"). There 
are websites that describe what this means[1][2], and an R package (called 
reprex) to help you verify that other people will in fact be able to run your 
example at least to the point where it generates the error you are dealing 
with. 

So, if you need to learn enough R in order to ask your question coherently in 
the OpenCPU support areas, maybe you should start with some R documentation and 
learn the language?

[1] 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

[2] http://adv-r.had.co.nz/Reproducibility.html
-- 
Sent from my phone. Please excuse my brevity.

On April 28, 2017 5:34:37 PM PDT, Jake Stone  wrote:
>Opencpu website recommends this site.
>You might want to clarify with them.
>
>
>
>On Apr 28, 2017 5:23 PM, "Jeff Newmiller" 
>wrote:
>
>> You have already been told this is the wrong list for these
>questions. Go
>> ask in the OpenCPU support areas.
>>
>> My very limited understanding of OpenCPU is that what you are asking
>for
>> is specifically not supported. You need to setup your own function
>that
>> does everything before it returns.
>> --
>> Sent from my phone. Please excuse my brevity.
>>
>> On April 28, 2017 4:42:15 PM PDT, Jake Stone 
>wrote:
>> >I am new to opencpu. My specialty is java. I use R for very specific
>> >analyses.
>> >
>> >*PROBLEM*
>> >My understanding is that each API call to opencpu opens a new R
>> >session.
>> >My function will classify the data input using the predict method of
>a
>> >linear discriminant analysis (lda from MASS package).
>> >The initial linear discriminant analysis on 10+ cases and 150+
>> >factor
>> >levels takes time (over 30 seconds). This function returns a list.
>> >The subsequent prediction function is quick and returns a simple
>> >vector.
>> >
>> >
>> >*APPROACH*
>> >I run one opencpu function to run the initial lda. This only needs
>to
>> >run
>> >once.
>> >I want my second function to ONLY run the predict function. This is
>> >possible if the lda is held as a global variable.
>> >My understanding is that global variables are not possible in
>opencpu.
>> >So I
>> >will have to cache the lda on the file system.
>> >In sum, I need to run the lda just once and hold the analysis (a
>list)
>> >either in memory or on the file system. I then retrieve the lda
>> >analysis
>> >when predict is called.
>> >
>> >*QUESTION*
>> >Which approach is best, and how to implement?
>> >1. I could use an opencpu function that creates and returns the lda.
>> >Then
>> >when I call a prediction, I could retrieve the lda object (a list)
>from
>> >the
>> >file system. But how do I retrieve the list from the file system.
>How
>> >does opencpu even know where it is?
>> >2. I could use r.cache package. I haven't used this package before
>but
>> >the
>> >docs suggest it is a solution. Will this work?
>> >
>> >Any advice would be deeply appreciated.
>> >
>> >best
>> >jake
>> >
>> >   [[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 create columns for squared values from previous columns?

2017-04-28 Thread C W
I came up with this solution,

> cbind(dat, dat[, 1:3]^2)
   X1 X2 X3 X4  X5  X1
X2X3
1  0.72776481 -1.1332612 -1.9857503 0.46189400 -0.09016379 0.529641625
1.28428102 3.9432044
2  0.05126592  0.2858707  0.9075806 1.27582713 -0.49438507 0.002628194
0.08172203 0.8237026
3 -0.40430146  0.5457195 -1.1924042 0.15025594  1.99710475 0.163459669
0.29780978 1.4218277
4  1.40746971 -1.2279416  0.3296075 0.84411774 -0.52371619 1.980970990
1.50784058 0.1086411
5 -0.53841150  0.4750082 -0.4705148 0.05591914 -0.31503500 0.289886944
0.22563275 0.2213842
6  0.90691210  0.7247171  0.8244184 0.73328097 -1.05284737 0.822489552
0.52521494 0.6796657

But, you would NOT ONLY get undesired variable names, BUT ALSO duplicated
names. I suppose I can use paste() to solve that?

Any better ideas?


On Fri, Apr 28, 2017 at 8:57 PM, C W  wrote:

> Dear R list,
>
> I am am a little unsure what is the best way to approach this. I suppose I
> have
>
> > dat <- matrix(rnorm(30), ncol = 5)
> > dat <- data.frame(dat)
> > dat
>X1  X2  X3 X4  X5
> 1 -1.1317 -0.87868106 -0.33000492  1.5241765 -0.92483388
> 2 -0.56168006 -0.08837883  1.96237792 -0.5335615  0.02880586
> 3  0.82800071 -1.89965562 -0.05438815 -0.9162857 -0.57470053
> 4 -0.03218412 -0.23119263 -1.10671765 -0.2885518 -0.30953951
> 5  1.70525779 -0.93854817 -1.05932636 -0.2983139 -0.21980145
> 6  1.19047531  0.38301678 -0.20830015 -0.6668266  0.82578534
>
> Suppose I want to add columns X6, X7, X8, where
> X6 = X1^2
> X7 = X2^2
> X8 = X3^2
>
> I am thinking of using apply(), but df asks for column names, what's a
> quick way to generate names on the fly?
>
> Thank you very much!
>
>

[[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 create columns for squared values from previous columns?

2017-04-28 Thread C W
Dear R list,

I am am a little unsure what is the best way to approach this. I suppose I
have

> dat <- matrix(rnorm(30), ncol = 5)
> dat <- data.frame(dat)
> dat
   X1  X2  X3 X4  X5
1 -1.1317 -0.87868106 -0.33000492  1.5241765 -0.92483388
2 -0.56168006 -0.08837883  1.96237792 -0.5335615  0.02880586
3  0.82800071 -1.89965562 -0.05438815 -0.9162857 -0.57470053
4 -0.03218412 -0.23119263 -1.10671765 -0.2885518 -0.30953951
5  1.70525779 -0.93854817 -1.05932636 -0.2983139 -0.21980145
6  1.19047531  0.38301678 -0.20830015 -0.6668266  0.82578534

Suppose I want to add columns X6, X7, X8, where
X6 = X1^2
X7 = X2^2
X8 = X3^2

I am thinking of using apply(), but df asks for column names, what's a
quick way to generate names on the fly?

Thank you very much!

[[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] Opencpu and caching

2017-04-28 Thread Jeff Newmiller
You have already been told this is the wrong list for these questions. Go ask 
in the OpenCPU support areas.

My very limited understanding of OpenCPU is that what you are asking for is 
specifically not supported. You need to setup your own function that does 
everything before it returns.
-- 
Sent from my phone. Please excuse my brevity.

On April 28, 2017 4:42:15 PM PDT, Jake Stone  wrote:
>I am new to opencpu. My specialty is java. I use R for very specific
>analyses.
>
>*PROBLEM*
>My understanding is that each API call to opencpu opens a new R
>session.
>My function will classify the data input using the predict method of a
>linear discriminant analysis (lda from MASS package).
>The initial linear discriminant analysis on 10+ cases and 150+
>factor
>levels takes time (over 30 seconds). This function returns a list.
>The subsequent prediction function is quick and returns a simple
>vector.
>
>
>*APPROACH*
>I run one opencpu function to run the initial lda. This only needs to
>run
>once.
>I want my second function to ONLY run the predict function. This is
>possible if the lda is held as a global variable.
>My understanding is that global variables are not possible in opencpu.
>So I
>will have to cache the lda on the file system.
>In sum, I need to run the lda just once and hold the analysis (a list)
>either in memory or on the file system. I then retrieve the lda
>analysis
>when predict is called.
>
>*QUESTION*
>Which approach is best, and how to implement?
>1. I could use an opencpu function that creates and returns the lda.
>Then
>when I call a prediction, I could retrieve the lda object (a list) from
>the
>file system. But how do I retrieve the list from the file system. How
>does opencpu even know where it is?
>2. I could use r.cache package. I haven't used this package before but
>the
>docs suggest it is a solution. Will this work?
>
>Any advice would be deeply appreciated.
>
>best
>jake
>
>   [[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] Opencpu and caching

2017-04-28 Thread Jake Stone
I am new to opencpu. My specialty is java. I use R for very specific
analyses.

*PROBLEM*
My understanding is that each API call to opencpu opens a new R session.
My function will classify the data input using the predict method of a
linear discriminant analysis (lda from MASS package).
The initial linear discriminant analysis on 10+ cases and 150+ factor
levels takes time (over 30 seconds). This function returns a list.
The subsequent prediction function is quick and returns a simple vector.


*APPROACH*
I run one opencpu function to run the initial lda. This only needs to run
once.
I want my second function to ONLY run the predict function. This is
possible if the lda is held as a global variable.
My understanding is that global variables are not possible in opencpu. So I
will have to cache the lda on the file system.
In sum, I need to run the lda just once and hold the analysis (a list)
either in memory or on the file system. I then retrieve the lda analysis
when predict is called.

*QUESTION*
Which approach is best, and how to implement?
1. I could use an opencpu function that creates and returns the lda. Then
when I call a prediction, I could retrieve the lda object (a list) from the
file system. But how do I retrieve the list from the file system. How
does opencpu even know where it is?
2. I could use r.cache package. I haven't used this package before but the
docs suggest it is a solution. Will this work?

Any advice would be deeply appreciated.

best
jake

[[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] Data.table vs dplr handling multiple variables

2017-04-28 Thread Jeff Newmiller
All approaches have strong points and weak points. Your question has no clear 
answer.

I happen to like dplyr for many things (including lots of timestamp values), 
but base R is always there to solve problems if the analysis framework-du-jour 
has troubles. So learn base R ways of doing things if nothing else. 

For next time: please read the Posting Guide. Give us a minimal example in R of 
what you are trying to accomplish along with your description and what you 
think the right answer will look like (consider using the reprex R package), 
and turn off HTML in your email program at least for your mails sent to this 
list because HTML gets damaged to varying degrees by the mailing list and then 
we are left puzzled about what you were asking. 
-- 
Sent from my phone. Please excuse my brevity.

On April 28, 2017 8:13:18 AM PDT, Ek Esawi  wrote:
>Hi All—
>
>I am often working with large datasets with multiple variables
>(integer,
>decimal, string, complex, date, and time) that require processing,
>cleaning, etc. I am relatively new to R and I would like to get some
>input
>on the following issue: I am trying to figure out which R-package(s) is
>most suitable for my work. I looked into data.table and dplyr. Both are
>very good but I found out that data.table does not handle time data
>well
>(one has to use fast time package) and not sure whether dplyr does the
>same
>or not. I am not sure about their handling of other variables listed
>above.
>I like data.table.
>
>
>The questions: (1) which package should I invest on learning and how to
>deal with issue like time data and possibly other variables such
>complex
>numbers, date, etc.? (2) What is the “best” practical solution for such
>issue?
>
>
>
>Thanks in advance,
>
>
>EKE
>
>   [[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-es] Hacer una gráfico de dispersión y línea de tendencia.

2017-04-28 Thread Carlos J. Gil Bellosta
Mira los ejemplos de ?abline.

El 29 de abril de 2017, 1:03, alejandro hernández morales <
hdezmor...@gmail.com> escribió:

> Buenas. Espero me pueda ayudar. Tengo dos variables cuantitativas, quiero
> aplicar un gráfico de dispersión y aplicarle una línea de tendencia, Pero
> no veo la manera de hacerlo. Agradecería su ayuda. Muchas gracias.
>
> --
> *Alejandro Hernández Morales*
> *Departamento de Biología Marina*
> Centro Interdisciplinario de Ciencias Marinas (CICIMAR)
> Instituto Politécnico Nacional (IPN)
> La Paz, B. C. S.
>
> [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[R-es] Hacer una gráfico de dispersión y línea de tendencia.

2017-04-28 Thread alejandro hernández morales
Buenas. Espero me pueda ayudar. Tengo dos variables cuantitativas, quiero
aplicar un gráfico de dispersión y aplicarle una línea de tendencia, Pero
no veo la manera de hacerlo. Agradecería su ayuda. Muchas gracias.

-- 
*Alejandro Hernández Morales*
*Departamento de Biología Marina*
Centro Interdisciplinario de Ciencias Marinas (CICIMAR)
Instituto Politécnico Nacional (IPN)
La Paz, B. C. S.

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] Larger rgl-images?

2017-04-28 Thread Duncan Murdoch

On 28/04/2017 5:18 AM, Atte Tenkanen wrote:

Hi,

In package ‘VecStatGraphs3D’ is a DrawDensity3D-function in which the
rgl-device size is defined as
r3dDefaults$windowRect=c(0,0, WSizeWidth, WSizeHeight).

To save, for instance, a png-snapshot, we can use rgl.snapshot()-function.

The size of the file is dependent on the window and thus your screen and
video card.

Can we somehow produce  larger images virtually, for example, 4k-images
(3840x2160)?



I don't know of a way to do that.  If you can create a virtual screen of 
that size, and your system allows you to create a window on it, then it 
might work:  but I haven't come across a way to do that that also 
supports OpenGL in the virtual window.


Duncan Murdoch

__
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] survival package can't find Ccoxfit6

2017-04-28 Thread Duncan Murdoch

On 28/04/2017 5:37 PM, Henric Winell wrote:

On 2017-04-26 22:17, Duncan Murdoch wrote:


On 26/04/2017 2:51 PM, Therneau, Terry M., Ph.D. wrote:

A user contacted me directly about this, I answered with my best
understanding of the
recent R-help discussion of the issue, and their response to my
response shows that I'm
not quite right.

I am emphatically not an MS Windows user so am asking for help --
which I will cut/paste
to this user and to the next dozen who will invariably contact me
directly.

Thanks,
   Terry Therneau



 Forwarded Message 
Subject: RE: survival package
Date: Wed, 26 Apr 2017 18:05:30 +
From: sesh...@mskcc.org
To: Therneau, Terry M., Ph.D. 

Thank you for the quick response. The session info command for v3.4.0
does in fact report
survival_2.41-3. Furthermore, while both v3.3.1 and v3.40 are on the
same computer the
library paths do not have any directory in common:


.libPaths()

[1] "C:/Program Files/R/R-3.4.0/library"




and

.libPaths()

[1] "C:/Program Files/R/R-3.3.1/library"





Thanks,
Venkat


-Original Message-
From: Therneau, Terry M., Ph.D. [mailto:thern...@mayo.edu] Sent:
Wednesday, April 26, 2017
1:42 PM
To: Seshan, Venkatraman E./Epidemiology-Biostatistics
Subject: Re: survival package

This has been discussed in R-help by multiple people.  You have a
pre-3.4 version of the
survival package somewhere on your search path, and the method for
resolving .C calls has
changed.   The sessionInfo command should report survival version 2.41-3.

Terry T.


On 04/26/2017 12:17 PM, sesh...@mskcc.org wrote:

Dear Prof. Therneau,

I am encountering an error message when I try to use the coxfit6
routine from the survival package under the 3.4.0 version of R. The
minimal function and the script are in the attached file. This
function worked under earlier versions of R.

--
-

***
**  Works under R-3.3.1  **
***


source("coxfit6-issue.R")

[1] -0.4838181


sessionInfo()

R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64
(build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United
States.1252 [3] LC_MONETARY=English_United States.1252 [4]
LC_NUMERIC=C [5] LC_TIME=English_United States.1252

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

other attached packages:
[1] survival_2.39-4

loaded via a namespace (and not attached):
[1] Matrix_1.2-6splines_3.3.1   grid_3.3.1  lattice_0.20-33

--
-

***
**  Does not work under R-3.4.0  **
***


library(survival)
source("coxfit6-issue.R")

Error in .Call("Ccoxfit6", as.integer(control$iter.max), stime,
as.integer(sstat),  :
   "Ccoxfit6" not available for .Call() for package "survival"


As far as I can see, that line doesn't appear in the current survival
source code, it's from some earlier version of the package.  The current
one has

coxfit <- .Call(Ccoxfit6,
  as.integer(maxiter),
  stime,
  sstat,
  x[sorted,],
  as.double(offset[sorted]),
  weights,
  newstrat,
  as.integer(method=="efron"),
  as.double(control$eps),
  as.double(control$toler.chol),
  as.vector(init),
  as.integer(1))  # internally rescale

There are several differences, the one leading to the error being the
change from "Ccoxfit6" in quotes, to Ccoxfit6 not in quotes.  That
corresponds to the difference between a registered symbol and an
unregistered one.


I think it's worthwhile to point out that non-exported symbols are
available using ':::'.  See WRE Section 5.4.

So, after fixing the argument list, just use '.Call(survival:::Ccoxfit6,
)' instead of '.Call("Ccoxfit6", , PACKAGE = "survival")'.



Yes, and in another section it says "Using foo:::f instead of foo::f 
allows access to unexported objects. This is generally not recommended, 
as the semantics of unexported objects may be changed by the package 
author in routine maintenance."


Duncan Murdoch



Henric Winell





Without seeing the code that led to the error message I can't really say
how the error came about.  There are a few ways:

- The user has a copy of the coxph.fit function from an older version of
survival saved in their workspace, and are using that one instead of the
current one.

- Some part of your code returns functions, and one of those is making
this call based on an object produced in an earlier version of survival.

- There are really two versions of survival on the 

Re: [R] Error with installed.packages with R 3.4.0 on Windows

2017-04-28 Thread Duncan Murdoch

On 28/04/2017 5:58 PM, Uwe Ligges wrote:



On 28.04.2017 19:10, Dimitri Liakhovitski wrote:

When I click on "r patched snapshot build" here
, it take me here
 , it
says: Download R-3.3.3 Patched build for Windows

However, I am unclear how can one get to the patched 3.4.0 version?


If you are on Windows, you did the roight things, but the page has to be
updated.CCing Duncan who maintains these pages.


Thanks, I missed that update.  It is now building 3.4.0-patched, so that 
version should be available on the mirrors in a few hours.


Duncan Murdoch



Best,
Uwe




Thank you!

On Fri, Apr 28, 2017 at 7:58 AM, Uwe Ligges
> wrote:



On 28.04.2017 10:45, Thierry Onkelinx wrote:

Dear Peter,

It actually breaks install.packages(). So it is not that innocent.


And hence, as Peter exoplained, it is already fixed inn R-patched,
thanks to Tomas Kalibera.

Best,
Uwe Ligges






Best regards,

Thierry


Op 28 apr. 2017 10:36 a.m. schreef "peter dalgaard"
>:

Yes, we noticed this in the last days of the code freeze before
release and
shied away from inserting a workaround, partly because we
couldn't see what
the root of the problem might be.

For the purposes of installed.packages it is relatively harmless
to treat
the NA condition as FALSE, since it is just a matter of whether
a cache is
valid. I.e., it might cause an unnecessary cache rebuild. For other
situations it might be more of an issue.

The workaround (NA -> FALSE, basically) is in place in R-patched and
R-devel.

-pd

On 28 Apr 2017, at 07:47 , Thierry Onkelinx
>

wrote:


We have several computers with the same problem.

Op 28 apr. 2017 7:25 a.m. schreef "Jean-Claude Arbaut"

:

Hello,

I am currently getting a strange error when I call
installed.packages():

Error in if (file.exists(dest) && file.mtime(dest) >
file.mtime(lib) &&  :
 missing value where TRUE/FALSE needed
Calls: installed.packages


I am working with R 3.4.0 on Windows. I didn't get this
error with R

3.3.3.

Apparently, file.mtime() is returning NA well applied to a
directory, and
this causes the entire && expression to be NA, then the "if"
fails because
it needs either T or F.
The source of "installed.packages" seems to be roughly the
same as in R
3.3.3, so I wonder if there have been other changes in R,
maybe the

logical

operators, that would make this function fail.

Any idea?

Best regards,

Jean-Claude Arbaut

   [[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.

  [[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.


--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501 
Office: A 4.23
Email: pd@cbs.dk   Priv:
pda...@gmail.com 

[[alternative HTML version deleted]]

__
R-help@r-project.org  mailing list
-- To UNSUBSCRIBE and more, see

Re: [R-es] ggplot dentro de una función

2017-04-28 Thread Carlos Ortega
Hola,

Otra alternativa que puedes utilizar es esta:

#--

  grafico <- function(dt, varx) {
dt <- as.data.frame(dt)
p <- ggplot(dt, aes( x= Date, y= dt[,varx] )  )
  p + geom_point()
## un montón de código de configuración del gráfico, etc
  }

grafico(datos, 2 )
#--

Y mira los problemas que presenta ggplot al incluirlo dentro de otra
función...:

http://stackoverflow.com/questions/5106782/use-of-ggplot-within-another-function-in-r

Saludos,
Carlos Ortega
www.qualityexcellence.es


El 28 de abril de 2017, 23:51, Carlos J. Gil Bellosta 
escribió:

> Usa aes_string en lugar de aes. Mira la documentación.
>
> 2017-04-28 23:39 GMT+02:00 Rubén Coca :
>
> > Hola a todos,
> > Partiendo de:
> >
> > library(ggplot2); library(data.table)
> >
> > datos <- data.table(Date = seq.Date(as.Date("2017-01-01"),
> >  as.Date("2017-01-10"),
> >  by = "day"),
> >  V1 = rnorm(10),
> >  V2 = rnorm(10))
> >
> > Quiero crear una función para pintar un gráfico cuyos argumentos sean el
> > data table y la variable a pintar en el eje de las x. Se me ocurre ésta:
> >
> > grafico <- function(dt, varx) {
> >   ggplot(dt, aes(x = Date, y = varx)) +
> > geom_point()
> >   ## un montón de código de configuración del gráfico, etc
> > }
> >
> > grafico(datos, V1)
> >
> > Pero ggplot dice que no encuentra V1...
> > Error in eval(expr, envir, enclos) : object 'V1' not found
> > In addition: Warning message:
> > In eval(expr, envir, enclos) : restarting interrupted promise evaluation
> >
> > Alguna sugerencia o nuevo enfoque?
> > Muchas gracias
> >
> > Rubén
> >
> > [[alternative HTML version deleted]]
> >
> > ___
> > R-help-es mailing list
> > R-help-es@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-help-es
> >
>
> [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>



-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] Error with installed.packages with R 3.4.0 on Windows

2017-04-28 Thread Uwe Ligges



On 28.04.2017 19:10, Dimitri Liakhovitski wrote:

When I click on "r patched snapshot build" here
, it take me here
 , it
says: Download R-3.3.3 Patched build for Windows

However, I am unclear how can one get to the patched 3.4.0 version?


If you are on Windows, you did the roight things, but the page has to be 
updated.CCing Duncan who maintains these pages.


Best,
Uwe




Thank you!

On Fri, Apr 28, 2017 at 7:58 AM, Uwe Ligges
> wrote:



On 28.04.2017 10:45, Thierry Onkelinx wrote:

Dear Peter,

It actually breaks install.packages(). So it is not that innocent.


And hence, as Peter exoplained, it is already fixed inn R-patched,
thanks to Tomas Kalibera.

Best,
Uwe Ligges






Best regards,

Thierry


Op 28 apr. 2017 10:36 a.m. schreef "peter dalgaard"
>:

Yes, we noticed this in the last days of the code freeze before
release and
shied away from inserting a workaround, partly because we
couldn't see what
the root of the problem might be.

For the purposes of installed.packages it is relatively harmless
to treat
the NA condition as FALSE, since it is just a matter of whether
a cache is
valid. I.e., it might cause an unnecessary cache rebuild. For other
situations it might be more of an issue.

The workaround (NA -> FALSE, basically) is in place in R-patched and
R-devel.

-pd

On 28 Apr 2017, at 07:47 , Thierry Onkelinx
>

wrote:


We have several computers with the same problem.

Op 28 apr. 2017 7:25 a.m. schreef "Jean-Claude Arbaut"

:

Hello,

I am currently getting a strange error when I call
installed.packages():

Error in if (file.exists(dest) && file.mtime(dest) >
file.mtime(lib) &&  :
 missing value where TRUE/FALSE needed
Calls: installed.packages


I am working with R 3.4.0 on Windows. I didn't get this
error with R

3.3.3.

Apparently, file.mtime() is returning NA well applied to a
directory, and
this causes the entire && expression to be NA, then the "if"
fails because
it needs either T or F.
The source of "installed.packages" seems to be roughly the
same as in R
3.3.3, so I wonder if there have been other changes in R,
maybe the

logical

operators, that would make this function fail.

Any idea?

Best regards,

Jean-Claude Arbaut

   [[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.

  [[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.


--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501 
Office: A 4.23
Email: pd@cbs.dk   Priv:
pda...@gmail.com 

[[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

Re: [R-es] ggplot dentro de una función

2017-04-28 Thread Carlos J. Gil Bellosta
Usa aes_string en lugar de aes. Mira la documentación.

2017-04-28 23:39 GMT+02:00 Rubén Coca :

> Hola a todos,
> Partiendo de:
>
> library(ggplot2); library(data.table)
>
> datos <- data.table(Date = seq.Date(as.Date("2017-01-01"),
>  as.Date("2017-01-10"),
>  by = "day"),
>  V1 = rnorm(10),
>  V2 = rnorm(10))
>
> Quiero crear una función para pintar un gráfico cuyos argumentos sean el
> data table y la variable a pintar en el eje de las x. Se me ocurre ésta:
>
> grafico <- function(dt, varx) {
>   ggplot(dt, aes(x = Date, y = varx)) +
> geom_point()
>   ## un montón de código de configuración del gráfico, etc
> }
>
> grafico(datos, V1)
>
> Pero ggplot dice que no encuentra V1...
> Error in eval(expr, envir, enclos) : object 'V1' not found
> In addition: Warning message:
> In eval(expr, envir, enclos) : restarting interrupted promise evaluation
>
> Alguna sugerencia o nuevo enfoque?
> Muchas gracias
>
> Rubén
>
> [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] Error with installed.packages with R 3.4.0 on Windows

2017-04-28 Thread peter dalgaard

> On 28 Apr 2017, at 12:08 , Duncan Murdoch  wrote:
> 
> On 28/04/2017 4:45 AM, Thierry Onkelinx wrote:
>> Dear Peter,
>> 
>> It actually breaks install.packages(). So it is not that innocent.
> 
> I don't think he meant that it is harmless, he meant that the fix is easy, 
> and is in place in R-patched and R-devel.  You should use R-patched and you 
> won't have the problem.

Read more carefully: I said that the _fix_ is harmless for this case, but might 
not be so in general.

-pd

> 
> More generally, there's a lot more variety of systems in the wild than on our 
> test machines, so we really do rely on people testing things in the 
> alpha/beta/rc phase.  In this case we saw the error too late to fix it (as I 
> recall, it was very late in rc).  If more people had tested, we might have 
> found it earlier.
> 
> Duncan Murdoch
> 
>> 
>> Best regards,
>> 
>> Thierry
>> 
>> 
>> Op 28 apr. 2017 10:36 a.m. schreef "peter dalgaard" :
>> 
>> Yes, we noticed this in the last days of the code freeze before release and
>> shied away from inserting a workaround, partly because we couldn't see what
>> the root of the problem might be.
>> 
>> For the purposes of installed.packages it is relatively harmless to treat
>> the NA condition as FALSE, since it is just a matter of whether a cache is
>> valid. I.e., it might cause an unnecessary cache rebuild. For other
>> situations it might be more of an issue.
>> 
>> The workaround (NA -> FALSE, basically) is in place in R-patched and
>> R-devel.
>> 
>> -pd
>> 
>>> On 28 Apr 2017, at 07:47 , Thierry Onkelinx 
>> wrote:
>>> 
>>> We have several computers with the same problem.
>>> 
>>> Op 28 apr. 2017 7:25 a.m. schreef "Jean-Claude Arbaut" >> :
>>> 
>>> Hello,
>>> 
>>> I am currently getting a strange error when I call installed.packages():
>>> 
>>> Error in if (file.exists(dest) && file.mtime(dest) > file.mtime(lib) &&  :
>>> missing value where TRUE/FALSE needed
>>> Calls: installed.packages
>>> 
>>> 
>>> I am working with R 3.4.0 on Windows. I didn't get this error with R
>> 3.3.3.
>>> Apparently, file.mtime() is returning NA well applied to a directory, and
>>> this causes the entire && expression to be NA, then the "if" fails because
>>> it needs either T or F.
>>> The source of "installed.packages" seems to be roughly the same as in R
>>> 3.3.3, so I wonder if there have been other changes in R, maybe the
>> logical
>>> operators, that would make this function fail.
>>> 
>>> Any idea?
>>> 
>>> Best regards,
>>> 
>>> Jean-Claude Arbaut
>>> 
>>>   [[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.
>>> 
>>>  [[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.
>> 
>> --
>> Peter Dalgaard, Professor,
>> Center for Statistics, Copenhagen Business School
>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>> Phone: (+45)38153501
>> Office: A 4.23
>> Email: pd@cbs.dk  Priv: pda...@gmail.com
>> 
>>  [[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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
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] Data.table vs dplr handling multiple variables

2017-04-28 Thread Ek Esawi
Hi All—

I am often working with large datasets with multiple variables (integer,
decimal, string, complex, date, and time) that require processing,
cleaning, etc. I am relatively new to R and I would like to get some input
on the following issue: I am trying to figure out which R-package(s) is
most suitable for my work. I looked into data.table and dplyr. Both are
very good but I found out that data.table does not handle time data well
(one has to use fast time package) and not sure whether dplyr does the same
or not. I am not sure about their handling of other variables listed above.
I like data.table.


The questions: (1) which package should I invest on learning and how to
deal with issue like time data and possibly other variables such complex
numbers, date, etc.? (2) What is the “best” practical solution for such
issue?



Thanks in advance,


EKE

[[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] Error with installed.packages with R 3.4.0 on Windows

2017-04-28 Thread Duncan Murdoch

On 28/04/2017 4:45 AM, Thierry Onkelinx wrote:

Dear Peter,

It actually breaks install.packages(). So it is not that innocent.


I don't think he meant that it is harmless, he meant that the fix is 
easy, and is in place in R-patched and R-devel.  You should use 
R-patched and you won't have the problem.


More generally, there's a lot more variety of systems in the wild than 
on our test machines, so we really do rely on people testing things in 
the alpha/beta/rc phase.  In this case we saw the error too late to fix 
it (as I recall, it was very late in rc).  If more people had tested, we 
might have found it earlier.


Duncan Murdoch



Best regards,

Thierry


Op 28 apr. 2017 10:36 a.m. schreef "peter dalgaard" :

Yes, we noticed this in the last days of the code freeze before release and
shied away from inserting a workaround, partly because we couldn't see what
the root of the problem might be.

For the purposes of installed.packages it is relatively harmless to treat
the NA condition as FALSE, since it is just a matter of whether a cache is
valid. I.e., it might cause an unnecessary cache rebuild. For other
situations it might be more of an issue.

The workaround (NA -> FALSE, basically) is in place in R-patched and
R-devel.

-pd


On 28 Apr 2017, at 07:47 , Thierry Onkelinx 

wrote:


We have several computers with the same problem.

Op 28 apr. 2017 7:25 a.m. schreef "Jean-Claude Arbaut"  file.mtime(lib) &&  :
 missing value where TRUE/FALSE needed
Calls: installed.packages


I am working with R 3.4.0 on Windows. I didn't get this error with R

3.3.3.

Apparently, file.mtime() is returning NA well applied to a directory, and
this causes the entire && expression to be NA, then the "if" fails because
it needs either T or F.
The source of "installed.packages" seems to be roughly the same as in R
3.3.3, so I wonder if there have been other changes in R, maybe the

logical

operators, that would make this function fail.

Any idea?

Best regards,

Jean-Claude Arbaut

   [[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.

  [[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.


--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

[[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] Larger rgl-images?

2017-04-28 Thread Atte Tenkanen

Hi,

In package ‘VecStatGraphs3D’ is a DrawDensity3D-function in which the 
rgl-device size is defined as

r3dDefaults$windowRect=c(0,0, WSizeWidth, WSizeHeight).

To save, for instance, a png-snapshot, we can use rgl.snapshot()-function.

The size of the file is dependent on the window and thus your screen and 
video card.


Can we somehow produce  larger images virtually, for example, 4k-images 
(3840x2160)?


Atte Tenkanen

__
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-es] ggplot dentro de una función

2017-04-28 Thread Rubén Coca
Hola a todos,
Partiendo de:

library(ggplot2); library(data.table)

datos <- data.table(Date = seq.Date(as.Date("2017-01-01"),
 as.Date("2017-01-10"),
 by = "day"),
 V1 = rnorm(10),
 V2 = rnorm(10))

Quiero crear una función para pintar un gráfico cuyos argumentos sean el
data table y la variable a pintar en el eje de las x. Se me ocurre ésta:

grafico <- function(dt, varx) {
  ggplot(dt, aes(x = Date, y = varx)) +
geom_point()
  ## un montón de código de configuración del gráfico, etc
}

grafico(datos, V1)

Pero ggplot dice que no encuentra V1...
Error in eval(expr, envir, enclos) : object 'V1' not found
In addition: Warning message:
In eval(expr, envir, enclos) : restarting interrupted promise evaluation

Alguna sugerencia o nuevo enfoque?
Muchas gracias

Rubén

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] survival package can't find Ccoxfit6

2017-04-28 Thread Henric Winell

On 2017-04-26 22:17, Duncan Murdoch wrote:


On 26/04/2017 2:51 PM, Therneau, Terry M., Ph.D. wrote:
A user contacted me directly about this, I answered with my best 
understanding of the
recent R-help discussion of the issue, and their response to my 
response shows that I'm

not quite right.

I am emphatically not an MS Windows user so am asking for help -- 
which I will cut/paste
to this user and to the next dozen who will invariably contact me 
directly.


Thanks,
   Terry Therneau



 Forwarded Message 
Subject: RE: survival package
Date: Wed, 26 Apr 2017 18:05:30 +
From: sesh...@mskcc.org
To: Therneau, Terry M., Ph.D. 

Thank you for the quick response. The session info command for v3.4.0 
does in fact report
survival_2.41-3. Furthermore, while both v3.3.1 and v3.40 are on the 
same computer the

library paths do not have any directory in common:


.libPaths()

[1] "C:/Program Files/R/R-3.4.0/library"




and

.libPaths()

[1] "C:/Program Files/R/R-3.3.1/library"





Thanks,
Venkat


-Original Message-
From: Therneau, Terry M., Ph.D. [mailto:thern...@mayo.edu] Sent: 
Wednesday, April 26, 2017

1:42 PM
To: Seshan, Venkatraman E./Epidemiology-Biostatistics
Subject: Re: survival package

This has been discussed in R-help by multiple people.  You have a 
pre-3.4 version of the
survival package somewhere on your search path, and the method for 
resolving .C calls has

changed.   The sessionInfo command should report survival version 2.41-3.

Terry T.


On 04/26/2017 12:17 PM, sesh...@mskcc.org wrote:

Dear Prof. Therneau,

I am encountering an error message when I try to use the coxfit6 
routine from the survival package under the 3.4.0 version of R. The 
minimal function and the script are in the attached file. This 
function worked under earlier versions of R.


--
-

***
**  Works under R-3.3.1  **
***


source("coxfit6-issue.R")

[1] -0.4838181


sessionInfo()

R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64
(build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United
States.1252 [3] LC_MONETARY=English_United States.1252 [4]
LC_NUMERIC=C [5] LC_TIME=English_United States.1252

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

other attached packages:
[1] survival_2.39-4

loaded via a namespace (and not attached):
[1] Matrix_1.2-6splines_3.3.1   grid_3.3.1  lattice_0.20-33

--
-

***
**  Does not work under R-3.4.0  **
***


library(survival)
source("coxfit6-issue.R")
Error in .Call("Ccoxfit6", as.integer(control$iter.max), stime, 
as.integer(sstat),  :

   "Ccoxfit6" not available for .Call() for package "survival"


As far as I can see, that line doesn't appear in the current survival 
source code, it's from some earlier version of the package.  The current 
one has


coxfit <- .Call(Ccoxfit6,
  as.integer(maxiter),
  stime,
  sstat,
  x[sorted,],
  as.double(offset[sorted]),
  weights,
  newstrat,
  as.integer(method=="efron"),
  as.double(control$eps),
  as.double(control$toler.chol),
  as.vector(init),
  as.integer(1))  # internally rescale

There are several differences, the one leading to the error being the 
change from "Ccoxfit6" in quotes, to Ccoxfit6 not in quotes.  That 
corresponds to the difference between a registered symbol and an 
unregistered one.


I think it's worthwhile to point out that non-exported symbols are 
available using ':::'.  See WRE Section 5.4.


So, after fixing the argument list, just use '.Call(survival:::Ccoxfit6, 
)' instead of '.Call("Ccoxfit6", , PACKAGE = "survival")'.



Henric Winell





Without seeing the code that led to the error message I can't really say 
how the error came about.  There are a few ways:


- The user has a copy of the coxph.fit function from an older version of 
survival saved in their workspace, and are using that one instead of the 
current one.


- Some part of your code returns functions, and one of those is making 
this call based on an object produced in an earlier version of survival.


- There are really two versions of survival on the search path (or 
perhaps copied bits of one), and this call isn't in survival 2.41-3 at all.


Duncan Murdoch


sessionInfo()

R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64
(build 7601) Service Pack 1

Matrix products: 

Re: [R] Reading XML attriutes in R

2017-04-28 Thread Archit Soni
Thanks Ben,  I'll give it a shot.. Thanks again :)

On Apr 28, 2017 18:54, "Ben Tupper"  wrote:

> Hi again,
>
> It would be super easy if xml2::xml_attrs() accepted a list of attribute
> names and defaults values like xml2::xml_attr() does, but it doesn't.  Once
> you have a list of character vectors like that returned by your ...
>
> ppt <- x %>% xml_find_all("precipitation") %>% xml_attrs()
>
> ..then you need only try to extract the fields you want.  Perhaps
> something like the following untested steps...
>
> precip <-  tibble::as_tibble(do.call(rbind, lapply(ppt, '[', c('unit',
> 'value', 'type')) ))
>
> colnames(precip) <- c('unit', 'value', 'type')
>
> Bon chance!
> Ben
>
> P.S.  Don't forget to change your email client to send plain text messages
> to this list.  Typically rich text and html emails get turned into hash by
> the R-help list services.
>
> > On Apr 28, 2017, at 4:25 AM, Archit Soni 
> wrote:
> >
> > Thanks Ben, got it working, just want one more help on this,
> >
> > If i have a node like:  and in some other city
> it came like:  
> >
> > How can i make my code to handle this dynamically? I am sorry to ask
> such novice questions but it would be extremely helpful if you could help
> me with this.
> >
> > So, i would want my resulting data set from this code:- ppt <- (x %>%
> xml_find_all("precipitation") %>% xml_attrs())
> >  if mode is no, then the three columns should come and values should be
> NA and if values are populated then as is.
> >
> > Unit Value  Type
> > NANA NA
> > 3h0.0925 rain
> >
> > Thanks again and in advance !
> >
> > Archit
> >
> > On Thu, Apr 27, 2017 at 6:27 PM, Ben Tupper  wrote:
> > Hi,
> >
> > There might be an easy solution out there already, but I suspect that
> you will need to parse the XML yourself.  The example below uses package
> xml2 not XML but you could do this with either.  The example simply shows
> how to get values out of the XML hierarchy.  Once you have the attributes
> you want in hand you can assemble the elements into a data frame (or a
> tibble from package tibble.)
> >
> > By the way, I had to prepend your example with ''
> >
> > Cheers,
> > Ben
> >
> > ### START
> >
> > library(tidyverse)
> > library(xml2)
> >
> > txt <- " lon=\"-0.13\" lat=\"51.51\"/>GB rise=\"2017-01-30T07:40:36\" set=\"2017-01-30T16:47:56\"/> value=\"280.15\" min=\"278.15\" max=\"281.15\" unit=\"kelvin\"/> value=\"81\" unit=\"%\"/> unit=\"hPa\"/> Breeze\"/> name=\"East\"/> clouds\"/> mode=\"no\"/> icon=\"50d\"/>"
> >
> > x <- read_xml(txt)
> >
> > windspeed <- x %>%
> > xml_find_first("wind/speed") %>%
> > xml_attrs()
> >
> > winddir <- x %>%
> > xml_find_first("wind/direction") %>%
> > xml_attrs()
> >
> > windspeed
> > #  valuename
> > #  "4.6" "Gentle Breeze"
> >
> > winddir
> > #  value   code   name
> > #  "90""E" "East"
> >
> > ### END
> >
> >
> >
> > > On Apr 27, 2017, at 6:08 AM, Archit Soni 
> wrote:
> > >
> > > Hi All,
> > >
> > > I have a XML file like :
> > >
> > > 
> > > 
> > > GB
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > >
> > > I want to create a data frame out of this XML but
> > > obviously xmlToDataFrame() is not working.
> > >
> > > It has dynamic attributes like for node precipitation , it could have
> > > attributes like value and mode both if there is ppt in some city.
> > >
> > > My basic issue now id to read XML attributes of different nodes and
> convert
> > > it into a data frame, I have scraped many forums but could not find any
> > > help in this.
> > >
> > > For starters, please suggest a solution to parse the value of city
> node and
> > > corresponding id, name, lat, long etc.
> > >
> > > I know I am asking a lot, thanks for reading and cheers! :)
> > >
> > > --
> > > Regards
> > > Archit
> > >
> > >   [[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.
> >
> > Ben Tupper
> > Bigelow Laboratory for Ocean Sciences
> > 60 Bigelow Drive, P.O. Box 380
> > East Boothbay, Maine 04544
> > http://www.bigelow.org
> >
> >
> >
> >
> >
> >
> > --
> > Regards
> > Archit
>
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org
>
>
>
>

[[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 

[R] Overriding lack of i386 build for ROracle when updating packages

2017-04-28 Thread Laviolette, Michael
Since I query my Oracle warehouse often, I load the ROracle package on startup. 
Whenever I update packages from RStudio (which actually runs the 
install.packages function) with ROracle loaded, I get the following error:

Error: package 'ROracle' is not installed for 'arch = i386'

Unloading the package doesn't help; I have to edit my startup script to not 
load ROracle, then restart R, update packages, and restore my original startup 
script. I don' t have any use for 32-bit ROracle and am not sure that it exists 
(the package archive doesn't contain a "libs/i386" folder. Does anyone know of 
a way to override the lack of an i386 build when installing other packages?

Thanks,
M.L.




[[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] Different output for "if else" and "ifelse" that I don't understand

2017-04-28 Thread William Dunlap via R-help
Thank you - I did mean tryCatch.

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Fri, Apr 28, 2017 at 10:01 AM, Bert Gunter 
wrote:

> Typo: last line should be
>
> Even better, use
>   p3p <- tryCatch(list(...), error=function(e) list())
>
>
> 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 Fri, Apr 28, 2017 at 8:34 AM, William Dunlap via R-help
>  wrote:
> > ifelse's vectorization messes this up.
> >
> > You could replace your original
> >   if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list() else
> > p3p <- list(...)
> > with
> >   p3p <- if (class(try(list(...), silent=TRUE))=="try-error") list() else
> > list(...)
> > instead of using ifelse, since the return value of 'if ... else ...' is
> the
> > value of whichever branch was taken.
> >
> > Even better, use
> >   p3p <- try(list(...), error=function(e) list())
> >
> >
> > Bill Dunlap
> > TIBCO Software
> > wdunlap tibco.com
> >
> > On Fri, Apr 28, 2017 at 2:21 AM, Marc Girondot via R-help <
> > r-help@r-project.org> wrote:
> >
> >> Dear list-members,
> >>
> >> During the test phase of a function, I run it interactively (in Rstudio)
> >> and the ... produces an error. Then I use this to read it:
> >>
> >> if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list() else
> >> p3p <- list(...)
> >>
> >> It works fine; interactively I will get
> >>
> >> > if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list()
> else
> >> p3p <- list(...)
> >> > p3p
> >> list()
> >>
> >> and within a function I will get a list with the ... value. Perfect.
> >>
> >> I wanted to simplify the line by doing:
> >>
> >> p3p <- ifelse(class(try(list(...), silent=TRUE))=="try-error", list(),
> >> list(...))
> >>
> >> In interactive mode, it works but within a function, I don't get the
> names
> >> of the parameters. I don't understand the logic behind this difference.
> >> Have you an idea ?
> >>
> >> Thanks
> >>
> >> Marc
> >>
> >>
> >> > Try1 <- function(...) {
> >> +   if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list()
> >> else p3p <- list(...)
> >> +   return(p3p)
> >> + }
> >> > Try1(k=100)
> >> $k
> >> [1] 100
> >>
> >> > Try1()
> >> list()
> >> > Try2 <- function(...) {
> >> +   p3p <- ifelse(class(try(list(...), silent=TRUE))=="try-error",
> list(),
> >> list(...))
> >> +   return(p3p)
> >> + }
> >> > Try2(k=100)
> >> [[1]]
> >> [1] 100
> >>
> >> > Try2()
> >> [[1]]
> >> NULL
> >>
> >> __
> >> 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.
>

[[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] update.packages() error R 3.4.0

2017-04-28 Thread Jeff Newmiller
Ah, if you have been following along the thread..  use the patched version.
-- 
Sent from my phone. Please excuse my brevity.

On April 28, 2017 9:06:21 AM PDT, Robert Baer  wrote:
>Is there an easy work-around for the update.packages error I'm getting 
>on Windows 10 with R 3.4.0?
>
> > update.packages()
>--- Please select a CRAN mirror for use in this session ---
>foreign :
>  Version 0.8-67 installed in C:/Program Files/R/R-3.4.0/library
>  Version 0.8-68 available at https://mirror.las.iastate.edu/CRAN
>Update (y/N/c)?  y
>Warning in install.packages(update[instlib == l, "Package"], l, repos =
>
>repos,  :
>   'lib = "C:/Program Files/R/R-3.4.0/library"' is not writable
>Error in if (file.exists(dest) && file.mtime(dest) > file.mtime(lib) &&
> :
>   missing value where TRUE/FALSE needed

__
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] Error with installed.packages with R 3.4.0 on Windows

2017-04-28 Thread Dimitri Liakhovitski
When I click on "r patched snapshot build" here
, it take me here
 , it says: Download
R-3.3.3 Patched build for Windows

However, I am unclear how can one get to the patched 3.4.0 version?
Thank you!

On Fri, Apr 28, 2017 at 7:58 AM, Uwe Ligges  wrote:

>
>
> On 28.04.2017 10:45, Thierry Onkelinx wrote:
>
>> Dear Peter,
>>
>> It actually breaks install.packages(). So it is not that innocent.
>>
>
> And hence, as Peter exoplained, it is already fixed inn R-patched, thanks
> to Tomas Kalibera.
>
> Best,
> Uwe Ligges
>
>
>
>
>
>
> Best regards,
>>
>> Thierry
>>
>>
>> Op 28 apr. 2017 10:36 a.m. schreef "peter dalgaard" :
>>
>> Yes, we noticed this in the last days of the code freeze before release
>> and
>> shied away from inserting a workaround, partly because we couldn't see
>> what
>> the root of the problem might be.
>>
>> For the purposes of installed.packages it is relatively harmless to treat
>> the NA condition as FALSE, since it is just a matter of whether a cache is
>> valid. I.e., it might cause an unnecessary cache rebuild. For other
>> situations it might be more of an issue.
>>
>> The workaround (NA -> FALSE, basically) is in place in R-patched and
>> R-devel.
>>
>> -pd
>>
>> On 28 Apr 2017, at 07:47 , Thierry Onkelinx 
>>>
>> wrote:
>>
>>>
>>> We have several computers with the same problem.
>>>
>>> Op 28 apr. 2017 7:25 a.m. schreef "Jean-Claude Arbaut" <
>>> arbau...@gmail.com
>>> :
>>>
>>> Hello,
>>>
>>> I am currently getting a strange error when I call installed.packages():
>>>
>>> Error in if (file.exists(dest) && file.mtime(dest) > file.mtime(lib) &&
>>> :
>>>  missing value where TRUE/FALSE needed
>>> Calls: installed.packages
>>>
>>>
>>> I am working with R 3.4.0 on Windows. I didn't get this error with R
>>>
>> 3.3.3.
>>
>>> Apparently, file.mtime() is returning NA well applied to a directory, and
>>> this causes the entire && expression to be NA, then the "if" fails
>>> because
>>> it needs either T or F.
>>> The source of "installed.packages" seems to be roughly the same as in R
>>> 3.3.3, so I wonder if there have been other changes in R, maybe the
>>>
>> logical
>>
>>> operators, that would make this function fail.
>>>
>>> Any idea?
>>>
>>> Best regards,
>>>
>>> Jean-Claude Arbaut
>>>
>>>[[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.
>>>
>>>   [[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.
>>>
>>
>> --
>> Peter Dalgaard, Professor,
>> Center for Statistics, Copenhagen Business School
>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>> Phone: (+45)38153501
>> Office: A 4.23
>> Email: pd@cbs.dk  Priv: pda...@gmail.com
>>
>> [[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.
>>
>>
> __
> 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.
>



-- 
Dimitri Liakhovitski

[[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] update.packages() error R 3.4.0

2017-04-28 Thread Bert Gunter
Please see previous messages from today concerning this.

-- 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 Fri, Apr 28, 2017 at 9:58 AM, Dimitri Liakhovitski
 wrote:
> I am having the same problem - just installed R 3.4.0 on my Windows
> laptop. Same thing with packages - exactly the same error.
>
> On Fri, Apr 28, 2017 at 12:06 PM, Robert Baer  wrote:
>> Is there an easy work-around for the update.packages error I'm getting on
>> Windows 10 with R 3.4.0?
>>
>>> update.packages()
>> --- Please select a CRAN mirror for use in this session ---
>> foreign :
>>  Version 0.8-67 installed in C:/Program Files/R/R-3.4.0/library
>>  Version 0.8-68 available at https://mirror.las.iastate.edu/CRAN
>> Update (y/N/c)?  y
>> Warning in install.packages(update[instlib == l, "Package"], l, repos =
>> repos,  :
>>   'lib = "C:/Program Files/R/R-3.4.0/library"' is not writable
>> Error in if (file.exists(dest) && file.mtime(dest) > file.mtime(lib) &&  :
>>   missing value where TRUE/FALSE needed
>>
>> --
>>
>>
>> --
>> Robert W. Baer, Ph.D.
>> Professor of Physiology
>> Kirksville College of Osteopathic Medicine
>> A T Still University of Health Sciences
>> 800 W. Jefferson St
>> Kirksville, MO 63501
>> 660-626-2321 Department
>> 660-626-2965 FAX
>>
>> __
>> 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.
>
>
>
> --
> Dimitri Liakhovitski
>
> __
> 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] Different output for "if else" and "ifelse" that I don't understand

2017-04-28 Thread Bert Gunter
Typo: last line should be

Even better, use
  p3p <- tryCatch(list(...), error=function(e) list())


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 Fri, Apr 28, 2017 at 8:34 AM, William Dunlap via R-help
 wrote:
> ifelse's vectorization messes this up.
>
> You could replace your original
>   if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list() else
> p3p <- list(...)
> with
>   p3p <- if (class(try(list(...), silent=TRUE))=="try-error") list() else
> list(...)
> instead of using ifelse, since the return value of 'if ... else ...' is the
> value of whichever branch was taken.
>
> Even better, use
>   p3p <- try(list(...), error=function(e) list())
>
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
> On Fri, Apr 28, 2017 at 2:21 AM, Marc Girondot via R-help <
> r-help@r-project.org> wrote:
>
>> Dear list-members,
>>
>> During the test phase of a function, I run it interactively (in Rstudio)
>> and the ... produces an error. Then I use this to read it:
>>
>> if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list() else
>> p3p <- list(...)
>>
>> It works fine; interactively I will get
>>
>> > if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list() else
>> p3p <- list(...)
>> > p3p
>> list()
>>
>> and within a function I will get a list with the ... value. Perfect.
>>
>> I wanted to simplify the line by doing:
>>
>> p3p <- ifelse(class(try(list(...), silent=TRUE))=="try-error", list(),
>> list(...))
>>
>> In interactive mode, it works but within a function, I don't get the names
>> of the parameters. I don't understand the logic behind this difference.
>> Have you an idea ?
>>
>> Thanks
>>
>> Marc
>>
>>
>> > Try1 <- function(...) {
>> +   if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list()
>> else p3p <- list(...)
>> +   return(p3p)
>> + }
>> > Try1(k=100)
>> $k
>> [1] 100
>>
>> > Try1()
>> list()
>> > Try2 <- function(...) {
>> +   p3p <- ifelse(class(try(list(...), silent=TRUE))=="try-error", list(),
>> list(...))
>> +   return(p3p)
>> + }
>> > Try2(k=100)
>> [[1]]
>> [1] 100
>>
>> > Try2()
>> [[1]]
>> NULL
>>
>> __
>> 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.

__
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] update.packages() error R 3.4.0

2017-04-28 Thread Dimitri Liakhovitski
I am having the same problem - just installed R 3.4.0 on my Windows
laptop. Same thing with packages - exactly the same error.

On Fri, Apr 28, 2017 at 12:06 PM, Robert Baer  wrote:
> Is there an easy work-around for the update.packages error I'm getting on
> Windows 10 with R 3.4.0?
>
>> update.packages()
> --- Please select a CRAN mirror for use in this session ---
> foreign :
>  Version 0.8-67 installed in C:/Program Files/R/R-3.4.0/library
>  Version 0.8-68 available at https://mirror.las.iastate.edu/CRAN
> Update (y/N/c)?  y
> Warning in install.packages(update[instlib == l, "Package"], l, repos =
> repos,  :
>   'lib = "C:/Program Files/R/R-3.4.0/library"' is not writable
> Error in if (file.exists(dest) && file.mtime(dest) > file.mtime(lib) &&  :
>   missing value where TRUE/FALSE needed
>
> --
>
>
> --
> Robert W. Baer, Ph.D.
> Professor of Physiology
> Kirksville College of Osteopathic Medicine
> A T Still University of Health Sciences
> 800 W. Jefferson St
> Kirksville, MO 63501
> 660-626-2321 Department
> 660-626-2965 FAX
>
> __
> 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.



-- 
Dimitri Liakhovitski

__
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] update.packages() error R 3.4.0

2017-04-28 Thread Robert Baer
Is there an easy work-around for the update.packages error I'm getting 
on Windows 10 with R 3.4.0?


> update.packages()
--- Please select a CRAN mirror for use in this session ---
foreign :
 Version 0.8-67 installed in C:/Program Files/R/R-3.4.0/library
 Version 0.8-68 available at https://mirror.las.iastate.edu/CRAN
Update (y/N/c)?  y
Warning in install.packages(update[instlib == l, "Package"], l, repos = 
repos,  :

  'lib = "C:/Program Files/R/R-3.4.0/library"' is not writable
Error in if (file.exists(dest) && file.mtime(dest) > file.mtime(lib) &&  :
  missing value where TRUE/FALSE needed

--


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences
800 W. Jefferson St
Kirksville, MO 63501
660-626-2321 Department
660-626-2965 FAX

__
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] Different output for "if else" and "ifelse" that I don't understand

2017-04-28 Thread William Dunlap via R-help
ifelse's vectorization messes this up.

You could replace your original
  if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list() else
p3p <- list(...)
with
  p3p <- if (class(try(list(...), silent=TRUE))=="try-error") list() else
list(...)
instead of using ifelse, since the return value of 'if ... else ...' is the
value of whichever branch was taken.

Even better, use
  p3p <- try(list(...), error=function(e) list())


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Fri, Apr 28, 2017 at 2:21 AM, Marc Girondot via R-help <
r-help@r-project.org> wrote:

> Dear list-members,
>
> During the test phase of a function, I run it interactively (in Rstudio)
> and the ... produces an error. Then I use this to read it:
>
> if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list() else
> p3p <- list(...)
>
> It works fine; interactively I will get
>
> > if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list() else
> p3p <- list(...)
> > p3p
> list()
>
> and within a function I will get a list with the ... value. Perfect.
>
> I wanted to simplify the line by doing:
>
> p3p <- ifelse(class(try(list(...), silent=TRUE))=="try-error", list(),
> list(...))
>
> In interactive mode, it works but within a function, I don't get the names
> of the parameters. I don't understand the logic behind this difference.
> Have you an idea ?
>
> Thanks
>
> Marc
>
>
> > Try1 <- function(...) {
> +   if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list()
> else p3p <- list(...)
> +   return(p3p)
> + }
> > Try1(k=100)
> $k
> [1] 100
>
> > Try1()
> list()
> > Try2 <- function(...) {
> +   p3p <- ifelse(class(try(list(...), silent=TRUE))=="try-error", list(),
> list(...))
> +   return(p3p)
> + }
> > Try2(k=100)
> [[1]]
> [1] 100
>
> > Try2()
> [[1]]
> NULL
>
> __
> 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.


Re: [R-es] Ingresar datos dentro de R sin Excel

2017-04-28 Thread Javier Marcuzzi
Estimado Wilmer

Es posible, le indicaron algunas opciones, pero no es recomendable, si no le 
molesta use el programa que más de gusta, guarde en csv, luego los importa con 
solo una línea de código, salvo para algunas pruebas específicas yo opto por 
tener los datos separados de R, aunque si sin pocos es posible escribirlos en 
R, pero casi como excepción.

Javier Rubén Marcuzzi

De: WILMER CONTRERAS SEPULVEDA
Enviado: viernes, 28 de abril de 2017 10:35
Para: r-help-es@r-project.org
Asunto: [R-es] Ingresar datos dentro de R sin Excel

Hola, buenos días.

Quisiera saber si existe alguna función o libreria en R que simule la
ventana de Excel para ingresar datos. No estoy hablando de importar datos
de excel a R, No.
Quisiera que dentro de R existiera el entorno para ingresar los datos
rapidamente y no pasar por la molestia de ingresar los datos a Excel y
luego tener que importarlos a R.

Muchas gracias.

Wilmer Contreras Sepulveda.

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R-es] Ingresar datos dentro de R sin Excel

2017-04-28 Thread Susana Rivera via R-help-es
Deducer: A GUI for R - Deducer Manual

  
|  
|   |  
Deducer: A GUI for R - Deducer Manual
   |  |

  |

 

Saludos,
Susana

  De: "miguel.angel.rodriguez.mui...@sergas.es" 

 Para: r-help-es@r-project.org 
 Enviado: Viernes, 28 de abril, 2017 8:43:52
 Asunto: Re: [R-es] Ingresar datos dentro de R sin Excel
   
Hola Wilmer.

Has probado con el editor de datos del RCommander?

Un saludo.


El 28/04/2017 a las 15:35, WILMER CONTRERAS SEPULVEDA escribió:
> Hola, buenos días.
>
> Quisiera saber si existe alguna función o libreria en R que simule la
> ventana de Excel para ingresar datos. No estoy hablando de importar datos
> de excel a R, No.
> Quisiera que dentro de R existiera el entorno para ingresar los datos
> rapidamente y no pasar por la molestia de ingresar los datos a Excel y
> luego tener que importarlos a R.
>
> Muchas gracias.
>
> Wilmer Contreras Sepulveda.



Nota: A información contida nesta mensaxe e os seus posibles documentos 
adxuntos é privada e confidencial e está dirixida únicamente ó seu 
destinatario/a. Se vostede non é o/a destinatario/a orixinal desta mensaxe, por 
favor elimínea. A distribución ou copia desta mensaxe non está autorizada.

Nota: La información contenida en este mensaje y sus posibles documentos 
adjuntos es privada y confidencial y está dirigida únicamente a su 
destinatario/a. Si usted no es el/la destinatario/a original de este mensaje, 
por favor elimínelo. La distribución o copia de este mensaje no está autorizada.

See more languages: http://www.sergas.es/aviso-confidencialidad

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

   
[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R-es] Ingresar datos dentro de R sin Excel

2017-04-28 Thread miguel.angel.rodriguez.muinos
Hola Wilmer.

Has probado con el editor de datos del RCommander?

Un saludo.


El 28/04/2017 a las 15:35, WILMER CONTRERAS SEPULVEDA escribió:
> Hola, buenos días.
>
> Quisiera saber si existe alguna función o libreria en R que simule la
> ventana de Excel para ingresar datos. No estoy hablando de importar datos
> de excel a R, No.
> Quisiera que dentro de R existiera el entorno para ingresar los datos
> rapidamente y no pasar por la molestia de ingresar los datos a Excel y
> luego tener que importarlos a R.
>
> Muchas gracias.
>
> Wilmer Contreras Sepulveda.



Nota: A información contida nesta mensaxe e os seus posibles documentos 
adxuntos é privada e confidencial e está dirixida únicamente ó seu 
destinatario/a. Se vostede non é o/a destinatario/a orixinal desta mensaxe, por 
favor elimínea. A distribución ou copia desta mensaxe non está autorizada.

Nota: La información contenida en este mensaje y sus posibles documentos 
adjuntos es privada y confidencial y está dirigida únicamente a su 
destinatario/a. Si usted no es el/la destinatario/a original de este mensaje, 
por favor elimínelo. La distribución o copia de este mensaje no está autorizada.

See more languages: http://www.sergas.es/aviso-confidencialidad

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[R-es] Ingresar datos dentro de R sin Excel

2017-04-28 Thread WILMER CONTRERAS SEPULVEDA
Hola, buenos días.

Quisiera saber si existe alguna función o libreria en R que simule la
ventana de Excel para ingresar datos. No estoy hablando de importar datos
de excel a R, No.
Quisiera que dentro de R existiera el entorno para ingresar los datos
rapidamente y no pasar por la molestia de ingresar los datos a Excel y
luego tener que importarlos a R.

Muchas gracias.

Wilmer Contreras Sepulveda.

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] Reading XML attriutes in R

2017-04-28 Thread Ben Tupper
Hi again,

It would be super easy if xml2::xml_attrs() accepted a list of attribute names 
and defaults values like xml2::xml_attr() does, but it doesn't.  Once you have 
a list of character vectors like that returned by your ...

ppt <- x %>% xml_find_all("precipitation") %>% xml_attrs()

..then you need only try to extract the fields you want.  Perhaps something 
like the following untested steps...

precip <-  tibble::as_tibble(do.call(rbind, lapply(ppt, '[', c('unit', 'value', 
'type')) ))

colnames(precip) <- c('unit', 'value', 'type')

Bon chance!
Ben

P.S.  Don't forget to change your email client to send plain text messages to 
this list.  Typically rich text and html emails get turned into hash by the 
R-help list services.

> On Apr 28, 2017, at 4:25 AM, Archit Soni  wrote:
> 
> Thanks Ben, got it working, just want one more help on this,
> 
> If i have a node like:  and in some other city it 
> came like:  
> 
> How can i make my code to handle this dynamically? I am sorry to ask such 
> novice questions but it would be extremely helpful if you could help me with 
> this.
> 
> So, i would want my resulting data set from this code:- ppt <- (x %>% 
> xml_find_all("precipitation") %>% xml_attrs())
>  if mode is no, then the three columns should come and values should be NA 
> and if values are populated then as is.
> 
> Unit Value  Type
> NANA NA
> 3h0.0925 rain
> 
> Thanks again and in advance ! 
> 
> Archit
> 
> On Thu, Apr 27, 2017 at 6:27 PM, Ben Tupper  wrote:
> Hi,
> 
> There might be an easy solution out there already, but I suspect that you 
> will need to parse the XML yourself.  The example below uses package xml2 not 
> XML but you could do this with either.  The example simply shows how to get 
> values out of the XML hierarchy.  Once you have the attributes you want in 
> hand you can assemble the elements into a data frame (or a tibble from 
> package tibble.)
> 
> By the way, I had to prepend your example with ''
> 
> Cheers,
> Ben
> 
> ### START
> 
> library(tidyverse)
> library(xml2)
> 
> txt <- " lat=\"51.51\"/>GB set=\"2017-01-30T16:47:56\"/> min=\"278.15\" max=\"281.15\" unit=\"kelvin\"/> unit=\"%\"/> name=\"Gentle Breeze\"/> name=\"East\"/> clouds\"/> number=\"701\" value=\"mist\" icon=\"50d\"/> value=\"2017-01-30T15:50:00\"/>"
> 
> x <- read_xml(txt)
> 
> windspeed <- x %>%
> xml_find_first("wind/speed") %>%
> xml_attrs()
> 
> winddir <- x %>%
> xml_find_first("wind/direction") %>%
> xml_attrs()
> 
> windspeed
> #  valuename
> #  "4.6" "Gentle Breeze"
> 
> winddir
> #  value   code   name
> #  "90""E" "East"
> 
> ### END
> 
> 
> 
> > On Apr 27, 2017, at 6:08 AM, Archit Soni  wrote:
> >
> > Hi All,
> >
> > I have a XML file like :
> >
> > 
> > 
> > GB
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
> > I want to create a data frame out of this XML but
> > obviously xmlToDataFrame() is not working.
> >
> > It has dynamic attributes like for node precipitation , it could have
> > attributes like value and mode both if there is ppt in some city.
> >
> > My basic issue now id to read XML attributes of different nodes and convert
> > it into a data frame, I have scraped many forums but could not find any
> > help in this.
> >
> > For starters, please suggest a solution to parse the value of city node and
> > corresponding id, name, lat, long etc.
> >
> > I know I am asking a lot, thanks for reading and cheers! :)
> >
> > --
> > Regards
> > Archit
> >
> >   [[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.
> 
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org
> 
> 
> 
> 
> 
> 
> -- 
> Regards
> Archit

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] Augmented Dickey Fuller test

2017-04-28 Thread Achim Zeileis

On Fri, 28 Apr 2017, T.Riedle wrote:


Dear all,

I am trying to run an ADF test using the adf.test() function in the 
tseries package and the ur.df() function in the urca package. The 
results I get contrast sharply. Whilst the adf.test() indicates 
stationarity which is in line with the corresponding graph, the ur.df() 
indicates non-stationarity.


Why does this happen?


This is likely due to different setting for the deterministic part of the 
model and/or the number of lags tested. The defaults of ur.df() are often 
not suitable for many practical applications which might to spurious 
significant results.


Could anybody explain the adf.test() function in more detail? How does 
adf.test() select the number of lags is it AIC or BIC and how does it 
take an intercept and/or a trend into account?


There is a deterministic trend and the default number of lags is selected 
by a heuristic.


At

https://stats.stackexchange.com/questions/168332/r-augmented-dickey-fuller-adf-test/168355#168355

I've summarized an overview that I had written for my students. It might 
also be helpful for you.


hth,
Z

__
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] Error with installed.packages with R 3.4.0 on Windows

2017-04-28 Thread Uwe Ligges



On 28.04.2017 10:45, Thierry Onkelinx wrote:

Dear Peter,

It actually breaks install.packages(). So it is not that innocent.


And hence, as Peter exoplained, it is already fixed inn R-patched, 
thanks to Tomas Kalibera.


Best,
Uwe Ligges






Best regards,

Thierry


Op 28 apr. 2017 10:36 a.m. schreef "peter dalgaard" :

Yes, we noticed this in the last days of the code freeze before release and
shied away from inserting a workaround, partly because we couldn't see what
the root of the problem might be.

For the purposes of installed.packages it is relatively harmless to treat
the NA condition as FALSE, since it is just a matter of whether a cache is
valid. I.e., it might cause an unnecessary cache rebuild. For other
situations it might be more of an issue.

The workaround (NA -> FALSE, basically) is in place in R-patched and
R-devel.

-pd


On 28 Apr 2017, at 07:47 , Thierry Onkelinx 

wrote:


We have several computers with the same problem.

Op 28 apr. 2017 7:25 a.m. schreef "Jean-Claude Arbaut"  file.mtime(lib) &&  :
 missing value where TRUE/FALSE needed
Calls: installed.packages


I am working with R 3.4.0 on Windows. I didn't get this error with R

3.3.3.

Apparently, file.mtime() is returning NA well applied to a directory, and
this causes the entire && expression to be NA, then the "if" fails because
it needs either T or F.
The source of "installed.packages" seems to be roughly the same as in R
3.3.3, so I wonder if there have been other changes in R, maybe the

logical

operators, that would make this function fail.

Any idea?

Best regards,

Jean-Claude Arbaut

   [[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.

  [[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.


--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

[[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] gap.barplot with means and standard error bars

2017-04-28 Thread Jim Lemon
Hi Bianca,
Try this:

gap.barplot(c(mean(SA),mean(AA),mean(CA)),
 gap=c(1,250),xlim=c(0.5,3.5),xaxlab=c("SA","AA","CA"),
 ytics=c(0,255,260,265),yaxlab=c(0,255,260,265))
barlabels(1:3,c(5,5,5),
 paste(c(mean(SA),mean(AA),mean(CA)),
 round(c(sd(SA),sd(AA),sd(CA)),3)))

It's a bit rough, but I don't have time for refinement tonight.

Jim

On Fri, Apr 28, 2017 at 5:10 AM, Biank M  wrote:
> Hi..
>
>
> I've been trying to create a barplot with the following data:
>
>
> SA<- c(0.06, 0.061, 0.06, 0.06, 0.06)
> AA<- c(0.29, 0.275, 0.271, 0.274, 0.276)
> CA<- c(266.783, 257.726, 276.331, 268.859, 265.042)
>
>
> I want a bar for "SA", a bar for "AA", and a bar for "CA" (x- axis). The 
> height of the bar must be represented by the mean of each vector data and 
> include SE bars. Since there are very very large differences in numbers , I 
> want to add a gap between 1 and 250 (y-axis).
>
>
> I know that the gap.barplot function is used to produce the gap, but I don't 
> know how to include the means and SE bars.
>
> Can you help me creating this plot??
>
>
> Thank you very much!!
>
>
> Greetings,
>
> Bianca
>
> [[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] Augmented Dickey Fuller test

2017-04-28 Thread T . Riedle
Dear all,

I am trying to run an ADF test using the adf.test() function in the tseries 
package and the ur.df() function in the urca package. The results I get 
contrast sharply. Whilst the adf.test() indicates stationarity which is in line 
with the corresponding graph, the ur.df() indicates non-stationarity.



Why does this happen? Could anybody explain the adf.test() function in more 
detail? How does adf.test() select the number of lags is it AIC or BIC and how 
does it take an intercept and/or a trend into account?



Help is greatly appreciated.



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.


Re: [R-es] RStudio en Ubuntu 17.10

2017-04-28 Thread José Antonio Palazón Ferrando

Hola:

Yo uso este procedimiento para instalar rstudio:

wget https://download1.rstudio.org/rstudio-1.0.136-amd64.deb
wget 
http://ftp.ca.debian.org/debian/pool/main/g/gstreamer0.10/libgstreamer0.10-0_0.10.36-1.5_amd64.deb
wget 
http://ftp.ca.debian.org/debian/pool/main/g/gst-plugins-base0.10/libgstreamer-plugins-base0.10-0_0.10.36-2_amd64.deb


dpkg -i libgstreamer0.10-0_0.10.36-1.5_amd64.deb
dpkg -i libgstreamer-plugins-base0.10-0_0.10.36-2_amd64.deb

dpkg -i rstudio-1.0.136-amd64.deb
apt install -f


Espero que te sea de utilidad

El 27/04/17 a las 22:46, Manuel Máquez escribió:

Carlos:
Muchas gracias por tu inmediata respuesta, sólo que el sistema me responde:
El paquete libgstreamer0.10-0 no está disponible, pero algún otro paquete
hace referencia a él. Esto puede significar que el paquete falta, está
obsoleto o sólo se encuentra disponible desde alguna otra fuente

E: El paquete «libgstreamer0.10-0» no tiene un candidato para la
instalación.
¿Entonces qué puede hacerse?

*MANOLO MÁRQUEZ P.*

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


--


José Antonio Palazón Ferrando
Profesor Titular. Departamento de Ecología e Hidrología.
Facultad de Biología. Universidad de Murcia.
Campus Universitario de Espinardo
30100 MURCIA-SPAIN
Telf: +34 868 88 49 80
Fax : +34 868 88 39 63
Email: pala...@um.es

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[R] Different output for "if else" and "ifelse" that I don't understand

2017-04-28 Thread Marc Girondot via R-help

Dear list-members,

During the test phase of a function, I run it interactively (in Rstudio) 
and the ... produces an error. Then I use this to read it:


if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list() else 
p3p <- list(...)


It works fine; interactively I will get

> if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list() 
else p3p <- list(...)

> p3p
list()

and within a function I will get a list with the ... value. Perfect.

I wanted to simplify the line by doing:

p3p <- ifelse(class(try(list(...), silent=TRUE))=="try-error", list(), 
list(...))


In interactive mode, it works but within a function, I don't get the 
names of the parameters. I don't understand the logic behind this 
difference. Have you an idea ?


Thanks

Marc


> Try1 <- function(...) {
+   if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list() 
else p3p <- list(...)

+   return(p3p)
+ }
> Try1(k=100)
$k
[1] 100

> Try1()
list()
> Try2 <- function(...) {
+   p3p <- ifelse(class(try(list(...), silent=TRUE))=="try-error", 
list(), list(...))

+   return(p3p)
+ }
> Try2(k=100)
[[1]]
[1] 100

> Try2()
[[1]]
NULL

__
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] Error with installed.packages with R 3.4.0 on Windows

2017-04-28 Thread Thierry Onkelinx
Dear Peter,

It actually breaks install.packages(). So it is not that innocent.

Best regards,

Thierry


Op 28 apr. 2017 10:36 a.m. schreef "peter dalgaard" :

Yes, we noticed this in the last days of the code freeze before release and
shied away from inserting a workaround, partly because we couldn't see what
the root of the problem might be.

For the purposes of installed.packages it is relatively harmless to treat
the NA condition as FALSE, since it is just a matter of whether a cache is
valid. I.e., it might cause an unnecessary cache rebuild. For other
situations it might be more of an issue.

The workaround (NA -> FALSE, basically) is in place in R-patched and
R-devel.

-pd

> On 28 Apr 2017, at 07:47 , Thierry Onkelinx 
wrote:
>
> We have several computers with the same problem.
>
> Op 28 apr. 2017 7:25 a.m. schreef "Jean-Claude Arbaut" :
>
> Hello,
>
> I am currently getting a strange error when I call installed.packages():
>
> Error in if (file.exists(dest) && file.mtime(dest) > file.mtime(lib) &&  :
>  missing value where TRUE/FALSE needed
> Calls: installed.packages
>
>
> I am working with R 3.4.0 on Windows. I didn't get this error with R
3.3.3.
> Apparently, file.mtime() is returning NA well applied to a directory, and
> this causes the entire && expression to be NA, then the "if" fails because
> it needs either T or F.
> The source of "installed.packages" seems to be roughly the same as in R
> 3.3.3, so I wonder if there have been other changes in R, maybe the
logical
> operators, that would make this function fail.
>
> Any idea?
>
> Best regards,
>
> Jean-Claude Arbaut
>
>[[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.
>
>   [[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.

--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

[[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] Error with installed.packages with R 3.4.0 on Windows

2017-04-28 Thread peter dalgaard
Yes, we noticed this in the last days of the code freeze before release and 
shied away from inserting a workaround, partly because we couldn't see what the 
root of the problem might be. 

For the purposes of installed.packages it is relatively harmless to treat the 
NA condition as FALSE, since it is just a matter of whether a cache is valid. 
I.e., it might cause an unnecessary cache rebuild. For other situations it 
might be more of an issue.

The workaround (NA -> FALSE, basically) is in place in R-patched and R-devel.

-pd

> On 28 Apr 2017, at 07:47 , Thierry Onkelinx  wrote:
> 
> We have several computers with the same problem.
> 
> Op 28 apr. 2017 7:25 a.m. schreef "Jean-Claude Arbaut" :
> 
> Hello,
> 
> I am currently getting a strange error when I call installed.packages():
> 
> Error in if (file.exists(dest) && file.mtime(dest) > file.mtime(lib) &&  :
>  missing value where TRUE/FALSE needed
> Calls: installed.packages
> 
> 
> I am working with R 3.4.0 on Windows. I didn't get this error with R 3.3.3.
> Apparently, file.mtime() is returning NA well applied to a directory, and
> this causes the entire && expression to be NA, then the "if" fails because
> it needs either T or F.
> The source of "installed.packages" seems to be roughly the same as in R
> 3.3.3, so I wonder if there have been other changes in R, maybe the logical
> operators, that would make this function fail.
> 
> Any idea?
> 
> Best regards,
> 
> Jean-Claude Arbaut
> 
>[[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.
> 
>   [[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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
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] Reading XML attriutes in R

2017-04-28 Thread Archit Soni
Thanks Ben, got it working, just want one more help on this,

If i have a node like:  and in some other city it
came like:  

How can i make my code to handle this dynamically? I am sorry to ask such
novice questions but it would be extremely helpful if you could help me
with this.

So, i would want my resulting data set from this code:- ppt <- (x %>%
xml_find_all("precipitation") %>% xml_attrs())
 if mode is no, then the three columns should come and values should be NA
and if values are populated then as is.

Unit Value  Type
NANA NA
3h0.0925 rain

Thanks again and in advance !

Archit

On Thu, Apr 27, 2017 at 6:27 PM, Ben Tupper  wrote:

> Hi,
>
> There might be an easy solution out there already, but I suspect that you
> will need to parse the XML yourself.  The example below uses package xml2
> not XML but you could do this with either.  The example simply shows how to
> get values out of the XML hierarchy.  Once you have the attributes you want
> in hand you can assemble the elements into a data frame (or a tibble from
> package tibble.)
>
> By the way, I had to prepend your example with ''
>
> Cheers,
> Ben
>
> ### START
>
> library(tidyverse)
> library(xml2)
>
> txt <- " lat=\"51.51\"/>GB set=\"2017-01-30T16:47:56\"/> min=\"278.15\" max=\"281.15\" unit=\"kelvin\"/> unit=\"%\"/> value=\"4.6\" name=\"Gentle Breeze\"/> code=\"E\" name=\"East\"/> clouds\"/> mode=\"no\"/> icon=\"50d\"/>"
>
> x <- read_xml(txt)
>
> windspeed <- x %>%
> xml_find_first("wind/speed") %>%
> xml_attrs()
>
> winddir <- x %>%
> xml_find_first("wind/direction") %>%
> xml_attrs()
>
> windspeed
> #  valuename
> #  "4.6" "Gentle Breeze"
>
> winddir
> #  value   code   name
> #  "90""E" "East"
>
> ### END
>
>
>
> > On Apr 27, 2017, at 6:08 AM, Archit Soni 
> wrote:
> >
> > Hi All,
> >
> > I have a XML file like :
> >
> > 
> > 
> > GB
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
> > I want to create a data frame out of this XML but
> > obviously xmlToDataFrame() is not working.
> >
> > It has dynamic attributes like for node precipitation , it could have
> > attributes like value and mode both if there is ppt in some city.
> >
> > My basic issue now id to read XML attributes of different nodes and
> convert
> > it into a data frame, I have scraped many forums but could not find any
> > help in this.
> >
> > For starters, please suggest a solution to parse the value of city node
> and
> > corresponding id, name, lat, long etc.
> >
> > I know I am asking a lot, thanks for reading and cheers! :)
> >
> > --
> > Regards
> > Archit
> >
> >   [[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.
>
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org
>
>
>
>


-- 
Regards
Archit

[[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.