Re: [R] Retrieving lists of colnames

2014-10-16 Thread PIKAL Petr
Hi

First of all you shall transfer your data to R.

Maybe it can be solved by apply but in your case I would use for cycle

Let say your data frame is named doc

lll-vector(nrow(doc), mode=list)
for(i in 1:nrow(doc)) lll[[i]]-colnames(doc)[(which(doc[i,]0))]

Cheers
Petr

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of adam.n.jenkin...@gmail.com
 Sent: Wednesday, October 15, 2014 2:24 PM
 To: r-help@r-project.org
 Subject: [R] Retrieving lists of colnames



 Hi what I have is a large excel doc (100 columns, 350 row) with data
 values from 0-1. The end goal is for each row to have a list of
 colnames of which columns contain values 0. I've been tinkering around
 with apply mostly and some other functions, any help offered would be
 greatly appreciated.
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] HELP

2014-10-16 Thread PIKAL Petr
Hi

It will be even worse with age, try to contact optician :-)

If you want to get better answer you need to provide more info about your file, 
what you did and how it failed.

Cheers
Petr


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of JAVAD LESSAN
 Sent: Wednesday, October 15, 2014 2:53 PM
 To: r-help@r-project.org
 Subject: [R] HELP

 Hello There!

 I have an issue reading a large text file and parsing it. I would be
 grateful if you let me you can help me about? Thanks.

 Javad

   [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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
https://stat.ethz.ch/mailman/listinfo/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 loop through dataframe objects in environment

2014-10-16 Thread Vikash Kumar
Hi Stephen,

Try out lapply(). It would help you loop through all data frames and sum.

Regards,
Vikash

On Thu, Oct 16, 2014 at 1:58 AM, Stephen HK Wong hon...@stanford.edu
wrote:

 Dear All,

 I  have many 50 objects they are all dataframes. Each dataframe has many
 rows and four column. I simply want to do an addition of 3rd and 4th column
 and save the result into 5th column. Since there are many dataframes, I
 don't want to do it one by one,  is there a way to loop through all objects
 and perform the similar action ?

 One way I can think of is like this:

 for (i in 1:50){
 get(ls()[i])[,3]+get(ls()[i][,4]
 }

 But I don't know how to save the addition result back to 5th column of
 each dataframe.


 Many Thanks!



 Stephen HK Wong

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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
https://stat.ethz.ch/mailman/listinfo/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] Retrieving lists of colnames

2014-10-16 Thread Vikash Kumar
Hi Adam,

I guess below code would help you achieve the desired ouput.

 colnames(data[,which(apply(data,2,FUN = function(x){any(x0.5)}))])

Happy Learning!

Vikash

On Wed, Oct 15, 2014 at 5:53 PM, adam.n.jenkin...@gmail.com 
adam.n.jenkin...@gmail.com wrote:



 Hi what I have is a large excel doc (100 columns, 350 row) with data
 values from 0-1. The end goal is for each row to have a list of
 colnames of which columns contain values 0. I've been tinkering around
 with apply mostly and some other functions, any help offered would be
 greatly appreciated.
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] package installation failure virtualisation environment

2014-10-16 Thread rl

On 2014-10-15 09:13, Sven E. Templer wrote:

did you check the connection in R via for example:

head(readLines(http://cran.r-project.org/web/licenses/GPL-3;))

which should yield:

[1] GNU GENERAL PUBLIC LICENSE
[2]Version 3, 29 June 2007
[3] 
[4]  Copyright (C) 2007 Free Software Foundation, Inc. 
http://fsf.org/

[5]  Everyone is permitted to copy and distribute verbatim copies
[6]  of this license document, but changing it is not allowed.



Yes, this result is seen.

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


Re: [R] package installation failure virtualisation environment

2014-10-16 Thread rl

On 2014-10-15 15:36, William Dunlap wrote:

Have you looked at recent entries in the system log files in /var/log,
especially /var/log/kern.log?


No such log file exist and other files in the directory do not make 
reference to R and any general errors (e.g. internet access).


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Retrieving lists of colnames

2014-10-16 Thread PIKAL Petr
Hi

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Vikash Kumar
 Sent: Thursday, October 16, 2014 7:06 AM
 To: adam.n.jenkin...@gmail.com
 Cc: r-help@r-project.org
 Subject: Re: [R] Retrieving lists of colnames

 Hi Adam,

 I guess below code would help you achieve the desired ouput.

  colnames(data[,which(apply(data,2,FUN = function(x){any(x0.5)}))])

I do not think so. It will give you overall names but not names for each row, 
which as I understand Adam needs.

Try

 data-data.frame(embed(1:12,2))
 data6
 X1X2
 [1,]  TRUE  TRUE
 [2,]  TRUE  TRUE
 [3,]  TRUE  TRUE
 [4,]  TRUE  TRUE
 [5,] FALSE  TRUE
 [6,] FALSE FALSE
 [7,] FALSE FALSE
 [8,] FALSE FALSE
 [9,] FALSE FALSE
[10,] FALSE FALSE
[11,] FALSE FALSE

 colnames(data[,which(apply(data,2,FUN = function(x){any(x6)}))])
[1] X1 X2


 lll-vector(nrow(data), mode=list)
 for(i in 1:nrow(data)) lll[[i]]-colnames(data)[(which(data[i,]6))]
 lll
[[1]]
[1] X1 X2

[[2]]
[1] X1 X2

[[3]]
[1] X1 X2

[[4]]
[1] X1 X2

[[5]]
[1] X2

[[6]]
character(0)

[[7]]
character(0)

[[8]]
character(0)

[[9]]
character(0)

[[10]]
character(0)

[[11]]
character(0)


Cheers
Petr



 Happy Learning!

 Vikash

 On Wed, Oct 15, 2014 at 5:53 PM, adam.n.jenkin...@gmail.com 
 adam.n.jenkin...@gmail.com wrote:

 
 
  Hi what I have is a large excel doc (100 columns, 350 row) with data
  values from 0-1. The end goal is for each row to have a list of
  colnames of which columns contain values 0. I've been tinkering
  around with apply mostly and some other functions, any help offered
  would be greatly appreciated.
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/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
 https://stat.ethz.ch/mailman/listinfo/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 

Re: [R] how to loop through dataframe objects in environment

2014-10-16 Thread Jeff Newmiller
This advice works best when you use the lapply function to load your data 
frames to begin with. That way your like-structured data frames are grouped 
into one list that you can loop through without complicated use of get and 
assign.

dtadir - mydatadir
fnames - list.files( dtadir )
dtalist - lapply( fnames, function( fn ) { read.csv( file.path( dtadir, fn ) ) 
}
for ( idx in seq_along( dtalist ) ) {
  dtalist[[ idx]]$result - dtalist[[ idx ]][ , 3 ] + dtalist[[ idx ]][ , 4 ]
}

---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On October 15, 2014 8:59:01 PM PDT, Vikash Kumar vikash.kr@gmail.com 
wrote:
Hi Stephen,

Try out lapply(). It would help you loop through all data frames and
sum.

Regards,
Vikash

On Thu, Oct 16, 2014 at 1:58 AM, Stephen HK Wong hon...@stanford.edu
wrote:

 Dear All,

 I  have many 50 objects they are all dataframes. Each dataframe has
many
 rows and four column. I simply want to do an addition of 3rd and 4th
column
 and save the result into 5th column. Since there are many dataframes,
I
 don't want to do it one by one,  is there a way to loop through all
objects
 and perform the similar action ?

 One way I can think of is like this:

 for (i in 1:50){
 get(ls()[i])[,3]+get(ls()[i][,4]
 }

 But I don't know how to save the addition result back to 5th column
of
 each dataframe.


 Many Thanks!



 Stephen HK Wong

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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
https://stat.ethz.ch/mailman/listinfo/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
https://stat.ethz.ch/mailman/listinfo/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] Retrieving lists of colnames

2014-10-16 Thread Vikash Kumar
Hi, It works! Only one thing we need to note is when we have only one
column name as an output we do not get the results.


 d=c(11:21)
 e=c(51:61)
 data-data.frame(embed(1:12,2))
 data=cbind(data,d,e)
 data6
 X1  X2  d e
 [1,] FALSE FALSE TRUE TRUE
 [2,] FALSE FALSE TRUE TRUE
 [3,] FALSE FALSE TRUE TRUE
 [4,] FALSE FALSE TRUE TRUE
 [5,] FALSE FALSE TRUE TRUE
 [6,]  TRUE FALSE TRUE TRUE
 [7,]  TRUE  TRUE TRUE TRUE
 [8,]  TRUE  TRUE TRUE TRUE
 [9,]  TRUE  TRUE TRUE TRUE
[10,]  TRUE  TRUE TRUE TRUE
[11,]  TRUE  TRUE TRUE TRUE
 data-data.frame(data)
* names(data[,which(apply(data,2,FUN = function(x){all(x6)}))])*
[1] d e

Thanks


On Thu, Oct 16, 2014 at 3:26 PM, PIKAL Petr petr.pi...@precheza.cz wrote:

 Hi

  -Original Message-
  From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
  project.org] On Behalf Of Vikash Kumar
  Sent: Thursday, October 16, 2014 7:06 AM
  To: adam.n.jenkin...@gmail.com
  Cc: r-help@r-project.org
  Subject: Re: [R] Retrieving lists of colnames
 
  Hi Adam,
 
  I guess below code would help you achieve the desired ouput.
 
   colnames(data[,which(apply(data,2,FUN = function(x){any(x0.5)}))])

 I do not think so. It will give you overall names but not names for each
 row, which as I understand Adam needs.

 Try

  data-data.frame(embed(1:12,2))
  data6
  X1X2
  [1,]  TRUE  TRUE
  [2,]  TRUE  TRUE
  [3,]  TRUE  TRUE
  [4,]  TRUE  TRUE
  [5,] FALSE  TRUE
  [6,] FALSE FALSE
  [7,] FALSE FALSE
  [8,] FALSE FALSE
  [9,] FALSE FALSE
 [10,] FALSE FALSE
 [11,] FALSE FALSE

  colnames(data[,which(apply(data,2,FUN = function(x){any(x6)}))])
 [1] X1 X2


  lll-vector(nrow(data), mode=list)
  for(i in 1:nrow(data)) lll[[i]]-colnames(data)[(which(data[i,]6))]
  lll
 [[1]]
 [1] X1 X2

 [[2]]
 [1] X1 X2

 [[3]]
 [1] X1 X2

 [[4]]
 [1] X1 X2

 [[5]]
 [1] X2

 [[6]]
 character(0)

 [[7]]
 character(0)

 [[8]]
 character(0)

 [[9]]
 character(0)

 [[10]]
 character(0)

 [[11]]
 character(0)


 Cheers
 Petr


 
  Happy Learning!
 
  Vikash
 
  On Wed, Oct 15, 2014 at 5:53 PM, adam.n.jenkin...@gmail.com 
  adam.n.jenkin...@gmail.com wrote:
 
  
  
   Hi what I have is a large excel doc (100 columns, 350 row) with data
   values from 0-1. The end goal is for each row to have a list of
   colnames of which columns contain values 0. I've been tinkering
   around with apply mostly and some other functions, any help offered
   would be greatly appreciated.
   __
   R-help@r-project.org mailing list
   https://stat.ethz.ch/mailman/listinfo/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
  https://stat.ethz.ch/mailman/listinfo/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 

[R] ggplot: Stacked bar/pie chart - Objects above the bar/pie

2014-10-16 Thread Gunnar Oehmichen
Hello,

I would like to draw a circle on top of a pie chart (The plot does not
need to fullfill scientific standards). The circle represents the
relation of a reference-value in comparison to the summed values of the
pie-pieces. To be able to do this I partly followed:
http://rpubs.com/RobinLovelace/11641 . But i have the problem of some
bar/pie pieces being placed above the stacked bar/outside of the pie
chart, see graph PA / PA + coord_polar.

System: $platform [1] i686-pc-linux-gnu; $version.string [1] R
version 3.1.1 (2014-07-10); ggplot2_0.9.3.1



require (ggplot2)

mdf - structure(list(
  VG = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L),
 .Label = c(A, B), class = factor),
  variable = structure(c(4L, 3L, 5L, 1L, 2L, 1L, 4L, 3L, 2L, 5L),
   .Label = c(a, b, c,  d, e), class =
factor),
  value = c(0, 8407346.56, 0, 124901773, 0, 184987520, 14612608,
3165030, 0, 0),
  reference = c(0.75, 0.75, 0.75, 0.75, 0.75, 1.25, 1.25, 1.25, 1.25,
1.25)),
  .Names = c(VG, variable, value, reference),
  row.names = c(16L, 17L, 18L,   19L, 20L, 46L, 47L, 48L, 49L, 50L),
class = data.frame)

# Calculate position
pos - function (x) 0.5 * (cumsum(x) + cumsum(c(0, x[-length(x)])))
lmdf - dlply (mdf, VG)
lmdf - lapply (lmdf, function (X) { X$pos - pos (X$value)
 return (X) })
mdf - rbind.data.frame (lmdf[[1]], lmdf[[2]])

# height (radius) of all pieces (variable) in one bar (pie) will be the
same:
mdf$rad - 1

# abline from the reference column in the dataframe
INTCA - unique (mdf$reference[mdf$VG==A])
PA - ggplot (mdf[mdf$VG==A,], aes (x = pos, y = rad)) +
  geom_bar (stat = identity, aes (fill = variable, width = value)) +
  geom_abline(intercept = INTCA, slope = 0)

PA
PA + coord_polar()
# Object c is placed above its position on the y axis

# abline from the reference column in the dataframe
INTCB - unique (mdf$reference[mdf$VG==B])
PB - ggplot (mdf[mdf$VG==B,], aes (x = pos, y = rad)) +
  geom_bar (stat = identity, aes (fill = variable, width = value)) +
  geom_abline(intercept = INTCB, slope = 0)

PB
PB + coord_polar()
# all objects are within rad = 1

###

Your help would be very much appreciated,

Gunnar

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Job Opening - PhD Discovery Statistician at Cambridge, MA

2014-10-16 Thread Liu, Ray
To all:

We have an immediate opening for one PhD statistician in the Analytical 
Innovation and Consultation group at Cambridge MA site. This group provides 
statistical project support and consultation services to Takeda's discovery, 
manufacturing, translational research, phase I clinical trial and outcome 
research areas. The person will work primary with discovery and CMC scientists, 
with the option to work on other areas. This is a perfect position for the 
person who enjoys learning science, promoting quantitative thinking and 
developing novel methodology. If you are interested in more details about this 
position, please send inquiries directly to ray@takeda.com . Thanks.




This e-mail, including any attachments, is a confidential business 
communication, and may contain information that is confidential, proprietary 
and/or privileged. This e-mail is intended only for the individual(s) to whom 
it is addressed, and may not be saved, copied, printed, disclosed or used by 
anyone else. If you are not the(an) intended recipient, please immediately 
delete this e-mail from your computer system and notify the sender. Thank you.

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


Re: [R] package installation failure virtualisation environment

2014-10-16 Thread William Dunlap
The log files may not have the name of the process (R), but only its
process number.  A good way to look at the log files in /var/log is to
cause your 'Kill' problem then use 'ls -lstA' or 'ls -lstrA' in
/var/log to see which ones changed recently.
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Thu, Oct 16, 2014 at 2:03 AM,  r...@openmailbox.org wrote:
 On 2014-10-15 15:36, William Dunlap wrote:

 Have you looked at recent entries in the system log files in /var/log,
 especially /var/log/kern.log?


 No such log file exist and other files in the directory do not make
 reference to R and any general errors (e.g. internet access).

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 for i-else iwth more than one alternative

2014-10-16 Thread moeby
I try to run an if-else command line where the else argument should be the
corresponding value of the pmax command.

#
#opt.fc is the optimal forecast
#rmax is the vector of the maximized r squared from pmax-command of 2 data
sets containing r squares 
#fc1 are the estimates of a specific forecast model (e.g. AR1)
#fc are the estimates of a specific forecast model, namely the Benchmark
(e.g. mean)

opt.fc - as.numeric(373) #data length is 373
for (x in 1:373)
{
if (rmax[x]  0.1)
opt.fc[x] - fc[x] #if rmax smaller than the value 0.1 the forecast of the
benchmark should be used.
else
opt.fc[x] - fc1[x] #else the forecast of fc model should be used.
}
So far, so easy.

How can I compute the opt.fc when I have more than one alternative forecast
model, let's say fc2 and fc3. 
In Addition, I want to use the values from the forecast model where the
values of the corresponding r squared are maxed (pmax(fcr1,fcr2,fcr3...)
. :(

any ideas?
 
Thank you very much in advance.
 
  



--
View this message in context: 
http://r.789695.n4.nabble.com/Help-for-i-else-iwth-more-than-one-alternative-tp4698410.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Time outside limits

2014-10-16 Thread Bart Joosen
Hi,
I'm currently facing the problem that I need to write a function where I get a 
dataframe back which contains the time (in hours) outside the limits of a 
temperature sensor, each month, and for how long exactly.
I wrote a for loop which check:- if a datapoint is outside the limit- if the 
previous datapoint is outside the limt, then count + 1- if the next datapoint 
isn't outside: write in dataframe.
I guess this could be with some vectorisation function, I tried with seq_along, 
and match, but couldn't figure it out.
Here some sample data:
y - c(rnorm(10,25), rnorm(10,32),rnorm(10,25), rnorm(10,20), rnorm(10,25))x - 
seq(c(ISOdate(2000,3,20)), by = hour, length.out = length(y))
limits of y: c(22,27)
Thanks
Bart  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Time outside limits

2014-10-16 Thread daniel
Bart,

Check if the following could help you.

library(xts)
y - c(rnorm(10,25), rnorm(10,32),rnorm(10,25), rnorm(10,20),
rnorm(10,25)); x - seq(c(ISOdate(2000,3,20)), by = hour, length.out =
length(y))
z - xts( y, order.by=as.POSIXct(x))
limit - ifelse( lag(z)  22 | z  27, 1, 0)


Daniel Merino

2014-10-16 15:12 GMT-03:00 Bart Joosen bartjoo...@hotmail.com:

 Hi,
 I'm currently facing the problem that I need to write a function where I
 get a dataframe back which contains the time (in hours) outside the limits
 of a temperature sensor, each month, and for how long exactly.
 I wrote a for loop which check:- if a datapoint is outside the limit- if
 the previous datapoint is outside the limt, then count + 1- if the next
 datapoint isn't outside: write in dataframe.
 I guess this could be with some vectorisation function, I tried with
 seq_along, and match, but couldn't figure it out.
 Here some sample data:
 y - c(rnorm(10,25), rnorm(10,32),rnorm(10,25), rnorm(10,20),
 rnorm(10,25))x - seq(c(ISOdate(2000,3,20)), by = hour, length.out =
 length(y))
 limits of y: c(22,27)
 Thanks
 Bart
 [[alternative HTML version deleted]]

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




-- 
Daniel

[[alternative HTML version deleted]]

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


Re: [R] Help for i-else iwth more than one alternative

2014-10-16 Thread MacQueen, Don
If I understand what you¹re trying to do, then I believe this will do the
same as your little loop:

  opt.fc - fc
  opt.fc[rmax  0.1] - fc1[rmax  0.1]

(this is an example of vectorization, and it¹s fundamental to how R works
and the power of R)

Then to extend it, use the same method

  opt.fx[ {some expression} ] - fc2[ {some expression} ]

But I have no idea what {some expression} should be. Perhaps it has
something to do with the maximized r squared values, but I can¹t tell from
what you¹ve said. In any case, the {some expression} has to result in a
logical vector of the same length as the others (373 in your example).

Hope this helps.

-Don

-- 
Don MacQueen

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





On 10/16/14, 8:51 AM, moeby fabian_schle...@hotmail.com wrote:

I try to run an if-else command line where the else argument should be the
corresponding value of the pmax command.

#
#opt.fc is the optimal forecast
#rmax is the vector of the maximized r squared from pmax-command of 2 data
sets containing r squares
#fc1 are the estimates of a specific forecast model (e.g. AR1)
#fc are the estimates of a specific forecast model, namely the Benchmark
(e.g. mean)

opt.fc - as.numeric(373) #data length is 373
for (x in 1:373)
{
if (rmax[x]  0.1)
opt.fc[x] - fc[x] #if rmax smaller than the value 0.1 the forecast of the
benchmark should be used.
else
opt.fc[x] - fc1[x] #else the forecast of fc model should be used.
}
So far, so easy.

How can I compute the opt.fc when I have more than one alternative
forecast
model, let's say fc2 and fc3.
In Addition, I want to use the values from the forecast model where the
values of the corresponding r squared are maxed (pmax(fcr1,fcr2,fcr3...)
. :(

any ideas?
 
Thank you very much in advance.
 
 



--
View this message in context:
http://r.789695.n4.nabble.com/Help-for-i-else-iwth-more-than-one-alternati
ve-tp4698410.html
Sent from the R help mailing list archive at Nabble.com.
   [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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
https://stat.ethz.ch/mailman/listinfo/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] understanding the no-label concept

2014-10-16 Thread moonkid
On 2014-10-11 14:16 David Winsemius dwinsem...@comcast.net wrote:
 Hmisc...

Tried but has no effect on table() calls.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] understanding the no-label concept

2014-10-16 Thread moonkid
On 2014-10-11 15:14 William Dunlap wdun...@tibco.com wrote:
 You can use 'factors' to assign labels to small integer values.  E.g.,
 x - c(1,2,3,4,3)
 fx - factor(x, levels=1:5,
 labels=c(One,Two,Three,Four,Five)) table(fx)
fx
  One   Two Three  Four  Five
1 1 2 1 0

Looks nice. It works! Thanks.

Now I will refere (going back) to the doc to try to understand the
concept behind it.

Reading the introduction before that had no effect on my
understanding. ;)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] understanding the no-label concept

2014-10-16 Thread moonkid
 aa - 1:5
 names(aa) - c(Eins, Zwei, Drei, Vier, Fünf)
 aa
Eins Zwei Drei Vier Fünf
   12345
 table(aa)
1 2 3 4 5
1 1 1 1 1

You see? It didn't work.

 aa - c(aa, 1, 2)
 aa
Eins Zwei Drei Vier Fünf
   1234512

This is no solution for my case.

But...

 bb - matrix(1:12, 3, 4, dimnames=list(letters[1:3], LETTERS[1:4]))

Nice. But look dam complex for a simple task. I see I have to change a
lot of the concepts in my mind and my workflows.

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


Re: [R] HELP

2014-10-16 Thread Greg Snow
I think we have a fortune candidate.

On Thu, Oct 16, 2014 at 12:35 AM, PIKAL Petr petr.pi...@precheza.cz wrote:
 Hi

 It will be even worse with age, try to contact optician :-)

 If you want to get better answer you need to provide more info about your 
 file, what you did and how it failed.

 Cheers
 Petr


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of JAVAD LESSAN
 Sent: Wednesday, October 15, 2014 2:53 PM
 To: r-help@r-project.org
 Subject: [R] HELP

 Hello There!

 I have an issue reading a large text file and parsing it. I would be
 grateful if you let me you can help me about? Thanks.

 Javad

   [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Time outside limits

2014-10-16 Thread Clint Bowman

?rle

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Thu, 16 Oct 2014, daniel wrote:


Bart,

Check if the following could help you.

library(xts)
y - c(rnorm(10,25), rnorm(10,32),rnorm(10,25), rnorm(10,20),
rnorm(10,25)); x - seq(c(ISOdate(2000,3,20)), by = hour, length.out =
length(y))
z - xts( y, order.by=as.POSIXct(x))
limit - ifelse( lag(z)  22 | z  27, 1, 0)


Daniel Merino

2014-10-16 15:12 GMT-03:00 Bart Joosen bartjoo...@hotmail.com:


Hi,
I'm currently facing the problem that I need to write a function where I
get a dataframe back which contains the time (in hours) outside the limits
of a temperature sensor, each month, and for how long exactly.
I wrote a for loop which check:- if a datapoint is outside the limit- if
the previous datapoint is outside the limt, then count + 1- if the next
datapoint isn't outside: write in dataframe.
I guess this could be with some vectorisation function, I tried with
seq_along, and match, but couldn't figure it out.
Here some sample data:
y - c(rnorm(10,25), rnorm(10,32),rnorm(10,25), rnorm(10,20),
rnorm(10,25))x - seq(c(ISOdate(2000,3,20)), by = hour, length.out =
length(y))
limits of y: c(22,27)
Thanks
Bart
[[alternative HTML version deleted]]

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





--
Daniel

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] HELP

2014-10-16 Thread Rolf Turner

On 17/10/14 09:01, Greg Snow wrote:

I think we have a fortune candidate.


Second the nomination!

cheers,

Rolf



On Thu, Oct 16, 2014 at 12:35 AM, PIKAL Petr petr.pi...@precheza.cz wrote:

Hi

It will be even worse with age, try to contact optician :-)

If you want to get better answer you need to provide more info about your file, 
what you did and how it failed.

Cheers
Petr



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of JAVAD LESSAN
Sent: Wednesday, October 15, 2014 2:53 PM
To: r-help@r-project.org
Subject: [R] HELP

Hello There!

I have an issue reading a large text file and parsing it. I would be
grateful if you let me you can help me about? Thanks.

Javad


--
Rolf Turner
Technical Editor ANZJS

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


[R] Difference betweeen cor.test() and formula everyone says to use

2014-10-16 Thread Jeremy Miles
I'm trying to understand how cor.test() is calculating the p-value of
a correlation. It gives a p-value based on t, but every text I've ever
seen gives the calculation based on z.

For example:
 data(cars)
 with(cars[1:10, ], cor.test(speed, dist))

Pearson's product-moment correlation

data:  speed and dist
t = 2.3893, df = 8, p-value = 0.04391
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.02641348 0.90658582
sample estimates:
  cor
0.6453079

But when I use the regular formula:
 r - cor(cars[1:10, ])[1, 2]
 r.z - fisherz(r)
 se - se - 1/sqrt(10 - 3)
 z - r.z / se
 (1 - pnorm(z))*2
[1] 0.04237039

My p-value is different.  The help file for cor.test doesn't (seem to)
have any reference to this, and I can see in the source code that it
is doing something different. I'm just not sure what.

Thanks,

Jeremy

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Difference betweeen cor.test() and formula everyone says to use

2014-10-16 Thread Joshua Wiley
Hi Jeremy,

I don't know about references, but this around.  See for example:
http://afni.nimh.nih.gov/sscc/gangc/tr.html

the relevant line in cor.test is:

STATISTIC - c(t = sqrt(df) * r/sqrt(1 - r^2))

You can convert *t*s to *r*s and vice versa.

Best,

Josh



On Fri, Oct 17, 2014 at 10:32 AM, Jeremy Miles jeremy.mi...@gmail.com
wrote:

 I'm trying to understand how cor.test() is calculating the p-value of
 a correlation. It gives a p-value based on t, but every text I've ever
 seen gives the calculation based on z.

 For example:
  data(cars)
  with(cars[1:10, ], cor.test(speed, dist))

 Pearson's product-moment correlation

 data:  speed and dist
 t = 2.3893, df = 8, p-value = 0.04391
 alternative hypothesis: true correlation is not equal to 0
 95 percent confidence interval:
  0.02641348 0.90658582
 sample estimates:
   cor
 0.6453079

 But when I use the regular formula:
  r - cor(cars[1:10, ])[1, 2]
  r.z - fisherz(r)
  se - se - 1/sqrt(10 - 3)
  z - r.z / se
  (1 - pnorm(z))*2
 [1] 0.04237039

 My p-value is different.  The help file for cor.test doesn't (seem to)
 have any reference to this, and I can see in the source code that it
 is doing something different. I'm just not sure what.

 Thanks,

 Jeremy

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




-- 
Joshua F. Wiley
Ph.D. Student, UCLA Department of Psychology
http://joshuawiley.com/
Senior Analyst, Elkhart Group Ltd.
http://elkhartgroup.com
Office: 260.673.5518

[[alternative HTML version deleted]]

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


[R] how to overwrite a Unary operator ?

2014-10-16 Thread PO SU

Dear expeRts,
  Now i want to know how to implement an Unary operator like  i++ in cpp's  
synax form.
  e.g.   2++  will let 2 be 3 ,  a-2 ,a++ ,will let a be 3
I tried this :
 '%++%'-function(x){
   x-x+1
}
but it have problem, the biggest one is   it seems  the function need two 
params like   a%++%b , how to write a function needing just one param?

TKS !



--

PO SU
mail: desolato...@163.com 
Majored in Statistics from SJTU
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 overwrite a Unary operator ?

2014-10-16 Thread Rolf Turner

On 17/10/14 17:29, PO SU wrote:


Dear expeRts,
   Now i want to know how to implement an Unary operator like  i++ in cpp's  
synax form.
   e.g.   2++  will let 2 be 3 ,  a-2 ,a++ ,will let a be 3
I tried this :
  '%++%'-function(x){
x-x+1
}
but it have problem, the biggest one is it seems the function need
twoparams like a%++%b , how to write a function needing just one param?

TKS !


Just ***DON'T***.  The ++ operator is useful only for those wish to 
write code which is obscure to the point of incomprehensibility.  It 
makes C and its offspring write only languages.


If you are going to use R, use R and don't pollute it with such 
abominations.


cheers,

Rolf Turner


--
Rolf Turner
Technical Editor ANZJS

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Making a very specific heatmap in R (ggplot2?)

2014-10-16 Thread Alexander Predeus
Hello All,

I'm trying to figure out the (automated) way to generate heatmaps from
simple data tables with annotated rows and columns. In the end, I need
these files to be easily viewed in a browser.

The initial data tables are simple; numbers are row-normalized (values are
real numbers varying from -1.0 to +1.0), with rows numbered from a zero to
a certain integer, and columns are named with (sometimes lengthy) strings.

What I came up with so far is building the heatmap using standard facility
with a set resolution of the final png file:

Which sort of works sometimes:

And fails pretty miserably other times:

What I really would like to do, is to make a heatmap with set number of
pixels per square, with a set font size (in pixels as well), and then save
it as a .png with variable resolution (appropriate for each concrete
heatmap). That way, a cell would be always say 10 by 10 pixels, and the
text on the right is always 8 pixels tall.

Alternatively, of course, it would be very neat to save it in some vector
format easily interpreted by the browser, but I have an impression it is
not an easy feat to accomplish.

Thank you very much in advance.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 overwrite a Unary operator ?

2014-10-16 Thread PO SU

Tks for your advice,  let the ++ problem alone, how to write an Unary operator 
? Is it permitted in R?
suchas    a-2 , a%+2%  will let a  be 4 .
I just want to know it , i won't pollute r with it , because i know what is r . 
 : )








--

PO SU
mail: desolato...@163.com 
Majored in Statistics from SJTU




At 2014-10-17 13:09:47, Rolf Turner r.tur...@auckland.ac.nz wrote:
On 17/10/14 17:29, PO SU wrote:

 Dear expeRts,
Now i want to know how to implement an Unary operator like  i++ in cpp's  
 synax form.
e.g.   2++  will let 2 be 3 ,  a-2 ,a++ ,will let a be 3
 I tried this :
   '%++%'-function(x){
 x-x+1
 }
 but it have problem, the biggest one is it seems the function need
 twoparams like a%++%b , how to write a function needing just one param?

 TKS !

Just ***DON'T***.  The ++ operator is useful only for those wish to 
write code which is obscure to the point of incomprehensibility.  It 
makes C and its offspring write only languages.

If you are going to use R, use R and don't pollute it with such 
abominations.

cheers,

Rolf Turner


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


Re: [R-es] RCharts+Leaflet+Shiny

2014-10-16 Thread Miguel Fiandor Gutiérrez
Daniel, muchas gracias por contestar y tan rápido.

Pues puede ser la solución, he hecho el cambio y sigue sin pintarme los
puntos -

  data_ - toJSONArray(data_, json = F)
  map$geoJson(
# leafletR::toGeoJSON(data_,
# # lat.lon = c('Lat', 'Long'),
# dest=output_geofile),
data_,
onEachFeature = '#! function(feature, layer){
  layer.bindPopup(feature.properties.popup)
} !#',
pointToLayer =  #! function(feature, latlng){
return L.circleMarker(latlng, {
  radius: 6,
  fillColor: feature.properties.fillColor ||
'blue',
  color: '#333',
  weight: 1,
  fillOpacity: 0.8
})
  } !#)


