Re: [R] Sweave - print \n ?

2008-03-29 Thread Werner Wernersen
Thanks for your comments!
I think using just one backslash for \n is correct
because otherwise I get a \n literally printed out
in the generated .tex code. But what I'm trying to get
is just a line break, thus that the .tex code
continues on a new line from the point where I put the
\n.

All the best,
  Werner



--- Abhijit Dasgupta [EMAIL PROTECTED]
schrieb:

 you haven't escaped the \ for the \n, I think. Your
 line should be
 cat(\\hline \\n). You did escape the \ for hline,
 though.
 
 Abhijit Dasgupta, Ph.D
 Assistant Professor | Division of Biostatistics
 Dept of Pharmacology and Experimental Therapeutics |
 Thomas Jefferson 
 University
 1015 Chestnut St | Suite M100 | Philadelphia PA
 19107
 Ph: (215) 503-9201 | Fax: (215) 503-3804
 adasgupt (at) mail (dot) jci (dot) tju (dot) edu


 The documents accompanying this transmission may
 contain confidential 
 health or business information. This information is
 intended for the use 
 of the individual or entity named above. If you have
 received this 
 information in error, please notify the sender
 immediately and arrange 
 for the return or destruction of these documents.


 
 
 Werner Wernersen wrote:
  Hi,
 
  this is probably quite stupid but I have no clue
  what's wrong. Let's say I write the function
  hline - function() {
cat(\\hline \n) 
  }
  and call hline() from within a Sweave chunk. Why
 is
  there no carriage return after the \hline in the
  resulting tex file? 
 
  if I call hline() hline() in the chunk, then I get
  \hline \hline 
  in the tex code without a linebreak in between.
 
  Thanks for any hints,
Werner
 
 
E-Mails jetzt auf Ihrem Handy.
 
  __
  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.

 



  Lesen Sie Ihre E-Mails jetzt einfach von unterwegs.

__
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 a new package

2008-03-29 Thread Uwe Ligges


Don MacQueen wrote:
 At the risk of oversimplifying, there are three steps to developing 
 and using a package:
 
 1) build
 2) install
 3) load
 
 Evidently your package does steps 1 and 2 but not 3.
 
 Furthermore, it tells you, not a valid package, and says something 
 that is suggestive of a version problem:
installed  2.0.0
 
 I think you have to look very carefully at your package and look for 
 what is invalid about it. There must be some requirement of package 
 structure, or contents, or version of something, that your package 
 doesn't meet or violates.
 
 Since your package can be installed, go into R, and try
require(HighProbability)
 but set the verbose argument to something that gives more information 
 than the default. Maybe that will give some helpful information, more 
 than the check provides.
 
 Either that, or delve deeply into the CMD check script(s) and find 
 out exactly what can trigger the error message.
 
 Anyway, that's the best I can come up with, without actually having 
 the package files.

And the having the latter, it would be much easier to help for all of us.

Uwe Ligges

 
 -Don
 
 At 2:52 PM -0400 3/28/08, [EMAIL PROTECTED] wrote:
 Dear all,
 I have prepared a new package to install in R, I tried to check my package
 and I got the following message
 
 232sub141:~ zahra$ R CMD check /Users/zahra/Desktop/HighProbability
 * checking for working latex ... OK
 * using log directory '/Users/zahra/HighProbability.Rcheck'
 * using R version 2.6.2 (2008-02-08)
 * checking for file 'HighProbability/DESCRIPTION' ... OK
 * this is package 'HighProbability' version '1.0-3'
 * checking package dependencies ... OK
 * checking if this is a source package ... OK
 * checking whether package 'HighProbability' can be installed ... OK
 * checking package directory ... OK
 * checking for portable file names ... OK
 * checking for sufficient/correct file permissions ... OK
 * checking DESCRIPTION meta-information ... OK
 * checking top-level files ... OK
 * checking index information ... OK
 * checking package subdirectories ... OK
 * checking R files for non-ASCII characters ... OK
 * checking R files for syntax errors ... OK
 * checking whether the package can be loaded ... ERROR
 Error in library(HighProbability) :
   'HighProbability' is not a valid package -- installed  2.0.0?
 Execution halted

 It looks like this package has a loading problem: see the messages for
 details.
 

 I don't know what the Error in library(package name) means and how can I
 solve it. I work with Mac.
 I'll appreciate it if you could help me.
 All the best,
 Zahra

 __
 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] Error: cannot allocate vector of size 3.0 Gb

2008-03-29 Thread Uwe Ligges
Can you make the data.frame available somewhere. Actually, I am 
surprised it need that huge amount of memory to do the plot.

Best,
Uwe Ligges

John wrote:
 Hello,
 
 I have read recent posts on this topic (Dr. Ronnen Levinson's Monday 02:39:55 
 pm), but before I install a 64 bit system, and purchase more RAM, I want to 
 make sure I understand this interesting issue.
 
 I was attempting to plot a data frame containing Dow Jones stock information:
 
 length(Date)
 [1] 19957
 length(Close)
 [1] 19957
 head(DowJones)
   Date Open High  LowClose Volume Adj.Close
 1 03/26/08 12531.79 12531.79 12309.62 12422.86 405567  12422.86
 2 03/25/08 12547.34 12639.82 12397.62 12532.60 414512  12532.60
 3 03/24/08 12361.97 12687.61 12346.17 12548.64 449900  12548.64
 4 03/20/08 12102.43 12434.34 12024.68 12361.32 207845  12361.32
 5 03/19/08 12391.52 12525.19 12077.27 12099.66 120383  12099.66
 6 03/18/08 11975.92 12411.63 11975.92 12392.66 126339  12392.66
 tail(DowJones)
   Date   Open   HighLow  Close  Volume Adj.Close
 19952 10/08/28 240.17 243.33 237.72 239.55 394239.55
 19953 10/05/28 240.00 243.08 238.22 240.44 436240.44
 19954 10/04/28 237.75 242.53 237.72 240.00 433240.00
 19955 10/03/28 238.14 239.14 233.60 237.75 406237.75
 19956 10/02/28 240.01 241.54 235.42 238.14 385238.14
 19957 10/01/28 239.43 242.46 238.24 240.01 350240.01
 plot(Date, Close)
 Error: cannot allocate vector of size 3.0 Gb
  
 
 
 I currently have installed R 2.60, from source, onto Linux SuSE 10.2. I 
 believe it is a 32 bit install:
 
 dmesg | grep bit 
 ...
 hpet0: 3 32-bit timers, 2500 Hz
 
 I have 1GB of RAM, with circa 883.61 not allocated to hardware after boot. 
 I naively thought 19957 rows of data would be easily handled by a fairly new 
 computer. R was able to cease execution, and place control back onto its 
 interpreter, while a Chart attempt in OpenOffice locks up OpenOffice.
 
 So,  will installation of a 64 bit Operating System, and at least an 
 additional 1GB of RAM  suffice to generate memory space for a 3.0 Gb vector, 
 in R?
 
 Much appreciated, time to buy a new computer?
 
 John
 
 __
 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] Error: cannot allocate vector of size 3.0 Gb

