Re: [R] Fwd: Re: Setting .Rprofile for RStudio on a Windows 7 x64bit / Windows file extension hiding

2017-04-18 Thread Troels Ring

Here it is how to make extensions visible before Windows 10

https://support.microsoft.com/en-us/help/865219/how-to-show-or-hide-file-name-extensions-in-windows-explorer

BW

Troels



Den 18-04-2017 kl. 23:44 skrev John C Frain:

At the risk of adding again to the noise on this point I would recommend
that all users of MS Windows enable the display of file name extensions.
This can be done in Windows 10 by opening Windows explorer under the view
item on the ribbon tick file name extensions. At least this will then
display any extensions added by programs when saving files. If a program
does add an extension then you can at least rename the file. Doing this
helps avoid these problems.

The same think can be done in earlier versions of windows explorer which do
not have the ribbon. I think that it is under the View menu item remove the
tick from the box "hide extensions for known file types". Save the revised
options. I don't have exact details as all the PCs that I can access at the
moment have windows 10.

You should note that this problem has consequences for most programs (e.g.
Matlab, Mathematica, Stata, Rats and many others). It is not specific to R.
It appears to work well with MS Office and similar programs in that it is
set up so that their users do not need any knowledge of file name
extensions.

  Under windows 10 if you use notepad when you select "Save As" There is a
save as type option below the file name. The default is Save as text
(*.txt) - in which case the file is saved as filename .txt.  If you select
save as type - all files (*.*) the file is save as filename with out
extension if that is what you want. Even if you edit the file filename and
choose the wrong type the .txt extension may be added.  There is a similar
provision with many other programs. I don't use notepad myself but would
prefer to use notepad++ to edit text files

In Windows 10 any editors that I have used (including notepad, emacs,
rstudio, octave gui and others) can save files starting with a period. The
original MS DOS had 8.3 filenames and a filename starting with a period (.)
was not allowed. This practice continued to some extent in various version
of windows and it was often difficult to use filenames starting with a
period. As different versions of windows and different programs imposed
different restrictions.  I have  encountered such problems over the years.
Possible solutions included using emacs, notepad++ or the windows console
to solve the problem. For various versions of windows google search will
offer a solution.

Again the problem is not with R or Matlab or Octave or Mathematica  or
Stata or Rats or  but with Windows which pretends to be a very
user-friendly operating system  by hiding many aspects of what it is doing.
When one needs to do serious work one need to understand some of these
hidden aspects. In Linux many of these aspects are on the surface and it
may appear that one need more knowledge to work with Linux.

John C Frain
3 Aranleigh Park
Rathfarnham
Dublin 14
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:fra...@tcd.ie
mailto:fra...@gmail.com

On 18 April 2017 at 14:12, Duncan Murdoch  wrote:


On 17/04/2017 6:41 PM, John Nash wrote:


The very large amount of noise on this topic seems to be the result of
allowing
Windows to hide file extensions. We have had to put up with millions of
malware
infections because someone in M$ thought this would be a nice idea. I've
seen it
cause lots of problems over the years, including among my own family.

Perhaps someone can create a check and repair that automatically turns
this "feature" off
whenever R is run. One reason among the many why I run Linux.



MacOS does this now too, though it feels less aggressive than Windows.
This page tells how to disable it there: https://support.apple.com/kb/p
h19072?locale=en_US

There's little point providing a link to a Microsoft page for doing this
on Windows, because their help page links are not very durable.  The main
one that Google finds describes itself as obsolete.

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

Re: [R] Unknown anomaly

2017-04-18 Thread Rolf Turner

On 19/04/17 13:55, Benjamin Robira wrote:

Dear Sir,

I writting to you as I am facing an irregularity in R that I do not know
the origin. When doing a sequence from 0 to 1 by 0.02 and assigning it to
a vector (i.e. code: a <- seq(from=0, to=1, by=0.02)) then, when I try to
use the 36th element (and two others behave the same way) it is not
recognized correctly. For instance a[36]==0.7, what should give TRUE,
gives instead FALSE. However, this works fine for element 35 and 37 and
all other elements but two.
I do not know the reason. I restarted my R session and tried on another
computer. This has been the same. None of my colleagues had an answer. I
hope that you would be able to help me fix that as it must be a pretty
straightforward error that I do not realise.

I would be thankful for any help.



See FAQ 7.31.

cheers,

Rolf Turner

--
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] r codes

2017-04-18 Thread Boris Steipe
Here you go:

https://www.google.ca/search?q=r+partial+least+squares
https://www.google.ca/search?q=r+ridge+regression




> On Apr 18, 2017, at 3:45 PM, SAIRA SALEEM  wrote:
> 
> i required r codes to calculate partial least squares and ridge regression 
> __
> 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] Unknown anomaly

2017-04-18 Thread Boris Steipe
The concept of equality for numbers that are represented on a computer is 
frequently misapplied. Consider:

a <- seq(from=0, to=1, by=0.02)

print(a[36])
[1] 0.7

a[36] == 0.7
[1] FALSE

print(a[36], digits=22)
[1] 0.7000666134

a[36] == 0.7001
[1] TRUE

All clear?


B.



> On Apr 18, 2017, at 9:55 PM, Benjamin Robira  wrote:
> 
> Dear Sir,
> 
> I writting to you as I am facing an irregularity in R that I do not know
> the origin. When doing a sequence from 0 to 1 by 0.02 and assigning it to
> a vector (i.e. code: a <- seq(from=0, to=1, by=0.02)) then, when I try to
> use the 36th element (and two others behave the same way) it is not
> recognized correctly. For instance a[36]==0.7, what should give TRUE,
> gives instead FALSE. However, this works fine for element 35 and 37 and
> all other elements but two.
> I do not know the reason. I restarted my R session and tried on another
> computer. This has been the same. None of my colleagues had an answer. I
> hope that you would be able to help me fix that as it must be a pretty
> straightforward error that I do not realise.
> 
> I would be thankful for any help,
> With my very Best Regards,
> Benjamin.
> 
> __
> 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] Unknown anomaly

2017-04-18 Thread Benjamin Robira
Dear Sir,

I writting to you as I am facing an irregularity in R that I do not know
the origin. When doing a sequence from 0 to 1 by 0.02 and assigning it to
a vector (i.e. code: a <- seq(from=0, to=1, by=0.02)) then, when I try to
use the 36th element (and two others behave the same way) it is not
recognized correctly. For instance a[36]==0.7, what should give TRUE,
gives instead FALSE. However, this works fine for element 35 and 37 and
all other elements but two.
I do not know the reason. I restarted my R session and tried on another
computer. This has been the same. None of my colleagues had an answer. I
hope that you would be able to help me fix that as it must be a pretty
straightforward error that I do not realise.