Un head(data_) ahora muestra esto -

 head(data_)[[1]]
[[1]]$latitude
[1] 40.386

[[1]]$longitude
[1] -3.725

[[1]]$fillColor
[1] #D251F3



Seguiré investigando pero parece un buen camino! ;-)


El 15 de octubre de 2014, 22:00, daniel daniel...@gmail.com escribió:

 Miguel,

 Alguna experiencia con rCharts tengo pero no tengo experiencia con el
 ejemplo que estás haciendo. Creo el problema es que tienes que convertir
 data_ en un JSON array. Mira la siguiente respuesta de Ramnathv:

  https://github.com/ramnathv/rCharts/issues/114

 donde usa

 toJSONArray(data_, json = F)

 Suerte,

 Daniel Merino

 El 15 de octubre de 2014, 16:18, Miguel Fiandor Gutiérrez 
 miguel.fiandor.gutier...@gmail.com escribió:

 Hola,

 Ando un poco desesperado con los mapas interactivos de Rcharts
 https://github.com/ramnathv/rCharts+Leaflet.


 Estoy intentando pintar en un mapa las cámaras de tráfico de madrid, y las
 estaciones de calidad del aire, simplemente donde están, es decir, aun no
 estoy recogiendo los datos de medida.
 Proyecto - https://github.com/ADIRSE/maddata

 He conseguido pintar ambos, con markers, la gota invertida típica de
 google
 maps. Pero esta solo viene en un color, así que le quiero meter 'circles'
 en vez de 'markers', y pintarlos después de colores en funcion del tráfico
 y calidad de aire que estén midiendo.

 Los círculos es lo que me trae de cabeza. Os dejo enlaces donde hay código
 y ejemplos del autor de la librería, y el código de mi proyecto en github,
 por si hay algún experto en el tema.

 Pero aún así, adelanto que la chicha ocurre en esta función =

  map$geoJson(
 leafletR::toGeoJSON(data_,
 dest=output_geofile),
 onEachFeature = '#! function(feature, layer){
   layer.bindPopup(feature.properties.popup)
 } !#',
 pointToLayer =  #! function(feature, latlng){
 return L.circleMarker(latlng, {
   radius: 6,
   fillColor: feature.properties.fillColor ||
 'blue',
   color: '#333',
   weight: 1,
   fillOpacity: 0.8
 })
   } !#)


 donde mi variable data_, es la que contiene las coordenadas y una columna
 con el supuesto color para el círculo:

  head(data_)  latitude longitude fillColor
 1   40.386-3.725   #BF
 2   40.393-3.715   #BF
 3   40.408-3.730   #BF
 4   40.471-3.711   #BF
 5   40.471-3.712   #BF
 6   40.439-3.673   #BF



 He intentado comparar mi variable data_ con el del proyecto de bicis
 https://github.com/ramnathv/bikeshare/ (muy bueno), pero el autor para
 generar su data_ hace unas cuantas operaciones en las que me pierdo. Así
 que yo le paso un mero data.frame, como en teoría dice la documentación
 que
 haga.


 En fin, toda ayuda es muy bien recibida :-)

 Aquí una muestra en shinyapps https://adirse.shinyapps.io/maddata/

 [[alternative HTML version deleted]]

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




 --
 Daniel


