Re: [R] find max value in different columns

2014-02-27 Thread PIKAL Petr
Hi

if I name your data frame to YDF

apply(YDF, 1, max, na.rm=FALSE)

shall find row max values. Jyst add them as new column.

Regards
Petr


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Mat
 Sent: Thursday, February 27, 2014 8:06 AM
 To: r-help@r-project.org
 Subject: [R] find max value in different columns

 Hello together,

 i have a data.frame like this one:

 IDONE   TWO   THREE
 1 2   57
 2 6   NA  NA
 3 5   7NA
 4 1   NA  NA

 Now i want a new column with the max-Value of ONE, TWO and THREE.
 The result look like this one:

 IDONE   TWO   THREEMAX
 1 2   57   7
 2 6   NA  NA 6
 3 5   7NA 7
 4 1   NA  NA 1

 how can i do this?

 thank you. Mat



 --
 View this message in context: http://r.789695.n4.nabble.com/find-max-
 value-in-different-columns-tp4685905.html
 Sent from the R help mailing list archive at Nabble.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.


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 fit a sine curve to those data

2014-02-27 Thread PIKAL Petr
Maybe this can be of some help.

http://r.789695.n4.nabble.com/Fit-a-sine-to-data-td859118.html

Regards
Petr


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of chiara.maglio...@libero.it
 Sent: Wednesday, February 26, 2014 5:42 PM
 To: r-help@r-project.org
 Subject: [R] how to fit a sine curve to those data

 Hello R-users,
 I am a biginner in R and I would like to fit a sinusoidal curve to my
 data. I
 couldn't get a nice results.

 here is an extract of my data:
 line  time  meters
 1 1 04:273.1
 2 2 10:480.9
 3 3 16:492.9
 4 4 23:001.0
 5 5 05:033.1
 6 6 11:291.0
 7 7 17:262.8
 8 8 23:421.1
 9 9 05:423.0
 10   10 12:141.1
 11   11 18:092.7
 12   12 00:311.2

 the time is in hours. I have tried to run this scrip trying to fit my
 data by
 eye using a time every 6 hours (just to try with a fixed time)

 TimeD - c(0,6,12,18,24)
 MetersD - c(3.1,0.9,2.9,1,3.1)
 AverageHigh - (max(MetersD) + mean(MetersD)) / 2
 AverageLow - (min(MetersD) + mean(MetersD)) / 2
 A - (AverageHigh - AverageLow) / 2
 K - (AverageHigh + AverageLow) / 2
 period - mean(TimeD[c(-1,-2,-length(TimeD)-1,-length(TimeD))])
 f - 2 * pi / period
 phi - TimeD[2] + (pi / (2 * f))
 Curve.plot -(A * sin(f * (TimeD - phi))) + K


 could somebody suggest me a way?It is becoming very complicated to get
 out
 from here.
 Many thanks

 __
 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] (no subject)

2014-02-27 Thread arun


Hi Dila,

Try:
transform(melt(dat,id.var=c(Day,Year)),Month=match(variable,month.abb),Amount=value)[,-c(3:4)]
A.K.




On Thursday, February 27, 2014 1:02 AM, dila radi dilarad...@gmail.com wrote:

Dear Arun,

Thank you so much for your help..but this command doesn't apply if I have more 
than one id. variables such as follows:

dat - read.table(text=Day Year Jan Feb Mar Apr 
  1  2012 0 2.5 0.5 2  
  2  2013 0 6.5 0 29
  3  2013 0 9.5 0 0 
  4  2013 0 0 8 0.5 
  5  2013 0 5 0.5 110.5  
  6  2011 0 4 3.5 22  
  7  2012 11 0 12.5 3.5
  8  2011 0 5 8 36.5,sep=,header=TRUE)
library(reshape2)


I have try this but it doesnt work

res - 
transform(melt(dat,id.var=Day),Month=match(variable,month.abb),melt(dat,id.var=Year),Amount=value)
res

Could you help me on this one..Sorry for asking again and again..
Thank you so much.

Regards,
Dila

__
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] [R 3.0.2] Compilation error in toms708.c during installation on Suse using icc

2014-02-27 Thread Prof Brian Ripley

This is not the correct list: see the posting guide.

Two comments:

1) The messages are about C++ constructs, and toms708.c is a C file. 
Perhaps you need to specify C explicitly (even though for a reasonable 
compiler -std=c99 does that).


2) The lines highlighted refer to 'L40'.  Perhaps some header is 
defining that, so you could try


#undef L40

at the head of the file.

Any follow-ups to R-devel please.


On 25/02/2014 11:20, Guy Moebs wrote:

Hello,

I have to install R 3.0.2 on a computing center ressources for some of
our users and I encounter a compilation error. I take some times to
search on the Internet but I find nothing relevant so I send an email to
this list. If this is not the right one, please tell me which is more
suitable.



The installation is done on an Intel based server, running Suse 10.2.
Linux Erdre-m 2.6.16.60-0.59.1-smp #1 SMP Thu Jan 14 18:30:10 UTC 2010
x86_64 x86_64 x86_64 GNU/Linux

I use Intel compiler icc (v 12.1.4) and the corresponding MKL library
version.

I set the environment like this :

export OBJECT_MODE=64
source /opt/intel/composer_xe_2011_sp1.10.319/bin/compilervars.sh intel64
export CC=icc
export CXX=icpc
export F77=ifort
export FC=ifort
export AR=xiar
export LD=xild
export CFLAGS=-std=c99 -O2 -openmp -xHost -g -traceback
export FFLAGS=-O3 -openmp -xHost -g -traceback
export FCFLAGS=-O3 -openmp -xHost -g -traceback
export CXXFLAGS=-std=c99 -O2 -openmp -xHost -g -traceback
MKL_LIB_PATH=/opt/intel/composer_xe_2011_sp1.10.319/mkl/lib/intel64
OMP_LIB_PATH=/opt/intel/composer_xe_2011_sp1.10.319/compiler/lib/intel64
export LD_LIBRARY_PATH=${MKL_LIB_PATH}:${OMP_LIB_PATH}:${LD_LIBRARY_PATH}
export MKL= -L${MKL_LIB_PATH} -L${OMP_LIB_PATH} -Wl,--start-group
-lmkl_gf_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -liomp5
-lpthread


The configuration step is ok :

./configure --prefix=/ccipl/logiciels/R/3.0.2 --with-blas=$MKL
--with-lapack --with-readline=no  configure.log 21



but during the compilation phase I get a fatal error :
icc -I. -I../../src/include -I../../src/include -I/usr/local/include
-DHAVE_CONFIG_H -std=c99 -O2 -openmp -xHost -g -traceback  -c
toms708.c -o toms708.o
toms708.c(2078): based on template arguments #589: previously specified:
no exceptions will be thrown
toms708.c(2098): Remark: diag_message: missing type substitution
   L40:
   ^

compilation aborted for toms708.c (code 4)
make[3]: *** [toms708.o] Erreur 4
make[3]: Leaving directory `/ccipl/users/gmoebs/SOFT/R/R-3.0.2/src/nmath'


And I don't know how to handle it.

Thank you in advance for your help.

Regards,
Guy Moebs




--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] Finding files matching full path regex

2014-02-27 Thread Alexander Shenkin
Hi folks,

I'm interested in finding files by matching both filenames and 
directories via regex.  If I have:

dir1_pat1/file1.csv
dir2_pat1/file2.csv
dir2_pat1/file3.txt
dir3_pat2/file4.csv

I would like to find, for example, all csv files in directories that 
have pat1 in their name:

dir1_pat1/file1.csv
dir2_pat1/file2.csv

  list.files(path = ., pattern = .*pat1/.*\\.csv, recursive = T)
character(0)
  list.files(path = ., pattern = .*pat1/.*\\.csv, recursive = T, 
full.names=T)
character(0)
  list.files(path = ., pattern = .*\\.csv, recursive = T, full.names=T)
[1] ./dir1_pat1/file1.csv ./dir2_pat1/file2.csv ./dir3_pat2/file4.csv
  list.files(path = ., pattern = pat1, recursive = T, full.names=T)
character(0)

I think list.files just runs the regex pattern against the file names, 
not the full path.  I tried full.names=T, but it still matches against 
the file name only.

Suggestions are greatly appreciated.

Thank you,
Allie

[[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] Finding files matching full path regex

2014-02-27 Thread Duncan Murdoch

On 27/02/2014 7:10 AM, Alexander Shenkin wrote:

Hi folks,

I'm interested in finding files by matching both filenames and
directories via regex.  If I have:

 dir1_pat1/file1.csv
 dir2_pat1/file2.csv
 dir2_pat1/file3.txt
 dir3_pat2/file4.csv

I would like to find, for example, all csv files in directories that
have pat1 in their name:

 dir1_pat1/file1.csv
 dir2_pat1/file2.csv

   list.files(path = ., pattern = .*pat1/.*\\.csv, recursive = T)
character(0)
   list.files(path = ., pattern = .*pat1/.*\\.csv, recursive = T,
full.names=T)
character(0)
   list.files(path = ., pattern = .*\\.csv, recursive = T, full.names=T)
[1] ./dir1_pat1/file1.csv ./dir2_pat1/file2.csv ./dir3_pat2/file4.csv
   list.files(path = ., pattern = pat1, recursive = T, full.names=T)
character(0)

I think list.files just runs the regex pattern against the file names,
not the full path.  I tried full.names=T, but it still matches against
the file name only.

Suggestions are greatly appreciated.


Two suggestions:

1.  Use Sys.glob() instead of list.files().  It uses shell globbing for 
the pattern instead of regular expressions, but it will handle your case:


Sys.glob(*pat1/*.csv)

should give you what you want.

2.  Break up your regex into part to match the path and part to match 
the filename.  Use list.files on the filename part, then subset the 
result using the path part.


Duncan Murdoch

__
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] Plots with Y axis split into two scales

2014-02-27 Thread John Kane
Here, here. 

John Kane
Kingston ON Canada


 -Original Message-
 From: 538...@gmail.com
 Sent: Wed, 26 Feb 2014 10:07:12 -0700
 To: j...@mail.bitwrit.com.au, achim.zeil...@r-project.org
 Subject: Re: [R] Plots with Y axis split into two scales
 
 I nominate the following for the fortunes package.
 
 
 . I still don't think it would be fair to the data, and you
 don't want those data liberation people parading around your laboratory
 with pictures of helpless data being devoured by a Babbage Difference
 Engine.
 
 
 
 --
 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.


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
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] pel fitdistr how to estimate distribution parameters?

2014-02-27 Thread victoryday
I`m using fitdistr() to estimate parameters for different distributions of my
data set.

Now I have problems to estimate the weibull Distribution and others. I found
the recommendation to use the pel…() function.

My question is: If I estimate parameters with the pel…() function. How can I
use them to create a theoretical distribution?

Like for normal distribution, exponential distribution, gamma distribution
and so on.
 
For example: I got this parameters:


 pelnor(x)
 mu  sigma
 0.09968345 0.12117581

 pelexp(x)
  xi   alpha
 -0.03704881  0.13673225

x ist my data set
 

I try to estimate parameters for different distribution based on my real
data set and then to create a theoretical data set based on the estimated
parameters. So I can compare to which distribution my data set match at
most. For this I use the chi quadrat test.




--
View this message in context: 
http://r.789695.n4.nabble.com/pel-fitdistr-how-to-estimate-distribution-parameters-tp4685919.html
Sent from the R help mailing list archive at Nabble.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.


[R] Basic question for subset of dataframe

2014-02-27 Thread Kapil Shukla
All - firstly apology if this is a very basic question but i tried myself
and could not find a satisfied answer.

I know that i can subset a dataframe using dataframe[row,column] and if i
give dataframe[row,] that specific row is provided and similarly i can do
dataframe[,column] to get the entire column.

what i don't understand is that if i do dataframe[conditional
expression]and don't provide the 'comma' what is being returned

e.g. i have the below code:

manager - c(1, 2, 3, 4, 5)
date - c(10/24/08, 10/28/08, 10/1/08, 10/12/08, 5/1/09)
country - c(US, US, UK, UK, UK)
gender - c(M, F, F, M, F)
age - c(32, 45, 25, 39, 99)
q1 - c(5, 3, 3, 3, 2)
q2 - c(4, 5, 5, 3, 2)
q3 - c(5, 2, 5, 4, 1)
q4 - c(5, 5, 5, NA, 2)
q5 - c(5, 5, 2, NA, 1)
leadership - data.frame(manager, date, country, gender, age, q1, q2, q3,
q4, q5, stringsAsFactors=FALSE)

now if i do


leadership[leadership$country == US,]

two row are being returned as



  managerID JoinDate country gender age q1 q2 q3 q4 q5 agecat
1 1 10/24/08  US  M  32  5  4  5  5  5  Young
2 2 10/28/08  US  F  45  3  5  2  5  5  Young


but if i do

leadership[leadership$country == US] to get the entire data frame
where country is US i am getting below


  managerID JoinDate q1 q2 agecat
1 1 10/24/08  5  4  Young
2 2 10/28/08  3  5  Young
3 3  10/1/08  3  5  Young
4 4 10/12/08  3  3  Young
5 5   5/1/09  2  2   NA



Please guide me what am i doing wrong.


Thanks