2008-03-29 Thread John
On Friday 28 March 2008 14:28, Daniel Nordlund wrote:
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  On Behalf Of John
  Sent: Friday, March 28, 2008 12:04 PM
  To: r-help@r-project.org
  Subject: [R] Error: cannot allocate vector of size 3.0 Gb
 
  Hello,
 
  I have read recent posts on this topic (Dr. Ronnen Levinson's Monday
  02:39:55 pm), but before I install a 64 bit system, and purchase more
  RAM, I want to make sure I understand this interesting issue.
 
  I was attempting to plot a data frame containing Dow Jones stock 
information:
   length(Date)
 
  [1] 19957
 
   length(Close)
 
  [1] 19957
 
   head(DowJones)
 
Date Open High  LowClose Volume Adj.Close
  1 03/26/08 12531.79 12531.79 12309.62 12422.86 405567  12422.86
  2 03/25/08 12547.34 12639.82 12397.62 12532.60 414512  12532.60
  3 03/24/08 12361.97 12687.61 12346.17 12548.64 449900  12548.64
  4 03/20/08 12102.43 12434.34 12024.68 12361.32 207845  12361.32
  5 03/19/08 12391.52 12525.19 12077.27 12099.66 120383  12099.66
  6 03/18/08 11975.92 12411.63 11975.92 12392.66 126339  12392.66
 
   tail(DowJones)
 
Date   Open   HighLow  Close  Volume Adj.Close
  19952 10/08/28 240.17 243.33 237.72 239.55 394239.55
  19953 10/05/28 240.00 243.08 238.22 240.44 436240.44
  19954 10/04/28 237.75 242.53 237.72 240.00 433240.00
  19955 10/03/28 238.14 239.14 233.60 237.75 406237.75
  19956 10/02/28 240.01 241.54 235.42 238.14 385238.14
  19957 10/01/28 239.43 242.46 238.24 240.01 350240.01
 
   plot(Date, Close)
 
  Error: cannot allocate vector of size 3.0 Gb
 
 
 
  I currently have installed R 2.60, from source, onto Linux SuSE 10.2. I
 
  believe it is a 32 bit install:
   dmesg | grep bit
   ...
   hpet0: 3 32-bit timers, 2500 Hz
 
  I have 1GB of RAM, with circa 883.61 not allocated to hardware after
  boot. I naively thought 19957 rows of data would be easily handled by a
  fairly new computer. R was able to cease execution, and place control
  back onto its interpreter, while a Chart attempt in OpenOffice locks up
  OpenOffice.
 
  So,  will installation of a 64 bit Operating System, and at least an
  additional 1GB of RAM  suffice to generate memory space for a 3.0 Gb
  vector, in R?

 John,

 Am I missing something here?  You have one 1 GB of RAM, you want to get a
 second 1 GB of RAM, and you want to know if you will be able to create a 3
 GB vector?  With or without a 64bit OS, I don't think you will be
 successful.  In addition to total memory available, I believe you need to
 have sufficient contiguous memory to allocate an object.  If memory is
 fragmented, you won't be able to create the vector, even if the total free
 space is sufficient.  If I am incorrect, I'm sure someone will be along to
 correct me shortly.

 Hope this is helpful,

 Dan

 Daniel Nordlund
 Bothell, WA

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


Hi Daniel,

Thank you for the information. It has saved me from needlessly installing a 
64-bit linux instance. In the short term, I'll try and generate multiple 
graphs, side by side. And purchase more RAM. A lot more.

Enjoying the notion of multiple plots in R,

John

__
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] AD-model builder under R for mix logistics model, a problem.

2008-03-29 Thread coldeyes.Rhelp
the code is list below , i can run this code for laplace approximation 
but not importance sampling.  the code work properly if use impSamp=0 , 
but error for any other number 0 .
could you guys help me out.

thanks so much !