I would be thankful for any help,
With my very Best Regards,
Benjamin.

__
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] r codes

2017-04-18 Thread SAIRA SALEEM
i required r codes to calculate partial least squares and ridge regression 
__
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] Fwd: Re: Setting .Rprofile for RStudio on a Windows 7 x64bit / Windows file extension hiding

2017-04-18 Thread John C Frain
At the risk of adding again to the noise on this point I would recommend
that all users of MS Windows enable the display of file name extensions.
This can be done in Windows 10 by opening Windows explorer under the view
item on the ribbon tick file name extensions. At least this will then
display any extensions added by programs when saving files. If a program
does add an extension then you can at least rename the file. Doing this
helps avoid these problems.

The same think can be done in earlier versions of windows explorer which do
not have the ribbon. I think that it is under the View menu item remove the
tick from the box "hide extensions for known file types". Save the revised
options. I don't have exact details as all the PCs that I can access at the
moment have windows 10.

You should note that this problem has consequences for most programs (e.g.
Matlab, Mathematica, Stata, Rats and many others). It is not specific to R.
It appears to work well with MS Office and similar programs in that it is
set up so that their users do not need any knowledge of file name
extensions.

 Under windows 10 if you use notepad when you select "Save As" There is a
save as type option below the file name. The default is Save as text
(*.txt) - in which case the file is saved as filename .txt.  If you select
save as type - all files (*.*) the file is save as filename with out
extension if that is what you want. Even if you edit the file filename and
choose the wrong type the .txt extension may be added.  There is a similar
provision with many other programs. I don't use notepad myself but would
prefer to use notepad++ to edit text files

In Windows 10 any editors that I have used (including notepad, emacs,
rstudio, octave gui and others) can save files starting with a period. The
original MS DOS had 8.3 filenames and a filename starting with a period (.)
was not allowed. This practice continued to some extent in various version
of windows and it was often difficult to use filenames starting with a
period. As different versions of windows and different programs imposed
different restrictions.  I have  encountered such problems over the years.
Possible solutions included using emacs, notepad++ or the windows console
to solve the problem. For various versions of windows google search will
offer a solution.

Again the problem is not with R or Matlab or Octave or Mathematica  or
Stata or Rats or  but with Windows which pretends to be a very
user-friendly operating system  by hiding many aspects of what it is doing.
When one needs to do serious work one need to understand some of these
hidden aspects. In Linux many of these aspects are on the surface and it
may appear that one need more knowledge to work with Linux.

John C Frain
3 Aranleigh Park
Rathfarnham
Dublin 14
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:fra...@tcd.ie
mailto:fra...@gmail.com

On 18 April 2017 at 14:12, Duncan Murdoch  wrote:

> On 17/04/2017 6:41 PM, John Nash wrote:
>
>>
>> The very large amount of noise on this topic seems to be the result of
>> allowing
>> Windows to hide file extensions. We have had to put up with millions of
>> malware
>> infections because someone in M$ thought this would be a nice idea. I've
>> seen it
>> cause lots of problems over the years, including among my own family.
>>
>> Perhaps someone can create a check and repair that automatically turns
>> this "feature" off
>> whenever R is run. One reason among the many why I run Linux.
>>
>>
> MacOS does this now too, though it feels less aggressive than Windows.
> This page tells how to disable it there: https://support.apple.com/kb/p
> h19072?locale=en_US
>
> There's little point providing a link to a Microsoft page for doing this
> on Windows, because their help page links are not very durable.  The main
> one that Google finds describes itself as obsolete.
>
> 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/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] Twitter Analytics Using streamR - subscript out of bounds

2017-04-18 Thread Raquel D .
I have tried this. Same error.


Att;



De: Jeff Newmiller 
Enviado: ter�a-feira, 18 de abril de 2017 19:23
Para: r-help@r-project.org; Raquel D.; r-help@r-project.org
Assunto: Re: [R] Twitter Analytics Using streamR - subscript out of bounds

I am no expert, but I think any attempt to save your OAuth data is doomed to 
fail. Solution is don't do it.
--
Sent from my phone. Please excuse my brevity.

On April 18, 2017 11:38:10 AM PDT, "Raquel D."  
wrote:
>can someone help me? How fix this error?
>
>My code:
>
>library("ROAuth")
>library("streamR")
>library("rjson")
>library("twitteR")
>
>apiKey <- "xxx"
>apiSecret <- "xxx"
>accessToken <- "xxx"
>accessSecret <- "xxx"
>requestURL <- "https://api.twitter.com/oauth/request_token;
>accessURL <- "https://api.twitter.com/oauth/access_token;
>authURL <- "https://api.twitter.com/oauth/authorize;
>
>my_oauth <- OAuthFactory$new(consumerKey = apiKey, consumerSecret =
>apiSecret,
> requestURL = requestURL, accessURL = accessURL, authURL = authURL)
>
>
>my_oauth$handshake(cainfo = system.file("CurlSSL", "cacert.pem",
>package = "RCurl"))
>
>
>save(my_oauth, file = "my_oauth.Rdata")
>
>load("my_oauth.Rdata")
>filterStream("tweets.json", track = "kinoplex", timeout = 180,
> oauth = my_oauth)
>
>
>tweets.df <- parseTweets("tweets.json", simplify = TRUE)
>
>ERROR: tweets.df <- parseTweets("tweets.json", simplify = TRUE) Error
>in results.list[[1]] : subscript out of bounds
>
>
>   [[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] Twitter Analytics Using streamR - subscript out of bounds

2017-04-18 Thread Jeff Newmiller
I am no expert, but I think any attempt to save your OAuth data is doomed to 
fail. Solution is don't do it. 
-- 
Sent from my phone. Please excuse my brevity.

On April 18, 2017 11:38:10 AM PDT, "Raquel D."  
wrote:
>can someone help me? How fix this error?
>
>My code:
>
>library("ROAuth")
>library("streamR")
>library("rjson")
>library("twitteR")
>
>apiKey <- "xxx"
>apiSecret <- "xxx"
>accessToken <- "xxx"
>accessSecret <- "xxx"
>requestURL <- "https://api.twitter.com/oauth/request_token;
>accessURL <- "https://api.twitter.com/oauth/access_token;
>authURL <- "https://api.twitter.com/oauth/authorize;
>
>my_oauth <- OAuthFactory$new(consumerKey = apiKey, consumerSecret =
>apiSecret,
> requestURL = requestURL, accessURL = accessURL, authURL = authURL)
>
>
>my_oauth$handshake(cainfo = system.file("CurlSSL", "cacert.pem",
>package = "RCurl"))
>
>
>save(my_oauth, file = "my_oauth.Rdata")
>
>load("my_oauth.Rdata")
>filterStream("tweets.json", track = "kinoplex", timeout = 180,
> oauth = my_oauth)
>
>
>tweets.df <- parseTweets("tweets.json", simplify = TRUE)
>
>ERROR: tweets.df <- parseTweets("tweets.json", simplify = TRUE) Error
>in results.list[[1]] : subscript out of bounds
>
>
>   [[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] Twitter Analytics Using streamR - subscript out of bounds

2017-04-18 Thread Raquel D .
can someone help me? How fix this error?

My code:

library("ROAuth")
library("streamR")
library("rjson")
library("twitteR")

apiKey <- "xxx"
apiSecret <- "xxx"
accessToken <- "xxx"
accessSecret <- "xxx"
requestURL <- "https://api.twitter.com/oauth/request_token;
accessURL <- "https://api.twitter.com/oauth/access_token;
authURL <- "https://api.twitter.com/oauth/authorize;

my_oauth <- OAuthFactory$new(consumerKey = apiKey, consumerSecret = apiSecret,
 requestURL = requestURL, accessURL = accessURL, 
authURL = authURL)


my_oauth$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = 
"RCurl"))


