David Reitter | 1 May 01:13 2009
Picon

Re: Hmisc: xYplot and panel.lines

On Apr 30, 2009, at 6:49 PM, David Reitter wrote:
> This works as expected for panel.abline, but as soon as I'm using  
> panel.lines (or llines or lpoints) from the "lattice" package  
> (version 0.17-17 with R 2.8.1), it seems that it is not using the  
> coordinate system that the original plot used, i.e. the graph does  
> not work at all.

Disregard my message:  I managed to figure it out.  panel.lines  
insists on x and y rather than y ~ x  or y (x are just discrete steps).

The question that remains is whether it is possible to draw to a panel  
directly using the normal plotting functions in cases where only one  
panel is shown.  The latest version of Hmisc seems to disallow this  
(error: "plot.new has not been called yet"), and with earlier versions  
I had said problems about ablines appearing in the wrong locations.

______________________________________________
R-help <at> 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.

Tena Sakai | 1 May 02:04 2009
Picon

Re: newbie HWRITER package question

Hi,

> How can I get R to insert such line into the head section
> of html file being generated under hwriter?

I found an answer myself.  It turns out that the line
  <link rel="stylesheet" type="text/css" href="hwriter.css"></link>
doesn't have to go into body section.  As an experiment, I did:

  p = openPage ('testPage.html')
  hwrite ('<link rel="stylesheet" type="text/css" href="hwriter.css"></link>', p)
  hwrite (iris[1:3,1:3], p, row.bgcolor='#ffda99')
  closePage (p)

  browseURL ('testPage.html')

and I get what I wanted.
If you have a better/different idea, I'd love to hear it.

Regards,

Tena Sakai
tsakai <at> gallo.ucsf.edu

-----Original Message-----
From: r-help-bounces <at> r-project.org on behalf of Tena Sakai
Sent: Thu 4/30/2009 3:56 PM
To: r-help <at> r-project.org
Subject: [R] newbie HWRITER package question

(Continue reading)

Ron Burns | 1 May 02:21 2009
Picon
Picon

Re: AICc

Katie-

I think you can calculate it easily in R using the definitions:

AIC<- -2*LL + 2*K
AICc<-AIC + 2*K*(K+1)/(n-K-1)

where LL is the logLik, K is the the number of parameters in the fitted 
model, and n is the number of observation, so if you know AIC then it is 
easy to calculate AICc

Ron

Katie Stumpf wrote:
> I am fitting logistic regression models, by defining my own link 
> function, and would like to get AICc values.  Using the glm command 
> gives a value for AIC, but I haven't been able to get R to convert 
> that to AICc.  Is there a code that has already been written for 
> this?  Right now I am just putting the AIC values into an excel 
> spreadsheet and calculating AICc, likelihood, and AIC weights that 
> way, but it would be much more efficient if I could do this in R.
>
> Thanks!
>
> ______________________________________________
> R-help <at> 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.
(Continue reading)

RLearner | 1 May 03:01 2009
Picon

How can I create all possible contigency tables if the total count and number of rows and columns are fixed?


Dear all

It sounds an easy task, but I got stuck with creating all possible
contigency tables if the total count is fixed. For example, if the total
count is 2, and number of cells in the table is 4 (nrow=2,ncol=2), there
should be 10 possible tables:
0 0     0 0    0 0     0 1     0 1      0 2      1 0     1 0     1 1     2 0
0 2     1 1    2 0     0 1     1 0      0 0      0 1     1 0     0 0     0 0

And, are there any suggestions on creating hash and inverse hash function
such that whenever we know the index integer, we can find the corresponding
table?

Please let me know if you have any thoughts. Thanks a lot!
--

-- 
View this message in context: http://www.nabble.com/How-can-I-create-all-possible-contigency-tables-if-the-total-count-and-number-of-rows-and-columns-are-fixed--tp23327067p23327067.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help <at> 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.

Erin Hodgess | 1 May 03:41 2009
Picon

Rscript vs R CMD BATCH

Dear R People:

Is is better to use Rscrpt or R CMD BATCH or does it not matter, please?

Thanks,
Erin

--

-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess <at> gmail.com

______________________________________________
R-help <at> 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.

Greg Snow | 1 May 03:50 2009

Re: Curved arrows

?xspline for the shaft, do the head by hand (or using arrows with a very short shaft)

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow <at> imail.org
801.408.8111

> -----Original Message-----
> From: r-help-bounces <at> r-project.org [mailto:r-help-bounces <at> r-
> project.org] On Behalf Of Paul Chatfield
> Sent: Thursday, April 30, 2009 2:57 AM
> To: r-help <at> r-project.org
> Subject: [R] Curved arrows
> 
> 
> I'm trying to draw an arrow with a curved shaft on the graph as a
> straight
> one looks messy on a detailed graph.  I've looked in arrows but it
> doesn't
> seem to give an option.  larrows doesn't look much more promising.  I
> had a
> look in the archive and couldn't find anything.  Any thoughts?
> 
> Thanks
> 
> Paul
> --
> View this message in context: http://www.nabble.com/Curved-arrows-
(Continue reading)

