Re: [R] trimmed mean and Winsorized mean

2016-01-21 Thread Michael Dewey

Dear Muhammad

You could try an internet search which should lead you to several 
packages on CRAN which meet your need for Winsorisation.


I used winsor cran but it may depend on what Google knows about you.

On 21/01/2016 09:50, Muhammad  Kashif wrote:

Dear respected group members


who we calculate trimmed and Winsorized mean of data. can we calculate directly 
of any latest package is available for their calculation.

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



--
Michael
http://www.dewey.myzen.co.uk/home.html

__
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] trimmed mean and Winsorized mean

2016-01-21 Thread PIKAL Petr
Hi

Out of curiosity I tried to find how precise is searching for such simple task 
on internet.

This was my question in google

winsorized mean in r


Position 6
http://finzi.psych.upenn.edu/library/SciencePo/html/winsor.mean.html

Position 5
http://www.statisticalanalysisconsulting.com/measures-of-central-tendency-the-trimmed-mean-and-median/

Position 4
https://cran.r-project.org/web/packages/robustHD/robustHD.pdf

Position 3
https://stat.ethz.ch/pipermail/r-help/2009-August/402610.html

Position 2
http://www.r-bloggers.com/winsorization/

and the winner
http://www.personality-project.org/r/html/winsor.html

Which of those 6 hits (which you could get instantly) are not compliant with 
your question?

Cheers
Petr

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of
> Muhammad Kashif
> Sent: Thursday, January 21, 2016 10:51 AM
> To: Group R-help
> Subject: [R] trimmed mean and Winsorized mean
>
> Dear respected group members
>
>
> who we calculate trimmed and Winsorized mean of data. can we calculate
> directly of any latest package is available for their calculation.
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.


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

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

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an 
express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into 
any contracts on behalf of the company except for cases in which he/she is 
expressly authorized to do so in writing, and such authorization or power of 
attorney is submitted to the recipient or the person represented by the 
recipient, or the existence of such authorization is known to the recipient of 
the person represented by the recipient.
__
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] trimmed mean and Winsorized mean

2016-01-21 Thread John Kane
I think this depends on how well google knows you. It took me about 6 months 
when I first starting using R just to get google to figure out what r meant.  I 
was getting a lot if information on how to do correlations before that. 

"winsorized mean in r statistics" sounds safer for a new R user 

John Kane
Kingston ON Canada


> -Original Message-
> From: petr.pi...@precheza.cz
> Sent: Thu, 21 Jan 2016 13:40:41 +
> To: mkas...@uaf.edu.pk, r-help@r-project.org
> Subject: Re: [R] trimmed mean and Winsorized mean
> 
> Hi
> 
> Out of curiosity I tried to find how precise is searching for such simple
> task on internet.
> 
> This was my question in google
> 
> winsorized mean in r
> 
> 
> Position 6
> http://finzi.psych.upenn.edu/library/SciencePo/html/winsor.mean.html
> 
> Position 5
> http://www.statisticalanalysisconsulting.com/measures-of-central-tendency-the-trimmed-mean-and-median/
> 
> Position 4
> https://cran.r-project.org/web/packages/robustHD/robustHD.pdf
> 
> Position 3
> https://stat.ethz.ch/pipermail/r-help/2009-August/402610.html
> 
> Position 2
> http://www.r-bloggers.com/winsorization/
> 
> and the winner
> http://www.personality-project.org/r/html/winsor.html
> 
> Which of those 6 hits (which you could get instantly) are not compliant
> with your question?
> 
> Cheers
> Petr
> 
>> -Original Message-
>> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of
>> Muhammad Kashif
>> Sent: Thursday, January 21, 2016 10:51 AM
>> To: Group R-help
>> Subject: [R] trimmed mean and Winsorized mean
>> 
>> Dear respected group members
>> 
>> 
>> who we calculate trimmed and Winsorized mean of data. can we calculate
>> directly of any latest package is available for their calculation.
>> 
>>   [[alternative HTML version deleted]]
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-
>> guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> 
> Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou
> určeny pouze jeho adresátům.
> Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě
> neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho
> kopie vymažte ze svého systému.
> Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento
> email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
> Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi
> či zpožděním přenosu e-mailu.
> 
> V případě, že je tento e-mail součástí obchodního jednání:
> - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření
> smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu.
> - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně
> přijmout; Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze
> strany příjemce s dodatkem či odchylkou.
> - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve
> výslovným dosažením shody na všech jejích náležitostech.
> - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za
> společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně
> zmocněn nebo písemně pověřen a takové pověření nebo plná moc byly
> adresátovi tohoto emailu případně osobě, kterou adresát zastupuje,
> předloženy nebo jejich existence je adresátovi či osobě jím zastoupené
> známá.
> 
> This e-mail and any documents attached to it may be confidential and are
> intended only for its intended recipients.
> If you received this e-mail by mistake, please immediately inform its
> sender. Delete the contents of this e-mail with all attachments and its
> copies from your system.
> If you are not the intended recipient of this e-mail, you are not
> authorized to use, disseminate, copy or disclose this e-mail in any
> manner.
> The sender of this e-mail shall not be liable for any possible damage
> caused by modifications of the e-mail or by delay with transfer of the
> email.
> 
> In case that this e-mail forms part of business dealings:
> - the sender reserves the right to end negotiations about entering into a
> contract in any time, for any reason, and without stating any reasoning.
> - if the e-mail contains an offer, the recipient is entitled to
> immediately accept such offer; The sender of this e-mail (offer) excludes
> any acceptance of the offer on the part of the recipient containing any
> amendment or variation.
> - the sender insists on that the respective contract is concluded only
> upon an express mutual agreement on all its aspects.
> - the sender of this e-mail informs that he/she is not authorized to
> enter into any contracts on behalf of the company except for cases in
> which he/she is expressly authorized to do so in writing, and such
> authorization or power of attorney is submitted to the 

Re: [R] Fwd:

2016-01-21 Thread Michael Dewey

Hello Maryam

See below

On 20/01/2016 21:26, maryam firoozi via R-help wrote:

Hello,
i made a population about 4500 individual.


So you mean nearly 4500, not exactly 4500?

this has two sex(female and male).they had pedigree.

i wanted to enter new indiviual but their ID of indiviual mustnot be same 
perivous and their ID number mustnot be bigger than 4500.
first population's ID number is 1:4500.


If you tabulate ID you will get a table where all the entries should be 
1 except for the ID which you have not yet used which will be zero.


?tabulate

_NOT_ ?table

All you need to do then is find them

?which

should work


how can i handel it?

Sent from my iPhone

Begin forwarded message:


From: maryam firoozi 
Date: January 18, 2016 at 1:14:56 AM GMT+3:30
To: r-help@r-project.org

hello,
we want to do genomic blup in r.i know that use pedigree package.
the formule is
gblup( P~1,data=ped[,c('ID','P')],M=M,lambda=1/h2-1)
P:phenotype variance
ped:pedigree
M: matrix marker or genotype
my ped has 4500 ID.but my M has 9000 individual.becasue i have two row for each 
ID in M matrix becasue each ID has two haplotype.how can i solve it.the formula 
didnt solve.
sincerely


Sent from my iPhone


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



--
Michael
http://www.dewey.myzen.co.uk/home.html

__
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] trimmed mean and Winsorized mean

2016-01-21 Thread Ivan Calandra
Regarding the trimmed mean, take a look at the arguments of the function 
mean():

?mean

No idea about the Winsorized mean, though.

HTH,
Ivan

--
Ivan Calandra, PhD
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calan...@univ-reims.fr
--
https://www.researchgate.net/profile/Ivan_Calandra
https://publons.com/author/705639/

Le 21/01/2016 10:50, Muhammad Kashif a écrit :

Dear respected group members


who we calculate trimmed and Winsorized mean of data. can we calculate directly 
of any latest package is available for their calculation.