[[alternative HTML version deleted]]

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


Re: [R-es] Heatmap de paro (o de otra cosa) en España

2014-10-16 Thread Jose Luis Cañadas Reche

Hola Pedro.

El INE cambió los ficheros de microdatos no hace mucho, aquí dejo como 
se haría ahora, (utilizando MicroDatosEs). Lo que cambia es la función 
para recodificar.


http://rpubs.com/joscani/unemplrate


El 15/10/14 a las #4, Carlos Ortega escribió:

Hola Pedro,

Acabo de recordar que hace poco José Luis Cañadas (participa en esta lista)
publicó un enlace suyo a un análisis del paro en Analucía hecho con R y
publicado en RPubs. Sobre mapas asocia diferentes nivels de paro con
diferentes matices de color (rojo)...

Este es el enlace:

http://rpubs.com/joscani/12805

Saludos,
Carlos Ortega
www.qualityexcellence.es

El 14 de octubre de 2014, 18:48, Pedro Concejero Cerezo 
pedro.concejerocer...@telefonica.com escribió:


Hola eRReRos, estamos preparando un talleR de coloR para el próximo
congreso y pensamos que el mejor ejemplo sería un mapa de España de
alguna variable interesante. Puesto que algunas de las cosas candentes
que preocupan en España son (afortunadamente) casos únicos, se nos
ocurre el gran problema del paro. Atención pregunta:
¿Hay algún script maravilloso publicado por ahí que nos permita
reproducir rápido un heatmap de paro sobre el mapa España? -o podría ser
de otra cosa interesante. Sobre él aplicaremos las recomendaciones de
color.
Gracias mil!!