[[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] Non-negative solution to an underdetermined linear system

2014-02-27 Thread klqmba



Dear R users,


I have to find optimal solution of an underdetermined linear system, but
only with positive variables. I tried the function from this post
https://stat.ethz.ch/pipermail/r-help/2007-October/143408.html , but it's
solution includes also negative values. 


Thanks in advance.


Best Regards.

-

Майски празници на остров Лефкада, Гърция 
от 158 евро
Безкрайните романтични пясъци съчетани с 
узо...
Дати: 30/04/14 - 05/04/14
 
http://www.arrivalsidi.com/%D0%BC%D0%B0%D0%B9%D1%81%D0%BA%D0%B8-%D0%BF%D1%80%D0%B0%D0%B7%D0%BD%D0%B8%D1%86%D0%B8/%D0%BC%D0%B0%D0%B9%D1%81%D0%BA%D0%B8-%D0%BF%D1%80%D0%B0%D0%B7%D0%BD%D0%B8%D1%86%D0%B8-%D0%B2-%D0%BB%D0%B5%D1%84%D0%BA%D0%B0%D0%B4%D0%B0
[[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] Installing WinBUGS OpenBUGS on OS X 10.8.5

2014-02-27 Thread Agony
Many thanks indeed.
But I foud a way.
It is worth of trying

http://www.davidbaumgold.com/tutorials/wine-mac/

Best,
Amir





On Monday, February 24, 2014 10:32 AM, jlu...@ria.buffalo.edu 
jlu...@ria.buffalo.edu wrote:
 
1. To install and run WBugs or Obugs on
OSX you must use Parallels or other Windows emulator.   

2. Another possibility is to install
JAGS (http://mcmc-jags.sourceforge.net/)
 via MacPorts (http://www.macports.org/)
 and use R2JAGS. 






Agony agony_...@yahoo.com  
Sent by: r-help-boun...@r-project.org 
02/24/2014 09:18 AM 
Please respond to
Agony agony_...@yahoo.com 
 To r-help@r-project.org
r-help@r-project.org, r-help@r-project.org r-help@r-project.org,   
cc  
Subject [R] Installing WinBUGS 
OpenBUGS on OS X 10.8.5 
  
 


Dear all, 

Could any body help me how to install OpenBUGS or WinBUGS on my operating
system; OS X 10.8.5?
Actually, If there are too many way what is the best way?
I will be very grateful to receive your guidance and comments.
The installation manual could help me in the best way.

Bunch of thanks in advance.
Best,
Amir
               
[[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.
[[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 Series on Binary Data.

2014-02-27 Thread shilpi harpavat
Hi,

I have a dichotomous data where some my independent variables are categorical, 
some are continuous and some are binary(0/1)

My dependent is a binary response (Fail/NoFail,0/1) .

The data is some readings collected everyday over a period of time.

The goal is to use this data and see if we can figure out cause of failure ,the 
end response.

Example data format

 

 

Date, Type,Mileage,S1,S2,S3 , Response

03/02/2013,A,32000,1,0,1,.., 1

03/03/2013,B,32400,0,0,0,...,0

03/04/2013,C,45000,0,1,1,..,1

 

Can we do Time series modeling?? Any suggesstions on what type of other 
exploratory analysis can be used to figure out patterns in data ??

Thanks
shi
  
[[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] Fast linear convolution with R

2014-02-27 Thread Philip Wette

Hello,

i am trying to compute the linear convolution of two vectors of length 
1e7 each.

The code i am using is
a = vector(length=1e7)
b = vector(length=1e7)
#fill a and b with data...
c = convolve(a, rev(b), type=o)

Unfortunately, this computation goes on now for a very long time 
(currently 15h and counting).



Does it make sense to wait a couple of hours more or do i only waste my 
time and resources because it will take ages?

Is there maybe a better way to compute the convolution?

Or are there specific vector lengths that speed up the computation of 
the convolution? I for example found out that convolving vectors of 
length 1e5 takes 3 times longer than convolving vectors of size 4e6...


 b = vector(length=4e6)
 a = vector(length=4e6)
 system.time( convolve(a, b, type=o) )
   user  system elapsed
123.796   0.196 124.132
 a = vector(length=1e5)
 b = vector(length=1e5)
 system.time( convolve(a, b, type=o) )
   user  system elapsed
303.129   0.099 303.635



Best,

Philip


--
Philip Wette, M.Sc. E-Mail: we...@mail.upb.de
University of Paderborn Tel.:   05251 / 60-1716
Department of Computer Science
Computer Networks Group http://wwwcs.upb.de/cs/ag-karl
Warburger Straße 100Room:   O3.152
33098 Paderborn

__
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] NOTE when checking CRAN income feasibility

2014-02-27 Thread Gunther Schauberger

Hello,

recently I submitted a new version of my package EffectStars to CRAN, 
but I was told that the following note arises:


* checking CRAN incoming feasibility ... NOTE
Maintainer: ‘Gunther Schauberger
gunther.schauber...@stat.uni-muenchen.de’

Can you pls remove the line break in the DESCRIPTION file?


There is clearly no line break in the description file, and the package check 
works fine if I do it with R 3.0.2. The note only appears with R devel.

Am I the only one with this problem? Do you have any advice how to deal with it?

Thanks in advance and best regards,
Gunther Schauberger

DESCRIPTION-file:

Package: EffectStars
Type: Package
Title: Visualization of Categorical Response Models
Version: 1.4
Date: 2014-02-25
Depends: VGAM
Author: Gunther Schauberger
Maintainer: Gunther Schauberger gunther.schauber...@stat.uni-muenchen.de
Description: The package provides functions to visualize regression 
models with categorical response. The effects of the covariates are 
plotted with star plots in order to allow for an optical impression of 
the fitted model.

License: GPL-2
LazyLoad: yes


--
_

Gunther Schauberger

Seminar für angewandte Stochastik
Institut für Statistik
Ludwig-Maximilians-Universität München
Akademiestraße 1, Zimmer 453
80799 München
Germany

Tel.:+49 (0)89 2180 6405
E-Mail:  gunther.schauber...@stat.uni-muenchen.de
Website: http://www.stat.uni-muenchen.de/~schauberger

__
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] Fast linear convolution with R

2014-02-27 Thread Mitchell Maltenfort
Convolve uses the FFT so probably expects powers of 2.

You might want to look at using filter

Ersatzistician and Chutzpahthologist
I can answer any question.  I don't know is an answer. I don't know
yet is a better answer.


On Thu, Feb 27, 2014 at 5:31 AM, Philip Wette we...@mail.upb.de wrote:
 Hello,

 i am trying to compute the linear convolution of two vectors of length 1e7
 each.
 The code i am using is
 a = vector(length=1e7)
 b = vector(length=1e7)
 #fill a and b with data...
 c = convolve(a, rev(b), type=o)

 Unfortunately, this computation goes on now for a very long time (currently
 15h and counting).


 Does it make sense to wait a couple of hours more or do i only waste my time
 and resources because it will take ages?
 Is there maybe a better way to compute the convolution?

 Or are there specific vector lengths that speed up the computation of the
 convolution? I for example found out that convolving vectors of length 1e5
 takes 3 times longer than convolving vectors of size 4e6...

 b = vector(length=4e6)
 a = vector(length=4e6)
 system.time( convolve(a, b, type=o) )
user  system elapsed
 123.796   0.196 124.132
 a = vector(length=1e5)
 b = vector(length=1e5)
 system.time( convolve(a, b, type=o) )
user  system elapsed
 303.129   0.099 303.635



 Best,

 Philip


 --
 Philip Wette, M.Sc. E-Mail: we...@mail.upb.de
 University of Paderborn Tel.:   05251 / 60-1716
 Department of Computer Science
 Computer Networks Group http://wwwcs.upb.de/cs/ag-karl
 Warburger Straße 100Room:   O3.152
 33098 Paderborn

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


[R] data.frmae : Error: unexpected numeric constant in:

2014-02-27 Thread Beáta Nagy
Dear R-users,



I would like to load into R  a  data.frame which record size is 2000.



And I got an error message:


daaa$freq-c(255899,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,32,34,36,38,40,42,23,25,27,29,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,60,61,62,63,8,8,8,8,8,8,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,13,14,15,16,24,26,28,30,32,34,36,38,40,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,59,60,61,62,63,64,8,7,7,7,7,7,7,6,12,13,14,15,16,17,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,81,82,83,84,85,86,22,22,22,22,22,22,25,26,27,28,29,30,34,36,38,40,42,29,30,31,32,33,34,20,20,14,14,14,14,14,14,8,8,8,8,7,7,7,7,7,7,6,6,6,6,6,6,6,6,7,8,9,10,11,12,14,16,18,20,22,24,26,28,!
 
30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,77,79,81,83,85,87,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,69,71,73,75,77,79,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,254,256,258,260,262,264,266,268,270,272,274,276,278,280,282,284,286,288,290,292,294,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,!
 68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,11
0,112,114,116,118,8,8,8,8,8,8,8,8,8,8,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,197,199,201,147,148,149,150,151,15,15,15,15,15,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,6,7,8,9,10,11,12,13,14,15,16,17,19,21,23,25,27,29,31,33,35,37,29,30,31,32,34,35,36,37,38,39,38,39,40,41,42,43,44,45,46,47,48,49,50,52,53,54,55,56,57,58,59,60,61,62,63,8,14,14,14,14,14,14,14,14,14,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,11!
 
6,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,254,256,258,260,262,264,266,268,270,272,274,276,278,280,282,284,286,288,290,292,294,296,298,300,302,304,306,308,310,312,314,316,318,320,322,324,326,328,330,332,334,336,338,340,342,344,346,348,350,352,354,356,358,360,362,364,366,368,370,372,374,376,378,380,382,384,386,388,390,392,394,396,398,400,402,404,406,408,215,217,219,221,223,225,227,229,231,233,235,237,239,241,243,245,247,249,251,253,255,257,259,261,263,265,267,269,271,273,275,277,279,281,283,285,287,289,291,293,295,297,299,301,303,305,307,309,311,313,315,317,319,321,323,325,327,329,331,333,335,337,339,341,343,345,347,349,351,353,355,357,359,36!
 1,363,365,367,369,371,373,375,377,379,381,383,248,249,250,251,252,253,
2

+

Re: [R] Basic question for subset of dataframe

2014-02-27 Thread Ivan Calandra

Hi,

Thanks for the example!

I cannot really tell you why you get what you get when you type 
leadership[leadership$country == US]


But what I know (or think I know) is that when you don't write the 
comma, R will take it as a condition for the columns.

It means that leadership[1:2] is identical to leadership[,1:2]
identical(leadership[1:2],leadership[,1:2])
[1] TRUE

If you want all rows where US is present in country, then you did it 
fine using leadership[leadership$country == US, ]


HTH,
Ivan

--
Ivan Calandra, ATER
Université de Franche-Comté
UFR STGI - UMR 6249 Chrono-Environnement
4 Place Tharradin - BP 71427
25211 Montbéliard Cedex, FRANCE
ivan.calan...@univ-fcomte.fr
http://biogeosciences.u-bourgogne.fr/calandra

Le 27/02/14 16:00, Kapil Shukla a écrit :

All - firstly apology if this is a very basic question but i tried myself
and could not find a satisfied answer.

I know that i can subset a dataframe using dataframe[row,column] and if i
give dataframe[row,] that specific row is provided and similarly i can do
dataframe[,column] to get the entire column.

what i don't understand is that if i do dataframe[conditional
expression]and don't provide the 'comma' what is being returned

e.g. i have the below code:

manager - c(1, 2, 3, 4, 5)
date - c(10/24/08, 10/28/08, 10/1/08, 10/12/08, 5/1/09)
country - c(US, US, UK, UK, UK)
gender - c(M, F, F, M, F)
age - c(32, 45, 25, 39, 99)
q1 - c(5, 3, 3, 3, 2)
q2 - c(4, 5, 5, 3, 2)
q3 - c(5, 2, 5, 4, 1)
q4 - c(5, 5, 5, NA, 2)
q5 - c(5, 5, 2, NA, 1)
leadership - data.frame(manager, date, country, gender, age, q1, q2, q3,
q4, q5, stringsAsFactors=FALSE)

now if i do


leadership[leadership$country == US,]

two row are being returned as



   managerID JoinDate country gender age q1 q2 q3 q4 q5 agecat
1 1 10/24/08  US  M  32  5  4  5  5  5  Young
2 2 10/28/08  US  F  45  3  5  2  5  5  Young


but if i do

leadership[leadership$country == US] to get the entire data frame
where country is US i am getting below


   managerID JoinDate q1 q2 agecat
1 1 10/24/08  5  4  Young
2 2 10/28/08  3  5  Young
3 3  10/1/08  3  5  Young
4 4 10/12/08  3  3  Young
5 5   5/1/09  2  2   NA



Please guide me what am i doing wrong.


Thanks

[[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] Basic question for subset of dataframe

2014-02-27 Thread MacQueen, Don
Try a simpler example:

 ick - data.frame(x=1:5, a=letters[1:5], c=month.abb[1:5], y=11:15)
 ick
  x a   c  y
1 1 a Jan 11
2 2 b Feb 12
3 3 c Mar 13
4 4 d Apr 14
5 5 e May 15
 ick[2]
  a
1 a
2 b
3 c
4 d
5 e
 
 ick[3]
c
1 Jan
2 Feb
3 Mar
4 Apr
5 May

If you use [] without a comma, it returns the specified columns.

  ick[ c(FALSE,TRUE,TRUE,FALSE) ]

will return the second and third columns, those where the logical vector
is TRUE.

This is because data frames are actually lists in disguise

 is.list(ick)  [1] TRUE


-Don

-- 
Don MacQueen

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





On 2/27/14 7:00 AM, Kapil Shukla shukla.ka...@gmail.com wrote:

All - firstly apology if this is a very basic question but i tried myself
and could not find a satisfied answer.

I know that i can subset a dataframe using dataframe[row,column] and if i
give dataframe[row,] that specific row is provided and similarly i can do
dataframe[,column] to get the entire column.

what i don't understand is that if i do dataframe[conditional
expression]and don't provide the 'comma' what is being returned

e.g. i have the below code:

manager - c(1, 2, 3, 4, 5)
date - c(10/24/08, 10/28/08, 10/1/08, 10/12/08, 5/1/09)
country - c(US, US, UK, UK, UK)
gender - c(M, F, F, M, F)
age - c(32, 45, 25, 39, 99)
q1 - c(5, 3, 3, 3, 2)
q2 - c(4, 5, 5, 3, 2)
q3 - c(5, 2, 5, 4, 1)
q4 - c(5, 5, 5, NA, 2)
q5 - c(5, 5, 2, NA, 1)
leadership - data.frame(manager, date, country, gender, age, q1, q2, q3,
q4, q5, stringsAsFactors=FALSE)

now if i do


leadership[leadership$country == US,]

two row are being returned as



  managerID JoinDate country gender age q1 q2 q3 q4 q5 agecat
1 1 10/24/08  US  M  32  5  4  5  5  5  Young
2 2 10/28/08  US  F  45  3  5  2  5  5  Young


but if i do

leadership[leadership$country == US] to get the entire data frame
where country is US i am getting below


  managerID JoinDate q1 q2 agecat
1 1 10/24/08  5  4  Young
2 2 10/28/08  3  5  Young
3 3  10/1/08  3  5  Young
4 4 10/12/08  3  3  Young
5 5   5/1/09  2  2   NA



Please guide me what am i doing wrong.


Thanks

   [[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] data.frmae : Error: unexpected numeric constant in:

2014-02-27 Thread Gergely Daróczi
Dear Beata,

how do you try to load the data? Copy-pasting that amount of characters
into the R console might now work due to size limitations of the clipboard.
Or do you get this error when calling source on the file?

Best,
Gergely

--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
On Feb 27, 2014 4:38 PM, Beáta Nagy beatanag...@gmail.com wrote:

 Dear R-users,



 I would like to load into R  a  data.frame which record size is 2000.



 And I got an error message:

 

 daaa$freq-c(255899,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,32,34,36,38,40,42,23,25,27,29,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,60,61,62,63,8,8,8,8,8,8,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,13,14,15,16,24,26,28,30,32,34,36,38,40,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,59,60,61,62,63,64,8,7,7,7,7,7,7,6,12,13,14,15,16,17,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,81,82,83,84,85,86,22,22,22,22,22,22,25,26,27,28,29,30,34,36,38,40,42,29,30,31,32,33,34,20,20,14,14,14,14,14,14,8,8,8,8,7,7,7,7,7,7,6,6,6,6,6,6,6,6,7,8,9,10,11,12,14,16,18,20,22,24,26,28,!

  
 30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,77,79,81,83,85,87,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,69,71,73,75,77,79,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,254,256,258,260,262,264,266,268,270,272,274,276,278,280,282,284,286,288,290,292,294,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,!
  68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,11

 0,112,114,116,118,8,8,8,8,8,8,8,8,8,8,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,197,199,201,147,148,149,150,151,15,15,15,15,15,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,6,7,8,9,10,11,12,13,14,15,16,17,19,21,23,25,27,29,31,33,35,37,29,30,31,32,34,35,36,37,38,39,38,39,40,41,42,43,44,45,46,47,48,49,50,52,53,54,55,56,57,58,59,60,61,62,63,8,14,14,14,14,14,14,14,14,14,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,11!

  
 6,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,254,256,258,260,262,264,266,268,270,272,274,276,278,280,282,284,286,288,290,292,294,296,298,300,302,304,306,308,310,312,314,316,318,320,322,324,326,328,330,332,334,336,338,340,342,344,346,348,350,352,354,356,358,360,362,364,366,368,370,372,374,376,378,380,382,384,386,388,390,392,394,396,398,400,402,404,406,408,215,217,219,221,223,225,227,229,231,233,235,237,239,241,243,245,247,249,251,253,255,257,259,261,263,265,267,269,271,273,275,277,279,281,283,285,287,289,291,293,295,297,299,301,303,305,307,309,311,313,315,317,319,321,323,325,327,329,331,333,335,337,339,341,343,345,347,349,351,353,355,357,359,36!
  1,363,365,367,369,371,373,375,377,379,381,383,248,249,250,251,252,253,
 2

 +

 

Re: [R] write function to convert to date or delete

2014-02-27 Thread William Dunlap
 Error in as.POSIXlt.character(as.character(x), ...) :
   character string is not in a standard unambiguous format.

That error occurs when as.POSIXlt is looking for a format
with which to parse the strings.  If you supply a format for the
date then as.POSIXlt will not give this error - it will just return
NA's for the entries that do not match the format.
as.POSIXlt(c(2013-02-28, Feb 28, 2013))
   Error in as.POSIXlt.character(c(2013-02-28, Feb 28, 2013)) :
 character string is not in a standard unambiguous format
as.POSIXlt(c(2013-02-28, Feb 28, 2013), format=%Y-%m-%d)
   [1] 2013-02-28 NA
as.POSIXlt(c(2013-02-28, Feb 28, 2013), format=%B %d, %Y)
   [1] NA   2013-02-28

If the strings may be in one of several formats, loop through
the formats and decide which to accept. 

Bill Dunlap
TIBCO Software
wdunlap tibco.com


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf
 Of Bill
 Sent: Wednesday, February 26, 2014 10:03 PM
 To: r-help@r-project.org
 Subject: [R] write function to convert to date or delete
 
 I have a dataframe that looks like the below. I want to convert the
 Captured.Time  field to a date object. but some of the entries are not
 properly formated and I get a message saying
 Error in as.POSIXlt.character(as.character(x), ...) :
   character string is not in a standard unambiguous format.
 
 So I want to write a function that will convert or delete. I could not
 figure out how to do that and so I tried to write a function that would
 convert or replace with text like noDateHere but that did not work either.
 Can anyone tell me how to accomplish this?
 Here is what I tried:
 
 convertOrOmit=function(dt){tryCatch(as.POSIXct(dt),error=print(noDateHere))}
 
   X   Captured.Time Latitude Longitude Value Unit Location.Name
 1 12696963 2012-08-07 11:00:51 39.16094  140.488345  cpm
 2  2056198 2013-11-10 03:14:19 32.84428 -117.224047  cpm
 3   727957 2014-01-28 04:47:54 35.80605  139.378928  cpm
 4  2864220 2013-10-22 19:41:53 35.07816 -106.612350  cpm
 5  5787688 2013-06-13 04:13:57 35.83174  136.202735  cpm
 6  6191345 2013-05-28 06:48:34 34.78944  137.949632  cpm
   Device.ID   MD5Sum Height Surface Radiation
 1NA b0465019b46289b82450c39ce1397b98 NANA
 2NA 8fa14a1227d23e6cf286785e8843cc39 NANA
 3NA c72cd7f9cedd59cf6e6892049dfbf9a0 NANA
 4NA aca82e39ff9098e45eea04f661f68dc7 NANA
 5NA cc9394e6dceb91f0e0de97cc2db57e19 NANA
 6NA f18d194a41e1448c7776dbeba8b351af NANA
Uploaded.Time Loader.ID
 1  2012-08-13 19:16:10.18555 10832
 2 2013-12-05 01:47:24.154971 13958
 3 2014-01-29 22:55:39.138043 14451
 4 2013-10-26 13:50:17.629869 13743
 5 2013-06-16 16:17:21.148239 12930
 6 2013-06-04 23:31:55.455323 12841
 
   [[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.


[R] scales percent precision

2014-02-27 Thread Jacob Wegelin


scales::percent appears not to be documented.

Details:

At http://cran.r-project.org/web/packages/scales/scales.pdf, equivalently in 
?percent, I find no answer to the following two questions.

(1) How can I specify the number of decimal points in a call to percent()? For 
instance, 0.010101 could be

1%

1.0%

1.01%

etc. depending on what kind of report I'm writing.

I can control precision myself by writing

mypercent-function(theargument, siglevel=2) {
stopifnot(is.numeric(theargument))
paste(signif(theargument, siglevel) * 100, %, sep=)
}

and then we have


mypercent(0.010101)

[1] 1%

mypercent(0.010101, 5)

[1] 1.0101%

mypercent(0.010101, 3)

[1] 1.01%

(2) What is the function precision() inside percent()? I find no documentation 
for it, and in fact it does not appear in the search path. Nor does round_any().


percent(0.010101)

[1] 1.01%

percent
function (x) 
{

x - round_any(x, precision(x)/100)
str_c(comma(x * 100), %)
}
environment: 0x10c0f9350

find(precision)

character(0)

find(round_any)

character(0)




Thanks for any insights

Jacob Wegelin


sessionInfo()

R version 2.15.3 (2013-03-01)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

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

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

other attached packages:
[1] scales_0.2.3xtable_1.7-0reshape2_1.2.2  moments_0.13
corrplot_0.70   ggplot2_0.9.3.1 nlme_3.1-108

loaded via a namespace (and not attached):
 [1] colorspace_1.2-0   dichromat_1.2-4digest_0.6.0   gtable_0.1.2  
 labeling_0.1   lattice_0.20-13MASS_7.3-23munsell_0.4
 [9] plyr_1.8   proto_0.3-10   psych_1.2.8RColorBrewer_1.0-5 stringr_0.6.2 




__
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] Controlling plot axis for dates

2014-02-27 Thread David Parkhurst
I’d like to control the number of tick marks on the “x” axis of a plot, 
when the variable there is dates.  I thought to use the xaxp parameter, 
but the documentation for par says “It [i.e., xaxp] is only relevant to 
default numeric axis systems, and not for example to dates.”  My 
question, then, is how to control the number of ticks on an axis that 
represents dates?


__
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] NOTE when checking CRAN income feasibility

2014-02-27 Thread Martin Maechler
 Gunther Schauberger gunther.schauber...@stat.uni-muenchen.de
 on Thu, 27 Feb 2014 16:20:36 +0100 writes:

 Hello,
 recently I submitted a new version of my package EffectStars to CRAN, 
 but I was told that the following note arises:

 * checking CRAN incoming feasibility ... NOTE
 Maintainer: ‘Gunther Schauberger
 gunther.schauber...@stat.uni-muenchen.de’

 Can you pls remove the line break in the DESCRIPTION file?


 There is clearly no line break in the description file, and the package 
check works fine if I do it with R 3.0.2. The note only appears with R devel.


 Am I the only one with this problem? Do you have any advice how to deal 
with it?

You are not at all alone.
I've seen it for all/many of my packages when using R-devel for quite
a while, at least with

  R CMD check --as-cran  pkg

I never got a clue about the reason for the NOTE, but assumed
the CRAN maintainers wanted to see the maintainer address for
some reason, and I had decided to gladly let them see it... ;-)

Martin


 Thanks in advance and best regards,
 Gunther Schauberger

 DESCRIPTION-file:

 Package: EffectStars
 Type: Package
 Title: Visualization of Categorical Response Models
 Version: 1.4
 Date: 2014-02-25
 Depends: VGAM
 Author: Gunther Schauberger
 Maintainer: Gunther Schauberger gunther.schauber...@stat.uni-muenchen.de
 Description: The package provides functions to visualize regression 
 models with categorical response. The effects of the covariates are 
 plotted with star plots in order to allow for an optical impression of 
 the fitted model.
 License: GPL-2
 LazyLoad: yes


 -- 
 _

 Gunther Schauberger

 Seminar für angewandte Stochastik
 Institut für Statistik
 Ludwig-Maximilians-Universität München
 Akademiestraße 1, Zimmer 453
 80799 München
 Germany

 Tel.:+49 (0)89 2180 6405
 E-Mail:  gunther.schauber...@stat.uni-muenchen.de
 Website: http://www.stat.uni-muenchen.de/~schauberger

__
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] Controlling plot axis for dates

2014-02-27 Thread Prof Brian Ripley

On 27/02/2014 17:09, David Parkhurst wrote:

I’d like to control the number of tick marks on the “x” axis of a plot,
when the variable there is dates.  I thought to use the xaxp parameter,
but the documentation for par says “It [i.e., xaxp] is only relevant to
default numeric axis systems, and not for example to dates.”  My
question, then, is how to control the number of ticks on an axis that
represents dates?


See ?Axis and ?axis.Date .


PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Please do.  It is not clear which plot method it was that produced 
dates, although it is a fair guess that it called Axis().


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] Basic question for subset of dataframe

2014-02-27 Thread David Carlson
You have discovered two features of R with your example. Don
told you about the first. Data frames are considered to be lists
so if you provide only one index, you get the columns (the list
elements) when you type

 str(leadership)
'data.frame':   5 obs. of  10 variables:
 $ manager: num  1 2 3 4 5
 $ date   : chr  10/24/08 10/28/08 10/1/08 10/12/08 ...
 $ country: chr  US US UK UK ...
 $ gender : chr  M F F M ...
 $ age: num  32 45 25 39 99
 $ q1 : num  5 3 3 3 2
 $ q2 : num  4 5 5 3 2
 $ q3 : num  5 2 5 4 1
 $ q4 : num  5 5 5 NA 2
 $ q5 : num  5 5 2 NA 1

The second is that when you give R less than it is expecting, it
often recycles what you gave it. You gave it a logical vector of
five values:

 leadership$country == US
[1]  TRUE  TRUE FALSE FALSE FALSE

But there are 10 list elements so R recycled your vector to make
it equal to the number of variables. As a result you got
variables 1 and 2, skipped the next three, then 6 and 7, and
skipped the last three.

-
David L Carlson
Department of Anthropology
Texas AM University
College Station, TX 77840-4352

-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Ivan Calandra
Sent: Thursday, February 27, 2014 9:46 AM
To: r-help@r-project.org
Subject: Re: [R] Basic question for subset of dataframe

Hi,

Thanks for the example!

I cannot really tell you why you get what you get when you type 
leadership[leadership$country == US]

But what I know (or think I know) is that when you don't write
the 
comma, R will take it as a condition for the columns.
It means that leadership[1:2] is identical to leadership[,1:2]
identical(leadership[1:2],leadership[,1:2])
[1] TRUE

If you want all rows where US is present in country, then
you did it 
fine using leadership[leadership$country == US, ]

HTH,
Ivan

--
Ivan Calandra, ATER
Université de Franche-Comté
UFR STGI - UMR 6249 Chrono-Environnement
4 Place Tharradin - BP 71427
25211 Montbéliard Cedex, FRANCE
ivan.calan...@univ-fcomte.fr
http://biogeosciences.u-bourgogne.fr/calandra

Le 27/02/14 16:00, Kapil Shukla a écrit :
 All - firstly apology if this is a very basic question but i
tried myself
 and could not find a satisfied answer.

 I know that i can subset a dataframe using
dataframe[row,column] and if i
 give dataframe[row,] that specific row is provided and
similarly i can do
 dataframe[,column] to get the entire column.

 what i don't understand is that if i do dataframe[conditional
 expression]and don't provide the 'comma' what is being
returned

 e.g. i have the below code:

 manager - c(1, 2, 3, 4, 5)
 date - c(10/24/08, 10/28/08, 10/1/08, 10/12/08,
5/1/09)
 country - c(US, US, UK, UK, UK)
 gender - c(M, F, F, M, F)
 age - c(32, 45, 25, 39, 99)
 q1 - c(5, 3, 3, 3, 2)
 q2 - c(4, 5, 5, 3, 2)
 q3 - c(5, 2, 5, 4, 1)
 q4 - c(5, 5, 5, NA, 2)
 q5 - c(5, 5, 2, NA, 1)
 leadership - data.frame(manager, date, country, gender, age,
q1, q2, q3,
 q4, q5, stringsAsFactors=FALSE)

 now if i do


 leadership[leadership$country == US,]

 two row are being returned as



managerID JoinDate country gender age q1 q2 q3 q4 q5 agecat
 1 1 10/24/08  US  M  32  5  4  5  5  5  Young
 2 2 10/28/08  US  F  45  3  5  2  5  5  Young


 but if i do

 leadership[leadership$country == US] to get the entire data
frame
 where country is US i am getting below


managerID JoinDate q1 q2 agecat
 1 1 10/24/08  5  4  Young
 2 2 10/28/08  3  5  Young
 3 3  10/1/08  3  5  Young
 4 4 10/12/08  3  3  Young
 5 5   5/1/09  2  2   NA



 Please guide me what am i doing wrong.


 Thanks

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

__
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] Fast linear convolution with R

2014-02-27 Thread Martin Maechler
 MM == Mitchell Maltenfort mmal...@gmail.com
 on Thu, 27 Feb 2014 10:34:00 -0500 writes:

MM Convolve uses the FFT so probably expects powers of 2.

Not quite (but in the correct direction):

?fft  contains

 The FFT is fastest when the length of the series being transformed
 is highly composite (i.e., has many factors).  If this is not the
 case, the transform may take a long time to compute and will use a
 large amount of memory.


Additionally,

Only the default 'type' (circular)  directly calls fft() on
the original inputs.

Your type = open (or type = filter)  0-pads the inputs
x and y  from left and right :

x - c(rep.int(0, length(y)-1),  x)
y - c(y, rep.int(0, length(x) - 1)))
  
and in this case,  if the original lengths are equal, = n,
the length of the padded vectors are newn := n + n-1 = 2n-1.

Here, n = 1e7, so newn = 199
and that is a prime number -- i.e., the absolute worst case !!!

BTW, for  n = 1e5,  100 x smaller,  2n-1 = 19
is also a prime number, and indeed convolve() already takes over
40 seconds on my new fast computer.

As a matter, it seem that taking   n = 10^k  for convolve,
type = open or filter is very often bad :
as 19..9 seems relatively often to be prime, and still has few
factors in the other cases :

 sfsmisc::factorize(2 * 10^(2:9) - 1)
$`199`
   p m
[1,] 199 1

$`1999`
p m
[1,] 1999 1

$`1`
p m
[1,]7 1
[2,] 2857 1

$`19`
  p m
[1,] 19 1

$`199`
p m
[1,]   17 1
[2,]   71 1
[3,] 1657 1

$`1999`
 p m
[1,] 2e+07 1

$`1`
p m
[1,]   89 1
[2,] 1447 1
[3,] 1553 1

$`19`
p m
[1,]   31 1
[2,] 64516129 1

 

If one does 0 padding,  one should really pad with one more, to
get length 2n instead of 2n-1:
2n is never (well, almost :-) a prime,
and n will often be composite, so  2n  will have the nice
properties that fft() wants.

Maybe allow types 1+open, 1+filter which will pad with one
more, and hence will typically be *fast*  (and very slightly
different) ? 

Martin



MM You might want to look at using filter


MM On Thu, Feb 27, 2014 at 5:31 AM, Philip Wette we...@mail.upb.de wrote:
 Hello,
 
 i am trying to compute the linear convolution of two vectors of length 
1e7
 each.
 The code i am using is
 a = vector(length=1e7)
 b = vector(length=1e7)
 #fill a and b with data...
 c = convolve(a, rev(b), type=o)
 
 Unfortunately, this computation goes on now for a very long time 
(currently
 15h and counting).
 
 
 Does it make sense to wait a couple of hours more or do i only waste my 
time
 and resources because it will take ages?
 Is there maybe a better way to compute the convolution?
 
 Or are there specific vector lengths that speed up the computation of the
 convolution? I for example found out that convolving vectors of length 
1e5
 takes 3 times longer than convolving vectors of size 4e6...
 
 b = vector(length=4e6)
 a = vector(length=4e6)
 system.time( convolve(a, b, type=o) )
 user  system elapsed
 123.796   0.196 124.132
 a = vector(length=1e5)
 b = vector(length=1e5)
 system.time( convolve(a, b, type=o) )
 user  system elapsed
 303.129   0.099 303.635
 
 
 
 Best,
 
 Philip
 
 
 --
 Philip Wette, M.Sc. E-Mail: we...@mail.upb.de
 University of Paderborn Tel.:   05251 / 60-1716
 Department of Computer Science
 Computer Networks Group http://wwwcs.upb.de/cs/ag-karl
 Warburger Straße 100Room:   O3.152
 33098 Paderborn
 
 __
 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.

MM __
MM R-help@r-project.org mailing list
MM https://stat.ethz.ch/mailman/listinfo/r-help
MM PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
MM 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] Non-negative solution to an underdetermined linear system

2014-02-27 Thread Berend Hasselman

On 27-02-2014, at 13:22, klq...@mail.bg wrote:

 
 
 
 Dear R users,
 
 
 I have to find optimal solution of an underdetermined linear system, but
 only with positive variables. I tried the function from this post
 https://stat.ethz.ch/pipermail/r-help/2007-October/143408.html , but it's
 solution includes also negative values. 
 
 

Have a look at package limSolve. Maybe (and only maybe) function linp can be of 
use.

Berend

 Thanks in advance.
 
 
 Best Regards.
 
 -
 
 Майски празници на остров Лефкада, Гърция от 158 евро
 Безкрайните романтични пясъци съчетани с узо...
 Дати: 30/04/14 - 05/04/14
 http://www.arrivalsidi.com/%D0%BC%D0%B0%D0%B9%D1%81%D0%BA%D0%B8-%D0%BF%D1%80%D0%B0%D0%B7%D0%BD%D0%B8%D1%86%D0%B8/%D0%BC%D0%B0%D0%B9%D1%81%D0%BA%D0%B8-%D0%BF%D1%80%D0%B0%D0%B7%D0%BD%D0%B8%D1%86%D0%B8-%D0%B2-%D0%BB%D0%B5%D1%84%D0%BA%D0%B0%D0%B4%D0%B0
   [[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.


[R] time series analysis

2014-02-27 Thread Yang Yang
Hi

Currently I am working on a river discharge data analysis. I have the daily
discharge record from 1935 to now. I want to extract the annual maximum
discharge for each hydrolocial year (*start from 01/11 to next year 31/10*).
However, I found that the hydroTSM package can only deal with the natural
year. I tried to use the zoo package, but I found it's difficult to
compute, as each year have different days. Does anyone have some idea?
Thanks.

the data looks like:

01-11-1935 66302-11-1935 59603-11-1935 45004-11-1935 38105-11-1935
35406-11-1935 312

my code:

mydata-read.table(discharge)
colnames(mydata) - c(date,discharge)

library(zoo)
z-zooreg(mydata[,2],start=as.Date(1935-11-1))

mydta$date - as.POSIXct(dat$date)

q.month-daily2monthly(z,FUN=max,na.rm = TRUE,date.fmt =
%Y-%m-%d,out.fmt=numeric)
q.month.plain=coredata(q.month)

z.month-zooreg(q.month.plain,start=1,frequency=12)

Thanks very much.

[[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] Problem with user-defined split function in rpart

2014-02-27 Thread Peter Mayer
Hello,

I have written an user-defined split function for the package rpart, now I
want to prune the fitted tree with my own defined function.
To do so I want at first to grow a large tree with rpart and then use the
function to prune the tree.
The problem here is, growing a large tree with the user defined split
function and therefore setting the complexity parameter to 0 (cp=0), gives
me a smaller tree, as when I set the complexity parameter to 0.01 (default
value).
My question is now, which node values does the rpart use in order to
'prune' the tree? I first thought it is only the 'deviance' value, which is
an output of the evaluation function, but I am not quite sure about that
anymore.

Example Output of 2 trees (same data and split functions, different cp) :
load('alist.R') # user defined split function

 fit1 - rpart(time.discrete ~
x1+x2+x3+x4+x5+x6,datTrain,control=list(cp=0.01),
+ method=alist)

n= 3042

node), split, n, deviance, yval
  * denotes terminal node
1) root 3042 3043.5170 2
   2) x3=2,3 1036 1231.5710 1
 4) x2=2,3,4,5 556  704.0214 1
   8) x6 23.5 118  126.3924 1 *
   9) x6=23.5 438  541.8522 1