[[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] trimmed mean and Winsorized mean

2016-01-21 Thread Muhammad Kashif
Dear respected group members


who we calculate trimmed and Winsorized mean of data. can we calculate directly 
of any latest package is available for their calculation.

[[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] Fwd:

2016-01-21 Thread David L Carlson
Assuming Michael is correct, you can use setdiff():

> set.seed(42)
> current <- sample.int(4500, 4495) # All but 5 numbers used
> setdiff(1:4500, current) # Find which numbers are left
[1]  905 1252 2508 3192 4484

-
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 Michael Dewey
Sent: Thursday, January 21, 2016 7:34 AM
To: maryam firoozi; r-help@r-project.org
Subject: Re: [R] Fwd:

Hello Maryam

See below

On 20/01/2016 21:26, maryam firoozi via R-help wrote:
> Hello,
> i made a population about 4500 individual.

So you mean nearly 4500, not exactly 4500?

this has two sex(female and male).they had pedigree.
> i wanted to enter new indiviual but their ID of indiviual mustnot be same 
> perivous and their ID number mustnot be bigger than 4500.
> first population's ID number is 1:4500.

If you tabulate ID you will get a table where all the entries should be 
1 except for the ID which you have not yet used which will be zero.

?tabulate

_NOT_ ?table

All you need to do then is find them

?which

should work

> how can i handel it?
>
> Sent from my iPhone
>
> Begin forwarded message:
>
>> From: maryam firoozi 
>> Date: January 18, 2016 at 1:14:56 AM GMT+3:30
>> To: r-help@r-project.org
>>
>> hello,
>> we want to do genomic blup in r.i know that use pedigree package.
>> the formule is
>> gblup( P~1,data=ped[,c('ID','P')],M=M,lambda=1/h2-1)
>> P:phenotype variance
>> ped:pedigree
>> M: matrix marker or genotype
>> my ped has 4500 ID.but my M has 9000 individual.becasue i have two row for 
>> each ID in M matrix becasue each ID has two haplotype.how can i solve it.the 
>> formula didnt solve.
>> sincerely
>>
>>
>> Sent from my iPhone
>
>   [[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.
>

-- 
Michael
http://www.dewey.myzen.co.uk/home.html

__
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] trimmed mean and Winsorized mean

2016-01-21 Thread Bert Gunter
But DO NOT DO ANY OF THIS.

See the Robust Task View on CRAN and use the functionality of the
robust or robustbase package. Trimmed/winsorized means are ancient
technology; there is much better available today (and for the last 40
or so years, in fact).

Cheers,
Bert


Bert Gunter

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


On Thu, Jan 21, 2016 at 6:01 AM, John Kane  wrote:
> I think this depends on how well google knows you. It took me about 6 months 
> when I first starting using R just to get google to figure out what r meant.  
> I was getting a lot if information on how to do correlations before that.
>
> "winsorized mean in r statistics" sounds safer for a new R user
>
> John Kane
> Kingston ON Canada
>
>
>> -Original Message-
>> From: petr.pi...@precheza.cz
>> Sent: Thu, 21 Jan 2016 13:40:41 +
>> To: mkas...@uaf.edu.pk, r-help@r-project.org
>> Subject: Re: [R] trimmed mean and Winsorized mean
>>
>> Hi
>>
>> Out of curiosity I tried to find how precise is searching for such simple
>> task on internet.
>>
>> This was my question in google
>>
>> winsorized mean in r
>>
>>
>> Position 6
>> http://finzi.psych.upenn.edu/library/SciencePo/html/winsor.mean.html
>>
>> Position 5
>> http://www.statisticalanalysisconsulting.com/measures-of-central-tendency-the-trimmed-mean-and-median/
>>
>> Position 4
>> https://cran.r-project.org/web/packages/robustHD/robustHD.pdf
>>
>> Position 3
>> https://stat.ethz.ch/pipermail/r-help/2009-August/402610.html
>>
>> Position 2
>> http://www.r-bloggers.com/winsorization/
>>
>> and the winner
>> http://www.personality-project.org/r/html/winsor.html
>>
>> Which of those 6 hits (which you could get instantly) are not compliant
>> with your question?
>>
>> Cheers
>> Petr
>>
>>> -Original Message-
>>> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of
>>> Muhammad Kashif
>>> Sent: Thursday, January 21, 2016 10:51 AM
>>> To: Group R-help
>>> Subject: [R] trimmed mean and Winsorized mean
>>>
>>> Dear respected group members
>>>
>>>
>>> who we calculate trimmed and Winsorized mean of data. can we calculate
>>> directly of any latest package is available for their calculation.
>>>
>>>   [[alternative HTML version deleted]]
>>>
>>> __
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-
>>> guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>> 
>> Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou
>> určeny pouze jeho adresátům.
>> Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě
>> neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho
>> kopie vymažte ze svého systému.
>> Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento
>> email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
>> Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi
>> či zpožděním přenosu e-mailu.
>>
>> V případě, že je tento e-mail součástí obchodního jednání:
>> - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření
>> smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu.
>> - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně
>> přijmout; Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze
>> strany příjemce s dodatkem či odchylkou.
>> - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve
>> výslovným dosažením shody na všech jejích náležitostech.
>> - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za
>> společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně
>> zmocněn nebo písemně pověřen a takové pověření nebo plná moc byly
>> adresátovi tohoto emailu případně osobě, kterou adresát zastupuje,
>> předloženy nebo jejich existence je adresátovi či osobě jím zastoupené
>> známá.
>>
>> This e-mail and any documents attached to it may be confidential and are
>> intended only for its intended recipients.
>> If you received this e-mail by mistake, please immediately inform its
>> sender. Delete the contents of this e-mail with all attachments and its
>> copies from your system.
>> If you are not the intended recipient of this e-mail, you are not
>> authorized to use, disseminate, copy or disclose this e-mail in any
>> manner.
>> The sender of this e-mail shall not be liable for any possible damage
>> caused by modifications of the e-mail or by delay with transfer of the
>> email.
>>
>> In case that this e-mail forms part of business dealings:
>> - the sender reserves the right to end negotiations about entering into a
>> contract in any time, for any reason, and without stating any reasoning.
>> - if the e-mail contains 

Re: [R] Survival::coxph (clogit), survConcordance vs. summary(fit) concordance

2016-01-21 Thread Joe Ceradini
Thanks Terry!

I thought that since I was providing survConcordance with the model object
that the same formula would be applied. But I was obviously wrong. I just
ran survConcordance with the addition of the strata argument, as you
suggested, and got the same answer as summary(fit)with the same scary
SE.

This is a wildlife habitat selection analysis. Each individual animal has
habitat features that they used (1) and habitat that was available but that
they did not use (0). The habitat that is available is different for each
individual, hence the need for strata(ID of individual). However, all the
habitat data are collected from multiple discrete sites and each site has
multiple individuals on it. For all these analyses of these data, I've
assumed that individuals within a site may be more correlated than
individuals between sites, hence addition of cluster(site).

I was able recalculate the same concordance estimate as summary(fit) by
estimating predicted probabilities using:
risk <- predict(fit, type='risk')
risk / (1+risk)
And then used a probability cut-off of 0.5 for whether an observed point
was correctly classified, which returned the same 0.76 as the concordance
estimate.
So, can I just think of this concordance as a classification table (or
confusion matrix) with a 0.5 threshold (thus classification error would be
(1 - 0.76)?
Was I mistaken in thinking concordance was more akin to AUC in
unconditional logistic regression?

Thanks.
Joe


On Thu, Jan 21, 2016 at 8:01 AM, Therneau, Terry M., Ph.D. <
thern...@mayo.edu> wrote:

> I read the digest form which puts me behind, plus the last 2 days have
> been solid meetings with an external advisory group so I missed the initial
> query.   Three responses.
>
> 1. The clogit routine sets the data up properly and then calls a
> stratified Cox model.  If you want the survConcordance routine to give the
> same answer, it also needs to know about the strata
> survConcordance (Surv(rep(1, 76L), resp) ~ predict(fit) + strata(ID),
> data=dat)
> I'm not surprised that you get a very different answer with/without strata.
>
> 2. I've never thought of using a robust variance for the matched
> case/control model.  I'm having a hard time wrapping my head around what
> you would expect that to accomplish (statistically).  Subjects are already
> matched on someone from the same site, so where does a per-site effect
> creep in?  Assuming there is a good reason and I just don't see it (not an
> unwarranted assumption), I'm not aware of any work on what an appropriate
> variance would be for the concordance in that case.
>
> 3. I need to think about the large variance issue.
>
> Terry Therneau
>
>
>
> On 01/20/2016 08:09 PM, r-help-requ...@r-project.org wrote:
>
>> Hi,
>>
>> I'm running conditional logistic regression with survival::clogit. I have
>> "1-1 case-control" data, i.e., there is 1 case and 1 control in each
>> strata.
>>
>> Model:
>> fit <- clogit(resp ~ x1 + x2, strata(ID), cluster(site), method ="efron",
>> data = dat)
>> Where resp is 1's and 0's, and x1 and x2 are both continuous.
>>
>> Predictors are both significant. A snippet of summary(fit):
>> Concordance= 0.763  (se = 0.5 )
>> Rsquare= 0.304   (max possible= 0.5 )
>> Likelihood ratio test= 27.54  on 2 df,   p=1.047e-06
>> Wald test= 17.19  on 2 df,   p=0.0001853
>> Score (logrank) test = 17.43  on 2 df,   p=0.0001644,   Robust = 6.66
>>   p=0.03574
>>
>> The concordance estimate seems good but the SE is HUGE.
>>
>> I get a very different estimate from the survConcordance function, which I
>> know says computes concordance for a "single continuous covariate", but it
>> runs on my model with 2 continuous covariates
>>
>> survConcordance(Surv(rep(1, 76L), resp) ~ predict(fit), dat)
>> n= 76
>> Concordance= 0.9106648 se= 0.09365047
>> concordant  discordant   tied.risk   tied.timestd(c-d)
>>   1315.   129. 0.   703.   270.4626
>>
>> Are both of these concordance estimates valid but providing different
>> information?
>> Is one more appropriate for measuring "performance" (in the AUC sense) of
>> conditional logistic models?
>> Is it possible that the HUGE SE estimate represents a convergence problem
>> (no warnings were thrown when fit the model), or is this model just
>> useless?
>>
>> Thanks!
>>
>
> __
> 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.
>



-- 
Cooperative Fish and Wildlife Research Unit
Zoology and Physiology Dept.
University of Wyoming
joecerad...@gmail.com / 914.707.8506
wyocoopunit.org

[[alternative HTML version deleted]]

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

Re: [R] Survival::coxph (clogit), survConcordance vs. summary(fit) concordance

2016-01-21 Thread Therneau, Terry M., Ph.D.
I read the digest form which puts me behind, plus the last 2 days have been solid meetings 
with an external advisory group so I missed the initial query.   Three responses.


1. The clogit routine sets the data up properly and then calls a stratified Cox model.  If 
you want the survConcordance routine to give the same answer, it also needs to know about 
the strata

survConcordance (Surv(rep(1, 76L), resp) ~ predict(fit) + strata(ID), 
data=dat)
I'm not surprised that you get a very different answer with/without strata.

2. I've never thought of using a robust variance for the matched case/control model.  I'm 
having a hard time wrapping my head around what you would expect that to accomplish 
(statistically).  Subjects are already matched on someone from the same site, so where 
does a per-site effect creep in?  Assuming there is a good reason and I just don't see it 
(not an unwarranted assumption), I'm not aware of any work on what an appropriate variance 
would be for the concordance in that case.


3. I need to think about the large variance issue.

Terry Therneau


On 01/20/2016 08:09 PM, r-help-requ...@r-project.org wrote:

Hi,

I'm running conditional logistic regression with survival::clogit. I have
"1-1 case-control" data, i.e., there is 1 case and 1 control in each strata.

Model:
fit <- clogit(resp ~ x1 + x2, strata(ID), cluster(site), method ="efron",
data = dat)
Where resp is 1's and 0's, and x1 and x2 are both continuous.

Predictors are both significant. A snippet of summary(fit):
Concordance= 0.763  (se = 0.5 )
Rsquare= 0.304   (max possible= 0.5 )
Likelihood ratio test= 27.54  on 2 df,   p=1.047e-06
Wald test= 17.19  on 2 df,   p=0.0001853
Score (logrank) test = 17.43  on 2 df,   p=0.0001644,   Robust = 6.66
  p=0.03574

The concordance estimate seems good but the SE is HUGE.

I get a very different estimate from the survConcordance function, which I
know says computes concordance for a "single continuous covariate", but it
runs on my model with 2 continuous covariates

survConcordance(Surv(rep(1, 76L), resp) ~ predict(fit), dat)
n= 76
Concordance= 0.9106648 se= 0.09365047
concordant  discordant   tied.risk   tied.timestd(c-d)
  1315.   129. 0.   703.   270.4626

Are both of these concordance estimates valid but providing different
information?
Is one more appropriate for measuring "performance" (in the AUC sense) of
conditional logistic models?
Is it possible that the HUGE SE estimate represents a convergence problem
(no warnings were thrown when fit the model), or is this model just useless?

Thanks!


__
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 editor for Mac

2016-01-21 Thread Duncan Murdoch

On 20/01/2016 1:28 PM, Duncan Murdoch wrote:

On 20/01/2016 1:22 PM, Christofer Bogaso wrote:
> Hi,
>
> Could you please suggest a good R editor for Mac OS X (10.7.5)
> Previously my operating system was Windows and there I used Notepad++,
> I really had very nice experience with it. However I dont see any Mac
> version is available for Mac.
>
> Appreciate your positive feedback.

RStudio is probably best on both OS X and Windows.A nice advantage
is that it looks the same on both, so you can move back and forth.

I only know two negatives:

   - I still don't like the tiled window.  I often work on a small
screen, and it's not enough space.

   - The editor still changes file endings to native format whenever it
saves.  It would be better if it handled both Windows and Unix line
endings in both systems, and left them alone unless the user asked them
to be changed.


I've just heard offline from JJ Allaire that both negatives above have 
been addressed in a version soon to be released.   Excellent news!


Duncan Murdoch

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R editor for Mac

2016-01-21 Thread boB Rudis
Aye. You can make source/editor windows consume the entire area or
have them as separate windows and can define a consistent line-ending
vs platform native (I run RStudio Preview and [sometimes] dailies and
can confirm these are in there). The addition of full R
(C/C++/HTML/javascript/etc) code diagnostics (optional) is also a
pretty compelling feature.

On Thu, Jan 21, 2016 at 1:06 PM, Duncan Murdoch
 wrote:
> On 20/01/2016 1:28 PM, Duncan Murdoch wrote:
>>
>> On 20/01/2016 1:22 PM, Christofer Bogaso wrote:
>> > Hi,
>> >
>> > Could you please suggest a good R editor for Mac OS X (10.7.5)
>> > Previously my operating system was Windows and there I used Notepad++,
>> > I really had very nice experience with it. However I dont see any Mac
>> > version is available for Mac.
>> >
>> > Appreciate your positive feedback.
>>
>> RStudio is probably best on both OS X and Windows.A nice advantage
>> is that it looks the same on both, so you can move back and forth.
>>
>> I only know two negatives:
>>
>>- I still don't like the tiled window.  I often work on a small
>> screen, and it's not enough space.
>>
>>- The editor still changes file endings to native format whenever it
>> saves.  It would be better if it handled both Windows and Unix line
>> endings in both systems, and left them alone unless the user asked them
>> to be changed.
>
>
> I've just heard offline from JJ Allaire that both negatives above have been
> addressed in a version soon to be released.   Excellent news!
>
>
> 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-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 for bayesian regression

2016-01-21 Thread Derya Sahin
Hello,



I don't have much knowledge about how to use JAGS to do bayesian
regression, I have seen several examples but my data is left censored and I
am not sure how to construct the likelihood function, if someone could post
a sample JAGS code for bayesian regression for left-censored data, that
would be great. for example I want to predict y and my predictors x1,x2,x3 such
that y ~a1*x1+a2*x2+a3*x3 and x3 is left censored some values are below LOD
values (LOD is also a vector, same size of x3)

for left-censored data x3, I know I can do the following,
# JAGS for left censored x3
model {
for (i in 1:N) {
above.lod[i] ~ dinterval(x3[i], llodVec[i])
x3[i] ~ dnorm(mu, tau)
}
mu ~ dnorm(0, .001)
tau <- 1/pow(sigma,2)
sigma~dt(0,1/625,1)
}

but where and how I should include the regression . In short I want to
combine the above and below code in one jags code, since I am new to JAGS
not sure what I am doing is correct. I appreciate any help and suggestions.
thanks,

#JAGS for regression
for( i in 1:N ) {
  y[i] ~ dnorm( y.hat[i] , tau )
  y.hat[i] <- a1*x1[i]+a2*x2[i]*a3*x3[i]
}
tau <- 1/pow(sigma,2)
sigma ~ dunif( 0 , 10 )
for ( j in 1:3 ) {
  a[j] ~ dnorm( 0 , 1.0E-3 )
}
  }

regression 
bayesian  jags


In short, I am not sure how to construct the likelihood function for this
kind of problem,
any help would  be appreciated

thanks

-- 
D

[[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] strange answer when using 'aggregate()' with a formula

2016-01-21 Thread Chel Hee Lee
I appreciate your kind guidance!  I did not read the manual carefully 
(it's my fault).


Thank you so much, Prof. John Fox!

Chel Hee Lee

On 01/21/2016 12:52 AM, Fox, John wrote:

Dear Chel Hee Lee,

With the formula method, the default na.action is na.omit; thus,


aggregate(y~grp, data=tmp, function(x) sum(is.na(x)), na.action=na.pass)

   grp y
1   2 1
2   3 0

I hope this helps,
  John

-
John Fox, Professor
McMaster University
Hamilton, Ontario
Canada L8S 4M4
Web: socserv.mcmaster.ca/jfox



-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Chel Hee Lee
Sent: January 21, 2016 5:08 AM
To: R-help@r-project.org
Subject: [R] strange answer when using 'aggregate()' with a formula

Could you kindly test the following codes?  It is because I found strange answer
when 'aggregate()' is used with a formula.

I am trying to count how many missing data entries are in each group.
For this exercise, I created data as below:

  > tmp <- data.frame(grp=c(2,3,2,3), y=c(NA, 0.5, 3, 0.5))  > tmp
grp   y
1   2  NA
2   3 0.5
3   2 3.0
4   3 0.5

I see that observations (variable y) can be grouped into two groups (variable
grp).  For group 2, y has NA and 3.0.  For group 3, y has 0.5 and 0.5.  Hence, 
the
number of missing values is 1 and 0 for group 2 and
3, respectively.   This work can be done using 'aggregate()' in the
'stats' package as below:

  > aggregate(x=tmp$y, by=list(grp=tmp$grp), function(x) sum(is.na(x)))
grp x
1   2 1
2   3 0

A formula can be used as below:

  > aggregate(y~grp, data=tmp, function(x) sum(is.na(x)))
grp y
1   2 0
2   3 0

What a surprise!  Is this a bug?  I would appreciate if you share the
results after testing the codes.   Thank you so much for your helps in
advance!

Chel Hee Lee

__
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] R editor for Mac

2016-01-21 Thread Ista Zahn
On Jan 21, 2016 12:01 PM, "Philippe Massicotte" 
wrote:
>
> On 01/20/2016 07:22 PM, Christofer Bogaso wrote:
>>
>> Hi,
>>
>> Could you please suggest a good R editor for Mac OS X (10.7.5)
>> Previously my operating system was Windows and there I used Notepad++,
>> I really had very nice experience with it. However I dont see any Mac
>> version is available for Mac.
>>
>> Appreciate your positive feedback.
>>
>> Thanks and regards,
>>
> Atom seems to be a good choice also.

Is it? Which package(s) should I install to write and run R code in Atom?
Certainly I don't see anything useful out of the box.

Best,
Ista
>
>
> __
> 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] R editor for Mac

2016-01-21 Thread boB Rudis
Here you go Ista: https://atom.io/packages/repl (Atom rly isn't bad
for general purpose data sci needs, I still think RStudio is the best
environment for working with R projects).

On Thu, Jan 21, 2016 at 12:48 PM, Ista Zahn  wrote:
> On Jan 21, 2016 12:01 PM, "Philippe Massicotte" 
> wrote:
>>
>> On 01/20/2016 07:22 PM, Christofer Bogaso wrote:
>>>
>>> Hi,
>>>
>>> Could you please suggest a good R editor for Mac OS X (10.7.5)
>>> Previously my operating system was Windows and there I used Notepad++,
>>> I really had very nice experience with it. However I dont see any Mac
>>> version is available for Mac.
>>>
>>> Appreciate your positive feedback.
>>>
>>> Thanks and regards,
>>>
>> Atom seems to be a good choice also.
>
> Is it? Which package(s) should I install to write and run R code in Atom?
> Certainly I don't see anything useful out of the box.
>
> Best,
> Ista
>>
>>
>> __
>> 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.


[R] ggplot2 - specific y axis scale for each time series in facet grind

2016-01-21 Thread Maxim Fomin
Dear R users,

I have a (melted) data frame of several metal prices from 1980. I want to
make a time series plot for each metal price. By default ggplot constructs
single plot for all prices. Adding +facet_grid(variable~.) makes for each
metal price a plot, but now there is another problem - scale of y axis.
Some metals have price $1000 and some $2. Because ggplot makes same y scale
for each metal, some metal prices printed as straight horizontal line. What
is the command to make for each plot specific y axis scale?

Currently I am trying command:

ggplot(data=melted2, aes(x=date, y=value, group=variable,
color=variable))+geom_line()+facet_grid(variable~.)


Best regards,
Maxim

P.S dput

structure(list(date = structure(c(3652, 3683, 3712, 3743, 3773,
3804, 3834, 3865, 3896, 3926, 3957, 3987, 4018, 4049, 4077, 4108,
4138, 4169, 4199, 4230, 4261, 4291, 4322, 4352, 4383, 4414, 4442,
4473, 4503, 4534, 4564, 4595, 4626, 4656, 4687, 4717, 4748, 4779,
4807, 4838, 4868, 4899, 4929, 4960, 4991, 5021, 5052, 5082, 5113,
5144, 5173, 5204, 5234, 5265, 5295, 5326, 5357, 5387, 5418, 5448,
5479, 5510, 5538, 5569, 5599, 5630, 5660, 5691, 5722, 5752, 5783,
5813, 5844, 5875, 5903, 5934, 5964, 5995, 6025, 6056, 6087, 6117,
6148, 6178, 6209, 6240, 6268, 6299, 6329, 6360, 6390, 6421, 6452,
6482, 6513, 6543, 6574, 6605, 6634, 6665, 6695, 6726, 6756, 6787,
6818, 6848, 6879, 6909, 6940, 6971, 6999, 7030, 7060, 7091, 7121,
7152, 7183, 7213, 7244, 7274, 7305, 7336, 7364, 7395, 7425, 7456,
7486, 7517, 7548, 7578, 7609, 7639, 7670, 7701, 7729, 7760, 7790,
7821, 7851, 7882, 7913, 7943, 7974, 8004, 8035, 8066, 8095, 8126,
8156, 8187, 8217, 8248, 8279, 8309, 8340, 8370, 8401, 8432, 8460,
8491, 8521, 8552, 8582, 8613, 8644, 8674, 8705, 8735, 8766, 8797,
8825, 8856, 8886, 8917, 8947, 8978, 9009, 9039, 9070, 9100, 9131,
9162, 9190, 9221, 9251, 9282, 9312, 9343, 9374, 9404, 9435, 9465,
9496, 9527, 9556, 9587, 9617, 9648, 9678, 9709, 9740, 9770, 9801,
9831, 9862, 9893, 9921, 9952, 9982, 10013, 10043, 10074, 10105,
10135, 10166, 10196, 10227, 10258, 10286, 10317, 10347, 10378,
10408, 10439, 10470, 10500, 10531, 10561, 10592, 10623, 10651,
10682, 10712, 10743, 10773, 10804, 10835, 10865, 10896, 10926,
10957, 10988, 11017, 11048, 11078, 11109, 11139, 11170, 11201,
11231, 11262, 11292, 11323, 11354, 11382, 11413, 11443, 11474,
11504, 11535, 11566, 11596, 11627, 11657, 11688, 11719, 11747,
11778, 11808, 11839, 11869, 11900, 11931, 11961, 11992, 12022,
12053, 12084, 12112, 12143, 12173, 12204, 12234, 12265, 12296,
12326, 12357, 12387, 12418, 12449, 12478, 12509, 12539, 12570,
12600, 12631, 12662, 12692, 12723, 12753, 12784, 12815, 12843,
12874, 12904, 12935, 12965, 12996, 13027, 13057, 13088, 13118,
13149, 13180, 13208, 13239, 13269, 13300, 13330, 13361, 13392,
13422, 13453, 13483, 13514, 13545, 13573, 13604, 13634, 13665,
13695, 13726, 13757, 13787, 13818, 13848, 13879, 13910, 13939,
13970, 14000, 14031, 14061, 14092, 14123, 14153, 14184, 14214,
14245, 14276, 14304, 14335, 14365, 14396, 14426, 14457, 14488,
14518, 14549, 14579, 14610, 14641, 14669, 14700, 14730, 14761,
14791, 14822, 14853, 14883, 14914, 14944, 14975, 15006, 15034,
15065, 15095, 15126, 15156, 15187, 15218, 15248, 15279, 15309,
15340, 15371, 15400, 15431, 15461, 15492, 15522, 15553, 15584,
15614, 15645, 15675, 15706, 15737, 15765, 15796, 15826, 15857,
15887, 15918, 15949, 15979, 16010, 16040, 16071, 16102, 16130,
16161, 16191, 16222, 16252, 16283, 16314, 16344, 16375, 16405,
16436, 16467, 16495, 16526, 16556, 16587, 16617, 16648, 16679,
16709, 16740, 3652, 3683, 3712, 3743, 3773, 3804, 3834, 3865,
3896, 3926, 3957, 3987, 4018, 4049, 4077, 4108, 4138, 4169, 4199,
4230, 4261, 4291, 4322, 4352, 4383, 4414, 4442, 4473, 4503, 4534,
4564, 4595, 4626, 4656, 4687, 4717, 4748, 4779, 4807, 4838, 4868,
4899, 4929, 4960, 4991, 5021, 5052, 5082, 5113, 5144, 5173, 5204,
5234, 5265, 5295, 5326, 5357, 5387, 5418, 5448, 5479, 5510, 5538,
5569, 5599, 5630, 5660, 5691, 5722, 5752, 5783, 5813, 5844, 5875,
5903, 5934, 5964, 5995, 6025, 6056, 6087, 6117, 6148, 6178, 6209,
6240, 6268, 6299, 6329, 6360, 6390, 6421, 6452, 6482, 6513, 6543,
6574, 6605, 6634, 6665, 6695, 6726, 6756, 6787, 6818, 6848, 6879,
6909, 6940, 6971, 6999, 7030, 7060, 7091, 7121, 7152, 7183, 7213,
7244, 7274, 7305, 7336, 7364, 7395, 7425, 7456, 7486, 7517, 7548,
7578, 7609, 7639, 7670, 7701, 7729, 7760, 7790, 7821, 7851, 7882,
7913, 7943, 7974, 8004, 8035, 8066, 8095, 8126, 8156, 8187, 8217,
8248, 8279, 8309, 8340, 8370, 8401, 8432, 8460, 8491, 8521, 8552,
8582, 8613, 8644, 8674, 8705, 8735, 8766, 8797, 8825, 8856, 8886,
8917, 8947, 8978, 9009, 9039, 9070, 9100, 9131, 9162, 9190, 9221,
9251, 9282, 9312, 9343, 9374, 9404, 9435, 9465, 9496, 9527, 9556,
9587, 9617, 9648, 9678, 9709, 9740, 9770, 9801, 9831, 9862, 9893,
9921, 9952, 9982, 10013, 10043, 10074, 10105, 10135, 10166, 10196,
10227, 10258, 10286, 10317, 10347, 10378, 10408, 10439, 10470,
10500, 10531, 10561, 10592, 10623, 10651, 10682, 10712, 10743,
10773, 10804, 10835, 10865, 

Re: [R] R editor for Mac

2016-01-21 Thread Ista Zahn
On Thu, Jan 21, 2016 at 12:54 PM, boB Rudis  wrote:
> Here you go Ista: https://atom.io/packages/repl (Atom rly isn't bad
> for general purpose data sci needs, I still think RStudio is the best
> environment for working with R projects).

Thanks Bob, the Atom REPL thingy is nice. I'm sticking with Emacs with
ESS (via Spacemacs) for now, but will keep an eye on Atom.

--Ista

>
> On Thu, Jan 21, 2016 at 12:48 PM, Ista Zahn  wrote:
>> On Jan 21, 2016 12:01 PM, "Philippe Massicotte" 
>> wrote:
>>>
>>> On 01/20/2016 07:22 PM, Christofer Bogaso wrote:

 Hi,

 Could you please suggest a good R editor for Mac OS X (10.7.5)
 Previously my operating system was Windows and there I used Notepad++,
 I really had very nice experience with it. However I dont see any Mac
 version is available for Mac.

 Appreciate your positive feedback.

 Thanks and regards,

>>> Atom seems to be a good choice also.
>>
>> Is it? Which package(s) should I install to write and run R code in Atom?
>> Certainly I don't see anything useful out of the box.
>>
>> Best,
>> Ista
>>>
>>>
>>> __
>>> 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] tcltk: write '[' and ']' in a table cell

2016-01-21 Thread peter dalgaard
“Right now I’m having amnesia and déjà vu at the same time. I think I’ve 
forgotten this before.” ― Steven Wright

Check if this might be the same issue as the one of embedded spaces in

https://stat.ethz.ch/pipermail/r-help/2009-January/378558.html

-pd

> On 21 Jan 2016, at 02:12 , Dalthorp, Daniel  wrote:
> 
> I know it should not be difficult to write the string:
> 
> i<-4
> j<-17
> lbl<-paste0("[", i, ", ", j, "]")
> 
> # to a table, but I'm having a devil of a time trying to figure out how to
> do it.
> # the following gives lbl surrounded by braces.
> 
> tt<-tktoplevel()
> tfr <- tkframe(tt)
> tkgrid(tfr)
> junk<-tclArray()
> junk[[0,0]]<-lbl
> table1<-tkwidget(tfr,"table", rows=1, cols=1, variable=junk)
> tkgrid(table1)
> 
> 
> How to write without the braces?
> 
> Any quick suggestions would be very much appreciated...I've burned much
> time trying to figure this should-be-simple problem out.
> 
> Thanks!
> 
> 
> 
> -- 
> Dan Dalthorp, PhD
> USGS Forest and Rangeland Ecosystem Science Center
> Forest Sciences Lab, Rm 189
> 3200 SW Jefferson Way
> Corvallis, OR 97331
> ph: 541-750-0953
> ddalth...@usgs.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.

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

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] R editor for Mac

2016-01-21 Thread William Michels via R-help
Run Atom with the language-r and r-exec packages:

"A language description and snippets for R"
https://atom.io/packages/language-r

"Send R code to various consoles"
https://atom.io/packages/r-exec


On Thu, Jan 21, 2016 at 9:54 AM, boB Rudis  wrote:
> Here you go Ista: https://atom.io/packages/repl (Atom rly isn't bad
> for general purpose data sci needs, I still think RStudio is the best
> environment for working with R projects).
>
> On Thu, Jan 21, 2016 at 12:48 PM, Ista Zahn  wrote:
>> On Jan 21, 2016 12:01 PM, "Philippe Massicotte" 
>> wrote:
>>>
>>> On 01/20/2016 07:22 PM, Christofer Bogaso wrote:

 Hi,

 Could you please suggest a good R editor for Mac OS X (10.7.5)
 Previously my operating system was Windows and there I used Notepad++,
 I really had very nice experience with it. However I dont see any Mac
 version is available for Mac.

 Appreciate your positive feedback.

 Thanks and regards,

>>> Atom seems to be a good choice also.
>>
>> Is it? Which package(s) should I install to write and run R code in Atom?
>> Certainly I don't see anything useful out of the box.
>>
>> Best,
>> Ista
>>>
>>>
>>> __
>>> 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.

__
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 editor for Mac

2016-01-21 Thread Berend Hasselman

> On 21 Jan 2016, at 19:06, Duncan Murdoch  wrote:
> 
> On 20/01/2016 1:28 PM, Duncan Murdoch wrote:
>> On 20/01/2016 1:22 PM, Christofer Bogaso wrote:
>> > Hi,
>> >
>> > Could you please suggest a good R editor for Mac OS X (10.7.5)
>> > Previously my operating system was Windows and there I used Notepad++,
>> > I really had very nice experience with it. However I dont see any Mac
>> > version is available for Mac.
>> >
>> > Appreciate your positive feedback.
>> 
>> RStudio is probably best on both OS X and Windows.A nice advantage
>> is that it looks the same on both, so you can move back and forth.
>> 
>> I only know two negatives:
>> 
>>   - I still don't like the tiled window.  I often work on a small
>> screen, and it's not enough space.
>> 
>>   - The editor still changes file endings to native format whenever it
>> saves.  It would be better if it handled both Windows and Unix line
>> endings in both systems, and left them alone unless the user asked them
>> to be changed.
> 
> I've just heard offline from JJ Allaire that both negatives above have been 
> addressed in a version soon to be released.   Excellent news!
> 

The Rstudio editor has a weird difference between OS X and Linux.
It has a shortcut Ctrl+K which is supposed to Delete to Line End (and not 
delete the Line End).

On OS X the shortcut Ctrl+K will also delete the end of line thus joining the 
next line with the remainder of the current line.
On Linux that doesn't happen.

I've complained about that quite some time ago but nothing seems to be done 
about it.

Berend

> 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-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 with a wide range of numbers.

2016-01-21 Thread Jim Lemon
Hi Sema,
I trimmed your file to the first 220 lines.

ads<-read.table("all_data_scor.txt",header=TRUE,sep="\t")
ads.tab<-table(cut(all_data_scor[,2],breaks=c(0,1e-100,1e-10,1e-1,1,10)))
barplot(adt.tab)

This gives you a basic idea of what can be done. If this is not clear, ask
again.

Jim


On Thu, Jan 21, 2016 at 8:16 PM, Sema Atasever  wrote:

> Dear Authorized Sir / Madam,
>
> I need your opinion on something R.
> I have a sample text file that includes eValue scores (2nd column).
> This column includes a wide range of numbers. For example: 1e-179 or 9.9
> You can find this text file in the attachment.
>
> How do I create a histogram in R with logarithmic scale or
> which method do i use these values which includes with a wide range of
> numbers.
>
> I would appreciate if you could advise on some methods.
>
> Thanks.
>
> __
> 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] tcltk tkwidget(..."table")