--
*Pedro Concejero
BI  Big Data - Internal Exploitation - Telefónica I+D http://www.tid.es
E-mail: pedro.concejerocer...@telefonica.com
skype: pedro.concejero
twitter @ConcejeroPedro https://twitter.com/ConcejeroPedro
linkedin pedroconcejero http://www.linkedin.com/in/pedroconcejero/es
Únete a la lista R en español
https://stat.ethz.ch/mailman/listinfo/r-help-es#%21 y a tu gRupo local
R, el mío es el gRupo R madRid http://http://madrid.r-es.org/ *



Este mensaje y sus adjuntos se dirigen exclusivamente a su destinatario,
puede contener información privilegiada o confidencial y es para uso
exclusivo de la persona o entidad de destino. Si no es usted. el
destinatario indicado, queda notificado de que la lectura, utilización,
divulgación y/o copia sin autorización puede estar prohibida en virtud de
la legislación vigente. Si ha recibido este mensaje por error, le rogamos
que nos lo comunique inmediatamente por esta misma vía y proceda a su
destrucción.

The information contained in this transmission is privileged and
confidential information intended only for the use of the individual or
entity named above. If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have received
this transmission in error, do not read it. Please immediately reply to the
sender that you have received this communication in error and then delete
it.

Esta mensagem e seus anexos se dirigem exclusivamente ao seu destinatário,
pode conter informação privilegiada ou confidencial e é para uso exclusivo
da pessoa ou entidade de destino. Se não é vossa senhoria o destinatário
indicado, fica notificado de que a leitura, utilização, divulgação e/ou
cópia sem autorização pode estar proibida em virtude da legislação vigente.
Se recebeu esta mensagem por erro, rogamos-lhe que nos o comunique
imediatamente por esta mesma via e proceda a sua destruição

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






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