18) x1=1 164  214.2196 1 *
19) x1=0 274  295.5250 2
  38) x5 30.5 81  102.2434 1 *
  39) x5=30.5 193  161.5116 3 *
 5) x2=0,1 480  454.6036 3 *
   3) x3=0,1 2006 1698.9710 3
 6) x6 23.5 596  660.9713 2 *
 7) x6=23.5 1410  978.9448 3
  14) x5 19.5 323  342.9626 2 *
  15) x5=19.5 1087  567.2176 4
30) x1=0 633  200.8669 5 *
31) x1=1 454  329.6705 3
  62) x2=0,1,3 254  109.3010 4 *
  63) x2=2,4,5 200  186.8194 3 *

 fit1$cptable
  CP nsplit rel error
1 0.03712005  0 1.000
2 0.02396757  1 0.9628800
3 0.02099862  2 0.9389124
4 0.01205192  4 0.8969151
5 0.01175506  5 0.8848632
6 0.01102346  6 0.8731082
7 0.01054950  7 0.8620847
8 0.01043856  8 0.8515352
9 0.0100  9 0.8410966


 fit2 - rpart(time.discrete ~
x1+x2+x3+x4+x5+x6,datTrain,control=list(cp=0),
+ method=alist)

n= 3042

node), split, n, deviance, yval
  * denotes terminal node