2016-01-21 Thread Dalthorp, Daniel
>  Once you're up to speed on those issues...

Any suggestions for getting up to speed on those issues?



On Thu, Jan 21, 2016 at 11:46 AM, peter dalgaard  wrote:

>
> > On 21 Jan 2016, at 00:25 , Dalthorp, Daniel  wrote:
> >
> > Thanks, Peter.
> >
> > I'm sure that's right, but it requires knowing: (1) that there's
> something called the "width subcommand", and (2) how to format the call to
> that command/subcommand.
> >
>
> Yes, there's a fair amount of that going on with the tcltk interface. You
> need to both grasp the rules for passing arguments to the underlying Tcl
> command, and know how to find and read the Tcl/Tk documentation. Once
> you're up to speed on those issues it's not all that hard to find stuff in
> (for the present case), say,
> http://tktable.sourceforge.net/tktable/doc/tkTable.html
>
> The situation may be unfortunate, but the alternative is for "someone" to
> sit down an convert all relevant Tcl/Tk documentation to R help files.
>
> -pd
>
>
> > I was able to do it eventually but only after a few hours of effort
> searching the web for help.
> >
> > E.g. with a table (called table1) with 3 columns and want to set widths
> to 30, 5, and 5:
> >
> > colwidths<-c(30, 5, 5)
> >
> > for(i in 1:3) {
> >   tcl(table1, "width", i - 1, colwidths[i])
> > }
> >
> >
> >
> > On Wed, Jan 20, 2016 at 3:07 PM, peter dalgaard 
> wrote:
> >
> > > On 19 Jan 2016, at 20:48 , Dalthorp, Daniel 
> wrote:
> > >
> > > Does anyone know a simple way to create a tcltk table with columns of
> > > varying widths?
> >
> > Create a table, then set the width of the columns with the width
> subcommand?
> >
> > -pd
> >
> >
> > pathName width ?col? ?value col value ...? If no col is specified,
> returns a list describing all cols for which a width has been set. If col
> is specified with no value, it prints out the width of that col in
> characters (positive number) or pixels (negative number). If one or more
> col-value pairs are specified, then it sets each col to be that width in
> characters (positive number) or pixels (negative number). If value is
> default, then the col uses the default width, specified by -colwidth.
> >
> >
> >
> > >
> > > -Dan
> > >
> > >
> > >
> > > --
> > > Dan Dalthorp, PhD
> > > USGS Forest and Rangeland Ecosystem Science Center
> > > Forest Sciences Lab, Rm 189
> > > 3200 SW Jefferson Way
> > > Corvallis, OR 97331
> > > ph: 541-750-0953
> > > ddalth...@usgs.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.
> >
> > --
> > Peter Dalgaard, Professor,
> > Center for Statistics, Copenhagen Business School
> > Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> > Phone: (+45)38153501
> > Office: A 4.23
> > Email: pd@cbs.dk  Priv: pda...@gmail.com
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > Dan Dalthorp, PhD
> > USGS Forest and Rangeland Ecosystem Science Center
> > Forest Sciences Lab, Rm 189
> > 3200 SW Jefferson Way
> > Corvallis, OR 97331
> > ph: 541-750-0953
> > ddalth...@usgs.gov
> >
>
> --
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Office: A 4.23
> Email: pd@cbs.dk  Priv: pda...@gmail.com
>
>
>
>
>
>
>
>
>
>