JiHO | 1 May 04:10 2009
Picon

Evaluating content of command line arguments

Hello everyone,

I am writing an R script which will be provided with command line  
arguments by a shell script. I read them with commandArgs() but I have  
an issue to make that fool proof.

For example, with test.R containing:

         args=commandArgs(trailingOnly=TRUE)
         args

I get:

         $ Rscript test_commandLineArgs.R 3 4 5
         [1] "3" "4" "5"

Now, to make the input more flexible and robust, I want to pass  
*named* arguments, so that the R script does not depend on the order  
of arguments passed and can check which are present/absent etc. I.e.

         $ Rscript test_commandLineArgs.R foo=3 bar=4 5
         [1] "foo=3" "bar=4"

But I am stuck on how to actually execute the code within those  
strings so as to get two variables foo and bar equal to 3 and 4  
respectively. I looked at eval, deparse, substitute and all that but  
did not find anything. Is that possible?

Otherwise I will resort to parsing the arguments with strsplit but I  
would much prefer and more elegant solution.
(Continue reading)

Gabor Grothendieck | 1 May 04:28 2009
Picon

Re: Evaluating content of command line arguments

Check out the getopt package.

On Thu, Apr 30, 2009 at 10:10 PM, JiHO <jo.lists <at> gmail.com> wrote:
> Hello everyone,
>
> I am writing an R script which will be provided with command line arguments
> by a shell script. I read them with commandArgs() but I have an issue to
> make that fool proof.
>
> For example, with test.R containing:
>
>        args=commandArgs(trailingOnly=TRUE)
>        args
>
> I get:
>
>        $ Rscript test_commandLineArgs.R 3 4 5
>        [1] "3" "4" "5"
>
> Now, to make the input more flexible and robust, I want to pass *named*
> arguments, so that the R script does not depend on the order of arguments
> passed and can check which are present/absent etc. I.e.
>
>        $ Rscript test_commandLineArgs.R foo=3 bar=4 5
>        [1] "foo=3" "bar=4"
>
> But I am stuck on how to actually execute the code within those strings so
> as to get two variables foo and bar equal to 3 and 4 respectively. I looked
> at eval, deparse, substitute and all that but did not find anything. Is that
> possible?
(Continue reading)

Rob Denniker | 1 May 04:50 2009

Confusion going from Stata -> R

Dear list,

I am trying to replicate some Stata results but having a tough time doing it in R.  The goal is to obtain a
difference-in-difference estimate in a model with simple state fixed effects. The "state" variable is a
factor, but some levels are missing.  It appears that Stata automatically recognizes this and works
around it. It also automatically pick "ME" as the base state  (see below), but trying to do the same thing in R
does not yield the same results... 

The data is as follows:

# States were assigned to treatment and control groups in 1976, and  residents surveyed in 1976 and 1985
# i.year indicates the year the respondent was surveyed
# i.st is a factor indicating the respondent's state of residence
# i.treatment is a dummy indicating whether that individual was resident in a treatment state
# hwover is the binary response variable of interest

load(url("http://h1.ripway.com/rdump/d.rdata"))
# load data frame "d" (slow to load, retry if 404)

# Code i.st as a factor
d$i.st <- factor(d$st)
n.i.st <- length(levels(d$i.st))
levels(d$i.st)[14] # Level 14 == "ME"
contrasts(d$i.st) <- contr.treatment(n.i.st, base = 14, contrasts=T)  # Sets base level to "ME"
attributes(d$i.st)

# Difference-in-difference estimate
reg1 <- lm(hwover ~ i.treatment*i.year + i.st, data=d, weights=weight1)
summary(reg1)
# Output (correctly) omit state "14" ("ME")
(Continue reading)

cameron.bracken | 1 May 07:00 2009
Picon

Re: postscript printer breaking up long strings


Ted.Harding-2 wrote:
> 
> In the graph shown in your URL above, the xlab and the ylab
> appear in their entirety, unbroken. So does the one plotted
> in the middle of the graph. I get the same when I run your code.
> 

Hi-

I am one of the developers of pgfSweave. The problem (although it is
considered a feature) is this (from https://svn.r-project.org/R/trunk/NEWS):

NEW FEATURES (in 2.9.0)

    o	pdf() and postscript() gain a 'useKerning' argument to place
	strings using kerning (which had previously been ignored in
	display but not in strwidth), based in part on an idea and
	code from Ei-ji Nakama. The default is TRUE.

	Kerning involving spaces is now ignored (it was previously
	only used in the computation of string widths).

This is normally not a problem but converting to pgf and then to pdf causes
large gaps when the useKerning option is turned on. The following will cause
the long strings to not break.

  postscript('linebreaktest.eps',useKerning=FALSE) 
  plot(1,xlab='aReallyLongStringToSeeHowItBreaks', 
         ylab='aReallyLongStringToSeeHowItBreaks') 
(Continue reading)


Gmane