1) root 3042 3.043517e+03 2
   2) x3=2,3 1036 1.231571e+03 1
 4) x2=2,3,4,5 556 7.040214e+02 1
   8) x6 23.5 118 1.263924e+02 1
16) x5 42.5 73 5.778729e+01 1
  32) x1=1 31 4.888716e-10 1 *
  33) x1=0 42 4.611536e+01 1 *
17) x5=42.5 45 5.607449e+01 1 *
   9) x6=23.5 438 5.418522e+02 1 *
 5) x2=0,1 480 4.546036e+02 3 *
   3) x3=0,1 2006 1.698971e+03 3 *

 fit2$cptable
CP nsplit rel error
1 0.037120046  0 1.000
2 0.023967574  1 0.9628800
3 0.011755057  2 0.9389124
4 0.004117156  3 0.9271573
5 0.003835016  4 0.9230402
6 0.0  5 0.9192052


Thank you
Peter Mayer

[[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] scales percent precision

2014-02-27 Thread Jacob Wegelin

But percent_format() does not take the argument, multiply it by 100, and paste 
on a percent sign, as we see here:


?scales::percent_format
percent_format(0.0101010101)

Error in percent_format(0.0101010101) : unused argument(s) (0.0101010101)

args(percent_format)
function () 
NULL


And how do we control the significant digits when we use percent()?


percent(0.0101010101)

[1] 1.01%

My point is that


?scales::percent_format


does not answer these questions. This is what I mean by saying that the 
function is not documented.

On 2014-02-27 Thu 14:34, Dennis Murphy wrote:

Hi:

On Thu, Feb 27, 2014 at 8:49 AM, Jacob Wegelin jacobwege...@fastmail.fm wrote:


scales::percent appears not to be documented.


?scales::percent_format

where it tells you that it takes its argument, multiplies it by 100
and then attaches a percent sign to it. For most situations, the data
should be relative frequencies/proportions. BTW, many of the functions
in the scales package are second-order R functions, which means there
are two calls in the function invocation. The first call returns a
function and the second is a call to the returned function.



Details:

At http://cran.r-project.org/web/packages/scales/scales.pdf, equivalently in
?percent, I find no answer to the following two questions.

(1) How can I specify the number of decimal points in a call to percent()?
For instance, 0.010101 could be

1%

1.0%

1.01%

etc. depending on what kind of report I'm writing.

I can control precision myself by writing

mypercent-function(theargument, siglevel=2) {
stopifnot(is.numeric(theargument))
paste(signif(theargument, siglevel) * 100, %, sep=)
}

and then we have


mypercent(0.010101)


[1] 1%


mypercent(0.010101, 5)


[1] 1.0101%


mypercent(0.010101, 3)


[1] 1.01%


percent_format() uses pretty breaks by default, so you'd probably want
to pass your desired labels to scale_y_continuous() directly and avoid
percent_format(). You could call the function on a vector of breaks
and use the return values for the labels.



(2) What is the function precision() inside percent()? I find no
documentation for it, and in fact it does not appear in the search path. Nor
does round_any().


round_any() comes from the plyr package. I have no idea where
precision() comes from; I've wondered about that myself a couple of
times. I imagine it comes from one of the imported packages, but I
didn't find it in any of plyr, stringr or labeling. I didn't check the
color-related packages (RColorBrewer, dichromat or munsell). It could
also be a hidden function.

Dennis



percent(0.010101)


[1] 1.01%


percent


function (x) {
x - round_any(x, precision(x)/100)
str_c(comma(x * 100), %)
}
environment: 0x10c0f9350


find(precision)


character(0)


find(round_any)


character(0)





Thanks for any insights

Jacob Wegelin


sessionInfo()


R version 2.15.3 (2013-03-01)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

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

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

other attached packages:
[1] scales_0.2.3xtable_1.7-0reshape2_1.2.2  moments_0.13
corrplot_0.70   ggplot2_0.9.3.1 nlme_3.1-108

loaded via a namespace (and not attached):
 [1] colorspace_1.2-0   dichromat_1.2-4digest_0.6.0   gtable_0.1.2
labeling_0.1   lattice_0.20-13MASS_7.3-23munsell_0.4
 [9] plyr_1.8   proto_0.3-10   psych_1.2.8
RColorBrewer_1.0-5 stringr_0.6.2





__
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] scales percent precision