-- 
Dan Dalthorp, PhD
USGS Forest and Rangeland Ecosystem Science Center
Forest Sciences Lab, Rm 189
3200 SW Jefferson Way
Corvallis, OR 97331
ph: 541-750-0953
ddalth...@usgs.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.


Re: [R] tcltk: write '[' and ']' in a table cell

2016-01-21 Thread Dalthorp, Daniel
Many thanks, Peter.

Simple, works perfectly, and nigh on impossible to figure out without your
help.

To summarize...in my example, I need to do:

junk[[0,0]] <- as.tclObj(lbl,drop=T) # instead of junk[[0,0]]<-lbl

It works for spaces, brackets, parentheses, and all manner of special
characters.

-Dan

On Thu, Jan 21, 2016 at 12:08 PM, peter dalgaard  wrote:

> “Right now I’m having amnesia and déjà vu at the same time. I think I’ve
> forgotten this before.” ― Steven Wright
>
> Check if this might be the same issue as the one of embedded spaces in
>
> https://stat.ethz.ch/pipermail/r-help/2009-January/378558.html
>
> -pd
>
> > On 21 Jan 2016, at 02:12 , Dalthorp, Daniel  wrote:
> >
> > I know it should not be difficult to write the string:
> >
> > i<-4
> > j<-17
> > lbl<-paste0("[", i, ", ", j, "]")
> >
> > # to a table, but I'm having a devil of a time trying to figure out how
> to
> > do it.
> > # the following gives lbl surrounded by braces.
> >
> > tt<-tktoplevel()
> > tfr <- tkframe(tt)
> > tkgrid(tfr)
> > junk<-tclArray()
> > junk[[0,0]]<-lbl
> > table1<-tkwidget(tfr,"table", rows=1, cols=1, variable=junk)
> > tkgrid(table1)
> >
> >
> > How to write without the braces?
> >
> > Any quick suggestions would be very much appreciated...I've burned much
> > time trying to figure this should-be-simple problem out.
> >
> > Thanks!
> >
> >
> >
> > --
> > Dan Dalthorp, PhD
> > USGS Forest and Rangeland Ecosystem Science Center
> > Forest Sciences Lab, Rm 189
> > 3200 SW Jefferson Way
> > Corvallis, OR 97331
> > ph: 541-750-0953
> > ddalth...@usgs.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.
>
> --
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Office: A 4.23
> Email: pd@cbs.dk  Priv: pda...@gmail.com
>
>
>
>
>
>
>
>
>
>