source(http://www.mi.uib.no/~skaug/cash/lesaffre_dat.s;)
 library(glmmADMB)

 fit_glmmADMB_ip - glmm.admb(y~treat,random=~1,group=subject,impSamp 
=100,data=lesaffre,family=binomial,link=logit,save.dir= NULL)

Initial statistics: 2 variables; iteration 0; function evaluation 0
Function value  1.5926934e+003; maximum gradient component mag  1.2500e+001
Var   ValueGradient   |Var   ValueGradient   |Var   Value
Gradient   
  1  0.  1.2500e+001 |  2  0.  6.2441e-001 |

 - final statistics:
2 variables; iteration 9; function evaluation 13
Function value  1.2593e+003; maximum gradient component mag -5.7984e-005
Exit code = 1;  converg criter  1.e-004
Var   ValueGradient   |Var   ValueGradient   |Var   Value
Gradient   
  1-56.9607 -1.2327e-005 |  2 -3.7159 -5.7984e-005 |
 inner maxg = 9.681e-005
max separable g 9.681e-005
Newton raphson 1
 f = 971.7651636 max g = 9.245773036e-010
max separable g 9.245775812e-010
Newton raphson 2
 f = 971.7651636 max g = 2.220446049e-015
971.7651636
Error in glmm.admb(y ~ treat, random = ~1, group = subject, impSamp = 
100,  :
  The function maximizer failed
In addition: Warning message:
In shell(paste(.path.package(glmmADMB), /admb/, file_name, .exe,  :
  'cmd' execution failed with error code 1
 

__
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] Sweave - print \n ?

2008-03-29 Thread Charilaos Skiadas
Try adding strip.white=false on the code chunks:

echo=false,results=tex, strip.white=false=
hline()
hline()
@

Read ?RweaveLatex for more settings.

or if you want this to happen in all code chunks add this early on in  
the rnw file:

\SweaveOpts{strip.white=false}

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College

On Mar 29, 2008, at 4:54 AM, Werner Wernersen wrote:

 Thanks for your comments!
 I think using just one backslash for \n is correct
 because otherwise I get a \n literally printed out
 in the generated .tex code. But what I'm trying to get
 is just a line break, thus that the .tex code
 continues on a new line from the point where I put the
 \n.

 All the best,
   Werner



 --- Abhijit Dasgupta [EMAIL PROTECTED]
 schrieb:

 you haven't escaped the \ for the \n, I think. Your
 line should be
 cat(\\hline \\n). You did escape the \ for hline,
 though.

 Abhijit Dasgupta, Ph.D
 Assistant Professor | Division of Biostatistics
 Dept of Pharmacology and Experimental Therapeutics |
 Thomas Jefferson
 University
 1015 Chestnut St | Suite M100 | Philadelphia PA
 19107
 Ph: (215) 503-9201 | Fax: (215) 503-3804
 adasgupt (at) mail (dot) jci (dot) tju (dot) edu

 -- 
 --
 The documents accompanying this transmission may
 contain confidential
 health or business information. This information is
 intended for the use
 of the individual or entity named above. If you have
 received this
 information in error, please notify the sender
 immediately and arrange
 for the return or destruction of these documents.

 -- 
 --


 Werner Wernersen wrote:
 Hi,

 this is probably quite stupid but I have no clue
 what's wrong. Let's say I write the function
 hline - function() {
   cat(\\hline \n)
 }
 and call hline() from within a Sweave chunk. Why
 is
 there no carriage return after the \hline in the
 resulting tex file?

 if I call hline() hline() in the chunk, then I get
 \hline \hline
 in the tex code without a linebreak in between.

 Thanks for any hints,
   Werner


__
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] Defining reference category for a cph model summary inside of a for loop

2008-03-29 Thread Wells, Brian
Dr. Harrell, 
Thanks for you help. 

I tried:

print(summary(f,parse(text=paste(i,'=1st Quartile', sep=''

Same result. No error, the reference category simply doesn't change. 

Brian 

-Original Message-
From: Frank E Harrell Jr [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 28, 2008 8:34 PM
To: Wells, Brian
Cc: r-help@r-project.org
Subject: Re: [R] Defining reference category for a cph model summary
inside of a for loop

Wells, Brian wrote:
 I have the following code. 
 
  
 
  
 
 f - cph(formula = Surv(TimeToDeath, Dead == Yes)
 ~1,data=single.dat, x=T, y=T, surv=T)
 
 for(i in c('A', 'B', 'C', 'D', 'E', 'F')){
 
 f -update(f,as.formula(paste('Surv(TimeToDeath, Dead ==
 Yes)~',i,sep='')))
 
 print(summary(f, paste(i,=1st Quartile, sep='')))
 
  
 
  
 
 There is no error message generated in R, but R ignores the reference
 category defined with paste in the summary function for the cph model.

 
  
 
 The output uses the 1st Quartile as the reference category to
 calculate hazards for some of the variables defined by i, but not all
of
 them. 


Your code is confusing.  What is to the right of ~ in a formula is a 
predictor variable name, not a value.  If your variables are named A, B,

C, ... you are OK.

'1st Quartile' has no special meaning to R or Design, and you can't pass

a character string as a second argument to summary and expect it to
work.

You will need parse(text=paste(...)) to create an appropriate
expression.

But Design gives you inter-quartile range hazard ratios by default
anyway.

Beware of getting hazard ratios that are not adjusted for other 
variables needed in the model.

Frank Harrell

 
  
 
  
 
 Any help would be greatly appreciated. 
 
  
 
 thanks
 
  
 
 Brian J. Wells, MD, MS
 
 Research Associate
 
 Quantitative Health Sciences
 
 Cleveland Clinic
 

-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt
University


===

P Please consider the environment before printing this e-mail

Cleveland Clinic is ranked one of the top hospitals
in America by U.S. News  World Report (2007).  
Visit us online at http://www.clevelandclinic.org for
a complete listing of our services, staff and
locations.


Confidentiality Note:  This message is intended for use\...{{dropped:13}}

__
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] AD-MB problem in package:glmmADMB

2008-03-29 Thread coldeyes.Rhelp
Hi here,
i recently notice the software built by otter company  know as AD-MB 
tools . i explore a little bit this tools under  the R Package for mixed 
logistics model. it is a very interesting tool. but i get several questions.

first question: i tried the R code below, and have the error , i can run 
the code for switching the setting to impSamp=0 , it means i can only 
run the code under Laplace approximation but importance sampling.  does  
anyone  have same problem here ?

second question: although i used save.dir=NULL option , but i can not 
see the folder which saves the intermedia output, i didn't find the 
nbmm.std file which save the BLUP. the strangest thing is i can see a 
temporary folder name as _glmm_ADMB_temp_dir_ when programing is running 
, but this fold mysteriously disappeared after the programing done . 
searched the whole computer desn't find any clue.

I posted my output below.

I really appreciate if you can help me with the questions.

source(http://www.mi.uib.no/~skaug/cash/lesaffre_dat.s 
http://www.mi.uib.no/%7Eskaug/cash/lesaffre_dat.s)
fit_glmmADMB_ip - glmm.admb(y~treat,random=~1,group=subject,impSamp 
=100,data=lesaffre,family=binomial,link=logit,save.dir= NULL)

Initial statistics: 2 variables; iteration 0; function evaluation 0
Function value 1.5926934e+003; maximum gradient component mag 1.2500e+001
Var Value Gradient |Var Value Gradient |Var Value Gradient
1 0. 1.2500e+001 | 2 0. 6.2441e-001 |

- final statistics:
2 variables; iteration 9; function evaluation 13
Function value 1.2593e+003; maximum gradient component mag -5.7984e-005
Exit code = 1; converg criter 1.e-004
Var Value Gradient |Var Value Gradient |Var Value Gradient
1-56.9607 -1.2327e-005 | 2 -3.7159 -5.7984e-005 |
inner maxg = 9.681e-005
max separable g 9.681e-005
Newton raphson 1
f = 971.7651636 max g = 9.245773036e-010
max separable g 9.245775812e-010
Newton raphson 2
f = 971.7651636 max g = 2.220446049e-015
971.7651636
Error in glmm.admb(y ~ treat, random = ~1, group = subject, impSamp = 
100, :
The function maximizer failed
In addition: Warning message:
In shell(paste(.path.package(glmmADMB), /admb/, file_name, .exe, :
'cmd' execution failed with error code 1

__
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] S4 : the list of all the object

2008-03-29 Thread Christophe Genolini
Hi the list,

Is it possible to get the list of all the S4 user define classes? I 
would like to set up a package.skeleton.S4 but for that, I need the 
list of the classes...

Thanks

Christophe

__
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] Singular Gradient in nls

2008-03-29 Thread Katharine Mullen

sorry, the below should read:

 A QR decomposition is done on the weighted gradient matrix; if the
 estimate of the rank that results is less than min( the number of
columns in
 the gradient (the number of nonlinear parameters), the
number
 of rows (the number of observations) ) , nls stops.

so you look at the number of observations, and the number of parameters,
and take the smaller of the two.  if the estimated rank of the weighted
gradient is small than this number, you stop.

On Fri, 28 Mar 2008, Katharine Mullen wrote:

 A QR decomposition is done on the weighted gradient matrix; if the
 estimate of the rank that results is less than the number of columns in
 the gradient (the number of nonlinear parameters), or less than the number
 of rows (the number of observations), nls stops.

 You can see the calls in the source code of nlsModel
 (https://svn.r-project.org/R/trunk/src/library/stats/R/nls.R).

 On Fri, 28 Mar 2008, glenn andrews wrote:

  //Referring to the response  posted many years ago, copied below, what
  is the specific criterium used for singularity of the gradient matrix?
  Is a Singular Value Decomposition used to determine the singular
  values?  Is it the gradient matrix condition number  or some other
  criterion for determining singularity?
  //
 
  //Glenn
  //
 
  /
  /
 
  / What does the error 'singular gradient' mean during a nonlinear
  regression? /
 
  The gradient matrix to which the message refers is the derivative of
  the vector of predicted values with respect to the vector of
  parameters at the current parameter estimates. If you have 20
  observations and three parameters, this will be a matrix with 20 rows
  and three columns.
 
  For the model to be estimable in a region of the current estimates,
  this matrix must have full column rank. When it fails to have full
  column rank the singular gradient message is given and the
  iterations stop.
 
  Generally this indicates that the model is overparameterized or that
  the starting estimates were poorly chosen. Try using trace = TRUE in
  the call to nls and watching the progress of the iterations. This
  will often show that the estimates are wandering into unreasonable
  regions of the parameter space.
 
  --
  Douglas Bates[EMAIL PROTECTED]
  Statistics Department608/262-2598
  University of Wisconsin - Madisonhttp://www.stat.wisc.edu/~bates/ 
  http://www.stat.wisc.edu/%7Ebates/
  -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
  r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html 
  http://www.ci.tuwien.ac.at/%7Ehornik/R/R-FAQ.html
  Send info, help, or [un]subscribe
  (in the body, not the subject !)  To: [EMAIL PROTECTED]
  _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
 
 
  [[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] Error: cannot allocate vector of size 3.0 Gb

2008-03-29 Thread Uwe Ligges
Dear John,

note that you Date is a factor rather than some date object.
If you convert it to some date object, just a few megabytes will suffice!

Best wishes,
Uwe




John wrote:
 On Friday 28 March 2008 14:28, Daniel Nordlund wrote:
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 On Behalf Of John
 Sent: Friday, March 28, 2008 12:04 PM
 To: r-help@r-project.org
 Subject: [R] Error: cannot allocate vector of size 3.0 Gb

 Hello,

 I have read recent posts on this topic (Dr. Ronnen Levinson's Monday
 02:39:55 pm), but before I install a 64 bit system, and purchase more
 RAM, I want to make sure I understand this interesting issue.

 I was attempting to plot a data frame containing Dow Jones stock 
 information:
 length(Date)
 [1] 19957

 length(Close)
 [1] 19957

 head(DowJones)
   Date Open High  LowClose Volume Adj.Close
 1 03/26/08 12531.79 12531.79 12309.62 12422.86 405567  12422.86
 2 03/25/08 12547.34 12639.82 12397.62 12532.60 414512  12532.60
 3 03/24/08 12361.97 12687.61 12346.17 12548.64 449900  12548.64
 4 03/20/08 12102.43 12434.34 12024.68 12361.32 207845  12361.32
 5 03/19/08 12391.52 12525.19 12077.27 12099.66 120383  12099.66
 6 03/18/08 11975.92 12411.63 11975.92 12392.66 126339  12392.66

 tail(DowJones)
   Date   Open   HighLow  Close  Volume Adj.Close
 19952 10/08/28 240.17 243.33 237.72 239.55 394239.55
 19953 10/05/28 240.00 243.08 238.22 240.44 436240.44
 19954 10/04/28 237.75 242.53 237.72 240.00 433240.00
 19955 10/03/28 238.14 239.14 233.60 237.75 406237.75
 19956 10/02/28 240.01 241.54 235.42 238.14 385238.14
 19957 10/01/28 239.43 242.46 238.24 240.01 350240.01

 plot(Date, Close)
 Error: cannot allocate vector of size 3.0 Gb



 I currently have installed R 2.60, from source, onto Linux SuSE 10.2. I

 believe it is a 32 bit install:
 dmesg | grep bit
 ...
 hpet0: 3 32-bit timers, 2500 Hz
 I have 1GB of RAM, with circa 883.61 not allocated to hardware after
 boot. I naively thought 19957 rows of data would be easily handled by a
 fairly new computer. R was able to cease execution, and place control
 back onto its interpreter, while a Chart attempt in OpenOffice locks up
 OpenOffice.

 So,  will installation of a 64 bit Operating System, and at least an
 additional 1GB of RAM  suffice to generate memory space for a 3.0 Gb
 vector, in R?
 John,

 Am I missing something here?  You have one 1 GB of RAM, you want to get a
 second 1 GB of RAM, and you want to know if you will be able to create a 3
 GB vector?  With or without a 64bit OS, I don't think you will be
 successful.  In addition to total memory available, I believe you need to
 have sufficient contiguous memory to allocate an object.  If memory is
 fragmented, you won't be able to create the vector, even if the total free
 space is sufficient.  If I am incorrect, I'm sure someone will be along to
 correct me shortly.

 Hope this is helpful,

 Dan

 Daniel Nordlund
 Bothell, WA

 __
 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.
 
 
 Hi Daniel,
 
 Thank you for the information. It has saved me from needlessly installing a 
 64-bit linux instance. In the short term, I'll try and generate multiple 
 graphs, side by side. And purchase more RAM. A lot more.
 
 Enjoying the notion of multiple plots in R,
 
 John
 
 __
 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] Problem installing aroma.affymetrix on Solaris 9 with R-2.6.2

2008-03-29 Thread Jun Zhang
Hi List,
I'm trying to install aroma.affymetrix, which depend on many packages, affyio 
is one of them. The task is done on 32-bit Linux without problem. The same task 
was done on Solaris 9 with R-2.5.1 without problem. Following is the error 
message when installation affyio. I did try to put a file stdint.h I got from 
the web in the path, but got more error messages.

Jun

  [EMAIL PROTECTED] R# R CMD INSTALL affyio_1.6.1.tar.gz 
* Installing to library '/apps/R-2.6.2/lib/R/library'
* Installing *source* package 'affyio' ...
creating cache ./config.cache
checking how to run the C preprocessor... grep: can't open conftest.out
cc -E
checking for main in -lz... no
updating cache ./config.cache
creating ./config.status
creating src/Makevars
** libs
gcc -std=gnu99 -I/apps/R-2.6.2/lib/R/include -I/apps/R-2.6.2/lib/R/include  
-I/apps/mpich-1.2.7p1/include-fPIC  -g -O2 -c fread_functions.c -o 
fread_functions.o
gcc -std=gnu99 -I/apps/R-2.6.2/lib/R/include -I/apps/R-2.6.2/lib/R/include  
-I/apps/mpich-1.2.7p1/include-fPIC  -g -O2 -c read_abatch.c -o read_abatch.o
gcc -std=gnu99 -I/apps/R-2.6.2/lib/R/include -I/apps/R-2.6.2/lib/R/include  
-I/apps/mpich-1.2.7p1/include-fPIC  -g -O2 -c read_bpmap.c -o read_bpmap.o
gcc -std=gnu99 -I/apps/R-2.6.2/lib/R/include -I/apps/R-2.6.2/lib/R/include  
-I/apps/mpich-1.2.7p1/include-fPIC  -g -O2 -c read_cdf_xda.c -o 
read_cdf_xda.o
read_cdf_xda.c: In function `isPM':
read_cdf_xda.c:614: warning: implicit declaration of function `toupper'
gcc -std=gnu99 -I/apps/R-2.6.2/lib/R/include -I/apps/R-2.6.2/lib/R/include  
-I/apps/mpich-1.2.7p1/include-fPIC  -g -O2 -c read_cdffile2.c -o 
read_cdffile2.o
gcc -std=gnu99 -I/apps/R-2.6.2/lib/R/include -I/apps/R-2.6.2/lib/R/include  
-I/apps/mpich-1.2.7p1/include-fPIC  -g -O2 -c read_celfile_generic.c -o 
read_celfile_generic.o
read_celfile_generic.c:31:20: stdint.h: No such file or directory
*** Error code 1
make: Fatal error: Command failed for target `read_celfile_generic.o'
chmod: WARNING: can't access /apps/R-2.6.2/lib/R/library/affyio/libs/*
ERROR: compilation failed for package 'affyio'
** Removing '/apps/R-2.6.2/lib/R/library/affyio' 


   
-

[[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] Generating maps in R

2008-03-29 Thread Aleksandr Andreev
Greetings!

I am trying plot some data on a map in R. Here's the scenario.

I have a variable called probworkinghealthy which contains a predicted
probability of employment for every individual in my sample (about
100,000 observations).
I have another variable, called a001ter, which contains the subject of
residency in the Russian Federation (akin to a US state) for every
individual in the sample.
I have a shape file with the boundaries of all the subjects, called russia.shp.

I can plot boxplots of the probability by Federal Subject using
plot(probworkinghealthy ~ a001ter). I can also plot the map using
plot(russia.shp)

Now, I would like to plot the mean probability of employment (i.e.
mean(probworkinghealthy)) on a map of Russia using color coding all
the Federal Subjects. Does anyone know how to do something like that?

Much appreciated,

Aleks Andreev
Duke University

__
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] directory of R consultants for hire

2008-03-29 Thread Thomas Pujol
Does anyone know of a directory that lists consultants with expertise in R, as 
well as other statistical and computing skills, ideally with geographic 
location and other pertinent information?

If one does not exist, might this be a good resource to create?


   
-
You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.
[[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] Problem installing aroma.affymetrix on Solaris 9 with R-2.6.2

2008-03-29 Thread Prof Brian Ripley
This is the wrong list for questions about Bioconductor packages: please 
do study the posting guide (and no HTML mail, please).

stdint.h is part of C99.  My guess is that your unspecified compiler + 
obsolete OS is not C99 compliant.

Since Solaris 8 has inttypes.h (which is supposed by POSIX to include 
stdint.h), it is a reasonable guess that you could might be able to 
replace stdint.h by inttypes.h (especially as R has been compiled on your 
OS and R uses inttypes.h as a fallback).

When you find a solution, you should report it to the maintainer of the 
affyio package (see the posting guide).

On Sat, 29 Mar 2008, Jun Zhang wrote:

 Hi List,
 I'm trying to install aroma.affymetrix, which depend on many packages, affyio 
 is one of them. The task is done on 32-bit Linux without problem. The same 
 task was done on Solaris 9 with R-2.5.1 without problem. Following is the 
 error message when installation affyio. I did try to put a file stdint.h I 
 got from the web in the path, but got more error messages.

 Jun

  [EMAIL PROTECTED] R# R CMD INSTALL affyio_1.6.1.tar.gz
 * Installing to library '/apps/R-2.6.2/lib/R/library'
 * Installing *source* package 'affyio' ...
 creating cache ./config.cache
 checking how to run the C preprocessor... grep: can't open conftest.out
 cc -E
 checking for main in -lz... no
 updating cache ./config.cache
 creating ./config.status
 creating src/Makevars
 ** libs
 gcc -std=gnu99 -I/apps/R-2.6.2/lib/R/include -I/apps/R-2.6.2/lib/R/include  
 -I/apps/mpich-1.2.7p1/include-fPIC  -g -O2 -c fread_functions.c -o 
 fread_functions.o
 gcc -std=gnu99 -I/apps/R-2.6.2/lib/R/include -I/apps/R-2.6.2/lib/R/include  
 -I/apps/mpich-1.2.7p1/include-fPIC  -g -O2 -c read_abatch.c -o 
 read_abatch.o
 gcc -std=gnu99 -I/apps/R-2.6.2/lib/R/include -I/apps/R-2.6.2/lib/R/include  
 -I/apps/mpich-1.2.7p1/include-fPIC  -g -O2 -c read_bpmap.c -o read_bpmap.o
 gcc -std=gnu99 -I/apps/R-2.6.2/lib/R/include -I/apps/R-2.6.2/lib/R/include  
 -I/apps/mpich-1.2.7p1/include-fPIC  -g -O2 -c read_cdf_xda.c -o 
 read_cdf_xda.o
 read_cdf_xda.c: In function `isPM':
 read_cdf_xda.c:614: warning: implicit declaration of function `toupper'
 gcc -std=gnu99 -I/apps/R-2.6.2/lib/R/include -I/apps/R-2.6.2/lib/R/include  
 -I/apps/mpich-1.2.7p1/include-fPIC  -g -O2 -c read_cdffile2.c -o 
 read_cdffile2.o
 gcc -std=gnu99 -I/apps/R-2.6.2/lib/R/include -I/apps/R-2.6.2/lib/R/include  
 -I/apps/mpich-1.2.7p1/include-fPIC  -g -O2 -c read_celfile_generic.c -o 
 read_celfile_generic.o
 read_celfile_generic.c:31:20: stdint.h: No such file or directory
 *** Error code 1
 make: Fatal error: Command failed for target `read_celfile_generic.o'
 chmod: WARNING: can't access /apps/R-2.6.2/lib/R/library/affyio/libs/*
 ERROR: compilation failed for package 'affyio'
 ** Removing '/apps/R-2.6.2/lib/R/library/affyio'



 -

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


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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] DE optimization with equality constraint

2008-03-29 Thread Paul Smith
On Sat, Mar 29, 2008 at 9:33 PM, Hans W. Borchers [EMAIL PROTECTED] wrote:
  Reply to Optimization with constraint on March 14, 2008

  One can get an accurate solutons applying the Differential Evolution 
 algorithm
  as implemented in the DEoptim package:

 f2 - function(x){
 if (x[1] + x[2]  1 || x[1] + x[2]  1) {
 r - Inf
 } else {
 r - x[1]^2 + x[2]^2
 }
 return(r)
 }

 lower - c(0, 0)
 upper - c(1, 1)

 DEoptim(f2, lower, upper, control=list(refresh=200))$bestmem

 iteration:  200 best member:  0.5 0.5 best value:  0.5

  This approach assumes nothing about the gradient, hessian or whatever. And 
 the
  equality is split into two inequalities assuming no relaxation or penalty.

The problem with DEoptim approach is that is not guaranteed that it
converges to the solution. Moreover, from my experience, it seems to
be quite slow when the optimization problem is high-dimensional (i.e.,
with many variables).

Paul



  Andreas Klein klein82517 at yahoo.de wrote:
  
   Hello.
  
   I have some problems, when I try to model an
   optimization problem with some constraints.
  
   The original problem cannot be solved analytically, so
   I have to use routines like Simulated Annealing or
   Sequential Quadric Programming.
  
   But to see how all this works in R, I would like to
   start with some simple problem to get to know the
   basics:
  
   The Problem:
   min f(x1,x2)= (x1)^2 + (x2)^2
   s.t. x1 + x2 = 1
  
   The analytical solution:
   x1 = 0.5
   x2 = 0.5
  
   Does someone have some suggestions how to model it in
   R with the given functions optim or constrOptim with
   respect to the routines SANN or SQP to obtain the
   analytical solutions numerically?
  
   Again, the simple example should only show me the
   basic working of the complex functions in R.
  
   Hope you can help me.
  
   With regards
   Andreas.

  __
  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] Alignment and Reshaping of the matrix

2008-03-29 Thread dinesh kumar
Dear R users,

I have a matrix like

85 .90 86 .89 87 .98 86 .87
88 .98 90 .78 88 .76 89 .56
90 .67 95 .67 89 .89 90 .87
91 .56 96 .87 90 .76 92.98

each pair of columns present a variable name and next  the value. I have
matrix with more than 500 rows and column.

Now I want to convert this matrix in to.

85  .90   00   .00   00
86  .00  .89   .00  .87
87  .00   00   .98   00
88  .98   00   .76   00
89  .00   00   .89  .56
90  .67  .78   .76  .87
91  .56   00   .00   00
92  .00  .00   .00  .98
93  .00  .0000   00
94  .00  .0000   00
95  .00  .6700   00
96  .00  .8700   00

Where first column represent the Variable name.

And if the first matrix is transposed, then how to get the output in which
First raw present the variable name.

It will be great help for my research.

Dinesh

-- 
Dinesh Kumar Barupal
Research Associate
Metabolomics Fiehn Lab
UCD Genome Center
451 East Health Science Drive
GBSF Builidng
University of California
DAVIS
95616
http://fiehnlab.ucdavis.edu/staff/kumar

[[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] Alignment and Reshaping of the matrix

2008-03-29 Thread jim holtman
Is this what you are after:

 x - read.table(textConnection(85 .90 86 .89 87 .98 86 .87
+ 88 .98 90 .78 88 .76 89 .56
+ 90 .67 95 .67 89 .89 90 .87
+ 91 .56 96 .87 90 .76 92 .98))
 closeAllConnections()
 odd - seq(1, ncol(x), by=2)
 x.r - range(x[,odd])
 # create large array starting from 1
 x.m - matrix(0, ncol=length(odd), nrow=max(x.r))
 for (i in odd){
+ x.m[x[, i], (i + 1) / 2] -x[, i + 1]  # save values
+ }
 # add first column with index
 x.m - cbind(seq(nrow(x.m)), x.m)
 # only print out the rows of interest
 x.m[x.r[1]:x.r[2],]
  [,1] [,2] [,3] [,4] [,5]
 [1,]   85 0.90 0.00 0.00 0.00
 [2,]   86 0.00 0.89 0.00 0.87
 [3,]   87 0.00 0.00 0.98 0.00
 [4,]   88 0.98 0.00 0.76 0.00
 [5,]   89 0.00 0.00 0.89 0.56
 [6,]   90 0.67 0.78 0.76 0.87
 [7,]   91 0.56 0.00 0.00 0.00
 [8,]   92 0.00 0.00 0.00 0.98
 [9,]   93 0.00 0.00 0.00 0.00
[10,]   94 0.00 0.00 0.00 0.00
[11,]   95 0.00 0.67 0.00 0.00
[12,]   96 0.00 0.87 0.00 0.00


On Sat, Mar 29, 2008 at 7:21 PM, dinesh kumar [EMAIL PROTECTED] wrote:
 Dear R users,

 I have a matrix like

 85 .90 86 .89 87 .98 86 .87
 88 .98 90 .78 88 .76 89 .56
 90 .67 95 .67 89 .89 90 .87
 91 .56 96 .87 90 .76 92.98

 each pair of columns present a variable name and next  the value. I have
 matrix with more than 500 rows and column.

 Now I want to convert this matrix in to.

 85  .90   00   .00   00
 86  .00  .89   .00  .87
 87  .00   00   .98   00
 88  .98   00   .76   00
 89  .00   00   .89  .56
 90  .67  .78   .76  .87
 91  .56   00   .00   00
 92  .00  .00   .00  .98
 93  .00  .0000   00
 94  .00  .0000   00
 95  .00  .6700   00
 96  .00  .8700   00

 Where first column represent the Variable name.

 And if the first matrix is transposed, then how to get the output in which
 First raw present the variable name.

 It will be great help for my research.

 Dinesh

 --
 Dinesh Kumar Barupal
 Research Associate
 Metabolomics Fiehn Lab
 UCD Genome Center
 451 East Health Science Drive
 GBSF Builidng
 University of California
 DAVIS
 95616
 http://fiehnlab.ucdavis.edu/staff/kumar

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




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
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] Second subsequent calls to function fails. Please help debug.

2008-03-29 Thread Michael Kubovy
Dear R-helpers,

I'm running Sweave() on a file. First run:
  Sweave('20080331.Rnw')
Writing to file 20080331.tex
Processing code chunks ...
  1 : term hide (label=setup)
  2 : echo term verbatim (label=oatvar)
  3 : echo term verbatim (label=oatvar1)
  4 : echo term verbatim (label=oat2wt)
  5 : echo term verbatim (label=oat2wt)
  6 : echo term verbatim (label=lm)
  7 : echo term verbatim (label=diag)
  8 : echo term verbatim (label=tukey)
  9 : echo term verbatim (label=efficiency)
10 : echo term verbatim (label=wear)
11 : echo term verbatim (label=wearX)
12 : echo term verbatim (label=gyd)
Loading required package: crossdes
Loading required package: AlgDesign
Loading required package: gtools

Attaching package: 'gtools'


The following object(s) are masked from package:faraway :

 logit

Loading required package: MASS
13 : echo term verbatim (label=2wt)
14 : echo term verbatim (label=ablm)
15 : echo term verbatim (label=abaov)

You can now run LaTeX on '20080331.tex'
There were 42 warnings (use warnings() to see them)

Second run:
  Sweave('20080331.Rnw')
Writing to file 20080331.tex
Processing code chunks ...
  1 : term hide (label=setup)
  2 : echo term verbatim (label=oatvar)
  3 : echo term verbatim (label=oatvar1)
  4 : echo term verbatim (label=oat2wt)
  5 : echo term verbatim (label=oat2wt)
  6 : echo term verbatim (label=lm)
  7 : echo term verbatim (label=diag)
  8 : echo term verbatim (label=tukey)

Error:  chunk 8 (label=tukey)
Error in parse(text = x) :
   unexpected symbol in yield ~ variety + block + preds(yield+variety 
+block+preds.sq)sq

It failed in:

tukey=
require(alr3)
tukey.nonadd.test(ov.lm)
@

At that point I ran debug() on the call:
debug(tukey.nonadd.test)
tukey.nonadd.test(ov.lm)
debugging in: tukey.nonadd.test(ov.lm1)
debug: {
 envir - environment(formula(m))
 dd - eval(m$call$data, envir)
 subs - eval(m$call$subset, envir)
 wgts - eval(m$call$weights, envir)
 naa - m$call$na.action
 dd - data.frame(dd, preds.sq = predict(m, dd)^2)
 uf - update.formula(formula(m$terms), ~. + preds.sq)
 environment(uf) - environment(NULL)
 mup - if (is.null(naa))
 lm(uf, data = dd, subset = subs, weights = wgts)
 else lm(uf, data = dd, subset = subs, weights = wgts, na.action =  
naa)
 if (mup$rank  m$rank) {
 ans - summary(mup)$coef[, 3:4]
 ans - ans[match(preds.sq, rownames(ans)), ]
 ans[2] - pnorm(-abs(ans[1])) * 2
 ans
 }
 else c(NA, NA)
}
Browse[1]
debug: envir - environment(formula(m))
Browse[1]
debug: dd - eval(m$call$data, envir)
Browse[1]
debug: subs - eval(m$call$subset, envir)
Browse[1]
debug: wgts - eval(m$call$weights, envir)
Browse[1]
debug: naa - m$call$na.action
Browse[1]
debug: dd - data.frame(dd, preds.sq = predict(m, dd)^2)
Browse[1]
debug: uf - update.formula(formula(m$terms), ~. + preds.sq)
Browse[1]
debug: environment(uf) - environment(NULL)
Browse[1]
debug: mup - if (is.null(naa)) lm(uf, data = dd, subset = subs,  
weights = wgts) else lm(uf,
 data = dd, subset = subs, weights = wgts, na.action = naa)
Browse[1]
Error in parse(text = x) :
   unexpected symbol in yield ~ variety + preds(yield+variety 
+preds.sq)sq

Advice?
_
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400Charlottesville, VA 22904-4400
Parcels:Room 102Gilmer Hall
 McCormick RoadCharlottesville, VA 22903
Office:B011+1-434-982-4729
Lab:B019+1-434-982-4751
Fax:+1-434-982-4766
WWW:http://www.people.virginia.edu/~mk9y/



[[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] Second subsequent calls to function fails. Please help debug.

2008-03-29 Thread Duncan Murdoch
On 29/03/2008 9:47 PM, Michael Kubovy wrote:
 Dear R-helpers,
 
 I'm running Sweave() on a file. First run:
   Sweave('20080331.Rnw')
 Writing to file 20080331.tex
 Processing code chunks ...
   1 : term hide (label=setup)
   2 : echo term verbatim (label=oatvar)
   3 : echo term verbatim (label=oatvar1)
   4 : echo term verbatim (label=oat2wt)
   5 : echo term verbatim (label=oat2wt)
   6 : echo term verbatim (label=lm)
   7 : echo term verbatim (label=diag)
   8 : echo term verbatim (label=tukey)
   9 : echo term verbatim (label=efficiency)
 10 : echo term verbatim (label=wear)
 11 : echo term verbatim (label=wearX)
 12 : echo term verbatim (label=gyd)
 Loading required package: crossdes
 Loading required package: AlgDesign
 Loading required package: gtools
 
 Attaching package: 'gtools'
 
 
   The following object(s) are masked from package:faraway :
 
logit
 
 Loading required package: MASS
 13 : echo term verbatim (label=2wt)
 14 : echo term verbatim (label=ablm)
 15 : echo term verbatim (label=abaov)
 
 You can now run LaTeX on '20080331.tex'
 There were 42 warnings (use warnings() to see them)
 
 Second run:
   Sweave('20080331.Rnw')
 Writing to file 20080331.tex
 Processing code chunks ...
   1 : term hide (label=setup)
   2 : echo term verbatim (label=oatvar)
   3 : echo term verbatim (label=oatvar1)
   4 : echo term verbatim (label=oat2wt)
   5 : echo term verbatim (label=oat2wt)
   6 : echo term verbatim (label=lm)
   7 : echo term verbatim (label=diag)
   8 : echo term verbatim (label=tukey)
 
 Error:  chunk 8 (label=tukey)
 Error in parse(text = x) :
unexpected symbol in yield ~ variety + block + preds(yield+variety 
 +block+preds.sq)sq
 
 It failed in:
 
 tukey=
 require(alr3)
 tukey.nonadd.test(ov.lm)
 @
 
 At that point I ran debug() on the call:
 debug(tukey.nonadd.test)
 tukey.nonadd.test(ov.lm)
 debugging in: tukey.nonadd.test(ov.lm1)
 debug: {
  envir - environment(formula(m))
  dd - eval(m$call$data, envir)
  subs - eval(m$call$subset, envir)
  wgts - eval(m$call$weights, envir)
  naa - m$call$na.action
  dd - data.frame(dd, preds.sq = predict(m, dd)^2)
  uf - update.formula(formula(m$terms), ~. + preds.sq)
  environment(uf) - environment(NULL)
  mup - if (is.null(naa))
  lm(uf, data = dd, subset = subs, weights = wgts)
  else lm(uf, data = dd, subset = subs, weights = wgts, na.action =  
 naa)
  if (mup$rank  m$rank) {
  ans - summary(mup)$coef[, 3:4]
  ans - ans[match(preds.sq, rownames(ans)), ]
  ans[2] - pnorm(-abs(ans[1])) * 2
  ans
  }
  else c(NA, NA)
 }
 Browse[1]
 debug: envir - environment(formula(m))
 Browse[1]
 debug: dd - eval(m$call$data, envir)
 Browse[1]
 debug: subs - eval(m$call$subset, envir)
 Browse[1]
 debug: wgts - eval(m$call$weights, envir)
 Browse[1]
 debug: naa - m$call$na.action
 Browse[1]
 debug: dd - data.frame(dd, preds.sq = predict(m, dd)^2)
 Browse[1]
 debug: uf - update.formula(formula(m$terms), ~. + preds.sq)
 Browse[1]
 debug: environment(uf) - environment(NULL)
 Browse[1]
 debug: mup - if (is.null(naa)) lm(uf, data = dd, subset = subs,  
 weights = wgts) else lm(uf,
  data = dd, subset = subs, weights = wgts, na.action = naa)
 Browse[1]
 Error in parse(text = x) :
unexpected symbol in yield ~ variety + preds(yield+variety 
 +preds.sq)sq
 
 Advice?
 

I don't see anything obvious, so I guess it's the usual advice:

Use traceback() to see what function was trying to do the parsing. 
Debug that function, and see why it was trying to parse that string.
If that doesn't make it obvious, put together a minimal reproducible 
version that others can try, and see if anyone else can spot the problem.

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.