Re: [R-es] Heatmap de paro (o de otra cosa) en Espa�

2014-10-16 Thread Isidro Hidalgo Arellano
Ah, vale, pues ya aprovecho para remarcar que, si hacíais
agregaciones o análisis según tipo de ocupación, al cambiar la
Clasificación Nacional de Ocupaciones, modificaron los códigos. Nos
tocó entonces cambiar los informes...
Perdonad el off-topic.
Un saludo.
Isidro



 El 16/10/2014, a las 16:09, Jose Luis Cañadas Reche  escribió:
 
 
 
 Yo me refería a que antes la codificación en el fichero de
microdatos 
 era numérica y ahora alfanumérica, lo que nos ocasionó algún
problemilla 
 a los usuarios de MicroDatosEs, eso si, en menos de una semana
quedó 
 solucionado..
 
 
 El 16/10/14 a las #4, Isidro Hidalgo escribió:
  Sólo cambió la codificación de ocupaciones, el año pasado, si
no recuerdo
  mal... ¿verdad?
  Un saludo
 
 
  Isidro Hidalgo Arellano
  Observatorio Regional de Empleo
  Consejería de Empleo y Economía
  http://www.jccm.es
 
 
 
  -Mensaje original-
  De: r-help-es-boun...@r-project.org [mailto:r-help-es-bounces@r-
  project.org] En nombre de Jose Luis Cañadas Reche
  Enviado el: jueves, 16 de octubre de 2014 11:43
  Para: r-help-es@r-project.org
  Asunto: Re: [R-es] Heatmap de paro (o de otra cosa) en España
 
  Hola Pedro.
 
  El INE cambió los ficheros de microdatos no hace mucho, aquí