-- 
Dan Dalthorp, PhD
USGS Forest and Rangeland Ecosystem Science Center
Forest Sciences Lab, Rm 189
3200 SW Jefferson Way
Corvallis, OR 97331
ph: 541-750-0953
ddalth...@usgs.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.

Re: [R] Error opening SHP file

2016-01-21 Thread David Winsemius

> On Jan 21, 2016, at 4:39 PM, Amoy Yang via R-help  
> wrote:
> 
> Any advice for the following errors?
> state.map <- readShapeSpatial("maps/st24_d00.shp")
> Error in getinfo.shape(fn) : Error opening SHP file

What does list.files('maps') return? Is there a 'st24_d00.shp' value in there?


-- 
David.

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

David Winsemius
Alameda, CA, USA

__
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] Error opening SHP file

2016-01-21 Thread Amoy Yang via R-help
 Any advice for the following errors?
state.map <- readShapeSpatial("maps/st24_d00.shp")
Error in getinfo.shape(fn) : Error opening SHP file

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Error opening SHP file

2016-01-21 Thread Jim Lemon
Hi Amoy,
Another mystery question. I should have pursued parapsychology. That error
statement is usually followed by one noting that the file specified cannot
be found. Today's guess is that the R working directory:

getwd()

did not have a "maps" directory below it.