2014-02-27 Thread Jacob Wegelin


Incidentally,

?scales::percent

brings up exactly the same text as

?scales::percent_format

On 2014-02-27 Thu 14:47, Jacob Wegelin wrote:
But percent_format() does not take the argument, multiply it by 100, and 
paste on a percent sign, as we see here:



?scales::percent_format
percent_format(0.0101010101)

Error in percent_format(0.0101010101) : unused argument(s) (0.0101010101)

args(percent_format)

function () NULL

And how do we control the significant digits when we use percent()?


percent(0.0101010101)

[1] 1.01%

My point is that


?scales::percent_format


does not answer these questions. This is what I mean by saying that the 
function is not documented.


On 2014-02-27 Thu 14:34, Dennis Murphy wrote:

Hi:

On Thu, Feb 27, 2014 at 8:49 AM, Jacob Wegelin jacobwege...@fastmail.fm 
wrote:


scales::percent appears not to be documented.


?scales::percent_format

where it tells you that it takes its argument, multiplies it by 100
and then attaches a percent sign to it. For most situations, the data
should be relative frequencies/proportions. BTW, many of the functions
in the scales package are second-order R functions, which means there
are two calls in the function invocation. The first call returns a
function and the second is a call to the returned function.



Details:

At http://cran.r-project.org/web/packages/scales/scales.pdf, equivalently 
in

?percent, I find no answer to the following two questions.

(1) How can I specify the number of decimal points in a call to percent()?
For instance, 0.010101 could be

1%

1.0%

1.01%

etc. depending on what kind of report I'm writing.

I can control precision myself by writing

mypercent-function(theargument, siglevel=2) {
stopifnot(is.numeric(theargument))
paste(signif(theargument, siglevel) * 100, %, sep=)
}

and then we have


mypercent(0.010101)


[1] 1%


mypercent(0.010101, 5)


[1] 1.0101%


mypercent(0.010101, 3)


[1] 1.01%


percent_format() uses pretty breaks by default, so you'd probably want
to pass your desired labels to scale_y_continuous() directly and avoid
percent_format(). You could call the function on a vector of breaks
and use the return values for the labels.



(2) What is the function precision() inside percent()? I find no
documentation for it, and in fact it does not appear in the search path. 
Nor

does round_any().


round_any() comes from the plyr package. I have no idea where
precision() comes from; I've wondered about that myself a couple of
times. I imagine it comes from one of the imported packages, but I
didn't find it in any of plyr, stringr or labeling. I didn't check the
color-related packages (RColorBrewer, dichromat or munsell). It could
also be a hidden function.

Dennis



percent(0.010101)


[1] 1.01%


percent


function (x) {
x - round_any(x, precision(x)/100)
str_c(comma(x * 100), %)
}
environment: 0x10c0f9350


find(precision)


character(0)


find(round_any)


character(0)





Thanks for any insights

Jacob Wegelin


sessionInfo()


R version 2.15.3 (2013-03-01)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

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

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

other attached packages:
[1] scales_0.2.3xtable_1.7-0reshape2_1.2.2  moments_0.13
corrplot_0.70   ggplot2_0.9.3.1 nlme_3.1-108

loaded via a namespace (and not attached):
 [1] colorspace_1.2-0   dichromat_1.2-4digest_0.6.0   gtable_0.1.2
labeling_0.1   lattice_0.20-13MASS_7.3-23munsell_0.4
 [9] plyr_1.8   proto_0.3-10   psych_1.2.8
RColorBrewer_1.0-5 stringr_0.6.2





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



__
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] expressions (nesting, substitution, 2-stage evaluation)

2014-02-27 Thread Daryl Morris

Hi,

I have a function which generates many plots.  To keep it simple, let's 
say I want to set the main title based on where we are in nested loops.


So, something like

vectorA = c(a,b,c)
vectorB = c(a,b,c)

for(ii in vectorA) { for(jj in vectorB) {
  plot(0:1,0:1)
  title(main = paste(ii,jj))
}

that part is easy!   The question is what if I wanted vectorA to be an 
expression?


I'd like to be able to set vectorA = 
c(expression(paste(TNF-,alpha)),expression(paste(IFN-,gamma))), and 
have the plot title show the greek letters.


Obviously, in the for-loop I could build the expression all at once, but 
there are lots of programmatic reasons I'd like to be able to have this 
program structure.  Is there a solution which modifies either/both (1) 
the setting of main in the loop (2) how I define the vector outside of 
the loop?



thanks, Daryl

__
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] expressions (nesting, substitution, 2-stage evaluation)

2014-02-27 Thread Bert Gunter
?plotmath

-- Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom.
H. Gilbert Welch




On Thu, Feb 27, 2014 at 2:58 PM, Daryl Morris dar...@uw.edu wrote:
 Hi,

 I have a function which generates many plots.  To keep it simple, let's say
 I want to set the main title based on where we are in nested loops.

 So, something like

 vectorA = c(a,b,c)
 vectorB = c(a,b,c)

 for(ii in vectorA) { for(jj in vectorB) {
   plot(0:1,0:1)
   title(main = paste(ii,jj))
 }

 that part is easy!   The question is what if I wanted vectorA to be an
 expression?

 I'd like to be able to set vectorA =
 c(expression(paste(TNF-,alpha)),expression(paste(IFN-,gamma))), and have
 the plot title show the greek letters.

 Obviously, in the for-loop I could build the expression all at once, but
 there are lots of programmatic reasons I'd like to be able to have this
 program structure.  Is there a solution which modifies either/both (1) the
 setting of main in the loop (2) how I define the vector outside of the loop?


 thanks, Daryl

 __
 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] data.frmae : Error: unexpected numeric constant in:

2014-02-27 Thread David Winsemius
You posted in HTML (despite warnings in the Posting Guide that doing so might 
create problems.) There are exclamation points at many places in the text that 
appear in a plain-text view of your code.  When I past the first section of 
your code to my console I see a similar error message (just snipping the first 
material up to the first + sign which was not included.)

86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,11!
Error: unexpected numeric constant in:
68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,11
0

I'm guessing you have spaces or console line continuation markers in material 
you copied from a console session.

Some people say that RTFM replies are not kewl, but I do think that message is 
needed here. I do not think it is a limitation (at least not on a Mac in the 
GUI) in the size of the clipboard or the console input driver since this edited 
version , removing the CRs and !'s, does load an object:

 length (freq)
[1] 5847


freq-c(255899,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,32,34,36,38,40,42,23,25,27,29,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,60,61,62,63,8,8,8,8,8,8,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
 
6,6,6,6,6,6,6,6,6,6,13,14,15,16,24,26,28,30,32,34,36,38,40,52,54,56,58,60,62,64,66,68,70,72,
 
74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,59,60,61,62,63,64,8,
 
7,7,7,7,7,7,6,12,13,14,15,16,17,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,
 
64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,
 
118,120,122,124,126,128,130,132,134,136,138,140,142,144,81,82,83,84,85,86,22,22,22,22,22,22,
 
25,26,27,28,29,30,34,36,38,40,42,29,30,31,32,33,34,20,20,14,14,14,14,14,14,8,8,8,8,7,7,7,7,
 7,7,6,6,6,6,6,6,6,6,7,8,9,10,11,12,14,16,18,20,22,24,26,28,
 
30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,
 
88,90,92,94,96,98,100,102,104,106,108,110,112,114,77,79,81,83,85,87,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,69,71,
 
73,75,77,79,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,
 
84,86,88,90,92,94,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,
 
128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,
 
172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,
 
216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,254,256,258,
 
260,262,264,266,268,270,272,274,276,278,280,282,284,286,288,290,292,294,22,22,22,22,22,
 
22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,10,12,14,16,18,20,22,24,26,28,30,32,34,36,
 
38,40,42,44,46,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,
 56,58,60,62,64,66,
 
68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,
 
118,8,8,8,8,8,8,8,8,8,8,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
 
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,
 
44,46,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,
 
58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,
 
110,112,197,199,201,147,148,149,150,151,15,15,15,15,15,14,14,14,14,14,14,14,14,14,14,
 
14,14,14,14,14,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,6,7,8,9,10,11,
 12,13, 
 
6,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,
 
158,160,162,164,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,
 
146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,
 
188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,
 
230,232,234,236,238,240,242,244,246,248,250,252,254,256,258,260,262,264,266,268,270,
 
272,274,276,278,280,282,284,286,288,290,292,294,296,298,300,302,304,306,308,310,312,
 
314,316,318,320,322,324,326,328,330,332,334,336,338,340,342,344,346,348,350,352,354,
 
356,358,360,362,364,366,368,370,372,374,376,378,380,382,384,386,388,390,392,394,396,
 
398,400,402,404,406,408,215,217,219,221,223,225,227,229,231,233,235,237,239,241,243,
 
245,247,249,251,253,255,257,259,261,263,265,267,269,271,273,275,277,279,281,283,285,
 
287,289,291,293,295,297,299,301,303,305,307,309,311,313,315,317,319,321,323,325,327,
 
329,331,333,335,337,339,341,343,345,347,349,351,353,355,357,359,361,363,365,367,369,371,
 
373,375,377,379,381,383,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,
 
264,265,266,267,262,264,266,268,270,272,274,276,278,280,282,284,286,288,290,292,336,338,
 
340,342,344,346,348,350,352,354,356,358,360,362,364,366,368,370,372,374,376,378,380,382,384,
 

[R] Three questions about plotting

2014-02-27 Thread David Parkhurst
I would like to plot three graphs, one above the other, of three “y” 
variables that have different scales against a common Date variable, as 
with the code below.


Q1.  If I understand correctly, I can't use lattice graphics because my 
y's have different scales.  Is that correct?  All the lattice or trellis 
plots I've seen have common “y” scales for all plots.


I have two problems with what this code produces:
Q2.  How can I get the vertical dimension of all three plots to be the 
same?  I know that I've made them different by using different mar 
numbers, but I had to do that, I thought, to leave room for date axis 
labels.  I don't want to leave wasted space between the plots.


Q3.  Why are my dates not coming out in the format I've specified in the 
axis.Date statement?


DateNum - seq(8248,9247)
Date-as.Date(DateNum, origin=1970/01/01)
y1- runif(1000,0,1)
y2- runif(1000,0,100)
y3- runif(1000,0,10)
par(mfrow=c(4,1))
par(mar=c(0,4,0,2)+0.1)
plot(y1 ~ Date, xaxt = n, type = p,cex=0.7)
plot(y2 ~ Date, xaxt = n, type = p,cex=0.7)
par(mar=c(4,4,0,2)+0.1)
plot(y3 ~ Date, xaxt = n, type = p,cex=0.7)
DateLbls - 
seq.Date(from=as.Date(1992/08/01),to=as.Date(1995/04/27),by=3 months)

axis.Date(side=1,Date,at=DateLbls, labels=DateLbls, format=%m-%y)

__
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] Three questions about plotting

2014-02-27 Thread Gabor Grothendieck
On Thu, Feb 27, 2014 at 7:19 PM, David Parkhurst parkh...@imap.iu.edu wrote:
 I would like to plot three graphs, one above the other, of three y
 variables that have different scales against a common Date variable, as with
 the code below.

 Q1.  If I understand correctly, I can't use lattice graphics because my y's
 have different scales.  Is that correct?  All the lattice or trellis plots
 I've seen have common y scales for all plots.

 I have two problems with what this code produces:
 Q2.  How can I get the vertical dimension of all three plots to be the same?
 I know that I've made them different by using different mar numbers, but I
 had to do that, I thought, to leave room for date axis labels.  I don't want
 to leave wasted space between the plots.

 Q3.  Why are my dates not coming out in the format I've specified in the
 axis.Date statement?

 DateNum - seq(8248,9247)
 Date-as.Date(DateNum, origin=1970/01/01)
 y1- runif(1000,0,1)
 y2- runif(1000,0,100)
 y3- runif(1000,0,10)
 par(mfrow=c(4,1))
 par(mar=c(0,4,0,2)+0.1)
 plot(y1 ~ Date, xaxt = n, type = p,cex=0.7)
 plot(y2 ~ Date, xaxt = n, type = p,cex=0.7)
 par(mar=c(4,4,0,2)+0.1)
 plot(y3 ~ Date, xaxt = n, type = p,cex=0.7)
 DateLbls -
 seq.Date(from=as.Date(1992/08/01),to=as.Date(1995/04/27),by=3 months)
 axis.Date(side=1,Date,at=DateLbls, labels=DateLbls, format=%m-%y)