dejo como
  se haría ahora, (utilizando MicroDatosEs). Lo que cambia es la
función
  para recodificar..
 
  http://rpubs.com/joscani/unemplrate
 
 
  El 15/10/14 a las #4, Carlos Ortega escribió:
  Hola Pedro,
 
  Acabo de recordar que hace poco José Luis Cañadas (participa
en esta
  lista) publicó un enlace suyo a un análisis del paro en
Analucía
  hecho
  con R y publicado en RPubs. Sobre mapas asocia diferentes nivels
de
  paro con diferentes matices de color (rojo)...
 
  Este es el enlace:
 
  http://rpubs.com/joscani/12805
 
  Saludos,
  Carlos Ortega
  www.qualityexcellence.es
 
  El 14 de octubre de 2014, 18:48, Pedro Concejero Cerezo 
  pedro.concejerocer...@telefonica.com escribió:
 
  Hola eRReRos, estamos preparando un talleR de coloR para el
próximo
  congreso y pensamos que el mejor ejemplo sería un mapa de
España de
  alguna variable interesante. Puesto que algunas de las cosas
  candentes que preocupan en España son (afortunadamente) casos
  únicos,
  se nos ocurre el gran problema del paro. Atención pregunta:
  ¿Hay algún script maravilloso publicado por ahí que nos
