Re: [R] different between read.table and read.delim

2016-12-22 Thread David Winsemius
In the future you can examine the consequence kid various choices for 
parameters with something along the lines of 

table( count.fields( file= .. ,  ... ))

Sent from my iPhone

> On Dec 22, 2016, at 9:13 PM, Jinsong Zhao  wrote:
> 
>> On 2016/12/23 11:31, Sarah Goslee wrote:
>> Look at the default arguments to each, especially the quote argument.
>> 
>> Sarah
>> 
> 
> Thank you very much!
> 
> The quote and fill argument are not same for the two function. only change 
> quote or fill can not make read.table() work.
> 
> Best,
> Jinsong
> 
>>> On Thu, Dec 22, 2016 at 10:24 PM, Jinsong Zhao  wrote:
>>> Hi there,
>>> 
>>> I have a data set file, called "ecotox.rep", which is a delimited file
>>> separated with "|".
>>> 
>>> When I tried to read the file with the following command,
>>> 
 df <- read.table("ecotox.rep", sep = "|", header = TRUE,
 stringsAsFactors=FALSE)
>>> 
>>> I got the error messages:
>>> 
>>> Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec,
>>> :
>>>  line 113 did not have 87 elements
>>> 
>>> However, when I read the file with the following command,
>>> 
 df <- read.delim("ecotox.rep", sep = "|", header = TRUE,
 stringsAsFactors=FALSE)
>>> 
>>> I got a correct output.
>>> 
>>> If I understand correctly, read.delim() is just wrapped from read.table(),
>>> why read.delim() works, but read.table() doesn't.
>>> 
>>> Thanks in advance.
>>> 
>>> Best,
>>> Jinsong
> 
> __
> 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 between read.table and read.delim

2016-12-22 Thread Jinsong Zhao

On 2016/12/23 11:31, Sarah Goslee wrote:

Look at the default arguments to each, especially the quote argument.

Sarah



Thank you very much!

The quote and fill argument are not same for the two function. only 
change quote or fill can not make read.table() work.


Best,
Jinsong


On Thu, Dec 22, 2016 at 10:24 PM, Jinsong Zhao  wrote:

Hi there,

I have a data set file, called "ecotox.rep", which is a delimited file
separated with "|".

When I tried to read the file with the following command,


df <- read.table("ecotox.rep", sep = "|", header = TRUE,
stringsAsFactors=FALSE)


I got the error messages:

Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec,
:
  line 113 did not have 87 elements

However, when I read the file with the following command,


df <- read.delim("ecotox.rep", sep = "|", header = TRUE,
stringsAsFactors=FALSE)


I got a correct output.

If I understand correctly, read.delim() is just wrapped from read.table(),
why read.delim() works, but read.table() doesn't.

Thanks in advance.

Best,
Jinsong


__
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 between read.table and read.delim

2016-12-22 Thread Sarah Goslee
Look at the default arguments to each, especially the quote argument.

Sarah

On Thu, Dec 22, 2016 at 10:24 PM, Jinsong Zhao  wrote:
> Hi there,
>
> I have a data set file, called "ecotox.rep", which is a delimited file
> separated with "|".
>
> When I tried to read the file with the following command,
>
>> df <- read.table("ecotox.rep", sep = "|", header = TRUE,
>> stringsAsFactors=FALSE)
>
> I got the error messages:
>
> Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec,
> :
>   line 113 did not have 87 elements
>
> However, when I read the file with the following command,
>
>> df <- read.delim("ecotox.rep", sep = "|", header = TRUE,
>> stringsAsFactors=FALSE)
>
> I got a correct output.
>
> If I understand correctly, read.delim() is just wrapped from read.table(),
> why read.delim() works, but read.table() doesn't.
>
> Thanks in advance.
>
> Best,
> Jinsong
>

__
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] different between read.table and read.delim

2016-12-22 Thread Jinsong Zhao

Hi there,

I have a data set file, called "ecotox.rep", which is a delimited file 
separated with "|".


When I tried to read the file with the following command,

> df <- read.table("ecotox.rep", sep = "|", header = TRUE, 
stringsAsFactors=FALSE)


I got the error messages:

Error in scan(file = file, what = what, sep = sep, quote = quote, dec = 
dec,  :

  line 113 did not have 87 elements

However, when I read the file with the following command,

> df <- read.delim("ecotox.rep", sep = "|", header = TRUE, 
stringsAsFactors=FALSE)


I got a correct output.

If I understand correctly, read.delim() is just wrapped from 
read.table(), why read.delim() works, but read.table() doesn't.


Thanks in advance.

Best,
Jinsong

__
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 to scale circle sizes in VennDiagram using draw.triple.venn

2016-12-22 Thread Ulrik Stervbo
Hi Yung-Chih,

This works for me:

library(Vennerable)
data("StemCell")

venn_res <- Venn(StemCell[1:3])
plot(venn_res, doWeights = TRUE)

HTH
Ulrik

On Thu, 22 Dec 2016 at 20:54 Yung-Chih Lai  wrote:

> Hi Ulrik,
>
> It seems that VennDiagram cannot draw weighted diagrams. Many thanks for
> your information.
>
> Best,
>
> Gary
>
> On Fri, Dec 16, 2016 at 4:09 PM, Ulrik Stervbo 
> wrote:
>
> I usually use the package Vennerable for all my Venn needs. It also has
> the option to draw weighted diagrams.
>
> HTH
> Ulrik
>
> Yung-Chih Lai  schrieb am Fr., 16. Dez. 2016,
> 21:40:
>
> Hi,
>
>
> The below is the command I used to create a Venn diagram with three sets.
> However, the three circle sizes are the same. Could you show me how to
> adjust the circle size based on the area size? Many thanks.
>
> grid.newpage()
>
> draw.triple.venn(area1 = 9737, area2 = 13329, area3 = 6300, n12 = 8612, n23
> = 6176, n13 = 5781, n123 = 5748, category = c("G8_13", "G8_14", "G8_15"),
> lty = "blank", fill = c("pink", "light blue", "orange"))
>
>
> Best,
>
>
> Gary
>
> [[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] How to scale circle sizes in VennDiagram using draw.triple.venn

2016-12-22 Thread Yung-Chih Lai
Hi Ulrik,

It seems that VennDiagram cannot draw weighted diagrams. Many thanks for
your information.

Best,

Gary

On Fri, Dec 16, 2016 at 4:09 PM, Ulrik Stervbo 
wrote:

> I usually use the package Vennerable for all my Venn needs. It also has
> the option to draw weighted diagrams.
>
> HTH
> Ulrik
>
> Yung-Chih Lai  schrieb am Fr., 16. Dez. 2016,
> 21:40:
>
>> Hi,
>>
>>
>> The below is the command I used to create a Venn diagram with three sets.
>> However, the three circle sizes are the same. Could you show me how to
>> adjust the circle size based on the area size? Many thanks.
>>
>> grid.newpage()
>>
>> draw.triple.venn(area1 = 9737, area2 = 13329, area3 = 6300, n12 = 8612,
>> n23
>> = 6176, n13 = 5781, n123 = 5748, category = c("G8_13", "G8_14", "G8_15"),
>> lty = "blank", fill = c("pink", "light blue", "orange"))
>>
>>
>> Best,
>>
>>
>> Gary
>>
>> [[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.


[R] gamlss question

2016-12-22 Thread George Trojan - NOAA Federal
What is the recommended way of accessing distribution parameters (mu,
sigma, ...) from the model fit? The indention is to use those values in
d/p/q/r calls. I came out with a wrapper

gamlss_fit <- function(x, family) {
fit <- gamlssML(x, family = family)
mu <- fitted(fit, "mu")[1]
sigma <- fitted(fit, "sigma")[1]
nu <- ifelse("nu" %in% fit$parameters, fitted(fit, "nu")[1], NA)
tau <- ifelse("tau" %in% fit$parameters, fitted(fit, "tau")[1], NA)
list(mu = mu, sigma = sigma, nu = nu, tau = tau)
}

Alternatively, I could write functions to emulate logspline calls to
density estimation.

I suspect I must be missing something obvious. I am relatively new to R.

George

[[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] histogram first bar wrong position

2016-12-22 Thread Ted Harding
Willam has listed the lid on the essence of the problem, which is
that in R the way that breaks (and therefore counts) in a histogram
are evaluated is an area of long grass with lurking snakes!

To get a glimpse of this, have a look at
  ?hist
and in the seaction "Arguments", look at "breaks", "freq", "right".
Also see under "Details".

and, as suggested under "See also", look at
  ?nclass.Sturges

As William suggests, if you know what claa intervals you want,
create them yourself! For your example (with N=100), look at:

   hist(y,freq=TRUE, col='red', breaks=0.5+(0:6))

or

   hist(y,freq=TRUE, col='red', breaks=0.25+(0:12)/2)

Hoping this helps!
Best wishes,
Ted.


On 22-Dec-2016 16:36:34 William Dunlap via R-help wrote:
> Looking at the return value of hist will show you what is happening:
> 
>> x <- rep(1:6,10*(6:1))
>> z <- hist(x, freq=TRUE)
>> z
> $breaks
>  [1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
> 
> $counts
>  [1] 60 50  0 40  0 30  0 20  0 10
> ...
> 
> The the first bin is [1-1.5], including both endpoints, while the other
> bins include only the upper endpoint.  I recommend defining your
> own breakpoints, ones don't include possible data points, as in
> 
>> print(hist(x, breaks=seq(min(x)-0.5, max(x)+0.5, by=1), freq=TRUE))
> $breaks
> [1] 0.5 1.5 2.5 3.5 4.5 5.5 6.5
> 
> $counts
> [1] 60 50 40 30 20 10
> ...
> 
> S+ had a 'factor' method for hist() that did this sort of thing, but R does
> not.
> 
> 
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
> 
> On Thu, Dec 22, 2016 at 5:17 AM, itpro  wrote:
> 
>> Hi, everyone.
>>
>>
>> I stumbled upon weird histogram behaviour.
>>
>> Consider this "dice emulator":
>> Step 1: Generate uniform random array x of size N.
>> Step 2: Multiply each item by six and round to next bigger integer to get
>> numbers 1 to 6.
>> Step 3: Plot histogram.
>>
>> > x<-runif(N)
>> > y<-ceiling(x*6)
>> > hist(y,freq=TRUE, col='orange')
>>
>>
>> Now what I get with N=10
>>
>> > x<-runif(10)
>> > y<-ceiling(x*6)
>> > hist(y,freq=TRUE, col='green')
>>
>> At first glance looks OK.
>>
>> Now try N=100
>>
>> > x<-runif(100)
>> > y<-ceiling(x*6)
>> > hist(y,freq=TRUE, col='red')
>>
>> Now first bar is not where it should be.
>> Hmm. Look again to 10 histogram... First bar is not where I want it,
>> it's only less striking due to narrow bars.
>>
>> So, first bar is always in wrong position. How do I fix it to make
>> perfectly spaced bars?
>>
>>
>>
>>
>>
>>
>> __
>> 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.

-
E-Mail: (Ted Harding) 
Date: 22-Dec-2016  Time: 17:23:26
This message was sent by XFMail

__
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] histogram first bar wrong position

2016-12-22 Thread William Dunlap via R-help
As a practical matter, 'continuous' data must be discretized, so if you
have long vectors of it you will run into this problem.

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Thu, Dec 22, 2016 at 8:19 AM, Martin Maechler  wrote:

> > itpro  
> > on Thu, 22 Dec 2016 16:17:28 +0300 writes:
>
> > Hi, everyone.
> > I stumbled upon weird histogram behaviour.
>
> > Consider this "dice emulator":
> > Step 1: Generate uniform random array x of size N.
> > Step 2: Multiply each item by six and round to next bigger integer
> to get numbers 1 to 6.
> > Step 3: Plot histogram.
>
> >> x<-runif(N)
> >> y<-ceiling(x*6)
> >> hist(y,freq=TRUE, col='orange')
>
>
> > Now what I get with N=10
>
> >> x<-runif(10)
> >> y<-ceiling(x*6)
> >> hist(y,freq=TRUE, col='green')
>
> > At first glance looks OK.
>
> > Now try N=100
>
> >> x<-runif(100)
> >> y<-ceiling(x*6)
> >> hist(y,freq=TRUE, col='red')
>
> > Now first bar is not where it should be.
> > Hmm. Look again to 10 histogram... First bar is not where I want
> it, it's only less striking due to narrow bars.
>
> > So, first bar is always in wrong position. How do I fix it to make
> perfectly spaced bars?
>
> Don't use histograms *at all* for such discrete integer data.
>
>  N <- rpois(100, 5)
>  plot(table(N), lwd = 4)
>
> Histograms should be only be used for continuous data (or discrete data
> with "many" possible values).
>
> It's a pain to see them so often "misused" for data like the 'N' above.
>
> Martin Maechler,
> ETH Zurich
>
> __
> 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] histogram first bar wrong position

2016-12-22 Thread William Dunlap via R-help
Looking at the return value of hist will show you what is happening:

> x <- rep(1:6,10*(6:1))
> z <- hist(x, freq=TRUE)
> z
$breaks
 [1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0

$counts
 [1] 60 50  0 40  0 30  0 20  0 10
...

The the first bin is [1-1.5], including both endpoints, while the other
bins include only the upper endpoint.  I recommend defining your
own breakpoints, ones don't include possible data points, as in

> print(hist(x, breaks=seq(min(x)-0.5, max(x)+0.5, by=1), freq=TRUE))
$breaks
[1] 0.5 1.5 2.5 3.5 4.5 5.5 6.5

$counts
[1] 60 50 40 30 20 10
...

S+ had a 'factor' method for hist() that did this sort of thing, but R does
not.


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Thu, Dec 22, 2016 at 5:17 AM, itpro  wrote:

> Hi, everyone.
>
>
> I stumbled upon weird histogram behaviour.
>
> Consider this "dice emulator":
> Step 1: Generate uniform random array x of size N.
> Step 2: Multiply each item by six and round to next bigger integer to get
> numbers 1 to 6.
> Step 3: Plot histogram.
>
> > x<-runif(N)
> > y<-ceiling(x*6)
> > hist(y,freq=TRUE, col='orange')
>
>
> Now what I get with N=10
>
> > x<-runif(10)
> > y<-ceiling(x*6)
> > hist(y,freq=TRUE, col='green')
>
> At first glance looks OK.
>
> Now try N=100
>
> > x<-runif(100)
> > y<-ceiling(x*6)
> > hist(y,freq=TRUE, col='red')
>
> Now first bar is not where it should be.
> Hmm. Look again to 10 histogram... First bar is not where I want it,
> it's only less striking due to narrow bars.
>
> So, first bar is always in wrong position. How do I fix it to make
> perfectly spaced bars?
>
>
>
>
>
>
> __
> 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] "Patched " version listed on CRAN mirrors is actually Oct RC version

2016-12-22 Thread David Winsemius

> On Dec 22, 2016, at 5:25 AM, Watson, David W. (MSFC-ES62) 
>  wrote:
> 
> I downloaded the file 
> R-3.3-branch-mavericks-sa-x86_64.tar.gz
>  from http://r.research.att.com and unpacked it. What was downloaded was R 
> version 3.3.2 RC (2016-10-26 r71594), not the advertised patched version.

Usually it is the case that the versions at CRAN and at the r.research.att.com 
site are the same. It appears that Simon forgot to update his own site when he 
pushed the current version to CRAN. As I showed in my earlier posting 
yesterday, the CRAN site delivers a more recent version. I suspect it does not 
have a Patched label because it was the final release and has not been modified 
since then.

> R.version[["svn rev"]]
[1] "71607"


You should be posting any further responses to R-SIG-Mac.


-- 
The other David W.


> 
> 
> 
> David Watson
> NASA - MSFC
> Mail Code ES62
> Phone 256-544-1300
> FAX   256-544-2964
> david.w.wat...@nasa.gov
> 
> 
> 
> 
> 
> 
> On Dec 22, 2016, at 2:47 AM, Erich Subscriptions 
> > wrote:
> 
> Current builds for R for Macs are available from
> http://r.research.att.com
> 
> On 22 Dec 2016, at 07:45, Berend Hasselman  wrote:
> 
> 
> On 21 Dec 2016, at 14:23, Watson, David W. (MSFC-ES62) 
>  wrote:
> 
> I have been trying to download the “patched” version of 3.3.2 for Mac from 
> CRAN, but the version that gets delivered is actually the October Release 
> Candidate version,
> (R version 3.3.2 RC (2016-10-26 r71594). It has been doing this since 3.3.2 
> has been released. Is there a real patched version somewhere?
> 
> 
> 
> Send this message to the R-SIG-Mac mailinglist. More likely to get response.
> 
> Berend Hasselman
> 
> David Watson
> NASA - MSFC
> Mail Code ES62
> Phone 256-544-1300
> FAX   256-544-2964
> david.w.wat...@nasa.gov
> 
> 
> [[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.
> 
> 
>   [[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] histogram first bar wrong position

2016-12-22 Thread Martin Maechler
> itpro  
> on Thu, 22 Dec 2016 16:17:28 +0300 writes:

> Hi, everyone.
> I stumbled upon weird histogram behaviour.

> Consider this "dice emulator":
> Step 1: Generate uniform random array x of size N.
> Step 2: Multiply each item by six and round to next bigger integer to get 
numbers 1 to 6.
> Step 3: Plot histogram.

>> x<-runif(N)
>> y<-ceiling(x*6)
>> hist(y,freq=TRUE, col='orange')


> Now what I get with N=10

>> x<-runif(10)
>> y<-ceiling(x*6)
>> hist(y,freq=TRUE, col='green')

> At first glance looks OK.

> Now try N=100

>> x<-runif(100)
>> y<-ceiling(x*6)
>> hist(y,freq=TRUE, col='red')

> Now first bar is not where it should be.
> Hmm. Look again to 10 histogram... First bar is not where I want it, 
it's only less striking due to narrow bars.

> So, first bar is always in wrong position. How do I fix it to make 
perfectly spaced bars?

Don't use histograms *at all* for such discrete integer data.

 N <- rpois(100, 5)
 plot(table(N), lwd = 4)

Histograms should be only be used for continuous data (or discrete data
with "many" possible values).

It's a pain to see them so often "misused" for data like the 'N' above.

Martin Maechler,
ETH Zurich

__
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] histogram first bar wrong position

2016-12-22 Thread itpro
Hi, everyone.


I stumbled upon weird histogram behaviour.

Consider this "dice emulator":
Step 1: Generate uniform random array x of size N.
Step 2: Multiply each item by six and round to next bigger integer to get 
numbers 1 to 6.
Step 3: Plot histogram.

> x<-runif(N)
> y<-ceiling(x*6)
> hist(y,freq=TRUE, col='orange')


Now what I get with N=10

> x<-runif(10)
> y<-ceiling(x*6)
> hist(y,freq=TRUE, col='green')

At first glance looks OK.

Now try N=100

> x<-runif(100)
> y<-ceiling(x*6)
> hist(y,freq=TRUE, col='red')

Now first bar is not where it should be.
Hmm. Look again to 10 histogram... First bar is not where I want it, it's 
only less striking due to narrow bars.

So, first bar is always in wrong position. How do I fix it to make perfectly 
spaced bars?





__
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] Any help on R code interpretation?

2016-12-22 Thread Rui Barradas

Hello,

t() is the transpose function, it computes the transpose of matrix

with(subset(data,site!='AB'),cbind(1,
site=='BC', site =='MM', site =='XY',Temp,Treatment=='Local'))

then %*% is matrix multiplication. If you have doubts on the result, 
compute as.matrix(mod7)%*%t(...) outside the call to plogis.


And no, the two codes do not give the same results. Read the help page 
?plogis to find out the arguments to that function.


Hope this helps,

Rui Barradas

Em 22-12-2016 13:08, Marna Wagley escreveu:

HI R user,
I was looking a r code and saw "%*%t", what does it("%*%t") mean?. The
example is given below.

For example: here is the code where "%*%t" has been used. when I run the
formula but did not run in my data.

prediction=plogis(as.matrix(mod7)%*%t(with(subset(data,site!='AB'),cbind(1,
site=='BC', site =='MM', site =='XY',Temp,Treatment=='Local'

Can I get the same result of above using the following code? Do both codes
give same results?

ab<-with(subset(data,site!='AB'),cbind(1,site=='BC', site =='MM', site ==
'XY',Temp,Treatment=='Local'))
prediction =plogis(as.matrix(mod7),(ab))

Thanks,

MW

[[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] "Patched " version listed on CRAN mirrors is actually Oct RC version

2016-12-22 Thread Erich Subscriptions
Current builds for R for Macs are available from
http://r.research.att.com

> On 22 Dec 2016, at 07:45, Berend Hasselman  wrote:
> 
> 
>> On 21 Dec 2016, at 14:23, Watson, David W. (MSFC-ES62) 
>>  wrote:
>> 
>> I have been trying to download the “patched” version of 3.3.2 for Mac from 
>> CRAN, but the version that gets delivered is actually the October Release 
>> Candidate version,
>> (R version 3.3.2 RC (2016-10-26 r71594). It has been doing this since 3.3.2 
>> has been released. Is there a real patched version somewhere?
>> 
> 
> 
> Send this message to the R-SIG-Mac mailinglist. More likely to get response.
> 
> Berend Hasselman
> 
>> David Watson
>> NASA - MSFC
>> Mail Code ES62
>> Phone 256-544-1300
>> FAX   256-544-2964
>> david.w.wat...@nasa.gov
>> 
>> 
>>  [[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-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] "Patched " version listed on CRAN mirrors is actually Oct RC version

2016-12-22 Thread Watson, David W. (MSFC-ES62)
I downloaded the file 
R-3.3-branch-mavericks-sa-x86_64.tar.gz
 from http://r.research.att.com and unpacked it. What was downloaded was R 
version 3.3.2 RC (2016-10-26 r71594), not the advertised patched version.



David Watson
NASA - MSFC
Mail Code ES62
Phone 256-544-1300
FAX   256-544-2964
david.w.wat...@nasa.gov






On Dec 22, 2016, at 2:47 AM, Erich Subscriptions 
> wrote:

Current builds for R for Macs are available from
http://r.research.att.com

On 22 Dec 2016, at 07:45, Berend Hasselman  wrote:


On 21 Dec 2016, at 14:23, Watson, David W. (MSFC-ES62) 
 wrote:

I have been trying to download the “patched” version of 3.3.2 for Mac from 
CRAN, but the version that gets delivered is actually the October Release 
Candidate version,
(R version 3.3.2 RC (2016-10-26 r71594). It has been doing this since 3.3.2 has 
been released. Is there a real patched version somewhere?



Send this message to the R-SIG-Mac mailinglist. More likely to get response.

Berend Hasselman

David Watson
NASA - MSFC
Mail Code ES62
Phone 256-544-1300
FAX   256-544-2964
david.w.wat...@nasa.gov


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


[[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] Any help on R code interpretation?

2016-12-22 Thread Bert Gunter
?"%*%"
?t

It looks like you need to spend some (more) time with an R tutorial or
two to understand basic R syntax. Please do so before posting further
here. There are many good ones on the web.

-- 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 Thu, Dec 22, 2016 at 5:08 AM, Marna Wagley  wrote:
> HI R user,
> I was looking a r code and saw "%*%t", what does it("%*%t") mean?. The
> example is given below.
>
> For example: here is the code where "%*%t" has been used. when I run the
> formula but did not run in my data.
>
> prediction=plogis(as.matrix(mod7)%*%t(with(subset(data,site!='AB'),cbind(1,
> site=='BC', site =='MM', site =='XY',Temp,Treatment=='Local'
>
> Can I get the same result of above using the following code? Do both codes
> give same results?
>
> ab<-with(subset(data,site!='AB'),cbind(1,site=='BC', site =='MM', site ==
> 'XY',Temp,Treatment=='Local'))
> prediction =plogis(as.matrix(mod7),(ab))
>
> Thanks,
>
> MW
>
> [[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] Reshape to wide format

2016-12-22 Thread Miluji Sb
Apologies for the late reply. Thank you very much!

I get the following warnings. If I modify the code to add both month and
year as part of the ID, will it still be correct?

df$ID<-paste(df$iso3,df$lon,df$lat,df$year,df$month,sep="")

wide <- reshape(df, v.names="precip", timevar="ID", idvar="month",
direction="wide",  drop=c("iso3", "lon", "lat", "year"))

Sincerely,

Milu

warnings()
Warning messages:
1: In reshapeWide(data, idvar = idvar, timevar = timevar,  ... :
  some constant variables (year) are really varying
2: In reshapeWide(data, idvar = idvar, timevar = timevar,  ... :
  multiple rows match for ID=AFG6132: first taken
3: In reshapeWide(data, idvar = idvar, timevar = timevar,  ... :
  multiple rows match for ID=AFG6133: first taken
4: In reshapeWide(data, idvar = idvar, timevar = timevar,  ... :
  multiple rows match for ID=AFG6134: first taken

On Tue, Dec 13, 2016 at 6:21 PM, David L Carlson  wrote:

> You can also use function reshape() in stats:
>
> temp$ID<-paste(temp$iso3,temp$lon,temp$lat,sep="")
> wide <- reshape(temp, v.names="precip", timevar="ID", idvar="month",
>  direction="wide",  drop=c("iso3", "lon", "lat", "dm"))
> wide
>
>month precip.AFG6132 precip.AFG6133
> 1  1  0.99666581.133129032
> 2  2  0.15671170.355208276
> 3  3  0.24247740.307277419
> 4  4  0.0000.008316000
> 5  5  0.0000.0
> 6  6  0.0000.0
> 7  7  0.0000.0
> 8  8  0.0000.000836129
> 9  9  0.000 NA
> 1010  0.000 NA
> 1111  0.1215360 NA
> 1212  0.3886606 NA
>
> -
> David L Carlson
> Department of Anthropology
> Texas A University
> College Station, TX 77840-4352
>
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jim Lemon
> Sent: Tuesday, December 13, 2016 2:59 AM
> To: Miluji Sb; r-help mailing list
> Subject: Re: [R] Reshape to wide format
>
> Hi Milu,
> I may have the wrong idea, but is this what you want?
>
> temp$ID<-paste(temp$iso3,temp$lon,temp$lat,sep="")
> library(prettyR)
> newtemp<-stretch_df(temp,"month","precip")[,c(5,7,8)]
> names(newtemp)<-c("month",unique(temp$ID))
>
> Jim
>
>
> On Tue, Dec 13, 2016 at 4:10 AM, Miluji Sb  wrote:
> > Dear all,
> >
> > I have the following monthly data by coordinates:
> >
> > I would like to reshape this data to wide format so that each column is a
> > coordinate and each row is a month,
> >
> > coordinate1 coordinate2 coordinate3...
> > Month 1
> > Month 2
> >
> > Is the best option to concatenate the iso3, lon, and lat variables to
> > create an ID variable? I realize that this question might be very basic
> but
> > I'm slightly baffled. Thank you.
> >
> > temp <- dput(head(precip_2000,20))
> > structure(list(iso3 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
> > 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("AFG",
> > "AGO", "ALB", "ARE", "ARG", "ARM", "AUS", "AUT", "AZE", "BDI",
> > "BEL", "BEN", "BFA", "BGD", "BGR", "BHS", "BIH", "BLR", "BLZ",
> > "BOL", "BRA", "BRN", "BTN", "BWA", "CAF", "CAN", "CHE", "CHL",
> > "CHN", "CIV", "CMR", "COD", "COG", "COL", "CRI", "CUB", "CYP",
> > "CZE", "DEU", "DJI", "DNK", "DOM", "DZA", "ECU", "EGY", "ERI",
> > "ESH", "ESP", "EST", "ETH", "FIN", "FJI", "FLK", "FRA", "GAB",
> > "GBR", "GEO", "GHA", "GIN", "GNB", "GNQ", "GRC", "GRL", "GTM",
> > "GUF", "GUY", "HND", "HRV", "HTI", "HUN", "IDN", "IND", "IRL",
> > "IRN", "IRQ", "ISL", "ISR", "ITA", "JAM", "JOR", "JPN", "KAZ",
> > "KEN", "KGZ", "KHM", "KIR", "KOR", "KWT", "LAO", "LBN", "LBR",
> > "LBY", "LCA", "LKA", "LSO", "LTU", "LUX", "LVA", "MAR", "MDA",
> > "MDG", "MEX", "MKD", "MLI", "MMR", "MNE", "MNG", "MOZ", "MRT",
> > "MWI", "MYS", "NAM", "NCL", "NER", "NGA", "NIC", "NLD", "NOR",
> > "NPL", "NZL", "OMN", "PAK", "PAN", "PER", "PHL", "PNG", "POL",
> > "PRI", "PRK", "PRT", "PRY", "QAT", "ROU", "RUS", "RWA", "SAU",
> > "SDN", "SEN", "SJM", "SLB", "SLE", "SLV", "SOM", "SRB", "SUR",
> > "SVK", "SVN", "SWE", "SWZ", "SYR", "TCD", "TGO", "THA", "TJK",
> > "TKM", "TLS", "TUN", "TUR", "TWN", "TZA", "UGA", "UKR", "URY",
> > "USA", "UZB", "VEN", "VNM", "VUT", "YEM", "ZAF", "ZMB", "ZWE"
> > ), class = "factor"), lon = c(61L, 61L, 61L, 61L, 61L, 61L, 61L,
> > 61L, 61L, 61L, 61L, 61L, 61L, 61L, 61L, 61L, 61L, 61L, 61L, 61L
> > ), lat = c(32L, 32L, 32L, 32L, 32L, 32L, 32L, 32L, 32L, 32L,
> > 32L, 32L, 33L, 33L, 33L, 33L, 33L, 33L, 33L, 33L), dm = structure(c(1L,
> > 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 2L, 3L, 4L, 1L, 5L, 6L, 7L,
> > 8L, 9L, 10L, 11L), .Label = c("2000m1", "2000m10", "2000m11",
> > "2000m12", "2000m2", "2000m3", "2000m4", "2000m5", "2000m6",
> > "2000m7", "2000m8", "2000m9"), class = "factor"), month = c(1L,
> > 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 4L,
> > 5L, 6L, 7L, 8L), 

Re: [R] Any help on R code interpretation?

2016-12-22 Thread Ben Tupper
Hi,

It's a bit hard to read what you have provided (don't forget that code pasted 
into emails on this list are best rendered if the email client is configured 
for plain text not html), but I suspect that it there is no %*%t. Instead, I 
think it should look like...

x %*% t(y)

where your x is 'mod7' and your y is all that other stuff. You might try ...

prediction = plogis( as.matrix( mod7 %*% t(ab) ) )

but that's just a guess.

Ben


> On Dec 22, 2016, at 8:08 AM, Marna Wagley  wrote:
> 
> HI R user,
> I was looking a r code and saw "%*%t", what does it("%*%t") mean?. The
> example is given below.
> 
> For example: here is the code where "%*%t" has been used. when I run the
> formula but did not run in my data.
> 
> prediction=plogis(as.matrix(mod7)%*%t(with(subset(data,site!='AB'),cbind(1,
> site=='BC', site =='MM', site =='XY',Temp,Treatment=='Local'
> 
> Can I get the same result of above using the following code? Do both codes
> give same results?
> 
> ab<-with(subset(data,site!='AB'),cbind(1,site=='BC', site =='MM', site ==
> 'XY',Temp,Treatment=='Local'))
> prediction =plogis(as.matrix(mod7),(ab))
> 
> Thanks,
> 
> MW
> 
>   [[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

__
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] Any help on R code interpretation?

2016-12-22 Thread Thierry Onkelinx
Dear Marna,

It's a combinations of two functions: %*% and t()
help("%*%") and help("t") will open their helpfiles.

Best regards,

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

2016-12-22 14:08 GMT+01:00 Marna Wagley :

> HI R user,
> I was looking a r code and saw "%*%t", what does it("%*%t") mean?. The
> example is given below.
>
> For example: here is the code where "%*%t" has been used. when I run the
> formula but did not run in my data.
>
> prediction=plogis(as.matrix(mod7)%*%t(with(subset(data,
> site!='AB'),cbind(1,
> site=='BC', site =='MM', site =='XY',Temp,Treatment=='Local'
>
> Can I get the same result of above using the following code? Do both codes
> give same results?
>
> ab<-with(subset(data,site!='AB'),cbind(1,site=='BC', site =='MM', site ==
> 'XY',Temp,Treatment=='Local'))
> prediction =plogis(as.matrix(mod7),(ab))
>
> Thanks,
>
> MW
>
> [[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.


[R] Any help on R code interpretation?

2016-12-22 Thread Marna Wagley
HI R user,
I was looking a r code and saw "%*%t", what does it("%*%t") mean?. The
example is given below.

For example: here is the code where "%*%t" has been used. when I run the
formula but did not run in my data.

prediction=plogis(as.matrix(mod7)%*%t(with(subset(data,site!='AB'),cbind(1,
site=='BC', site =='MM', site =='XY',Temp,Treatment=='Local'

Can I get the same result of above using the following code? Do both codes
give same results?

ab<-with(subset(data,site!='AB'),cbind(1,site=='BC', site =='MM', site ==
'XY',Temp,Treatment=='Local'))
prediction =plogis(as.matrix(mod7),(ab))

Thanks,

MW

[[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] Tomas Kalibera joins the R core team

2016-12-22 Thread Martin Maechler
We are very happy to announce that

Tomas Kalibera (e.g. https://github.com/kalibera )

has joined the R core team (on Dec 17).  He has been a
contributor to the R source with numerous improvements
since mid 2014. 

Note that he's been among the five newly elected
ordinary members of the R Foundation in early November,
https://stat.ethz.ch/pipermail/r-announce/2016/000609.html


For the R core team, 
Martin Maechler, ETH Zurich

___
r-annou...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-announce

__
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] creating possible cominations of a vector's elements

2016-12-22 Thread William Michels via R-help
Hi Dmitri,

> hoyt <- unlist(strsplit("how are you today", split="\\s"))
> y <- list()
> for(j in seq_along(hoyt))  y[[j]] <- sapply(combn(length(hoyt), j, 
> simplify=F, function(i) hoyt[i]), paste, collapse = " ")

> y

[[1]]
[1] "how"   "are"   "you"   "today"
[[2]]
[1] "how are"   "how you"   "how today" "are you"   "are today" "you today"
[[3]]
[1] "how are you"   "how are today" "how you today" "are you today"
[[4]]
[1] "how are you today"

>

It was unclear if you wanted combinations (per your subject line), or
consecutive-word substrings (per your example). The code above returns
combinations.

If you actually want a third output--permutations--you'll have to look
at the permn() function in the "combinat" package, authored by Scott
Chasalow and maintained by Vince Carey.

Cheers,

Bill
William Michels, Ph.D.


On Fri, Dec 9, 2016 at 7:52 AM, Dimitri Liakhovitski
 wrote:
> Thanks a lot, David and Bill!
>
>
> On Thu, Dec 8, 2016 at 8:16 PM, David L Carlson  wrote:
>> Not my day. Another correction:
>>
>> makestrings <- function(vec) {
>>  len <- length(vec)
>>  idx <- expand.grid(1:len, 1:len)
>>  idx <- idx[idx$Var2 <= idx$Var1, c("Var2", "Var1")]
>>  mapply(function(x, y) paste(vec[x:y], collapse=" "),
>>   x=idx[, 1], y=idx[, 2])
>> }
>>
>> David C
>>
>> -Original Message-
>> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of David L 
>> Carlson
>> Sent: Thursday, December 8, 2016 7:12 PM
>> To: Dimitri Liakhovitski ; r-help 
>> 
>> Subject: Re: [R] creating possible cominations of a vector's elements
>>
>> This corrects an error in my earlier function definition:
>>
>> makestrings <- function(vec) {
>>  len <- length(mystring.spl)
>>  idx <- expand.grid(1:len, 1:len)
>>  idx <- idx[idx$Var2 <= idx$Var1, c("Var2", "Var1")]
>>  mapply(function(x, y) paste(vec[x:y], collapse=" "),
>>   x=idx[, 1], y=idx[, 2])
>> }
>>
>> David C
>>
>> -Original Message-
>> From: David L Carlson
>> Sent: Thursday, December 8, 2016 5:51 PM
>> To: 'Dimitri Liakhovitski' ; r-help 
>> 
>> Subject: RE: [R] creating possible cominations of a vector's elements
>>
>> You can use expand.grid() and mapply():
>>
>> mystring <- "this is my vector"
>> mystring.spl <- strsplit(mystring, " ")[[1]]
>>
>> makestrings <- function(x) {
>>  len <- length(mystring.spl)
>>  idx <- expand.grid(1:len, 1:len)
>>  idx <- idx[idx$Var2 <= idx$Var1, c("Var2", "Var1")]
>>  mapply(function(x, y) paste(mystring.spl[x:y], collapse=" "),
>>   x=idx[, 1], y=idx[, 2])
>> }
>> makestrings(mystring.spl)
>>
>>  [1] "this"  "this is"   "this is my"
>>  [4] "this is my vector" "is""is my"
>>  [7] "is my vector"  "my""my vector"
>> [10] "vector"
>>
>> This makes a vector of strings but if you want a list use as.list(mapply())
>>
>> David L. Carlson
>> Department of Anthropology
>> Texas A University
>>
>>
>>
>> -Original Message-
>> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Dimitri 
>> Liakhovitski
>> Sent: Thursday, December 8, 2016 5:03 PM
>> To: r-help 
>> Subject: [R] creating possible cominations of a vector's elements
>>
>> Hello!
>>
>> I have a vector of strings 'x' that was based on a longer string
>> 'mystring' (the actual length of x is unknown).
>>
>> mystring <- "this is my vector"
>> x <- strsplit(mystr, " ")[[1]]
>>
>> I am looking for an elegant way of creating an object (e.g., a list)
>> that contains the following strings:
>>
>> "this"
>> "this is"
>> "this is my"
>> "this is my vector"
>> "is"
>> "is my"
>> "is my vector"
>> "my"
>> "my vector"
>> "vector"
>>
>> Thanks a lot!
>>
>> --
>> Dimitri
>>
>> __
>> 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.
>
>
>
> --
> 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

[R] [R-pkgs] gpuR 1.2.0 released

2016-12-22 Thread Charles Determan
Dear R users,



I am happy to announce the most recent version of gpuR has been released.
There are several new enhancements to the package including:

1.Automatically detect available SDK on install if available

2.Simplified installation to build OpenCL ICD when have OpenCL driver
but no SDK installed (thanks Yixuan Qui)

3.Control over individual OpenCL contexts to allow user to choose
device to use

4.Added as.* methods for vclMatrix/Vector and gpuMatrix/Vector objects

5.Added str method for matrix objects

6.Added length method for matrix objects

7.Added solve method for square vclMatrix objects

8.Added QR-decompsition, SVD, Cholesky for square gpuMatrix/vclMatrix
objects

9.Added diag and diag<- method for matix objects


There are many more features in the works.  Suggestions and contributions
continue to be welcomed.  Please submit all through my github issues
https://github.com/cdeterman/gpuR.git


Also, thanks to all those as well for testing this package on various GPU
devices and operating systems.  A lot of the stability of this package is
made possible by your efforts.


Kind regards,

Charles

[[alternative HTML version deleted]]

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

__
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] "Patched " version listed on CRAN mirrors is actually Oct RC version

2016-12-22 Thread David Winsemius

> On Dec 21, 2016, at 10:45 PM, Berend Hasselman  wrote:
> 
> 
>> On 21 Dec 2016, at 14:23, Watson, David W. (MSFC-ES62) 
>>  wrote:
>> 
>> I have been trying to download the “patched” version of 3.3.2 for Mac from 
>> CRAN, but the version that gets delivered is actually the October Release 
>> Candidate version,
>> (R version 3.3.2 RC (2016-10-26 r71594). It has been doing this since 3.3.2 
>> has been released. Is there a real patched version somewhere?
>> 
> 

I just downloaded these pkg file from CRAN and get:

R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
https://cran.r-project.org/bin/macosx/R-3.3.2.pkg

> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X Yosemite 10.10.5

I had earlier today downloaded the version I get from r.att.research.com and 
got:

R version 3.3.2 RC (2016-10-26 r71594) -- "Sincere Pumpkin Patch"
https://r.research.att.com/mavericks/R-3.3-branch/R-3.3-branch-mavericks.pkg

> sessionInfo()
R version 3.3.2 RC (2016-10-26 r71594)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X Yosemite 10.10.5



The 10-31 date matches the release data for the 3.3.2 source.
-- 
David Winsemius
usually in Alameda, California

> 


> Send this message to the R-SIG-Mac mailinglist. More likely to get response.
> 
> Berend Hasselman
> 
>> 

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