Try this:

library(lattice)
DF - data.frame(make.groups(y1, y2, y3), Date)
xyplot(data ~ Date | which, DF, scales = list(y = list(relation =
free)), layout = c(1, 3))

-- 
Statistics  Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at 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 series analysis

2014-02-27 Thread Pascal Oettli
Hello,

Maybe functions xts, endpoints and period.apply of the xts
package might help you.

Regards,
Pascal


On Fri, Feb 28, 2014 at 1:32 AM, Yang Yang simonyangy...@gmail.com wrote:
 Hi

 Currently I am working on a river discharge data analysis. I have the daily
 discharge record from 1935 to now. I want to extract the annual maximum
 discharge for each hydrolocial year (*start from 01/11 to next year 31/10*).
 However, I found that the hydroTSM package can only deal with the natural
 year. I tried to use the zoo package, but I found it's difficult to
 compute, as each year have different days. Does anyone have some idea?
 Thanks.

 the data looks like:

 01-11-1935 66302-11-1935 59603-11-1935 45004-11-1935 38105-11-1935
 35406-11-1935 312

 my code:

 mydata-read.table(discharge)
 colnames(mydata) - c(date,discharge)

 library(zoo)
 z-zooreg(mydata[,2],start=as.Date(1935-11-1))

 mydta$date - as.POSIXct(dat$date)

 q.month-daily2monthly(z,FUN=max,na.rm = TRUE,date.fmt =
 %Y-%m-%d,out.fmt=numeric)
 q.month.plain=coredata(q.month)

 z.month-zooreg(q.month.plain,start=1,frequency=12)

 Thanks very much.

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



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan

__
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] expressions (nesting, substitution, 2-stage evaluation)

2014-02-27 Thread David Winsemius

On Feb 27, 2014, at 3:17 PM, Bert Gunter wrote:

 ?plotmath
 
 -- Bert

Daryl;; 

I think what Bert was hoping you would do was read the plotmath page and figure 
it out on your own but that can be a bit tricky when working with expression 
object vectors. Here is (perhaps) a step forward:

vectorA = c( bquote(TNF-*alpha), bquote(IFN-*gamma) )

for(ii in vectorA)  {
  plot(0:1,0:1)
  title(main = ii)
 } 

Now as Jim Holtman is fond of saying... what problem were you (really) trying 
to solve?

-- 
David.

 
 Bert Gunter
 Genentech Nonclinical Biostatistics
 (650) 467-7374
 
 Data is not information. Information is not knowledge. And knowledge
 is certainly not wisdom.
 H. Gilbert Welch
 
 
 
 
 On Thu, Feb 27, 2014 at 2:58 PM, Daryl Morris dar...@uw.edu wrote:
 Hi,
 
 I have a function which generates many plots.  To keep it simple, let's say
 I want to set the main title based on where we are in nested loops.
 
 So, something like
 
 vectorA = c(a,b,c)
 vectorB = c(a,b,c)
 
 for(ii in vectorA) { for(jj in vectorB) {
  plot(0:1,0:1)
  title(main = paste(ii,jj))
 }
 
 that part is easy!   The question is what if I wanted vectorA to be an
 expression?
 
 I'd like to be able to set vectorA =
 c(expression(paste(TNF-,alpha)),expression(paste(IFN-,gamma))), and have
 the plot title show the greek letters.
 
 Obviously, in the for-loop I could build the expression all at once, but
 there are lots of programmatic reasons I'd like to be able to have this
 program structure.  Is there a solution which modifies either/both (1) the
 setting of main in the loop (2) how I define the vector outside of the loop?
 
 
 thanks, Daryl
 
 __
 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.

David Winsemius
Alameda, CA, USA

__
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] Three questions about plotting

2014-02-27 Thread Jim Lemon

On 02/28/2014 11:19 AM, David Parkhurst wrote:

I would like to plot three graphs, one above the other, of three “y”
variables that have different scales against a common Date variable, as
with the code below.

Q1. If I understand correctly, I can't use lattice graphics because my
y's have different scales. Is that correct? All the lattice or trellis
plots I've seen have common “y” scales for all plots.

I have two problems with what this code produces:
Q2. How can I get the vertical dimension of all three plots to be the
same? I know that I've made them different by using different mar
numbers, but I had to do that, I thought, to leave room for date axis
labels. I don't want to leave wasted space between the plots.


You can get what you want with:

layout(matrix(1:3,ncol=1),heights=c(1,1,1.4))

rather than mfrow. Also, try using:

# first plot
par(mar=c(0,4,4,4))
# second plot
par(mar=c(0,4,0,4)) # and yaxt=n
...
axis(4)
# third plot
par(mar=c(4,4,0,4))


Q3. Why are my dates not coming out in the format I've specified in the
axis.Date statement?


Try DateLbls-format(seq.Date(...),format=%m-%y)

Jim

__
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] pre-allocation not always a timesaver

2014-02-27 Thread Ross Boylan
The R Inferno advises that if you are building up results in pieces it's
best to pre-allocate the result object and fill it in.  In some testing,
I see a benefit with this strategy for regular variables.  However, when
the results are held by a class, the opposite seems to be the case.

Comments?  Explanations?

Possibly for classes any update causes the entire object to be
replaced--perhaps to trigger the validation machinery?--and so
preallocation simply means on average a bigger object is being
manipulated.

Here is some test code, with CPU seconds given in the comments.  I tried
everything twice in case there was some first-time overhead such as
growing total memory in the image.  When the 2 times differed noticeably
I reported both values.

# class definitions
refbase - setRefClass(refBase, fields = list(dispatch=ANY, myx=ANY),
   methods = list( initialize = function(x0=NULL, ...) {
   usingMethods(foo)
   dispatch - foo
   myx - x0   



   }
# some irrelevant methods edited out
   ))

myclass - setClass(simple, representation=list(myx=ANY))

### Method 1: regular variables
pre - function(n, j=1000) {
x - array(dim=(c(j, n)))
for (i in 1:n) {
x[,i] - rnorm(j)
}
x
}
system.time(pre(1000)) #0.3s


   

nopre - function(n, j=1000) {
x - numeric(0)
for (i in 1:n)
x - c(x, rnorm(j))
x
}

system.time(nopre(1000))  # 2.0s, 2.7s  


   

# Method 2: with ref class  


 
pre2 - function(n, j=1000) {
a - refbase(x0=numeric(0))
a$myx - array(dim=c(j, n))
for (i in 1:n) {
a$myx[,i] - rnorm(j)
}
a$myx
}
system.time(pre2(1000)) # 4.0 s 


   

nopre2 - function(n, j=1000) {
a - refbase(x0=numeric(0))
for (i in 1:n)
a$myx - c(a$myx, rnorm(j))
a$myx
}
system.time(nopre2(1000)) # 2.9s, 4.3   


   

# Method 3: with regular class  


 
pre3 - function(n, j=1000) {
a - myclass()
a@myx - array(dim=c(j, n))
for (i in 1:n) {
a@myx[,i] - rnorm(j)
}
a@myx
}
system.time(pre3(1000)) # 7.3 s 


   

nopre3 - function(n, j=1000) {
a - myclass(myx=numeric(0))
for (i in 1:n)
a@myx - c(a@myx, rnorm(j))
a@myx
}
system.time(nopre3(1000))  # 4.2s

__
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] expressions (nesting, substitution, 2-stage evaluation)

2014-02-27 Thread Daryl Morris
Hi,

Both your code and my code work when I don't combine things.  The 
problem is when I want to combine an expression (or a bquote in your 
example) with something else

e.g. this doesn't work:

vectorA = c( bquote(TNF-*alpha), bquote(IFN-*gamma) )

for(ii in vectorA)  {
plot(0:1,0:1)
title(main = paste(asdfsadf,ii))
}

because as soon as I've made an expression, I can no longer append it to 
something else.  While in this example I could have had the asdfsadf 
in the original bquote, there are reasons I need to build the ultimate 
label at a separate point than I define the labels (I mix and match 
things multiple ways inside the code).

So, the thing I'm really trying to do is a 2-stage evaluation of an 
expression, aka a nested expression evaluation, or a substition of 
expressions.  I've tried things like deparse, but so far haven't found 
the magic.

thanks, Daryl