save(my_oauth, file = "my_oauth.Rdata")

load("my_oauth.Rdata")
filterStream("tweets.json", track = "kinoplex", timeout = 180,
 oauth = my_oauth)


tweets.df <- parseTweets("tweets.json", simplify = TRUE)

ERROR: tweets.df <- parseTweets("tweets.json", simplify = TRUE) Error in 
results.list[[1]] : subscript out of bounds


[[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] difference-in-difference method for estimating causal impact,

2017-04-18 Thread Ralf Pfeiffer via R-help



Hello, 

i want to estimate the causal impact on a scale variable, using the 
difference-in-difference-method and the following 4 groups
- control- and treatment group (counterfactual analysis) 
- two periods, measurement before and after treatment.  

After discovering and estimating the causal effect (of course, only if 
existing) i like to make deeper analysis, causal mediation analysis, and fixed 
effects analyisis.  

Does anyone know a package or packages, with which one can do this estimations, 
calculation and graphics?
Thanks a  lot for any information.
iksmax


   
[[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] Prediction plots

2017-04-18 Thread Santiago Bueno
Thanks Boris, the following is an extract of my data. I have developed
biomass models using codes like:

start <- coef (lm(log(Btot)~I(log(dbh**2*haut)),data=dat[dat$Btot>0,]))

start[1] <- exp(start[1])

names(start) <- c("a","b")

M1 <- nls(Btot~a*(dbh**2*haut)**b,data=dat,start=start,weights=1/dat$dbh**4)


start <- coef(lm(log(Btot)~I(log(dbh))+I(log(haut)),data=dat[dat$Btot>0,]))

start[1] <- exp(start[1])

names(start) <- c("a","b1","b2")

M2 <- nls(Btot~a*dbh**b1*haut**b2,data=dat,start=start,weights=1/dat$dbh**4)


Tree No dbh haut Btot
1 35.00 18.90 0.535
2 25.00 16.60 0.248
3 23.00 19.50 0.228
4 13.50 15.60 0.080
5 20.00 18.80 0.172
6 23.00 17.40 0.190
7 29.00 19.90 0.559
8 17.60 18.20 0.117
9 31.00 25.30 0.645
10 26.00 23.50 0.394
11 13.00 13.00 0.038
12 32.00 20.70 0.443
It is my interest to get prediction plots for the models. I have tried to
use the following codes with no success: Let m be one of the fitted models
with dbh as the only entry. To construct a plot of the predictions made by
this model I have tried:
with(dat,plot(dbh,Btot,xlab="Dbh(cm)",ylab="Biomass (t)"))
D <- seq(par("usr")[1],par("usr")[2],length=200)
lines(D,predict(m,newdata=data.frame(dbh=D)),col="red")
For a model m that has dbh and height as entries, I have tried to get its
predictions as follows:
D <- seq(0,180,length=20)
H <- seq(0,61,length=20)
B <- matrix(predict(m,newdata=expand.grid(dbh=D,height=H)),length(D))

Can someone provide help please!!!


Best regards,

Santiago Bueno

[[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: [ESS] interacting with Docker

2017-04-18 Thread Stephen Eglen
hi Ista,
I'm not sure I follow what you mean here for starting an R session
within a docker container such that its available to ESS?

On Tue, Apr 18 2017, Ista Zahn wrote:

> Set your container to run ssh and then connect as normal following the
> documentation at
> http://ess.r-project.org/Manual/ess.html#ESS-processes-on-Remote-Computers
>
> Best,
> Ista
>
> On Tue, Apr 18, 2017 at 10:07 AM, François Michonneau
>  wrote:
>> Hi all,
>>
>>  I was wondering if it was possible to connect ESS with an R process
>> that is running in a Docker container.
>>
>>   Thank you,
>>-- François
>>
>> __
>> ESS-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/ess-help
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

[R] Safeguarded Newton method for function minimization

2017-04-18 Thread J C Nash

Recently Marie Boehnstedt reported a bug in the nlm() function for function 
minimization
when both gradient and hessian are provided. She has provided a work-around for 
some
cases and it seems this will get incorporated into the R function eventually.

However, despite the great number of packages on CRAN, there does not appear to 
be a
straightforward Newton approach to function minimization. This may be because 
providing
the code for a hessian (the matrix of second derivatives) is a lot of work and 
error-prone.
(R could also use some good tools for Automatic Differentiation). I have also 
noted that
a number of researchers try to implement textbook methods and run into trouble 
when maths
and computing are not quite in sync. Therefore, I wrote a simple safeguarded 
Newton and
put a small package on R-forge at

https://r-forge.r-project.org/R/?group_id=395

Note that Newton's method is used to solve nonlinear equations. In fact, for 
function
minimization, we apply it to solve g(x) = 0 where g is the gradient and x is 
the vector
of parameters. In part, safeguards ensure we reduce the function f(x) at each 
step to avoid
some of the difficulties that may arise from a non-positive-definite hessian.

In the package, I have a very simple quadratic test, the Rosenbrock test 
function and
the Wood test function. The method fails on the last function -- the hessian is 
not
positive definite where it stops.

Before submitting this package to CRAN, I would like to see its behaviour on 
other
test problems, but am lazy enough to wish to avoid creating the hessian code. 
If anyone
has such code, it would be very welcome. Please contact me off-list. If I get 
some workable
examples that are open for public view, I'll report back here.

John Nash

__
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] Quantmod cant download data

2017-04-18 Thread Nordlund, Dan (DSHS/RDA)
The download works for me without any warning message.  The following is my 
session info.

> sessionInfo()
R version 3.3.3 (2017-03-06)
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] quantmod_0.4-7 TTR_0.23-1 xts_0.9-7  zoo_1.7-14

loaded via a namespace (and not attached):
[1] tools_3.3.3 grid_3.3.3  lattice_0.20-35
>

And here is the download result.


> getSymbols("SPY", verbose = TRUE)
As of 0.4-0, 'getSymbols' uses env=parent.frame() and
 auto.assign=TRUE by default.

 This  behavior  will be  phased out in 0.5-0  when the call  will
 default to use auto.assign=FALSE. getOption("getSymbols.env") and 
 getOptions("getSymbols.auto.assign") are now checked for alternate defaults

 This message is shown once per session and may be disabled by setting 
 options("getSymbols.warning4.0"=FALSE). See ?getSymbols for more details.
downloading  SPY .

trying URL 
'http://ichart.finance.yahoo.com/table.csv?s=SPY=0=01=2007=3=18=2017=d=q=0=SPY=.csv'
Content type 'text/csv' length unknown
downloaded 187 KB

done.
[1] "SPY"
>


Hope this is useful,

Dan

Daniel Nordlund, PhD
Research and Data Analysis Division
Services & Enterprise Support Administration
Washington State Department of Social and Health Services

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Joshua
> Ulrich
> Sent: Tuesday, April 18, 2017 9:16 AM
> To: Christofer Bogaso
> Cc: r-help
> Subject: Re: [R] Quantmod cant download data
> 
> See https://github.com/joshuaulrich/quantmod/issues/149
> 
> On Tue, Apr 18, 2017 at 11:14 AM, Christofer Bogaso
>  wrote:
> > Hi again,
> >
> > I generally use Quantmod package to download stock data. However
> > recently I observed that it is unable to download the data although
> > Source file is available.
> >
> > Below is Error I found when I use Quantmod :
> >
> >> library(quantmod)
> >> getSymbols("^NSEI")
> > Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "=",
> from.m,  :
> >   cannot open URL
> >
> 'http://ichart.finance.yahoo.com/table.csv?s=^NSEI=0=01=2007=
> 3=18=2017=d=q=0=^NSEI=.csv'
> >
> > However the Source file
> >
> "http://ichart.finance.yahoo.com/table.csv?s=^NSEI=0=01=2007=
> 3=18=2017=d=q=0=^NSEI=.csv"
> > is available for manual download.
> >
> > R version :
> >
> > R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
> > Copyright (C) 2016 The R Foundation for Statistical Computing
> > Platform: x86_64-apple-darwin13.4.0 (64-bit)
> >
> >> sessionInfo()
> > R version 3.3.2 (2016-10-31)
> > Platform: x86_64-apple-darwin13.4.0 (64-bit)
> > Running under: macOS Sierra 10.12.3
> >
> > locale:
> > [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-
> 8
> >
> > attached base packages:
> > [1] stats graphics  grDevices utils datasets  methods   base
> >
> > other attached packages:
> > [1] quantmod_0.4-7TTR_0.23-1xts_0.9-7 zoo_1.8-0
> >  data.table_1.10.0
> >
> > loaded via a namespace (and not attached):
> > [1] grid_3.3.2  lattice_0.20-35
> >
> > Could you please help to resolve this issue.
> >
> > Thanks for your time.
> >
> > __
> > 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.
> 
> 
> 
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com
> R/Finance 2017 | www.rinfinance.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-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] ggplot2: ..n.. and ..count.. in geom_text

2017-04-18 Thread G . Maubach
Hi All,

I have the following code:

-- cut 

(g03_02_p02 <- ggplot(data = d_kzb_input) +
  geom_bar(
mapping = aes(x = v03_02_r01, y = round(..prop.. * 100, 0)),
fill = c_ww_palette["blue"]) +
  scale_y_continuous(limits = c(0, c_y_limit)) +
  theme_classic() +
  ggtitle(paste0("Question 3",
"(n = ", <>, ")")) +  # How can I refer to the number of cases 
for this plot? Is there something like "..n.."?
  xlab("Orders") +
  ylab("Percent") +
  geom_text(
aes(label = ..count..),  # How can I refer to the counts for the 
labels of the columns?
color = "white",
position = position_stack(vjust = 0.5)))

-- cut --

I would like to refer to the internal statistics of the geom_bar():

How can I refer to the number of cases for this plot? Is there something 
like "..n.."?
How can I refer to the counts for the labels of the columns?

Kind regards

Georg

__
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] Question on accessing foreign files

2017-04-18 Thread William Dunlap via R-help
I've attached data.restore4.txt, containing the function
data.restore4(), which has the same argument list as
foreign::data.restore() and is mean to be called by the latter if the
first line of the file is "## Dump S Version 4 Dump".   It can read
version 4 of the 'S data dump' format, which for which S+ uses the
file extension ".sdd".  It stores the objects it reads in the
environment specified by the 'env' argument/.

I think it works pretty well; please report any issues to me.

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Mon, Apr 17, 2017 at 3:20 PM, Daniel Molinari  wrote:
> Hi all,
>
> I have several data files provided in mtw format (Minitab) and sdd format
> (S-Plus) and I need to read them in R.
>
> I do not have access either to Minitab or to S-Plus.
>
> How can I accomplish this task ?
>
> Thank you,
> Daniel
>
> [[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.
data.restore4 <- function(file, print = FALSE, verbose = FALSE, env = 
.GlobalEnv)
{
# Like foreign::data.restore, but for S Version 4 data.dump format
# TODO: when creating functions within functions or expressions, make the 
inner
#ones calls to function(), not already-created functions.  Splus does
#not have lexical scoping so this should not affect behavior, but makes
#the new  function more R-like.
#Dumping the function to a file and sourcing it back in would have the 
same
#effect.
# TODO: deal with stored Splus objects that have an implicit class
#but no "class" attribute.  Except for "matrix" and "array" I don't
#think Splus creates such objects, but they exist in the 'data' package
#and they depend on getOldClass() to map the class field in the 
data.dump
#to a class vector in the object.  E.g., get("wafer", where="data") has
#class 'design' which should become attribute class=c("design", 
"data.frame").
#Some 'ordered' objects are analogous - no class attribute and class 
field is 'ordered' so you
#have to know that 'ordered' means class=c("ordered","factor").
#"factor" and "ordered" may also be stored without a named ".Label" 
attribute.
#(I have dealt with the factor the matrix/array objects are commonly 
stored without
#named attributes - I assume that the structure has length 3 and the 
attributes
#are ".Dims" and ".Dimnames".)
origFile <- file
if (!inherits(file, "connection")) {
file <- file(file, "r")
on.exit(close(file))
}
lineNo <- 0
nextLine <- function(n = 1) {
lineNo <<- lineNo + n
readLines(file, n = n)
}
Verbosely <- function(...) {
if (verbose) {
message(simpleMessage(paste("(object ", objName, ", line ", lineNo, 
") ", paste(..., collapse = " ", sep = ""), sep = ""), sys.call(-1)))
}
}
Stop <- function(...) {
stop(simpleError(paste(paste(..., collapse = " ", sep = ""), sep = "",
" (object ", objName, ", file ", 
deparse(summary(file)$description), ", line ", lineNo, ")"), sys.call(-1)))
}
Recurse <- function(length) {
# Never call 'blah <- .data.restore4()' directly as it may return a 
missing
# argument object, which will break '<-' but not lapply.
lapply(seq_len(length), function(i) { .data.restore4() })
}
constructMissingArgument <- function() formals(function(x)NULL)$x
txt <- nextLine()
objName <- ""
if (length(txt) != 1) {
Stop("File is empty")
}
if (txt != "## Dump S Version 4 Dump ##") {
Stop("File does not start with '## Dump S Version 4 Dump', so this is 
not a SV4 data.dump file")
}
.data.restore4 <- function()
{
class <- nextLine()
mode <- nextLine()
length <- as.numeric(tmp <- nextLine())
if (is.na(length) || length%%1 != 0 || length < 0) {
Stop("Expected nonnegative integer 'length' at line ", lineNo, " 
but got ", deparse(tmp))
}
if (mode == "character") {
ret <- nextLine(length)
# convert \\n to newline, \\t to tab, etc. by using parse()
vapply(ret, function(string)parse(text=paste0("\"", string, 
"\""))[[1]], FUN.VALUE="", USE.NAMES=FALSE)
} else if (mode == "logical") {
txt <- nextLine(length)
lglVector <- rep(NA, length)
lglVector[txt != "N"] <- as.logical(as.integer(txt[txt != "N"]))
lglVector
} else if (mode %in% c("integer", "single", "numeric")) {
txt <- nextLine(length)
txt[txt == "M"] <- "NaN"
txt[txt == "I"] <- "Inf"

Re: [R] Quantmod cant download data

2017-04-18 Thread Joshua Ulrich
See https://github.com/joshuaulrich/quantmod/issues/149

On Tue, Apr 18, 2017 at 11:14 AM, Christofer Bogaso
 wrote:
> Hi again,
>
> I generally use Quantmod package to download stock data. However
> recently I observed that it is unable to download the data although
> Source file is available.
>
> Below is Error I found when I use Quantmod :
>
>> library(quantmod)
>> getSymbols("^NSEI")
> Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "=", from.m,  :
>   cannot open URL
> 'http://ichart.finance.yahoo.com/table.csv?s=^NSEI=0=01=2007=3=18=2017=d=q=0=^NSEI=.csv'
>
> However the Source file
> "http://ichart.finance.yahoo.com/table.csv?s=^NSEI=0=01=2007=3=18=2017=d=q=0=^NSEI=.csv;
> is available for manual download.
>
> R version :
>
> R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
> Copyright (C) 2016 The R Foundation for Statistical Computing
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
>
>> sessionInfo()
> R version 3.3.2 (2016-10-31)
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
> Running under: macOS Sierra 10.12.3
>
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
>
> other attached packages:
> [1] quantmod_0.4-7TTR_0.23-1xts_0.9-7 zoo_1.8-0
>  data.table_1.10.0
>
> loaded via a namespace (and not attached):
> [1] grid_3.3.2  lattice_0.20-35
>
> Could you please help to resolve this issue.
>
> Thanks for your time.
>
> __
> 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.



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.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] Quantmod cant download data

2017-04-18 Thread Christofer Bogaso
Hi again,

I generally use Quantmod package to download stock data. However
recently I observed that it is unable to download the data although
Source file is available.

Below is Error I found when I use Quantmod :

> library(quantmod)
> getSymbols("^NSEI")
Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "=", from.m,  :
  cannot open URL
'http://ichart.finance.yahoo.com/table.csv?s=^NSEI=0=01=2007=3=18=2017=d=q=0=^NSEI=.csv'

However the Source file
"http://ichart.finance.yahoo.com/table.csv?s=^NSEI=0=01=2007=3=18=2017=d=q=0=^NSEI=.csv;
is available for manual download.

R version :

R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)

> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.3

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] quantmod_0.4-7TTR_0.23-1xts_0.9-7 zoo_1.8-0
 data.table_1.10.0

loaded via a namespace (and not attached):
[1] grid_3.3.2  lattice_0.20-35

Could you please help to resolve this issue.

Thanks for your time.

__
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] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-18 Thread Bruce Ratner PhD
Dear John:
My pleasure to respond to your request. 
Problem: Cannot get the .Rprofile file to take affect in either R (or RStudio). 
As to "what" can be in put into a  .Rprofile file is abound, many examples in 
the manuals, blogs, links, and books. 

The "how to" write the file was the real issue, not clearly covered in any 
material I could find or purchase.

I read that any notepad-type app can be used to create the .Rprofile file: 
1. with or without a txt/R extension, and/or
2. with or without Administrator permission. 

Not being a professional programmer/developer, I did not know about text 
editors that can create files with no extension, which was the problem at hand.

After many back and forth drilling down by R-helpers with trouble shooting 
queries, it became clear that I was not using a developer's text editor. 

Solution: I found an editor online, EditPad Pro 7 (for Windows), with which I 
created my .Rprofile file. 

The result was complete success, and gratitude to all R-helpers who stuck by 
me, 
understanding I am new to R, with non professional programming skills. As a 
statistician (or if you prefer data scientist) for twenty plus years, clearly I 
must know how to program, but not at the pro level or pro understanding. 

John, I hope this write up is satisfactory, if not please let let me know, as I 
will rewrite until you are happy with it.

It is a nice surprise to hear your wanting to archive the problem-solution, 
which almost did me in, and which created ill feelings among several R-helpers 
towards me. 

Regards, 
Bruce

__
Bruce Ratner PhD
The Significant Statistician™
(516) 791-3544
Statistical Predictive Analytics -- www.DMSTAT1.com
Machine-Learning Data Mining -- www.GenIQ.net



> On Apr 18, 2017, at 9:52 AM, Sparks, John James  wrote:
> 
> Bruce,
> 
> Do you think that you could post the final solution to the problem?  That
> way it would be stored with this thread and the next person who has the
> same problem would be able to locate the FINAL solution.
> 
> --JJS
> 
> 
>> On Mon, April 17, 2017 12:47 pm, BR_email wrote:
>> TO _ALL_:
>> THANK YOU. THANK YOU. THANK YOU.
>> After hours, and hours, and hours, and ... , and hours: Success.
>> To all who helped, thanks.
>> My quest was minor, but major for me, as I learn from the path of one,
>> whether big or small begets another.
>> 
>> I never look down at anyone, except to help him/her up.
>> 
>> With gratitude,
>> Bruce
>> 
>> Bruce Ratner, Ph.D.
>> The Significant Statistician™
>> (516) 791-3544
>> Statistical Predictive Analtyics -- www.DMSTAT1.com
>> Machine-Learning Data Mining and Modeling -- www.GenIQ.net
>> 
>> 
>> Peter Dalgaard wrote:
 On 17 Apr 2017, at 19:01 , BR_email  wrote:
 
 Berend: Something looks good, but RStudio still Rprofile still doees
 not affect the launch.
 
> source(echo=TRUE, "C:/Users/BruceRatner/Documents/.Rprofile.site")
> options(prompt="R> ")
> set.seed(12345)
> rm(list=ls())
 R>
 
 
 Bruce Ratner, Ph.D.
 The Significant Statistician™
 (516) 791-3544
 Statistical Predictive Analtyics -- www.DMSTAT1.com
 Machine-Learning Data Mining and Modeling -- www.GenIQ.net
 
 Berend Hasselman wrote:
> source(echo=TRUE, ""C:/Users/BruceRatner/Documents/.Rprofile.site")
>>> According to the gospel of St.Henrik, that filename is wrong, and
>>> possibly the directory too.
>>> 
>>> So try his suggestions. What is the output (show us!) of
>>> 
>>> normalizePath("./.Rprofile")
>>> normalizePath("~/.Rprofile")
>>> 
>>> Assuming that the former is
>>> 
>>> "C:/Users/BruceRatner/Documents/.Rprofile"
>>> 
>>> you could try renaming the .Rprofile.site file to that. If need be, use
>>> file.rename, as in
>>> 
>>> file.rename(from="C:/Users/BruceRatner/Documents/.Rprofile.site",
>>> to="C:/Users/BruceRatner/Documents/.Rprofile")
>>> 
>>> (and restart, obviously).
>>> 
>>> [I wouldn't set the seed in a .Rprofile file, nor would I use rm()
>>> there, but that is a different kettle of fish.]
>>> 
>> 
>> __
>> 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] qqplot for binomial distribution

2017-04-18 Thread Boris Steipe
As per the help pages, the data samples are expected in the second argument, 
"y".

So try 
  qqplot(rbinom(n=100, size=100, p=0.05), count1_vector)

... and then plot your qqline()

Alternatively, try

qqline(count1_vector,
   distribution = function(probs) { qbinom(probs, size=100, prob=0.05) },
   datax = TRUE, # <- logical. Should data values be on the x-axis?
   col = "red",
   lwd = 0.5)
... and use your original qqplot()


B.


> On Apr 18, 2017, at 12:47 AM, Ashim Kapoor  wrote:
> 
> Dear Boris,
> 
> Thank you for your reply. 
> 
> > dput(count1_vector)
> c(5, 6, 4, 4, 6, 5, 4, 5, 3, 7, 5, 5, 3, 4, 8, 6, 10, 2, 4, 6, 
> 8, 4, 4, 6, 8, 5, 6, 3, 7, 9, 4, 7, 5, 7, 3, 4, 5, 2, 11, 7, 
> 8, 5, 5, 6, 3, 2, 3, 5, 9, 6, 5, 6, 7, 3, 10, 7, 6, 4, 9, 5, 
> 7, 3, 7, 3, 2, 3, 4, 5, 10, 4, 5, 5, 6, 7, 4, 8, 7, 5, 5, 4, 
> 8, 7, 9, 4, 4, 4, 7, 5, 4, 10, 4, 5, 6, 1, 3, 5, 4, 7, 4, 6)
> 
> set.seed(123)
> qqplot(count1_vector,rbinom(n=100,size=100,p=.05))
> qqline(count1_vector,distribution = function(probs) { qbinom(probs, size=100, 
> prob=0.05) },
>col = "red",
>lwd = 0.5)
> 
> When I do this, the line does not pass through the center of my data.I do 
> expect count1_vector to be 100 samples of binomial with n=100 and p=.05. 
> 
> Any comments or suggestions for me ? 
> 
> Note : I built a 95% Confidence interval for my data and I counted how often 
> out of 100 times did the data fall outside the CI.This I expect to be 
> binomial with n=100,p=.05. I repeated this a 100 times and obtained 
> count1_vector.
> 
> Best Regards,
> Ashim. 
> 
> 
> On Mon, Apr 17, 2017 at 7:51 PM, Boris Steipe  
> wrote:
> That's not how qqline() works. The line is drawn with respect to a 
> _reference_distribution_ which is the normal distribution by default. For the 
> binomial distribution, you need to specify the distribution argument. There 
> is an example in the help page that shows you how this is done for qchisq(). 
> for qbinom() it is:
> 
> 
> set.seed(123)
> qqplot(rbinom(n=100, size=100, p=0.05),
>rbinom(n=100, size=100, p=0.05) )
> 
> qqline(rbinom(n=100,size=100,p=.05),
>distribution = function(probs) { qbinom(probs, size=100, prob=0.05) },
>col = "red",
>lwd = 0.5)
> 
> 
> 
> 
> B.
> 
> 
> > On Apr 17, 2017, at 9:15 AM, Ashim Kapoor  wrote:
> >
> > Dear Spencer,
> >
> > Okay. Many thanks. My next query is how do I use qqline?
> >
> > When I try
> >
> >> qqline(rbinom(n=100,size=100,p=.05))
> >
> > I don't get the line in the right place.
> >
> > Best Regards,
> > Ashim
> >
> > On Mon, Apr 17, 2017 at 6:31 PM, Spencer Graves <
> > spencer.gra...@effectivedefense.org> wrote:
> >
> >>
> >>
> >> On 2017-04-17 7:58 AM, Ashim Kapoor wrote:
> >>
> >>> Dear All,
> >>>
> >>> set.seed(123)
> >>> qqplot(rbinom(n=100,size=100,p=.05), rbinom(n=100,size=100,p=.05) )
> >>>
> >>> I expect to see 1 clear line,but I don't. What am I misunderstanding?
> >>>
> >>
> >>
> >>  The distribution is discrete, and points are superimposed. Try the
> >> following:
> >>
> >>
> >> set.seed(123)
> >> qqplot(jitter(rbinom(n=100,size=100,p=.05)),
> >>   jitter(rbinom(n=100,size=100,p=.05) ))
> >>
> >>
> >>  Spencer Graves
> >>
> >>>
> >>> Best Regards,
> >>> Ashim
> >>>
> >>>[[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.
> >>
> >
> >   [[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] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-18 Thread Sparks, John James
Bruce,

Do you think that you could post the final solution to the problem?  That
way it would be stored with this thread and the next person who has the
same problem would be able to locate the FINAL solution.

--JJS


On Mon, April 17, 2017 12:47 pm, BR_email wrote:
> TO _ALL_:
> THANK YOU. THANK YOU. THANK YOU.
> After hours, and hours, and hours, and ... , and hours: Success.
> To all who helped, thanks.
> My quest was minor, but major for me, as I learn from the path of one,
> whether big or small begets another.
>
> I never look down at anyone, except to help him/her up.
>
> With gratitude,
> Bruce
>
> Bruce Ratner, Ph.D.
> The Significant Statistician™
> (516) 791-3544
> Statistical Predictive Analtyics -- www.DMSTAT1.com
> Machine-Learning Data Mining and Modeling -- www.GenIQ.net
>
>
> Peter Dalgaard wrote:
>>> On 17 Apr 2017, at 19:01 , BR_email  wrote:
>>>
>>> Berend: Something looks good, but RStudio still Rprofile still doees
>>> not affect the launch.
>>>
 source(echo=TRUE, "C:/Users/BruceRatner/Documents/.Rprofile.site")
 options(prompt="R> ")
 set.seed(12345)
 rm(list=ls())
>>> R>
>>>
>>>
>>> Bruce Ratner, Ph.D.
>>> The Significant Statistician™
>>> (516) 791-3544
>>> Statistical Predictive Analtyics -- www.DMSTAT1.com
>>> Machine-Learning Data Mining and Modeling -- www.GenIQ.net
>>>
>>> Berend Hasselman wrote:
 source(echo=TRUE, ""C:/Users/BruceRatner/Documents/.Rprofile.site")
>> According to the gospel of St.Henrik, that filename is wrong, and
>> possibly the directory too.
>>
>> So try his suggestions. What is the output (show us!) of
>>
>> normalizePath("./.Rprofile")
>> normalizePath("~/.Rprofile")
>>
>> Assuming that the former is
>>
>> "C:/Users/BruceRatner/Documents/.Rprofile"
>>
>> you could try renaming the .Rprofile.site file to that. If need be, use
>> file.rename, as in
>>
>> file.rename(from="C:/Users/BruceRatner/Documents/.Rprofile.site",
>> to="C:/Users/BruceRatner/Documents/.Rprofile")
>>
>> (and restart, obviously).
>>
>> [I wouldn't set the seed in a .Rprofile file, nor would I use rm()
>> there, but that is a different kettle of fish.]
>>
>
> __
> 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] Fwd: Re: Setting .Rprofile for RStudio on a Windows 7 x64bit / Windows file extension hiding

2017-04-18 Thread Duncan Murdoch

On 17/04/2017 6:41 PM, John Nash wrote:


The very large amount of noise on this topic seems to be the result of allowing
Windows to hide file extensions. We have had to put up with millions of malware
infections because someone in M$ thought this would be a nice idea. I've seen it
cause lots of problems over the years, including among my own family.

Perhaps someone can create a check and repair that automatically turns this 
"feature" off
whenever R is run. One reason among the many why I run Linux.



MacOS does this now too, though it feels less aggressive than Windows. 
This page tells how to disable it there: 
https://support.apple.com/kb/ph19072?locale=en_US


There's little point providing a link to a Microsoft page for doing this 
on Windows, because their help page links are not very durable.  The 
main one that Google finds describes itself as obsolete.


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.


[R] Fwd: Re: Setting .Rprofile for RStudio on a Windows 7 x64bit / Windows file extension hiding

2017-04-18 Thread John Nash

The very large amount of noise on this topic seems to be the result of allowing
Windows to hide file extensions. We have had to put up with millions of malware
infections because someone in M$ thought this would be a nice idea. I've seen it
cause lots of problems over the years, including among my own family.

Perhaps someone can create a check and repair that automatically turns this 
"feature" off
whenever R is run. One reason among the many why I run Linux.

JN
__
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] Question on accessing foreign files

2017-04-18 Thread Daniel Molinari
Hi all,

I have several data files provided in mtw format (Minitab) and sdd format
(S-Plus) and I need to read them in R.

I do not have access either to Minitab or to S-Plus.

How can I accomplish this task ?

Thank you,
Daniel

[[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] Error en sql UpDate

2017-04-18 Thread Andres Hirigoyen
Gracias ya me pongo en acción

El 18 abr. 2017 8:15 AM, "Javier Marcuzzi" 
escribió:

Por las dudas



https://msdn.microsoft.com/en-us/microsoft-r/



Javier Rubén Marcuzzi



*De: *Mauricio Monsalvo 
*Enviado: *martes, 18 de abril de 2017 6:39
*Para: *Andres Hirigoyen 
*CC: *Lista R 
*Asunto: *Re: [R-es] Error en sql UpDate



Hola.

Hay unos pocos casos en los que se mencionan errores parecidos:

http://stackoverflow.com/search?q=Invalid+character+
value+for+cast+specification+RODBC

y en todos van en la dirección de tener que asegurar que ambos sistemas

estén utilizando el mismo tipo de datos. En particular, las fechas pueden

tener problemas. Recomiendan pasarlas a character.

Saludos.



El 17 de abril de 2017, 11:28, Andres Hirigoyen 

escribió:



> Buenos días,  al querer actualizar los datos de una tabla en SQL SERVER

> sale el siguiente error:

>

> Error in sqlUpdate(canal_conexion, Datos, tablename =

> "Tabla_SQL_SERVER_Actualizar",  :

>   [RODBC] Failed exec in Update22018 0 [Microsoft][ODBC SQL Server

> Driver]Invalid character value for cast specification

>

> Gracias desde ya por la ayuda.

>

> --

>

> [[alternative HTML version deleted]]

>

> ___

> R-help-es mailing list

> R-help-es@r-project.org

> https://stat.ethz.ch/mailman/listinfo/r-help-es

>







-- 

Mauricio



[[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] Error en sql UpDate

2017-04-18 Thread Javier Marcuzzi
Por las dudas

https://msdn.microsoft.com/en-us/microsoft-r/

Javier Rubén Marcuzzi

De: Mauricio Monsalvo
Enviado: martes, 18 de abril de 2017 6:39
Para: Andres Hirigoyen
CC: Lista R
Asunto: Re: [R-es] Error en sql UpDate

Hola.
Hay unos pocos casos en los que se mencionan errores parecidos:
http://stackoverflow.com/search?q=Invalid+character+value+for+cast+specification+RODBC
y en todos van en la dirección de tener que asegurar que ambos sistemas
estén utilizando el mismo tipo de datos. En particular, las fechas pueden
tener problemas. Recomiendan pasarlas a character.
Saludos.

El 17 de abril de 2017, 11:28, Andres Hirigoyen 
escribió:

> Buenos días,  al querer actualizar los datos de una tabla en SQL SERVER
> sale el siguiente error:
>
> Error in sqlUpdate(canal_conexion, Datos, tablename =
> "Tabla_SQL_SERVER_Actualizar",  :
>   [RODBC] Failed exec in Update22018 0 [Microsoft][ODBC SQL Server
> Driver]Invalid character value for cast specification
>
> Gracias desde ya por la ayuda.
>
> --
>
> [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>



-- 
Mauricio

[[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] Error en sql UpDate

2017-04-18 Thread Javier Marcuzzi
Estimado Andres Hirigoyen

Intenta guardar los datos en una nueva tabla en sql server, yo no recuerdo bien 
con que sql tuve ese problema, lo solucione guardando en una tabla temporal, 
luego un procedimiento almacenado realiza el resto y elimina la tabla temporal.

Javier Rubén Marcuzzi

De: Mauricio Monsalvo
Enviado: martes, 18 de abril de 2017 6:39
Para: Andres Hirigoyen
CC: Lista R
Asunto: Re: [R-es] Error en sql UpDate

Hola.
Hay unos pocos casos en los que se mencionan errores parecidos:
http://stackoverflow.com/search?q=Invalid+character+value+for+cast+specification+RODBC
y en todos van en la dirección de tener que asegurar que ambos sistemas
estén utilizando el mismo tipo de datos. En particular, las fechas pueden
tener problemas. Recomiendan pasarlas a character.
Saludos.

El 17 de abril de 2017, 11:28, Andres Hirigoyen 
escribió:

> Buenos días,  al querer actualizar los datos de una tabla en SQL SERVER
> sale el siguiente error:
>
> Error in sqlUpdate(canal_conexion, Datos, tablename =
> "Tabla_SQL_SERVER_Actualizar",  :
>   [RODBC] Failed exec in Update22018 0 [Microsoft][ODBC SQL Server
> Driver]Invalid character value for cast specification
>
> Gracias desde ya por la ayuda.
>
> --
>
> [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>



-- 
Mauricio

[[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] Matriz como producto de vectores.

2017-04-18 Thread rubenfcasal

Hola a todos,

Pego un trozo de una práctica de R sobre el tema (como veis está en 
formato spin: https://yihui.name/knitr/demo/stitch) por si resulta de 
interés:


#' Consideramos datos recogidos en un estudio de mejora de calidad en 
una fábrica de semiconductores.
#' Se obtuvo una muestra de obleas que se clasificaron dependiendo de si 
se encontraron partículas

#' en la matriz que producía la oblea y de si la calidad de oblea era buena
#' (Para más detalles Hall, 1994. Analysis of defectivity of 
semiconductor wafers by contigency table.

#' Proceedings of the Institute of Environmental Sciences 1, 177-183).

n <- c(320, 14, 80, 36)
particulas <- gl(2, 1, 4, labels = c("no","si"))
calidad <- gl(2, 2, labels = c("buena", "mala"))
df <- data.frame(n, particulas, calidad)
df

#' En lugar de estar en el formato de un conjunto de datos (`data.frame`)
#' puede que los datos estén en formato de tabla (`table`, `matrix`):

tabla <- xtabs(n ~ calidad + particulas)
tabla

#' Por ejemplo, si se quiere simular bajo independencia,
#' estimando las probabilidades a partir de la tabla,
#' consideraríamos:

pind <- (rowSums(tabla) %o% colSums(tabla))/(sum(tabla)^2)
matrix(pind, nrow = nrow(tabla))

rtablas <- rmultinom(ntsim, sum(n), pind) # Se fija el total de la tabla...
rtablas[ , 1:5] # Las cinco primeras simulaciones

#' Para realizar el contraste de independencia:

res <- chisq.test(tabla)
res

El 17/04/2017 a las 17:40, Carlos J. Gil Bellosta escribió:

a <- 1:4
b <- 3:6
a %*% t(b)


El 17 de abril de 2017, 17:26, Horacio  escribió:


Buenas tengo una matriz de contingencia de 5x4 donde en la última fila
y última columna tengo las frecuencias marginales, en función de estas
quiero sacar las esperadas, pero cuando hago por ejemplo el producto,,

Esperadas<-Estrategia["Suma",]*Estrategia[,"Suma_e"]
E1E2E3E4  Suma
  5550 14160 52650 89600 20720
Warning message:
In Estrategia["Suma", ] * Estrategia[, "Suma_e"] :
   longitud de objeto mayor no es múltiplo de la longitud de uno menor

me da un vector y no una matriz,,, como puedo hacer esto? no sé si se
entiende lo que busco

Gracias,,,

___
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




--
Ruben Fernandez Casal
Department of Mathematics
Faculty of Computer Science
Universidade da Coruña
Corporate email: ruben.fcasal  udc  es
--

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


Re: [R-es] Error en sql UpDate

2017-04-18 Thread Mauricio Monsalvo
Hola.
Hay unos pocos casos en los que se mencionan errores parecidos:
http://stackoverflow.com/search?q=Invalid+character+value+for+cast+specification+RODBC
y en todos van en la dirección de tener que asegurar que ambos sistemas
estén utilizando el mismo tipo de datos. En particular, las fechas pueden
tener problemas. Recomiendan pasarlas a character.
Saludos.

El 17 de abril de 2017, 11:28, Andres Hirigoyen 
escribió:

> Buenos días,  al querer actualizar los datos de una tabla en SQL SERVER
> sale el siguiente error:
>
> Error in sqlUpdate(canal_conexion, Datos, tablename =
> "Tabla_SQL_SERVER_Actualizar",  :
>   [RODBC] Failed exec in Update22018 0 [Microsoft][ODBC SQL Server
> Driver]Invalid character value for cast specification
>
> Gracias desde ya por la ayuda.
>
> --
>
> [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>



-- 
Mauricio

[[alternative HTML version deleted]]

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