permita
  reproducir rápido un heatmap de paro sobre el mapa España? -o
podría
  ser de otra cosa interesante.. Sobre él aplicaremos las
  recomendaciones de color.
  Gracias mil!!
 
  --
  *Pedro Concejero
  BI  Big Data - Internal Exploitation - Telefónica I+D
  
  E-mail: pedro.concejerocer...@telefonica..com
  skype: pedro.concejero
  twitter @ConcejeroPedro 
  linkedin pedroconcejero
  
  Únete a la lista R en español
  y a tu gRupo
  local R, el mío es el gRupo R madRid  es.org/
  *
 
  
 
  Este mensaje y sus adjuntos se dirigen exclusivamente a su
  destinatario, puede contener información privilegiada o
confidencial
  y es para uso exclusivo de la persona o entidad de destino.. Si
no es
  usted. el destinatario indicado, queda notificado de que la
lectura,
  utilización, divulgación y/o copia sin autorización puede
estar
  prohibida en virtud de la legislación vigente. Si ha recibido
este
  mensaje por error, le rogamos que nos lo comunique
inmediatamente
  por
  esta misma vía y proceda a su destrucción.
 
  The information contained in this transmission is privileged
and
  confidential information intended only for the use of the
individual
  or entity named above. If the reader of this message is not the
  intended recipient, you are hereby notified that any
dissemination,
  distribution or copying of this communication is strictly
  prohibited.
  If you have received this transmission in error, do not read
it.
  Please immediately reply to the sender that you have received
this
  communication in error and then delete it.
 
  Esta mensagem e seus anexos se dirigem exclusivamente ao seu
  destinatário, pode conter informação privilegiada ou
confidencial e
  é
  para uso exclusivo da pessoa ou entidade de destino. Se não é
vossa
  senhoria o destinatário indicado, fica notificado de que a
leitura,
  utilização, divulgação e/ou cópia sem autorização pode
estar
  proibida em virtude da legislação vigente.
  Se recebeu esta mensagem por erro, rogamos-lhe que nos o
comunique
  imediatamente por esta mesma via e proceda a sua destruição
 
  ___
  R-help-es mailing list
  R-help-es@r-project.org
  https://stat.ethz.ch/mailman/listinfo/r-help-es
 
 
  ___
  R-help-es mailing list
  R-help-es@r-project.org
  https://stat.ethz.ch/mailman/listinfo/r-help-es
 
 


[[alternative HTML version deleted]]

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