On 2/27/14 5:17 PM, David Winsemius wrote:
 On Feb 27, 2014, at 3:17 PM, Bert Gunter wrote:

 ?plotmath
 
 -- Bert
 Daryl;;

 I think what Bert was hoping you would do was read the plotmath page and 
 figure it out on your own but that can be a bit tricky when working with 
 expression object vectors. Here is (perhaps) a step forward:

 vectorA = c( bquote(TNF-*alpha), bquote(IFN-*gamma) )

 for(ii in vectorA)  {
plot(0:1,0:1)
title(main = ii)
   }

 Now as Jim Holtman is fond of saying... what problem were you (really) trying 
 to solve?

 -- David.
 
 Bert Gunter
 Genentech Nonclinical Biostatistics
 (650) 467-7374
 
 Data is not information. Information is not knowledge. And knowledge
 is certainly not wisdom.
 H. Gilbert Welch
 
 
 
 
 On Thu, Feb 27, 2014 at 2:58 PM, Daryl Morrisdar...@uw.edu  wrote:
 Hi,
 
 I have a function which generates many plots.  To keep it simple, let's 
 say
 I want to set the main title based on where we are in nested loops.
 
 So, something like
 
 vectorA = c(a,b,c)
 vectorB = c(a,b,c)
 
 for(ii in vectorA) { for(jj in vectorB) {
   plot(0:1,0:1)
   title(main = paste(ii,jj))
 }
 
 that part is easy!   The question is what if I wanted vectorA to be an
 expression?
 
 I'd like to be able to set vectorA =
 c(expression(paste(TNF-,alpha)),expression(paste(IFN-,gamma))), and 
 have
 the plot title show the greek letters.
 
 Obviously, in the for-loop I could build the expression all at once, but
 there are lots of programmatic reasons I'd like to be able to have this
 program structure.  Is there a solution which modifies either/both (1) the
 setting of main in the loop (2) how I define the vector outside of the 
 loop?
 
 
 thanks, Daryl
 
 __
 R-help@r-project.org  mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting 
 guidehttp://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 guidehttp://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 David Winsemius
 Alameda, CA, USA



[[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] expressions (nesting, substitution, 2-stage evaluation)

2014-02-27 Thread Daryl Morris
Yes, plotmath contains expressions. The example produced in ?plotmath is 
not as complex as the example I provided.  bquote and substitute allow 
substitutions of variables ... but what I need to be able to do is 
substitute an expression... and that is the magic I'm looking for.


thanks, Daryl


On 2/27/14 3:17 PM, Bert Gunter wrote:

?plotmath

-- Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom.
H. Gilbert Welch




On Thu, Feb 27, 2014 at 2:58 PM, Daryl Morris dar...@uw.edu wrote:

Hi,

I have a function which generates many plots.  To keep it simple, let's say
I want to set the main title based on where we are in nested loops.

So, something like

vectorA = c(a,b,c)
vectorB = c(a,b,c)

for(ii in vectorA) { for(jj in vectorB) {
   plot(0:1,0:1)
   title(main = paste(ii,jj))
}

that part is easy!   The question is what if I wanted vectorA to be an
expression?

I'd like to be able to set vectorA =
c(expression(paste(TNF-,alpha)),expression(paste(IFN-,gamma))), and have
the plot title show the greek letters.

Obviously, in the for-loop I could build the expression all at once, but
there are lots of programmatic reasons I'd like to be able to have this
program structure.  Is there a solution which modifies either/both (1) the
setting of main in the loop (2) how I define the vector outside of the loop?


thanks, Daryl

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


[R] Parameter fitting by using minpack.lm package

2014-02-27 Thread Rajendra Paudel
Hi!

I am trying to fit 2-dimensional data (global data with 2-degree
resolution) using nls.lm function of minpack.lm package. I am successful to
fit the transient data in a single grid point but not able to fit 2-D data.
The error message is listed below. I am just wondering if anybody has used
this routine to fit 2-D/3-D data?

Error in `colnames-`(`*tmp*`, value = c(a, b, c)) :
  length of 'dimnames' [2] not equal to array extent

It seems like the error is generated after the iteration. I googled the
error but did not find anything significant.

It.0, RSS =nan, Par. =  0  0  0
It.1, RSS =   37.5, Par. =  0  0  0

Here is the code I used:

require(graphics)
library(ncdf)
library(minpack.lm)

data - E:/R/Optimize_FIN.Params/output.with.zwt_actual.base.jul1993.nc
dataModel - open.ncdf(data)
data.obs - E:/R/Optimize_FIN.Params/Prigent_fraction_jul1993_conserved.nc
dataObs - open.ncdf(data.obs)
data.params - E:/R/Optimize_FIN.Params/
surfdata_1.9x2.5_simyr1850_c120622.nc
dataParams - open.ncdf(data.params)

# get latitudes and longitudes
lat - get.var.ncdf(dataModel,lat,verbose=F)
nlat - dim(lat)
lon - get.var.ncdf(dataModel,lon)
nlon - dim(lon)
dimlat - dim.def.ncdf(lat,degrees_north,lat)
dimlon - dim.def.ncdf(lon,degrees_east,lon)
print(dimlat)

# get time dimension for model data
t - get.var.ncdf(dataModel,time)
nt - dim(t)
tunits - att.get.ncdf(dataModel,time,units)

#get the variables from the netcdf file
zwt0 - get.var.ncdf(dataParams,ZWT0)
f0 - get.var.ncdf(dataParams,F0)
p3 - get.var.ncdf(dataParams,P3)
zwt - get.var.ncdf(dataModel,ZWT_ACTUAL)
qr - get.var.ncdf(dataModel,QOVER_LAG)
obs - get.var.ncdf(dataObs,frac)
close.ncdf(dataModel)
close.ncdf(dataParams)
close.ncdf(dataObs)

#change NA to zero in data
qr[is.na(qr)] - 0
zwt[is.na(zwt)]- 0

for (i in 1:144)
{
  for (j in 1:96)
  {
f.fin - function(params,data) {
  fin.mod - expression(params$a*exp(-(data$a/params$b)) +
params$c*data$b)
  eval(fin.mod)
}
p.fin - list(a=f0, b=zwt0, c=p3)
d.fin - list(a=zwt, b=qr)
model - f.fin(p.fin, d.fin)

residFun - function(p, observed, data) {
  r.residual -expression(observed - f.fin(p,data))
  eval(r.residual)
}
parStart - list(a=f0,b=zwt0,c=p3)
#perform the optimization
nls.out - nls.lm(par=parStart, fn = residFun, observed = obs,
  data = d.fin, control = nls.lm.control(maxiter =
100,nprint=1))
  }
}
summary(nls.out)

Any help would be greatly appreciated. Thank you.

Best,
Rajendra Paudel
Cornell University

[[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] Data Rearrangement

2014-02-27 Thread dila radi
Hi all,

I know this is easy, but I really do not have any idea to solve it.

I have this kind of data set:

dat - read.table(text=Day Year Jan Feb Mar Apr
  1  2012 0 2.5 0.5 2
  2  2012 0 6.5 0 29
  3  2012 0 9.5 0 0
  4  2012 0 0 8 0.5
  5  2012 0 5 0.5 110.5
  6  2012 0 4 3.5 22
  7  2012 11 0 12.5 3.5
  8  2012 0 5 8 36.5
  1  2013 0 2.5 0.5 2
  2  2013 0 6.5 0 29
  3  2013 0 9.5 0 0
  4  2013 0 0 8 0.5
  5  2013 0 5 0.5 110.5
  6  2013 0 4 3.5 22
  7  2013 11 0 12.5 3.5
  8  2013 0 5 8 36.5,sep=,header=TRUE)

and I want it to be in this form:

Year   Day Month Amount  2012 1 1 0  2012 2 1 0  2012 3 1 0  2012 4
1 0  2012 5 1 0  2012 6 1 0  2012 7 1 11  2012 8 1 0  2012 1 2 2.5  2012 2 2
6.5  2012 3 2 9.5  2012 4 2 0  2012 5 2 5  2012 6 2 4  2012 7 2 0  2012 8 2
5  2012 1 3 0.5  2012 2 3 0  2012 3 3 0  2012 4 3 8  2012 5 3 0.5  2012 6 3
3.5  2012 7 3 12.5  2012 8 3 8  2012 1 4 2  2012 2 4 29  2012 3 4 0  2012 4
4 0.5  2012 5 4 110.5  2012 6 4 22  2012 7 4 3.5  2012 8 4 36.5 2013 1 1
0  2013 2 1 0  2013 3 1 0  2013 4 1 0  2013 5 1 0  2013 6 1 0  2013 7 1 11
2013 8 1 0  2013 1 2 2.5  2013 2 2 6.5  2013 3 2 9.5  2013 4 2 0  2013 5 2 5
2013 6 2 4  2013 7 2 0  2013 8 2 5  2013 1 3 0.5  2013 2 3 0  2013 3 3 0
2013 4 3 8  2013 5 3 0.5  2013 6 3 3.5  2013 7 3 12.5  2013 8 3 8  2012 1 4
2  2012 2 4 29  2012 3 4 0  2012 4 4 0.5  2012 5 4 110.5  2012 6 4 22  2012
7 4 3.5  2012 8 4 36.5  2013 1 4 2  2013 2 4 29  2013 3 4 0  2013 4 4 0.5
2013 5 4 110.5  2013 6 4 22  2013 7 4 3.5  2013 8 4 36.5
I want to rearrange the data according to the YEAR (year by year)

Thank you.

Regards,
Dila

[[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] New to R

2014-02-27 Thread George Katsuras
I successfully downloaded and loaded the stockPortfolio and quadprog packages, 
but when I entered the following command I got an error:


returns - getReturns(names(stocks), freq=week)
Error in file(file, rt) : cannot open the connection
In addition: Warning message:
In file(file, rt) : cannot open: HTTP status was '404 Not Found'




When I tried discovering the source of this error, it appears that the file has 
been temporarily moved to a new URL address.


I’m currently running Windows 8.1.


Is there a fix for this?




Sent from Windows Mail
[[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] expressions (nesting, substitution, 2-stage evaluation)

2014-02-27 Thread Bert Gunter
1. I don't think this is the right way to go about this. I would think
about making pieces of your title arguments and assembling them in
your call.

... But be that as it may...

2. The problem is that in your loop, ii is already an expression -- a
language object. Pasting to it is meaningless.  So you need to deparse
it first to a character string and paste to that. Then parse the
result:

vectorA - c( quote(TNF-*alpha), quote(IFN-*gamma) )

for(ii in vectorA)  {
   plot(0:1,0:1)
  ex - paste(abcd*~~,deparse(ii),sep=)
   title(main = (parse(text=ex)))
}


3. There may well be more elegant ways to do this. But discovering
them exceeds my capabilities.


Cheers,
Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom.
H. Gilbert Welch




On Thu, Feb 27, 2014 at 5:37 PM, Daryl Morris dar...@uw.edu wrote:
 Hi,

 Both your code and my code work when I don't combine things.  The problem is
 when I want to combine an expression (or a bquote in your example) with
 something else

 e.g. this doesn't work:

 vectorA = c( bquote(TNF-*alpha), bquote(IFN-*gamma) )

 for(ii in vectorA)  {
plot(0:1,0:1)
title(main = paste(asdfsadf,ii))
 }

 because as soon as I've made an expression, I can no longer append it to
 something else.  While in this example I could have had the asdfsadf in
 the original bquote, there are reasons I need to build the ultimate label at
 a separate point than I define the labels (I mix and match things multiple
 ways inside the code).

 So, the thing I'm really trying to do is a 2-stage evaluation of an
 expression, aka a nested expression evaluation, or a substition of
 expressions.  I've tried things like deparse, but so far haven't found the
 magic.

 thanks, Daryl


 On 2/27/14 5:17 PM, David Winsemius wrote:

 On Feb 27, 2014, at 3:17 PM, Bert Gunter wrote:

 ?plotmath

 -- Bert

 Daryl;;

 I think what Bert was hoping you would do was read the plotmath page and
 figure it out on your own but that can be a bit tricky when working with
 expression object vectors. Here is (perhaps) a step forward:

 vectorA = c( bquote(TNF-*alpha), bquote(IFN-*gamma) )

 for(ii in vectorA)  {
   plot(0:1,0:1)
   title(main = ii)
  }

 Now as Jim Holtman is fond of saying... what problem were you (really)
 trying to solve?

 --
 David.


 Bert Gunter
 Genentech Nonclinical Biostatistics
 (650) 467-7374

 Data is not information. Information is not knowledge. And knowledge
 is certainly not wisdom.
 H. Gilbert Welch




 On Thu, Feb 27, 2014 at 2:58 PM, Daryl Morris dar...@uw.edu wrote:

 Hi,

 I have a function which generates many plots.  To keep it simple, let's
 say
 I want to set the main title based on where we are in nested loops.

 So, something like

 vectorA = c(a,b,c)
 vectorB = c(a,b,c)

 for(ii in vectorA) { for(jj in vectorB) {
  plot(0:1,0:1)
  title(main = paste(ii,jj))
 }

 that part is easy!   The question is what if I wanted vectorA to be an
 expression?

 I'd like to be able to set vectorA =
 c(expression(paste(TNF-,alpha)),expression(paste(IFN-,gamma))), and
 have
 the plot title show the greek letters.

 Obviously, in the for-loop I could build the expression all at once, but
 there are lots of programmatic reasons I'd like to be able to have this
 program structure.  Is there a solution which modifies either/both (1)
 the
 setting of main in the loop (2) how I define the vector outside of the
 loop?


 thanks, Daryl

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

 David Winsemius
 Alameda, CA, USA



__
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] expressions (nesting, substitution, 2-stage evaluation)

2014-02-27 Thread David Winsemius

On Feb 27, 2014, at 9:55 PM, Bert Gunter wrote:

 1. I don't think this is the right way to go about this. I would think
 about making pieces of your title arguments and assembling them in
 your call.
 
 ... But be that as it may...
 
 2. The problem is that in your loop, ii is already an expression -- a
 language object. Pasting to it is meaningless.  So you need to deparse
 it first to a character string and paste to that. Then parse the
 result:
 
 vectorA - c( quote(TNF-*alpha), quote(IFN-*gamma) )
 
 for(ii in vectorA)  {
   plot(0:1,0:1)
  ex - paste(abcd*~~,deparse(ii),sep=)
   title(main = (parse(text=ex)))
 }
 
 
 3. There may well be more elegant ways to do this. But discovering
 them exceeds my capabilities.
 

What about just using `substitute`?

vectorA = c( bquote(TNF-*alpha), bquote(IFN-*gamma) )

for(ii in vectorA)  {
   plot(0:1,0:1)
   title(main = substitute(asdfsadf*x, list(x=ii)) )
}

-- 
David.

 
 Cheers,
 Bert
 
 Bert Gunter
 Genentech Nonclinical Biostatistics
 (650) 467-7374
 
 Data is not information. Information is not knowledge. And knowledge
 is certainly not wisdom.
 H. Gilbert Welch
 
 
 
 
 On Thu, Feb 27, 2014 at 5:37 PM, Daryl Morris dar...@uw.edu wrote:
 Hi,
 
 Both your code and my code work when I don't combine things.  The problem is
 when I want to combine an expression (or a bquote in your example) with
 something else
 
 e.g. this doesn't work:
 
 vectorA = c( bquote(TNF-*alpha), bquote(IFN-*gamma) )
 
 for(ii in vectorA)  {
   plot(0:1,0:1)
   title(main = paste(asdfsadf,ii))
 }
 
 because as soon as I've made an expression, I can no longer append it to
 something else.  While in this example I could have had the asdfsadf in
 the original bquote, there are reasons I need to build the ultimate label at
 a separate point than I define the labels (I mix and match things multiple
 ways inside the code).
 
 So, the thing I'm really trying to do is a 2-stage evaluation of an
 expression, aka a nested expression evaluation, or a substition of
 expressions.  I've tried things like deparse, but so far haven't found the
 magic.
 
 thanks, Daryl
 
 
 On 2/27/14 5:17 PM, David Winsemius wrote:
 
 On Feb 27, 2014, at 3:17 PM, Bert Gunter wrote:
 
 ?plotmath
 
 -- Bert
 
 Daryl;;
 
 I think what Bert was hoping you would do was read the plotmath page and
 figure it out on your own but that can be a bit tricky when working with
 expression object vectors. Here is (perhaps) a step forward:
 
 vectorA = c( bquote(TNF-*alpha), bquote(IFN-*gamma) )
 
 for(ii in vectorA)  {
  plot(0:1,0:1)
  title(main = ii)
 }
 
 Now as Jim Holtman is fond of saying... what problem were you (really)
 trying to solve?
 
 --
 David.
 
 
 Bert Gunter
 Genentech Nonclinical Biostatistics
 (650) 467-7374
 
 Data is not information. Information is not knowledge. And knowledge
 is certainly not wisdom.
 H. Gilbert Welch
 
 
 
 
 On Thu, Feb 27, 2014 at 2:58 PM, Daryl Morris dar...@uw.edu wrote:
 
 Hi,
 
 I have a function which generates many plots.  To keep it simple, let's
 say
 I want to set the main title based on where we are in nested loops.
 
 So, something like
 
 vectorA = c(a,b,c)
 vectorB = c(a,b,c)
 
 for(ii in vectorA) { for(jj in vectorB) {
 plot(0:1,0:1)
 title(main = paste(ii,jj))
 }
 
 that part is easy!   The question is what if I wanted vectorA to be an
 expression?
 
 I'd like to be able to set vectorA =
 c(expression(paste(TNF-,alpha)),expression(paste(IFN-,gamma))), and
 have
 the plot title show the greek letters.
 
 Obviously, in the for-loop I could build the expression all at once, but
 there are lots of programmatic reasons I'd like to be able to have this
 program structure.  Is there a solution which modifies either/both (1)
 the
 setting of main in the loop (2) how I define the vector outside of the
 loop?
 
 
 thanks, Daryl
 
 __
 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.
 
 David Winsemius
 Alameda, CA, USA
 
 

David Winsemius
Alameda, CA, USA

__
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] Data Rearrangement

2014-02-27 Thread David Winsemius

On Feb 27, 2014, at 7:24 PM, dila radi wrote:

 Hi all,
 
 I know this is easy, but I really do not have any idea to solve it.
 
 I have this kind of data set:
 
 dat - read.table(text=Day Year Jan Feb Mar Apr
  1  2012 0 2.5 0.5 2
  2  2012 0 6.5 0 29
  3  2012 0 9.5 0 0
  4  2012 0 0 8 0.5
  5  2012 0 5 0.5 110.5
  6  2012 0 4 3.5 22
  7  2012 11 0 12.5 3.5
  8  2012 0 5 8 36.5
  1  2013 0 2.5 0.5 2
  2  2013 0 6.5 0 29
  3  2013 0 9.5 0 0
  4  2013 0 0 8 0.5
  5  2013 0 5 0.5 110.5
  6  2013 0 4 3.5 22
  7  2013 11 0 12.5 3.5
  8  2013 0 5 8 36.5,sep=,header=TRUE)
 
 and I want it to be in this form:

Yeah,  right. This is the form you want?
 
Year   Day Month Amount  2012 1 1 0  2012 2 1 0  2012 3 1 0  2012 4
 1 0  2012 5 1 0  2012 6 1 0  2012 7 1 11  2012 8 1 0  2012 1 2 2.5  2012 2 2
 6.5  2012 3 2 9.5  2012 4 2 0  2012 5 2 5  2012 6 2 4  2012 7 2 0  2012 8 2
 5  2012 1 3 0.5  2012 2 3 0  2012 3 3 0  2012 4 3 8  2012 5 3 0.5  2012 6 3
 3.5  2012 7 3 12.5  2012 8 3 8  2012 1 4 2  2012 2 4 29  2012 3 4 0  2012 4
 4 0.5  2012 5 4 110.5  2012 6 4 22  2012 7 4 3.5  2012 8 4 36.5 2013 1 1
 0  2013 2 1 0  2013 3 1 0  2013 4 1 0  2013 5 1 0  2013 6 1 0  2013 7 1 11
 2013 8 1 0  2013 1 2 2.5  2013 2 2 6.5  2013 3 2 9.5  2013 4 2 0  2013 5 2 5
 2013 6 2 4  2013 7 2 0  2013 8 2 5  2013 1 3 0.5  2013 2 3 0  2013 3 3 0
 2013 4 3 8  2013 5 3 0.5  2013 6 3 3.5  2013 7 3 12.5  2013 8 3 8  2012 1 4
 2  2012 2 4 29  2012 3 4 0  2012 4 4 0.5  2012 5 4 110.5  2012 6 4 22  2012
 7 4 3.5  2012 8 4 36.5  2013 1 4 2  2013 2 4 29  2013 3 4 0  2013 4 4 0.5
 2013 5 4 110.5  2013 6 4 22  2013 7 4 3.5  2013 8 4 36.5
 I want to rearrange the data according to the YEAR (year by year)
 

Sigh. Please do not post in HTML.

-- 
David.

 Thank you.
 
 Regards,
 Dila
 
   [[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.

David Winsemius
Alameda, CA, USA

__
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 is the model resample performance calculated by caret?

2014-02-27 Thread zhenjiang zech xu
Dear all,

I did a 5-repeat of 10-fold cross validation using partial least square
regression model provided by caret package. Can anyone tell me how are the
values in plsTune$resample calculated? Is that predicted on each hold-out
set using the model which is trained on the rest data with the optimized
parameter tuned from previous cross validation? So in the following
example, firstly, 5-repeat of 10-fold cross validation gives 2 for ncomp as
the best, and then using ncomp of 2 and the training data to build a model
and then predict the hold-out data with the model to give a RMSE and
RSQUARE - is what I am thinking true?


 plsTune
524 samples
615 predictors

Pre-processing: centered, scaled
Resampling: Cross-Validation (10 fold, repeated 5 times)

Summary of sample sizes: 472, 472, 471, 471, 471, 471, ...

Resampling results across tuning parameters:

  ncomp  RMSE  Rsquared  RMSE SD  Rsquared SD
  1  16.8  0.434 1.47 0.0616
  2  14.3  0.612 2.21 0.0768
  3  13.5  0.704 6.33 0.145
  4  14.6  0.706 9.29 0.163
  5  15.2  0.703 10.9 0.172
  6  16.5  0.69  13.4 0.181
  7  18.4  0.672 17.8 0.194
  8  200.651 20.4 0.199
  9  20.9  0.634 20.9 0.199
  10 22.1  0.613 22.1 0.197
  11 23.3  0.599 23.8 0.198
  12 240.588 24.7 0.198
  13 24.9  0.572 25.2 0.197
  14 25.8  0.557 26.2 0.194
  15 26.2  0.544 25.8 0.191
  16 26.6  0.532 25.5 0.187

RMSE was used to select the optimal model using  the one SE rule.
The final value used for the model was ncomp = 2.

 plsTune$resample
   ncomp RMSE  RsquaredResample
1  2 13.61569 0.6349700 Fold06.Rep4
2  2 16.02091 0.5808985 Fold05.Rep1
3  2 12.59985 0.6008357 Fold03.Rep5
4  2 13.20069 0.6296245 Fold02.Rep3
5  2 12.43419 0.6560434 Fold04.Rep2
6  2 15.36510 0.5954177 Fold04.Rep5
7  2 12.70028 0.6894489 Fold03.Rep2
8  2 13.34882 0.6468300 Fold09.Rep3
9  2 14.80217 0.5575010 Fold08.Rep3
10 2 19.03705 0.4907630 Fold05.Rep4
11 2 14.26704 0.6579390 Fold10.Rep2
12 2 13.79060 0.5806663 Fold05.Rep3
13 2 14.83641 0.5918039 Fold05.Rep2
14 2 12.48721 0.7011439 Fold01.Rep3
15 2 14.98765 0.5866102 Fold07.Rep4
16 2 10.88100 0.7597167 Fold06.Rep1
17 2 13.60705 0.6321377 Fold08.Rep5
18 2 13.42618 0.6136031 Fold08.Rep4
19 2 13.26066 0.6784586 Fold07.Rep1
20 2 13.20623 0.6812341 Fold03.Rep3
21 2 18.54275 0.4404729 Fold08.Rep2
22 2 11.80312 0.7177681 Fold05.Rep5
23 2 18.56271 0.4661072 Fold03.Rep1
24 2 13.54879 0.5850439 Fold10.Rep3
25 2 14.10859 0.5994811 Fold06.Rep5
26 2 13.68329 0.6701091 Fold01.Rep5
27 2 16.12123 0.5401200 Fold10.Rep1
28 2 12.92250 0.6917220 Fold06.Rep3
29 2 12.94366 0.6400066 Fold06.Rep2
30 2 12.39889 0.6790578 Fold01.Rep2
31 2 13.48499 0.6759649 Fold01.Rep1
32 2 12.52938 0.6728476 Fold03.Rep4
33 2 16.43352 0.5795160 Fold09.Rep5
34 2 12.53991 0.6550694 Fold09.Rep4
35 2 12.78708 0.6304606 Fold08.Rep1
36 2 13.97559 0.6655688 Fold04.Rep3
37 2 15.31642 0.5124997 Fold09.Rep2
38 2 15.24194 0.5324943 Fold09.Rep1
39 2 12.90107 0.6318960 Fold04.Rep1
40 2 13.59574 0.6277869 Fold01.Rep4
41 2 19.73633 0.4154821 Fold07.Rep5
42 2 12.03759 0.6537381 Fold02.Rep5
43 2 15.47139 0.5597097 Fold02.Rep4
44 2 22.55060 0.3816672 Fold07.Rep3
45 2 14.57875 0.6269560 Fold07.Rep2
46 2 13.02385 0.6395148 Fold02.Rep2
47 2 13.81020 0.6116137 Fold02.Rep1
48 2 13.46100 0.6200828 Fold04.Rep4
49 2 13.95487 0.6709253 Fold10.Rep5
50 2 12.65981 0.6606435 Fold10.Rep4

Best,
Zhenjiang

[[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] acessing symbols dynamically through a gedit box using getsymbol function

2014-02-27 Thread Ashis Deb
I had tried a little weird way of accessing symbols from YAHOO.FINANCE in
my GUI which is made in gwidgets ...Here is an example:--

tbl[5,1]=glabel(ENTER SYMBOL:-,cont=tbl)

tbl[5,2]=gedit(, cont=tbl,coerce.with=as.character)

BSS-function(h,...)

{

options(guiToolkit=RGtk2)

data - new.env()

getSymbols(svalue(tbl[5,2]),env = data, auto.assign = T)

options(getSymbols.warning4.0=FALSE)

ashdata1-data.frame(tbl[5,2])

}

My question is I could not get those symbols from the getSymbol function ,
can any one show me some way how to access this symbols dynamically ,such
that the users can specify any symbols and could access those data in a
click of a button .. Thanks You.


ASHIS  DEB

[[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] ggplot/ barplot

2014-02-27 Thread arun
Hi Farnoosh,

YOu can try:
 DataA$percent - with(DataA,round((Var2/sum(Var2))*100,2))

library(ggplot2)
 
ggplot(DataA,aes(x=Var1,y=percent))+geom_bar(stat=identity,aes(fill=Var1))+geom_text(label=paste0(DataA$percent,%),vjust=-0.2,size=4)


A.K.



On Thursday, February 27, 2014 5:02 PM, farnoosh sheikhi 
farnoosh...@yahoo.com wrote:

Hi Arun,

I hope all is well.
I have a data set like below. I want to get a barplot by ggplot function in R 
that can change the color of the bins and also shows the percentage of each 
category on the bin too.
Var1=Group
Var2=Frequencies 
Percentage can be calculated as follow: (DataA$Var2/sum(DataA$Var2))*100

DataA - read.table(text=ID,Var1,Var2
1,A,100
1,B,58
                    2,C,200
                    2,D,125
                    2,E,250,sep=,,header=TRUE,stringsAsFactors=FALSE)


Thank you so much for your help and time.



Regards, Farnoosh Sheikhi

__
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] ggplot/ barplot

2014-02-27 Thread farnoosh sheikhi
You are the best. Thanks tons:))

 
Regards, Farnoosh Sheikhi



On Thursday, February 27, 2014 10:37 PM, arun smartpink...@yahoo.com wrote:
 
Hi Farnoosh,

YOu can try:
 DataA$percent - with(DataA,round((Var2/sum(Var2))*100,2))

library(ggplot2)
 
ggplot(DataA,aes(x=Var1,y=percent))+geom_bar(stat=identity,aes(fill=Var1))+geom_text(label=paste0(DataA$percent,%),vjust=-0.2,size=4)


A.K.




On Thursday, February 27, 2014 5:02 PM, farnoosh sheikhi 
farnoosh...@yahoo.com wrote:

Hi Arun,

I hope all is well.
I have a data set like below. I want to get a barplot by ggplot function in R 
that can change the color of the bins and also shows the percentage of each 
category on the bin too.
Var1=Group
Var2=Frequencies 
Percentage can be calculated as follow: (DataA$Var2/sum(DataA$Var2))*100

DataA - read.table(text=ID,Var1,Var2
1,A,100
1,B,58
                    2,C,200
                    2,D,125
                    2,E,250,sep=,,header=TRUE,stringsAsFactors=FALSE)


Thank you so much for your help and time.



Regards, Farnoosh Sheikhi
[[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] Data Rearrangement

2014-02-27 Thread PIKAL Petr
Hi

Your data came scrambled as you in contrary to advice post in HTML. So it is 
just a guess but maybe you want

library(reshape)
melt(dat, id=c(Year, Day))

Petr

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of dila radi
 Sent: Friday, February 28, 2014 4:25 AM
 To: r-help@r-project.org
 Subject: [R] Data Rearrangement

 Hi all,

 I know this is easy, but I really do not have any idea to solve it.

 I have this kind of data set:

 dat - read.table(text=Day Year Jan Feb Mar Apr
   1  2012 0 2.5 0.5 2
   2  2012 0 6.5 0 29
   3  2012 0 9.5 0 0
   4  2012 0 0 8 0.5
   5  2012 0 5 0.5 110.5
   6  2012 0 4 3.5 22
   7  2012 11 0 12.5 3.5
   8  2012 0 5 8 36.5
   1  2013 0 2.5 0.5 2
   2  2013 0 6.5 0 29
   3  2013 0 9.5 0 0
   4  2013 0 0 8 0.5
   5  2013 0 5 0.5 110.5
   6  2013 0 4 3.5 22
   7  2013 11 0 12.5 3.5
   8  2013 0 5 8 36.5,sep=,header=TRUE)

 and I want it to be in this form:

 Year   Day Month Amount  2012 1 1 0  2012 2 1 0  2012 3 1 0
 2012 4
 1 0  2012 5 1 0  2012 6 1 0  2012 7 1 11  2012 8 1 0  2012 1 2 2.5
 2012 2 2
 6.5  2012 3 2 9.5  2012 4 2 0  2012 5 2 5  2012 6 2 4  2012 7 2 0  2012
 8 2
 5  2012 1 3 0.5  2012 2 3 0  2012 3 3 0  2012 4 3 8  2012 5 3 0.5  2012
 6 3
 3.5  2012 7 3 12.5  2012 8 3 8  2012 1 4 2  2012 2 4 29  2012 3 4 0
 2012 4
 4 0.5  2012 5 4 110.5  2012 6 4 22  2012 7 4 3.5  2012 8 4 36.5
 2013 1 1
 0  2013 2 1 0  2013 3 1 0  2013 4 1 0  2013 5 1 0  2013 6 1 0  2013 7 1
 11
 2013 8 1 0  2013 1 2 2.5  2013 2 2 6.5  2013 3 2 9.5  2013 4 2 0  2013
 5 2 5
 2013 6 2 4  2013 7 2 0  2013 8 2 5  2013 1 3 0.5  2013 2 3 0  2013 3 3
 0
 2013 4 3 8  2013 5 3 0.5  2013 6 3 3.5  2013 7 3 12.5  2013 8 3 8  2012
 1 4
 2  2012 2 4 29  2012 3 4 0  2012 4 4 0.5  2012 5 4 110.5  2012 6 4 22
 2012
 7 4 3.5  2012 8 4 36.5  2013 1 4 2  2013 2 4 29  2013 3 4 0  2013 4 4
 0.5
 2013 5 4 110.5  2013 6 4 22  2013 7 4 3.5  2013 8 4 36.5
 I want to rearrange the data according to the YEAR (year by year)

 Thank you.

 Regards,
 Dila

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