Jim


On Fri, Jan 22, 2016 at 11:39 AM, Amoy Yang via R-help  wrote:

>  Any advice for the following errors?
> state.map <- readShapeSpatial("maps/st24_d00.shp")
> Error in getinfo.shape(fn) : Error opening SHP file
>
> [[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] Error opening SHP file

2016-01-21 Thread boB Rudis
Agreed with the others. After finding that shapefile and getting it to
work you are definitely not in the proper working directory.

On Thu, Jan 21, 2016 at 8:40 PM, David Winsemius  wrote:
>
>> On Jan 21, 2016, at 4:39 PM, Amoy Yang via R-help  
>> wrote:
>>
>> Any advice for the following errors?
>> state.map <- readShapeSpatial("maps/st24_d00.shp")
>> Error in getinfo.shape(fn) : Error opening SHP file
>
> What does list.files('maps') return? Is there a 'st24_d00.shp' value in there?
>
>
> --
> David.
>
>>
>>   [[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.
>
> David Winsemius
> Alameda, CA, USA
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ggplot2 - specific y axis scale for each time series in facet grind

2016-01-21 Thread Jeff Newmiller
> What is the command to make for 
> each plot specific y axis scale?

Read the documentation for ?facet_grid... in particular the scales argument. 
-- 
Sent from my phone. Please excuse my brevity.

On January 21, 2016 7:15:46 AM PST, Maxim Fomin  wrote:
>Dear R users,
>
>I have a (melted) data frame of several metal prices from 1980. I want
>to
>make a time series plot for each metal price. By default ggplot
>constructs
>single plot for all prices. Adding +facet_grid(variable~.) makes for
>each
>metal price a plot, but now there is another problem - scale of y axis.
>Some metals have price $1000 and some $2. Because ggplot makes same y
>scale
>for each metal, some metal prices printed as straight horizontal line.
>What
>is the command to make for each plot specific y axis scale?
>
>Currently I am trying command:
>
>ggplot(data=melted2, aes(x=date, y=value, group=variable,
>color=variable))+geom_line()+facet_grid(variable~.)
>
>
>Best regards,
>Maxim
>
>P.S dput
>
>structure(list(date = structure(c(3652, 3683, 3712, 3743, 3773,
>3804, 3834, 3865, 3896, 3926, 3957, 3987, 4018, 4049, 4077, 4108,
>4138, 4169, 4199, 4230, 4261, 4291, 4322, 4352, 4383, 4414, 4442,
>4473, 4503, 4534, 4564, 4595, 4626, 4656, 4687, 4717, 4748, 4779,
>4807, 4838, 4868, 4899, 4929, 4960, 4991, 5021, 5052, 5082, 5113,
>5144, 5173, 5204, 5234, 5265, 5295, 5326, 5357, 5387, 5418, 5448,
>5479, 5510, 5538, 5569, 5599, 5630, 5660, 5691, 5722, 5752, 5783,
>5813, 5844, 5875, 5903, 5934, 5964, 5995, 6025, 6056, 6087, 6117,
>6148, 6178, 6209, 6240, 6268, 6299, 6329, 6360, 6390, 6421, 6452,
>6482, 6513, 6543, 6574, 6605, 6634, 6665, 6695, 6726, 6756, 6787,
>6818, 6848, 6879, 6909, 6940, 6971, 6999, 7030, 7060, 7091, 7121,
>7152, 7183, 7213, 7244, 7274, 7305, 7336, 7364, 7395, 7425, 7456,
>7486, 7517, 7548, 7578, 7609, 7639, 7670, 7701, 7729, 7760, 7790,
>7821, 7851, 7882, 7913, 7943, 7974, 8004, 8035, 8066, 8095, 8126,
>8156, 8187, 8217, 8248, 8279, 8309, 8340, 8370, 8401, 8432, 8460,
>8491, 8521, 8552, 8582, 8613, 8644, 8674, 8705, 8735, 8766, 8797,
>8825, 8856, 8886, 8917, 8947, 8978, 9009, 9039, 9070, 9100, 9131,
>9162, 9190, 9221, 9251, 9282, 9312, 9343, 9374, 9404, 9435, 9465,
>9496, 9527, 9556, 9587, 9617, 9648, 9678, 9709, 9740, 9770, 9801,
>9831, 9862, 9893, 9921, 9952, 9982, 10013, 10043, 10074, 10105,
>10135, 10166, 10196, 10227, 10258, 10286, 10317, 10347, 10378,
>10408, 10439, 10470, 10500, 10531, 10561, 10592, 10623, 10651,
>10682, 10712, 10743, 10773, 10804, 10835, 10865, 10896, 10926,
>10957, 10988, 11017, 11048, 11078, 11109, 11139, 11170, 11201,
>11231, 11262, 11292, 11323, 11354, 11382, 11413, 11443, 11474,
>11504, 11535, 11566, 11596, 11627, 11657, 11688, 11719, 11747,
>11778, 11808, 11839, 11869, 11900, 11931, 11961, 11992, 12022,
>12053, 12084, 12112, 12143, 12173, 12204, 12234, 12265, 12296,
>12326, 12357, 12387, 12418, 12449, 12478, 12509, 12539, 12570,
>12600, 12631, 12662, 12692, 12723, 12753, 12784, 12815, 12843,
>12874, 12904, 12935, 12965, 12996, 13027, 13057, 13088, 13118,
>13149, 13180, 13208, 13239, 13269, 13300, 13330, 13361, 13392,
>13422, 13453, 13483, 13514, 13545, 13573, 13604, 13634, 13665,
>13695, 13726, 13757, 13787, 13818, 13848, 13879, 13910, 13939,
>13970, 14000, 14031, 14061, 14092, 14123, 14153, 14184, 14214,
>14245, 14276, 14304, 14335, 14365, 14396, 14426, 14457, 14488,
>14518, 14549, 14579, 14610, 14641, 14669, 14700, 14730, 14761,
>14791, 14822, 14853, 14883, 14914, 14944, 14975, 15006, 15034,
>15065, 15095, 15126, 15156, 15187, 15218, 15248, 15279, 15309,
>15340, 15371, 15400, 15431, 15461, 15492, 15522, 15553, 15584,
>15614, 15645, 15675, 15706, 15737, 15765, 15796, 15826, 15857,
>15887, 15918, 15949, 15979, 16010, 16040, 16071, 16102, 16130,
>16161, 16191, 16222, 16252, 16283, 16314, 16344, 16375, 16405,
>16436, 16467, 16495, 16526, 16556, 16587, 16617, 16648, 16679,
>16709, 16740, 3652, 3683, 3712, 3743, 3773, 3804, 3834, 3865,
>3896, 3926, 3957, 3987, 4018, 4049, 4077, 4108, 4138, 4169, 4199,
>4230, 4261, 4291, 4322, 4352, 4383, 4414, 4442, 4473, 4503, 4534,
>4564, 4595, 4626, 4656, 4687, 4717, 4748, 4779, 4807, 4838, 4868,
>4899, 4929, 4960, 4991, 5021, 5052, 5082, 5113, 5144, 5173, 5204,
>5234, 5265, 5295, 5326, 5357, 5387, 5418, 5448, 5479, 5510, 5538,
>5569, 5599, 5630, 5660, 5691, 5722, 5752, 5783, 5813, 5844, 5875,
>5903, 5934, 5964, 5995, 6025, 6056, 6087, 6117, 6148, 6178, 6209,
>6240, 6268, 6299, 6329, 6360, 6390, 6421, 6452, 6482, 6513, 6543,
>6574, 6605, 6634, 6665, 6695, 6726, 6756, 6787, 6818, 6848, 6879,
>6909, 6940, 6971, 6999, 7030, 7060, 7091, 7121, 7152, 7183, 7213,
>7244, 7274, 7305, 7336, 7364, 7395, 7425, 7456, 7486, 7517, 7548,
>7578, 7609, 7639, 7670, 7701, 7729, 7760, 7790, 7821, 7851, 7882,
>7913, 7943, 7974, 8004, 8035, 8066, 8095, 8126, 8156, 8187, 8217,
>8248, 8279, 8309, 8340, 8370, 8401, 8432, 8460, 8491, 8521, 8552,
>8582, 8613, 8644, 8674, 8705, 8735, 8766, 8797, 8825, 8856, 8886,
>8917, 8947, 8978, 9009, 9039, 9070, 9100, 9131, 9162, 

Re: [R] ggplot2 - specific y axis scale for each time series in facet grind

2016-01-21 Thread Ulrik Stervbo
You can try facet_grid(variable~., scales = "free_y")

On Thu, 21 Jan 2016 at 19:29 Maxim Fomin  wrote:

> Dear R users,
>
> I have a (melted) data frame of several metal prices from 1980. I want to
> make a time series plot for each metal price. By default ggplot constructs
> single plot for all prices. Adding +facet_grid(variable~.) makes for each
> metal price a plot, but now there is another problem - scale of y axis.
> Some metals have price $1000 and some $2. Because ggplot makes same y scale
> for each metal, some metal prices printed as straight horizontal line. What
> is the command to make for each plot specific y axis scale?
>
> Currently I am trying command:
>
> ggplot(data=melted2, aes(x=date, y=value, group=variable,
> color=variable))+geom_line()+facet_grid(variable~.)
>
>
> Best regards,
> Maxim
>
> P.S dput
>
> structure(list(date = structure(c(3652, 3683, 3712, 3743, 3773,
> 3804, 3834, 3865, 3896, 3926, 3957, 3987, 4018, 4049, 4077, 4108,
> 4138, 4169, 4199, 4230, 4261, 4291, 4322, 4352, 4383, 4414, 4442,
> 4473, 4503, 4534, 4564, 4595, 4626, 4656, 4687, 4717, 4748, 4779,
> 4807, 4838, 4868, 4899, 4929, 4960, 4991, 5021, 5052, 5082, 5113,
> 5144, 5173, 5204, 5234, 5265, 5295, 5326, 5357, 5387, 5418, 5448,
> 5479, 5510, 5538, 5569, 5599, 5630, 5660, 5691, 5722, 5752, 5783,
> 5813, 5844, 5875, 5903, 5934, 5964, 5995, 6025, 6056, 6087, 6117,
> 6148, 6178, 6209, 6240, 6268, 6299, 6329, 6360, 6390, 6421, 6452,
> 6482, 6513, 6543, 6574, 6605, 6634, 6665, 6695, 6726, 6756, 6787,
> 6818, 6848, 6879, 6909, 6940, 6971, 6999, 7030, 7060, 7091, 7121,
> 7152, 7183, 7213, 7244, 7274, 7305, 7336, 7364, 7395, 7425, 7456,
> 7486, 7517, 7548, 7578, 7609, 7639, 7670, 7701, 7729, 7760, 7790,
> 7821, 7851, 7882, 7913, 7943, 7974, 8004, 8035, 8066, 8095, 8126,
> 8156, 8187, 8217, 8248, 8279, 8309, 8340, 8370, 8401, 8432, 8460,
> 8491, 8521, 8552, 8582, 8613, 8644, 8674, 8705, 8735, 8766, 8797,
> 8825, 8856, 8886, 8917, 8947, 8978, 9009, 9039, 9070, 9100, 9131,
> 9162, 9190, 9221, 9251, 9282, 9312, 9343, 9374, 9404, 9435, 9465,
> 9496, 9527, 9556, 9587, 9617, 9648, 9678, 9709, 9740, 9770, 9801,
> 9831, 9862, 9893, 9921, 9952, 9982, 10013, 10043, 10074, 10105,
> 10135, 10166, 10196, 10227, 10258, 10286, 10317, 10347, 10378,
> 10408, 10439, 10470, 10500, 10531, 10561, 10592, 10623, 10651,
> 10682, 10712, 10743, 10773, 10804, 10835, 10865, 10896, 10926,
> 10957, 10988, 11017, 11048, 11078, 11109, 11139, 11170, 11201,
> 11231, 11262, 11292, 11323, 11354, 11382, 11413, 11443, 11474,
> 11504, 11535, 11566, 11596, 11627, 11657, 11688, 11719, 11747,
> 11778, 11808, 11839, 11869, 11900, 11931, 11961, 11992, 12022,
> 12053, 12084, 12112, 12143, 12173, 12204, 12234, 12265, 12296,
> 12326, 12357, 12387, 12418, 12449, 12478, 12509, 12539, 12570,
> 12600, 12631, 12662, 12692, 12723, 12753, 12784, 12815, 12843,
> 12874, 12904, 12935, 12965, 12996, 13027, 13057, 13088, 13118,
> 13149, 13180, 13208, 13239, 13269, 13300, 13330, 13361, 13392,
> 13422, 13453, 13483, 13514, 13545, 13573, 13604, 13634, 13665,
> 13695, 13726, 13757, 13787, 13818, 13848, 13879, 13910, 13939,
> 13970, 14000, 14031, 14061, 14092, 14123, 14153, 14184, 14214,
> 14245, 14276, 14304, 14335, 14365, 14396, 14426, 14457, 14488,
> 14518, 14549, 14579, 14610, 14641, 14669, 14700, 14730, 14761,
> 14791, 14822, 14853, 14883, 14914, 14944, 14975, 15006, 15034,
> 15065, 15095, 15126, 15156, 15187, 15218, 15248, 15279, 15309,
> 15340, 15371, 15400, 15431, 15461, 15492, 15522, 15553, 15584,
> 15614, 15645, 15675, 15706, 15737, 15765, 15796, 15826, 15857,
> 15887, 15918, 15949, 15979, 16010, 16040, 16071, 16102, 16130,
> 16161, 16191, 16222, 16252, 16283, 16314, 16344, 16375, 16405,
> 16436, 16467, 16495, 16526, 16556, 16587, 16617, 16648, 16679,
> 16709, 16740, 3652, 3683, 3712, 3743, 3773, 3804, 3834, 3865,
> 3896, 3926, 3957, 3987, 4018, 4049, 4077, 4108, 4138, 4169, 4199,
> 4230, 4261, 4291, 4322, 4352, 4383, 4414, 4442, 4473, 4503, 4534,
> 4564, 4595, 4626, 4656, 4687, 4717, 4748, 4779, 4807, 4838, 4868,
> 4899, 4929, 4960, 4991, 5021, 5052, 5082, 5113, 5144, 5173, 5204,
> 5234, 5265, 5295, 5326, 5357, 5387, 5418, 5448, 5479, 5510, 5538,
> 5569, 5599, 5630, 5660, 5691, 5722, 5752, 5783, 5813, 5844, 5875,
> 5903, 5934, 5964, 5995, 6025, 6056, 6087, 6117, 6148, 6178, 6209,
> 6240, 6268, 6299, 6329, 6360, 6390, 6421, 6452, 6482, 6513, 6543,
> 6574, 6605, 6634, 6665, 6695, 6726, 6756, 6787, 6818, 6848, 6879,
> 6909, 6940, 6971, 6999, 7030, 7060, 7091, 7121, 7152, 7183, 7213,
> 7244, 7274, 7305, 7336, 7364, 7395, 7425, 7456, 7486, 7517, 7548,
> 7578, 7609, 7639, 7670, 7701, 7729, 7760, 7790, 7821, 7851, 7882,
> 7913, 7943, 7974, 8004, 8035, 8066, 8095, 8126, 8156, 8187, 8217,
> 8248, 8279, 8309, 8340, 8370, 8401, 8432, 8460, 8491, 8521, 8552,
> 8582, 8613, 8644, 8674, 8705, 8735, 8766, 8797, 8825, 8856, 8886,
> 8917, 8947, 8978, 9009, 9039, 9070, 9100, 9131, 9162, 9190, 9221,
> 9251, 9282, 9312, 9343, 9374, 9404, 9435, 9465, 9496, 9527, 9556,
> 

Re: [R] tcltk tkwidget(..."table")

2016-01-21 Thread peter dalgaard

> On 21 Jan 2016, at 00:25 , Dalthorp, Daniel  wrote:
> 
> Thanks, Peter. 
> 
> I'm sure that's right, but it requires knowing: (1) that there's something 
> called the "width subcommand", and (2) how to format the call to that 
> command/subcommand.
> 

Yes, there's a fair amount of that going on with the tcltk interface. You need 
to both grasp the rules for passing arguments to the underlying Tcl command, 
and know how to find and read the Tcl/Tk documentation. Once you're up to speed 
on those issues it's not all that hard to find stuff in (for the present case), 
say, http://tktable.sourceforge.net/tktable/doc/tkTable.html

The situation may be unfortunate, but the alternative is for "someone" to sit 
down an convert all relevant Tcl/Tk documentation to R help files.

-pd 


> I was able to do it eventually but only after a few hours of effort searching 
> the web for help.
> 
> E.g. with a table (called table1) with 3 columns and want to set widths to 
> 30, 5, and 5:
> 
> colwidths<-c(30, 5, 5)
> 
> for(i in 1:3) {
>   tcl(table1, "width", i - 1, colwidths[i])
> }
> 
> 
> 
> On Wed, Jan 20, 2016 at 3:07 PM, peter dalgaard  wrote:
> 
> > On 19 Jan 2016, at 20:48 , Dalthorp, Daniel  wrote:
> >
> > Does anyone know a simple way to create a tcltk table with columns of
> > varying widths?
> 
> Create a table, then set the width of the columns with the width subcommand?
> 
> -pd
> 
> 
> pathName width ?col? ?value col value ...? If no col is specified, returns a 
> list describing all cols for which a width has been set. If col is specified 
> with no value, it prints out the width of that col in characters (positive 
> number) or pixels (negative number). If one or more col-value pairs are 
> specified, then it sets each col to be that width in characters (positive 
> number) or pixels (negative number). If value is default, then the col uses 
> the default width, specified by -colwidth.
> 
> 
> 
> >
> > -Dan
> >
> >
> >
> > --
> > Dan Dalthorp, PhD
> > USGS Forest and Rangeland Ecosystem Science Center
> > Forest Sciences Lab, Rm 189
> > 3200 SW Jefferson Way
> > Corvallis, OR 97331
> > ph: 541-750-0953
> > ddalth...@usgs.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.
> 
> --
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Office: A 4.23
> Email: pd@cbs.dk  Priv: pda...@gmail.com
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> Dan Dalthorp, PhD
> USGS Forest and Rangeland Ecosystem Science Center
> Forest Sciences Lab, Rm 189
> 3200 SW Jefferson Way 
> Corvallis, OR 97331 
> ph: 541-750-0953
> ddalth...@usgs.gov
> 

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

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ggplot2 - specific y axis scale for each time series in facet grind

2016-01-21 Thread Maxim Fomin
Thanks, that worked.

Best regards,
Maxim

2016-01-21 22:29 GMT+03:00 Ulrik Stervbo :
>
> You can try facet_grid(variable~., scales = "free_y")
>
> On Thu, 21 Jan 2016 at 19:29 Maxim Fomin  wrote:
>>
>> Dear R users,
>>
>> I have a (melted) data frame of several metal prices from 1980. I want to
>> make a time series plot for each metal price. By default ggplot constructs
>> single plot for all prices. Adding +facet_grid(variable~.) makes for each
>> metal price a plot, but now there is another problem - scale of y axis.
>> Some metals have price $1000 and some $2. Because ggplot makes same y scale
>> for each metal, some metal prices printed as straight horizontal line. What
>> is the command to make for each plot specific y axis scale?
>>
>> Currently I am trying command:
>>
>> ggplot(data=melted2, aes(x=date, y=value, group=variable,
>> color=variable))+geom_line()+facet_grid(variable~.)
>>
>>
>> Best regards,
>> Maxim
>>

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