Re: [R] Package installation in Windows

2008-09-09 Thread Prof Brian Ripley

On Tue, 9 Sep 2008, [EMAIL PROTECTED] wrote:


As a sys admin, how do I install packages so that there is one common
library for all users of the MS Windows computer, instead of the
default individual location for each user?

I've done this for Linux.


The same way.  You set R_LIBS_SITE in etc/Renviron.site.  See 
?.Library.site .


This was discussed on this list with the last couple of weeks, so please 
do check the archives.



Thanks, in advance, for your help.

Mike


--
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] Problem with starting and using R

2008-09-09 Thread Prof Brian Ripley

On Wed, 10 Sep 2008, Thomas Lo wrote:


The patched version (r46512) solves the problem!!  Thanks!


Thank you for confirming this.

In the meantime I tracked down the exact problem.  The standards for a 
locale name are 'language_country.encoding', as in 'en_GB.utf8' or 
'English_United Kingdom.1252'.  In Windows XP (at least) Microsoft gives 
'Chinese_Hong Kong S.A.R..950'.  This is ambiguous, and in at least two 
places it was parsed as an encoding of 'A.R..950'.  There seem to be only 
three locales with dots in the country name (Hong Kong, Macau, U.A.E.), so 
it perhaps not surprising that this has gone undetected for so long.




On Tue, Sep 9, 2008 at 12:20 AM, Thomas Lo <[EMAIL PROTECTED]> wrote:
  Hi Brian and Duncan,
 
Many thanks for your responses.  Setting the 'Current format' in
'Regional and language options' under Control Panel to English
(Singapore) solved the R usage problem for me.  I will have a go at
R-patched build 46507 after it is released.
 
Regards,
Thomas

On Mon, Sep 8, 2008 at 7:20 PM, Prof Brian Ripley
<[EMAIL PROTECTED]> wrote:
  On Mon, 8 Sep 2008, Duncan Murdoch wrote:

On 08/09/2008 6:56 AM, Prof Brian Ripley
wrote:
  On Mon, 8 Sep 2008, Prof Brian
  Ripley wrote:

This reflects a
problem in your
locale (traditional
Chinese): we cannot
reproduce it.  Try
running R in a
different locale
(e.g. append
LC_ALL=en to the
target when you
start R).


  Maybe I have found this as a
  bug in iconv.  Please try a
  version of R-patched with svn
  revision 46507 or later.


Unfortunately, something stopped the daily
builds of R-patched on Saturday, and I
haven't been in to the office yet to fix
things.  So it's likely to be tomorrow
before the Windows build of r46507 or later
is available on CRAN.


I only found r46507 this morning, as a side effect of
something else.  So it would not be in a build until
tomorrow.




  Duncan Murdoch


  On Sun, 7 Sep 2008,
  Thomas Lo wrote:

Dear all,

I encountered
a problem on
starting and
using the R v
 2.7.2
installation
on
my PC running
Windows Vista
and would
appreciate
your help.

When R was
first
started, the
Rgui returned
several error
messages:

Error in
structure(.Internal(Sys.getenv(as.character(x),
as.character(unset)$
  unsupported
conversion
Error in
file.exists(name)
: unsupported
conversion in
'filenameToWchar'

In addition,
a dialog box
called
'Information'
popped up
with the
following
message:

Fatal error:
unable to
restore saved
data in
.RData

On clicking
'OK', R
closed
immediately
and the same
thing occurs
on
restarting R.

After
checking for
previous
related
messages
online, I
followed one
of the
recommendations
from before
and appended
--no-restore-data
to the R
shorcut
target line.
 After that,
R could start
without the
'fatal
error'.
However,
 

Re: [R] Genmod in SAS vs. glm in R

2008-09-09 Thread Peter Dalgaard

Rolf Turner wrote:


For one thing your call to glm() is wrong --- didn't you notice the
warning messages about ``non-integer #successes in a binomial glm!''?

You need to do either:

glm(r/k ~ x, family=binomial(link='cloglog'), data=bin_data, 
offset=log(y), weights=k)


or:

glm(cbind(r,k-r) ~ x, family=binomial(link='cloglog'), data=bin_data, 
offset=log(y))


You get the same answer with either, but this answer still does not 
agree with your
SAS results.  Perhaps you have an error in your SAS syntax as well.  I 
wouldn't know.
The data created in the data step are not those used in the analysis. 
Changing to


data nelson;


gives the same result as  R on the versions I have available:

 Analysis Of Parameter Estimates

Standard Wald 95% 
Confidence   Chi-
 ParameterDFEstimate   Error   Limits  
  SquarePr > ChiSq

 Intercept 1 -3.5866  2.2413 -7.9795  
0.8064   2.560.1096
 x 1  0.9544  2.8362 -4.6046  
6.5133   0.110.7365
 Scale 0  1.  0.  1.  1. 



and 


Call:
glm(formula = r/k ~ x, family = binomial(link = "cloglog"), data = bin_data, 
   weights = k, offset = log(y))


Deviance Residuals: 
 1234  
0.5407  -0.9448  -1.0727   0.7585  


Coefficients:
   Estimate Std. Error z value Pr(>|z|)
(Intercept)  -3.5866 2.2413  -1.6000.110
x 0.9544 2.8362   0.3360.736




cheers,

Rolf Turner


On 10/09/2008, at 10:37 AM, sandsky wrote:




Hello,

I have different results from these two softwares for a simple 
binomial GLM

problem.

From Genmod in SAS: LogLikelihood=-4.75, coeff(intercept)=-3.59,

coeff(x)=0.95
From glm in R: LogLikelihood=-0.94, coeff(intercept)=-3.99, 
coeff(x)=1.36


Is there anyone tell me what I did wrong?

Here are the code and results,

1) SAS Genmod:

% r: # of failure
% k: size of a risk set

data bin_data;
input r k y x;
os=log(y);
cards;
1350.5
0250.5
0241.0
1241.0
;
proc genmod data=nelson;
model r/k = x / dist = binomial link =cloglog   offset = 
os ;


 

Log Likelihood   -4.7514

ParameterDFEstimate   Error   Limits
SquarePr > ChiSq

Intercept 1 -3.6652  1.9875 -7.5605  0.2302
3.400.0652
x1  0.8926  2.4900 -3.9877  5.7728
0.130.7200
Scale  0  1.  0.  1.  1.



2) glm in R

bin_data <-
data.frame(cbind(y=c(5,5,4,4),r=c(1,0,0,1),k=c(3,2,2,2),x=c(0.5,0.5,1.0,1.0))) 

glm(r/k ~ x, family=binomial(link='cloglog'), data=bin_data, 
offset=log(y))


 
Coefficients:
(Intercept)x
-3.9911.358

'log Lik.' -0.9400073 (df=2)


##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

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



--
  O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
 c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
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] building a package that contains S4 classes and methods

2008-09-09 Thread Peter Dalgaard

Marie Pierre Sylvestre wrote:

Hello R users,

I am trying to make a my first package and I get an error that I can
understand. The package is build out of three files (one for functions, 1
for s4 classes and 1 for s4 methods).

Once I source them I run 


package.skeleton( name="TDC" )

within a R session and I get 


Creating directories ...
Creating DESCRIPTION ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in './TDC/Read-and-delete-me'.
Warning messages:
1: In dump(internalObjs, file = file.path(code_dir,
sprintf("%s-internal.R",  :
  deparse of an S4 object will not be source()able
2: In dump(internalObjs, file = file.path(code_dir,
sprintf("%s-internal.R",  :
  deparse of an S4 object will not be source()able
3: In dump(internalObjs, file = file.path(code_dir,
sprintf("%s-internal.R",  :
  deparse of an S4 object will not be source()able
4: In dump(internalObjs, file = file.path(code_dir,
sprintf("%s-internal.R",  :
  deparse may be incomplete


I keep going in spite of the warnings with 
R CMD check --no-examples TDC


and I get 
* checking for working pdflatex ... OK

* using log directory
'/home/mariepierre/Packages/PermAlgo/PermAlgo/PermAlgo2/TDC.Rcheck'
* using R version 2.7.1 (2008-06-23)
* using session charset: UTF-8
* checking for file 'TDC/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'TDC' version '1.0'
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking whether package 'TDC' can be installed ... ERROR
Installation failed.

The error file says:
 
* Installing *source* package 'TDC' ...

** R
** preparing package for lazy loading
Error in parse(n = -1, file = file) : unexpected '<' at
102: `.__C__BindArgs` <-
103: <
Calls:  -> code2LazyLoadDB -> sys.source -> parse
Execution halted
ERROR: lazy loading failed for package 'TDC'
** Removing
'/home/mariepierre/Packages/PermAlgo/PermAlgo/PermAlgo2/TDC.Rcheck/TDC'

The problem is with my classes and methods. The respective files contain:

setClass("BindArgs",  signature( "function" ))
setClass("BindArgs2", signature( "function" )) 


and

setMethod("initialize", "BindArgs", function( .Object, f, ... )
  callNextMethod( .Object, function( x ) f( x, ... ) )) 


setMethod("initialize", "BindArgs2", function( .Object, f, ...)
  callNextMethod( .Object, function( x, y ) f( x, y, ... ) )) 


Everything works well within a R session but I can build the package.

If I look at the internal R file that this created I get

`.__C__BindArgs` <-

`.__C__BindArgs2` <-

`.__M__initialize:methods` <-

`.__T__initialize:methods` <-


Well, let just say that I am new to classes so this confuses me greatly. I
have checked the documentation and tried a few things but I reached my
personal limits!

I am using R 2.7.1 on Linux Fedora 8.

Any comments on what is happening and/or help would be greatly appreciated.

  
The main point is that you should not rely on R putting sensible code in 
the package source files, but rather stay in control yourself. What the 
warnings are telling you is that you cannot deparse an S4 object in a 
way that can be reparsed, so dump() doesn't work. What you get is


obj <-  

and the syntax error from source() if you try using it. So what you need 
to is to delete it and put in the appropriate class/methods definitions 
from your original sources. It might help to look at an existing 
S4-using package.


--
  O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
 c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
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] "figure margins too large" issue

2008-09-09 Thread Hui-Yi Chu
Thank you Marc,
I have checked two versions following your suggestions and the default
setting of mar in both versions are same to each other as c(5,4,4,2)+0.1.
Besides, I dont change any default settings about the graphics devices.
For more info, following is my two sessions of R.

*1.*
R version 2.6.2 (2008-02-08)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

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



*2.*
R version 2.7.2 (2008-08-25)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

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


Thank you in advance!!
Hui-Yi

On Tue, Sep 9, 2008 at 9:04 PM, Marc Schwartz <[EMAIL PROTECTED]>wrote:

> on 09/09/2008 05:19 PM Hui-Yi Chu wrote:
> > Hi everyone,
> >
> > I updated R from 2.6.2 to 2.7.2 recently but keep getting the error
> "figure
> > margins too large" when plot pictures which never happened to me when
> using
> > 2.6.2. After googling and searching the mailing list, I still have no
> idea
> > how to optimize it. One of my packages fixed bugs in 2.7.2 version, so
> that
> > I have to use it. Any suggestions are really appreciated!!!
> >
> > Best regards,
> > Hui-Yi Chu
>
> There were substantial changes in the graphics devices for 2.7.0. More
> information here:
>
>  https://svn.r-project.org/R/branches/R-2-7-branch/NEWS
>
> and review the sections for 2.7.0 and newer, which now includes 2.7.2
> patched.
>
> Without knowing your OS and which graphics device you are using and
> having an issue with, preferably along with sample (working) code that
> reproduces the issue, it will be difficult to know the exact source of
> the problem.
>
> A first place to start however would be to see ?par and review 'mar'.
> You will likely need to adjust either the default values or any adjusted
> values you have in your code.
>
> HTH,
>
> Marc Schwartz
>
>

[[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] yahoo finance into R

2008-09-09 Thread thomastos

thanks a lot. i thought it was more difficult.

however i am dissapointed that i get so little data. 

thanks again

thomas
  

Peter Dalgaard wrote:
> 
> thomastos wrote:
>> Hi R, 
>>
>> I am familiar with the basics of R.
>> To learn more I would like how to get data from Yahoo!finance directly
>> into
>> R. So basically I want a data frame or matrix to do some data analysis.
>> How do I do this?
>>   
> RSiteSearch("yahoo")
> 
> get.hist.quote() from tseries
> yahooSeries() from fImport (untried)
> 
> -- 
>O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
>   c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
>  (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
> ~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907
> 
> __
> 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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/yahoo-finance-into-R-tp19385481p19405623.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.


Re: [R] extract variance components

2008-09-09 Thread huang min
Hi,

Thanks for all. I now know how to extract the \sigma's.
For the unbalanced model y_{ijk}=x\beta+\alpha_i+\beta_{ij}+e_{ijk}
i=1,2,\dots,a, j=1,2,\dots,b_i, k=1,2,\dots,n_{ij}

How can I extract the variance matrix $V$? The variance for the ith group is
also of help. Suppose the ith group has totally 10 observations. b_i=4,
n_{i1}=1,n_{i2}=3,n_{i3}=2 and n_{i4}=1. $V_i=\sigma_a^2 J_{10}+\sigma_b^2
diag(J_1,J_3,J_2, J_1)+\sigma_e^2 I_{10}$, where I is the identity matrix
and J_d is the matrix of 1's with dimention d \by d. J_d reduces to 1 if
d=1. I only know how to extract the design matrix for the fixed effect by
model.matrix(lme.fit2). How to deal with the parts for the random effects?
Thank you.

Huang



On Fri, Aug 29, 2008 at 11:30 AM, huang min <[EMAIL PROTECTED]> wrote:

>  HI,
>
> I would like to extract the variance components estimation in lme function
> like
>
> a.fit<-lme(distance~age, data=aaa, random=~day/subject)
>
> There should be three variances \sigma_day, \sigma_{day %in% subject } and
> \sigma_e.
>
> I can extract the \sigma_e using something like a.fit$var. However, I
> cannot manage to extract the first two variance components. I can only see
> the results in summary(a.fit).
>
> I have some problem in the lme4 package and hence use the nlme package. The
> example data also has some problem so I just list the function here using
> some imaginary data set. Thank you.
>
> Huang
>

[[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] Substitute Values in a Matrix?

2008-09-09 Thread Marc Schwartz
on 09/09/2008 06:12 PM Chris82 wrote:
> Hi,
> 
> I'm searching for a function to subistute Values in a Matrix to new Values.
> For example: 
> 
> old value  new value
> 1.1 6
> 1.2 7
> ..
> ..
> ..
> 1.9 14
> 2.0 15
> 
> and
> 
> 2.1 15.5
> 2.2 16
> ..
> ..
> 2.9 19.5
> 3.0 20
> 
> There is a difference between the correlation old to new value
> 
> For the present my code is like this:
> 
> y <- matrix(c(1,2,1, 3,2,4, 1,1,1), ncol=3, byrow=TRUE)
> 
> for (i in 1:3) {
>  for (j in 1:3) {
>if y[i,j] = 1:2 substitute y[i,j] = 6:15
> 
> 
> }
> }
> 
> But I don't find a correct syntax for this term " if y[i,j] = 1:2 substitute
> y[i,j] = 6:15" and I'm not sure if my idea is to simple and it's more
> complex than I think.
> 
> thanks.


It is made more complicated because you are using floating point values
in the table lookup process, rather than integer or character based
comparisons. See R FAQ 7.31 for why floating point comparisons are
problematic.

In this case, we need to set up a process by which we can include a
tolerance for the floating point comparisons for the Search vector in
the source matrix and then generate the matching indices into the
Replace vector.

In traditional floating point comparison applications, you would look to
use all.equal(), but it is not suitably 'vectorized' for this
application, so we set up a parallel process.

There are likely to be further optimizations applicable here, for
someone with fresher eyes, but here is a first pass function:

SR <- function(x, Search, Replace, tol = .Machine$double.eps ^ 0.5)
{
  Ind <- sapply(x, function(i) which(abs(i - Search) < tol))
  names(Ind) <- seq(length(Ind))
  Ind <- unlist(Ind)
  x[as.integer(names(Ind))] <- Replace[Ind]
  x
}


The arguments are the source matrix, the Search vector, the Replace
vector and the required tolerance for the comparison. In this case, I
took the default tolerance from all.equal().

Within the function body, we loop over each value in the source matrix
and subtract the Search vector. We then compare the absolute values of
the result vector to the tolerance value and get the index using which()
for any values within the tolerance. We thus presume that this is a
'match' between the matrix value and a Search vector value, within the
tolerance level.

They key is that if there is no value that matches, which() returns
integer(0), not NA, so there is additional code to deal with that
possibility. In this case, 'Ind' would be a list, rather than a vector,
but the additional code will work in either case, perhaps adding a bit
of overhead in lieu of an if/else construct.

So let's set up two test matrices. The first only has the values in the
Search vector, whereas the second has four additional values that do not
match.


Search <- seq(1.1, 3.0, 0.1)
Replace <- c(6:15, seq(15.5, 20, 0.5))

mat <- matrix(seq(1.1, 3.0, 0.1), ncol = 4)
mat2 <- matrix(c(seq(1.1, 3.0, 0.1), 0, 4, 5, 6), ncol = 4)


> Search
 [1] 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7
[18] 2.8 2.9 3.0

> Replace
 [1]  6.0  7.0  8.0  9.0 10.0 11.0 12.0 13.0 14.0 15.0 15.5 16.0 16.5
[14] 17.0 17.5 18.0 18.5 19.0 19.5 20.0

> mat
 [,1] [,2] [,3] [,4]
[1,]  1.1  1.6  2.1  2.6
[2,]  1.2  1.7  2.2  2.7
[3,]  1.3  1.8  2.3  2.8
[4,]  1.4  1.9  2.4  2.9
[5,]  1.5  2.0  2.5  3.0

> mat2
 [,1] [,2] [,3] [,4]
[1,]  1.1  1.7  2.3  2.9
[2,]  1.2  1.8  2.4  3.0
[3,]  1.3  1.9  2.5  0.0
[4,]  1.4  2.0  2.6  4.0
[5,]  1.5  2.1  2.7  5.0
[6,]  1.6  2.2  2.8  6.0


# Let's do 'mat'
> SR(mat, Search, Replace)
 [,1] [,2] [,3] [,4]
[1,]6   11 15.5 18.0
[2,]7   12 16.0 18.5
[3,]8   13 16.5 19.0
[4,]9   14 17.0 19.5
[5,]   10   15 17.5 20.0


# Now on 'mat2'
> SR(mat2, Search, Replace)
 [,1] [,2] [,3] [,4]
[1,]6 12.0 16.5 19.5
[2,]7 13.0 17.0 20.0
[3,]8 14.0 17.5  0.0
[4,]9 15.0 18.0  4.0
[5,]   10 15.5 18.5  5.0
[6,]   11 16.0 19.0  6.0


My solution is likely to become rather inefficient on 'large' matrices,
for some suitable definition of 'large'.

HTH,

Marc Schwartz

__
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] bootstrapping - number of items to replace is not a multiple of replacement length

2008-09-09 Thread Steven McKinney
Hello,

Your theta() function is returning different
sets of coefficients depending on the results of
step().

You'll need to add code to theta() to figure
out which variables were selected, and store
them into the right positions of a vector
of length 20 (the apparent number of covariates
you describe below), so that your theta()
function always returns the same sized output.  

(Google

   stepwise regression random forest

and you'll get a number of hits
about using random forests instead
of stepwise regression, and pointers
about bootstrapping the random forest.)

HTH

Steve McKinney


> -Original Message-
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> On Behalf Of Gabriela Bucini
> Sent: Tuesday, September 09, 2008 5:02 PM
> To: r-help@r-project.org
> Subject: [R] bootstrapping - number of items to replace is not a
multiple
> ofreplacement length
> 
> Hello,
> 
> I'm new to boostrapping and I'd need some help to understand the error
> message that pops up when I run my script.
> 
> I have a data.frame with 73 lines and 21 column.
> I am running a stepwise regression to find the best model using the R
> function "step".
> I apply bootstrapping to obtain model coefficients.
> This is my script:
> 
> # "datare80" is the name of the data.frame and "woodycover" is the
> response
> variable
> theta <- function(datare80, indices) {
>  d <- datare80[indices, ]# allows boot to select
subsample
> datasets
>  full <- lm(d$woodycover~ ., data= d )
>  lmbroadst <- step(full, data=d , direction = "both", k=2,
> trace=0)
>  coefficients(lmbroadst)  # return coef. vector
>   }
> resb <- boot(data = datare80, statistic = theta, R=1000)
> 
> 
> 
> When I run it, I get these two messages:
> If I omit the last line "coefficients(lmbroadst)" in the function
> definition, I get :
> "Error in t.star[r, ] <- statistic(data, i[r, ], ...) :
> incorrect number of subscripts on matrix"
> If I have the last line "coefficients(lmbroadst)", then I get:
> "Error in t.star[r, ] <- statistic(data, i[r, ], ...) :
> number of items to replace is not a multiple of replacement
> length"
> 
> 
> Thank you very much for any help!
> 
> Gabriela
> 
> __
> 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] "figure margins too large" issue

2008-09-09 Thread Marc Schwartz
It is not the default setting for par("mar") that changed.

There are other device specific changes that occurred in 2.7.0,
including, for some devices (eg. pdf and bitmap), the default device
dimensions.

See the bullets in the NEWS file under "SIGNIFICANT USER-VISIBLE
CHANGES" and "GRAPHICS CHANGES" for 2.7.0. It could be something subtle,
having to do with any font/symbol selections and/or sizes (eg. cex.*).

You still did not provide a small reproducible example, which would
better help us help you. The fundamental error message suggests that you
need to either reduce one or more of the par("mar") settings to reduce
the margin size, increase the device dimensions, or alter some other
attribute. This is further complicated if you might be using layout() or
par(mfrow/mfcol) to create a matrix of plots.

Regards,

Marc

on 09/09/2008 09:05 PM Hui-Yi Chu wrote:
> Thank you Marc,
> I have checked two versions following your suggestions and the default
> setting of mar in both versions are same to each other as
> c(5,4,4,2)+0.1. Besides, I dont change any default settings about the
> graphics devices.
> For more info, following is my two sessions of R.
> 
> *1.*
> R version 2.6.2 (2008-02-08)
> i386-pc-mingw32
> 
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> States.1252;LC_MONETARY=English_United
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
> 
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
> 
> 
> 
> *2.*
> R version 2.7.2 (2008-08-25)
> i386-pc-mingw32
> 
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> States.1252;LC_MONETARY=English_United
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
> 
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
>  
> 
> Thank you in advance!!
> Hui-Yi
> 
> On Tue, Sep 9, 2008 at 9:04 PM, Marc Schwartz <[EMAIL PROTECTED]
> > wrote:
> 
> on 09/09/2008 05:19 PM Hui-Yi Chu wrote:
> > Hi everyone,
> >
> > I updated R from 2.6.2 to 2.7.2 recently but keep getting the
> error "figure
> > margins too large" when plot pictures which never happened to me
> when using
> > 2.6.2.  After googling and searching the mailing
> list, I still have no idea
> > how to optimize it. One of my packages fixed bugs in 2.7.2
> version, so that
> > I have to use it. Any suggestions are really appreciated!!!
> >
> > Best regards,
> > Hui-Yi Chu
> 
> There were substantial changes in the graphics devices for 2.7.0.
>  More
> information here:
> 
>  https://svn.r-project.org/R/branches/R-2-7-branch/NEWS
> 
> and review the sections for 2.7.0 and newer, which now includes 2.7.2
> patched.
> 
> Without knowing your OS and which graphics device you are using and
> having an issue with, preferably along with sample (working) code that
> reproduces the issue, it will be difficult to know the exact source of
> the problem.
> 
> A first place to start however would be to see ?par and review 'mar'.
> You will likely need to adjust either the default values or any adjusted
> values you have in your code.
> 
> HTH,
> 
> Marc Schwartz
> 
>

__
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] "figure margins too large" issue

2008-09-09 Thread Marc Schwartz
on 09/09/2008 05:19 PM Hui-Yi Chu wrote:
> Hi everyone,
> 
> I updated R from 2.6.2 to 2.7.2 recently but keep getting the error "figure
> margins too large" when plot pictures which never happened to me when using
> 2.6.2. After googling and searching the mailing list, I still have no idea
> how to optimize it. One of my packages fixed bugs in 2.7.2 version, so that
> I have to use it. Any suggestions are really appreciated!!!
> 
> Best regards,
> Hui-Yi Chu

There were substantial changes in the graphics devices for 2.7.0. More
information here:

  https://svn.r-project.org/R/branches/R-2-7-branch/NEWS

and review the sections for 2.7.0 and newer, which now includes 2.7.2
patched.

Without knowing your OS and which graphics device you are using and
having an issue with, preferably along with sample (working) code that
reproduces the issue, it will be difficult to know the exact source of
the problem.

A first place to start however would be to see ?par and review 'mar'.
You will likely need to adjust either the default values or any adjusted
values you have in your code.

HTH,

Marc Schwartz

__
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: error handling in try

2008-09-09 Thread Andy Zhu
First time to post and searched archive for this problem with no clue. My 
version is 2.5.1.

Below is a function to check if a given date is a valid date to a given date 
function object. It uses try (also tried tryCatch but with same problem). When 
given an invalid date, I am hoping try will generate en error message which 
would be picked up by the geterrmessage and thus expecting a false result. but 
this is not the case when it is inside a function. However, if simply run the 
body of function, the ret is indeed a false value. Why are they different?

Many thanks


is.Date=
# adate: a scalar value
# fun: the date function object
# format: the designated date format to date function
function(adate,fun,format) {
    ret=NA;
    error.old=geterrmessage();
    .Internal(seterrmessage('no error'));
    try(fun(adate,format),silent=T);
    error=geterrmessage();
    if (error=='no error') {
    ret=T;
    } else {
    ret=F;
    }
    .Internal(seterrmessage(error.old));
    return(ret);
}

adate='12/2000';
fun=as.Date;
format='%b %Y';

is.Date(adate,fun,format) # returns true which is not correct. 

    ret=NA;

    error.old=geterrmessage();

    .Internal(seterrmessage('no error'));

    try(fun(adate,format),silent=T);

    error=geterrmessage();

    if (error=='no error') {

    ret=T;

    } else {

    ret=F;

    }

    .Internal(seterrmessage(error.old));


ret # shows false which is correct



  
[[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] Substitute Values in a Matrix?

2008-09-09 Thread Chris82

Hi,

I'm searching for a function to subistute Values in a Matrix to new Values.
For example: 

old value  new value
1.1 6
1.2 7
..
..
..
1.9 14
2.0 15

and

2.1 15.5
2.2 16
..
..
2.9 19.5
3.0 20

There is a difference between the correlation old to new value

For the present my code is like this:

y <- matrix(c(1,2,1, 3,2,4, 1,1,1), ncol=3, byrow=TRUE)

for (i in 1:3) {
 for (j in 1:3) {
   if y[i,j] = 1:2 substitute y[i,j] = 6:15


}
}

But I don't find a correct syntax for this term " if y[i,j] = 1:2 substitute
y[i,j] = 6:15" and I'm not sure if my idea is to simple and it's more
complex than I think.

thanks.




-- 
View this message in context: 
http://www.nabble.com/Substitute-Values-in-a-Matrix--tp19403197p19403197.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.


Re: [R] densities with overlapping area of 0.35

2008-09-09 Thread Lavan

Hi,

I just findout that the KL Divengence depends on the variances of the
distrubutions too and I'm trying to figureout how to do this. please help
me.

let's say 

X ~n(0,1) and Y~n(2*a, sigma^2). Is there any way I can calculate the
"sigma" and "a" corresponding to an overlapping area of 0.35.

Thank you,

Lavan



Lavan wrote:
> 
> Hi,
> 
> I like to generate two normal densities such that the overlapping area
> between them is 0.35. Is there any code/package available in R to do
> that??
> 
> Regards,
> 
> Lavan
> 

-- 
View this message in context: 
http://www.nabble.com/densities-with-overlapping-area-of-0.35-tp19384741p19404352.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.


Re: [R] Problem with starting and using R

2008-09-09 Thread Thomas Lo
The patched version (r46512) solves the problem!!  Thanks!

On Tue, Sep 9, 2008 at 12:20 AM, Thomas Lo <[EMAIL PROTECTED]> wrote:

>  Hi Brian and Duncan,
>
> Many thanks for your responses.  Setting the 'Current format' in 'Regional
> and language options' under Control Panel to English (Singapore) solved the
> R usage problem for me.  I will have a go at R-patched build 46507 after it
> is released.
>
> Regards,
> Thomas
>
>   On Mon, Sep 8, 2008 at 7:20 PM, Prof Brian Ripley <[EMAIL PROTECTED]
> > wrote:
>
>> On Mon, 8 Sep 2008, Duncan Murdoch wrote:
>>
>> On 08/09/2008 6:56 AM, Prof Brian Ripley wrote:
>>>
 On Mon, 8 Sep 2008, Prof Brian Ripley wrote:

 This reflects a problem in your locale (traditional Chinese): we cannot
> reproduce it.  Try running R in a different locale (e.g. append LC_ALL=en 
> to
> the target when you start R).
>

 Maybe I have found this as a bug in iconv.  Please try a version of
 R-patched with svn revision 46507 or later.

>>>
>>> Unfortunately, something stopped the daily builds of R-patched on
>>> Saturday, and I haven't been in to the office yet to fix things.  So it's
>>> likely to be tomorrow before the Windows build of r46507 or later is
>>> available on CRAN.
>>>
>>
>> I only found r46507 this morning, as a side effect of something else.  So
>> it would not be in a build until tomorrow.
>>
>>
>>
>>
>>> Duncan Murdoch
>>>
>>>
 On Sun, 7 Sep 2008, Thomas Lo wrote:
>
> Dear all,
>>
>> I encountered a problem on starting and using the R v  2.7.2
>> installation on
>> my PC running Windows Vista and would appreciate your help.
>>
>> When R was first started, the Rgui returned several error messages:
>>
>> Error in structure(.Internal(Sys.getenv(as.character(x),
>> as.character(unset)$   unsupported conversion
>> Error in file.exists(name) : unsupported conversion in
>> 'filenameToWchar'
>>
>> In addition, a dialog box called 'Information' popped up with the
>> following
>> message:
>>
>> Fatal error: unable to restore saved data in .RData
>>
>> On clicking 'OK', R closed immediately and the same thing occurs on
>> restarting R.
>>
>> After checking for previous related messages online, I followed one of
>> the
>> recommendations from before and appended --no-restore-data to the R
>> shorcut
>> target line.  After that, R could start without the 'fatal error'.
>> However,
>> some functions such as 'help' and 'setwd' do not work:
>>
>> e.g. >help()
>> Error: could not find function "help"
>>
>> setwd("DirName")
>>>
>> Error in setwd("DirName") : unsupported conversion in
>> 'filenameToWchar'
>> I then typed 'Sys.getlocale()' and got this:
>>
>> Sys.getlocale()
>>>
>> [1] "LC_COLLATE=Chinese (Traditional)_Hong Kong
>> S.A.R..950;LC_CTYPE=Chinese
>> (Traditional)_Hong Kong S.A.R..950;LC_MONETARY=Chinese
>> (Traditional)_Hong
>> Kong S.A.R..950;LC_NUMERIC=C;LC_TIME=Chinese (Traditional)_Hong Kong
>> S.A.R..950"
>> Setting LC_ALL=en in the shortcut target does not appear to work in
>> this
>> case as I got
>>
>> During startup - Warning message:
>> Setting LC_CTYPE=en failed
>>
>> Furthermore, I tried the patched version of R 2.7.2 and the same
>> problem
>> occurs.
>>
>> I would be very grateful if anybody could help.  Many thx.
>>
>> Thomas
>>
>>[[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
>
>

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

[[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] test for a single variance

2008-09-09 Thread Ben Bolker
Edna Bell  gmail.com> writes:

> 
> Dear R Gurus:
> 
> Is there a test for a single variance available in R, please?
> 
> Thanks,
> Edna Bell
> 

  Do you mean a test for homogeneity of variance?
If so, try RSiteSearch("variance homogeneity")
and see what you get ...

   Ben Bolker

__
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] NMDS and varimax rotation

2008-09-09 Thread William Revelle

At 9:54 PM +0200 9/9/08, Bernd Panassiti wrote:

hello,

subsequently to a NMDS analysis (performed with metaMDS or isoMDS) is
it possible to
rotate the axis through a varimax-rotation?

Thanks in advance.

Bernd Panassiti



Bernd,


Yes.  The output of isoMDS is an object with points and stress.

consider the following example:

 test.data <- Harman74.cor$cov  #twenty four mental measurements
 harm.dist <- sqrt(2*(1- test.data) )  #convert correlations to distances
harm.iso <- isoMDS(harm.dist,k=2)  # find the multidimensional solution
harm.varimax <- varimax(harm.iso$points) #rotate with varimax
op <- par(mfrow=c(1,2))
plot(harm.iso$points, main="unrotated")
plot(harm.varimax$loadings,main="rotated")

Bill





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



--
William Revelle http://personality-project.org/revelle.html
Professor   http://personality-project.org/personality.html
Department of Psychology http://www.wcas.northwestern.edu/psych/
Northwestern University http://www.northwestern.edu/
Use R for psychology   http://personality-project.org/r

__
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] bootstrapping - number of items to replace is not a multiple of replacement length

2008-09-09 Thread Gabriela Bucini
Hello,

I'm new to boostrapping and I'd need some help to understand the error
message that pops up when I run my script.

I have a data.frame with 73 lines and 21 column.
I am running a stepwise regression to find the best model using the R
function "step".
I apply bootstrapping to obtain model coefficients.
This is my script:

# "datare80" is the name of the data.frame and "woodycover" is the response
variable
theta <- function(datare80, indices) {
 d <- datare80[indices, ]# allows boot to select subsample
datasets
 full <- lm(d$woodycover~ ., data= d )
 lmbroadst <- step(full, data=d , direction = "both", k=2,
trace=0)
 coefficients(lmbroadst)  # return coef. vector
  }
resb <- boot(data = datare80, statistic = theta, R=1000)



When I run it, I get these two messages:
If I omit the last line "coefficients(lmbroadst)" in the function
definition, I get :
"Error in t.star[r, ] <- statistic(data, i[r, ], ...) :
incorrect number of subscripts on matrix"
If I have the last line "coefficients(lmbroadst)", then I get:
"Error in t.star[r, ] <- statistic(data, i[r, ], ...) :
number of items to replace is not a multiple of replacement length"


Thank you very much for any help!

Gabriela

__
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] Genmod in SAS vs. glm in R

2008-09-09 Thread Rolf Turner


For one thing your call to glm() is wrong --- didn't you notice the
warning messages about ``non-integer #successes in a binomial glm!''?

You need to do either:

glm(r/k ~ x, family=binomial(link='cloglog'), data=bin_data,  
offset=log(y), weights=k)


or:

glm(cbind(r,k-r) ~ x, family=binomial(link='cloglog'), data=bin_data,  
offset=log(y))


You get the same answer with either, but this answer still does not  
agree with your
SAS results.  Perhaps you have an error in your SAS syntax as well.   
I wouldn't know.


cheers,

Rolf Turner


On 10/09/2008, at 10:37 AM, sandsky wrote:



Hello,

I have different results from these two softwares for a simple  
binomial GLM

problem.

From Genmod in SAS: LogLikelihood=-4.75, coeff(intercept)=-3.59,

coeff(x)=0.95
From glm in R: LogLikelihood=-0.94, coeff(intercept)=-3.99, coeff 
(x)=1.36


Is there anyone tell me what I did wrong?

Here are the code and results,

1) SAS Genmod:

% r: # of failure
% k: size of a risk set

data bin_data;
input r k y x;
os=log(y);
cards;
1   3   5   0.5
0   2   5   0.5
0   2   4   1.0
1   2   4   1.0
;
proc genmod data=nelson;
model r/k = x / dist = binomial link =cloglog   offset 
= os ;

 

Log Likelihood   -4.7514

ParameterDFEstimate   Error   Limits
SquarePr > ChiSq

Intercept 1 -3.6652  1.9875 -7.5605  0.2302
3.400.0652
x1  0.8926  2.4900 -3.9877  5.7728
0.130.7200
Scale  0  1.  0.  1.  1.



2) glm in R

bin_data <-
data.frame(cbind(y=c(5,5,4,4),r=c(1,0,0,1),k=c(3,2,2,2),x=c 
(0.5,0.5,1.0,1.0)))
glm(r/k ~ x, family=binomial(link='cloglog'), data=bin_data,  
offset=log(y))


 
Coefficients:
(Intercept)x
-3.9911.358

'log Lik.' -0.9400073 (df=2)


##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
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] probably easy methods question

2008-09-09 Thread David Scott

On Tue, 9 Sep 2008, Edna Bell wrote:


Dear R Gurus:
I want to look at the code for the t.test function.  I did the following:


t.test

function (x, ...)
UseMethod("t.test")


getAnywhere("t.test")

A single object matching 't.test' was found
It was found in the following places
 package:stats
 registered S3 method for t from namespace stats
 namespace:stats
with value

function (x, ...)
UseMethod("t.test")


methods("t.test")

[1] t.test.default* t.test.formula*

  Non-visible functions are asterisked




Ok. Now what, please?  I'm sure it's really simple.

Thanks,
Edna Bell



getAnywhere(t.test.default)

David Scott


_
David Scott Department of Statistics, Tamaki Campus
The University of Auckland, PB 92019
Auckland 1142,NEW ZEALAND
Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000
Email:  [EMAIL PROTECTED]

Graduate Officer, Department of Statistics
Director of Consulting, Department of Statistics

__
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] probably easy methods question

2008-09-09 Thread Edna Bell
Dear R Gurus:
I want to look at the code for the t.test function.  I did the following:

> t.test
function (x, ...)
UseMethod("t.test")

> getAnywhere("t.test")
A single object matching 't.test' was found
It was found in the following places
  package:stats
  registered S3 method for t from namespace stats
  namespace:stats
with value

function (x, ...)
UseMethod("t.test")

> methods("t.test")
[1] t.test.default* t.test.formula*

   Non-visible functions are asterisked
>

Ok. Now what, please?  I'm sure it's really simple.

Thanks,
Edna Bell

__
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] Genmod in SAS vs. glm in R

2008-09-09 Thread sandsky

Hello,

I have different results from these two softwares for a simple binomial GLM
problem. 
>From Genmod in SAS: LogLikelihood=-4.75, coeff(intercept)=-3.59,
coeff(x)=0.95
>From glm in R: LogLikelihood=-0.94, coeff(intercept)=-3.99, coeff(x)=1.36

Is there anyone tell me what I did wrong?

Here are the code and results,

1) SAS Genmod:

% r: # of failure
% k: size of a risk set

data bin_data;
input r k y x;
os=log(y);
cards;
1   3   5   0.5
0   2   5   0.5
0   2   4   1.0
1   2   4   1.0
;
proc genmod data=nelson;
model r/k = x / dist = binomial link =cloglog   offset 
= os ;

 

Log Likelihood   -4.7514

ParameterDFEstimate   Error   Limits   
SquarePr > ChiSq

Intercept 1 -3.6652  1.9875 -7.5605  0.2302  
3.400.0652
x1  0.8926  2.4900 -3.9877  5.7728  
0.130.7200
Scale  0  1.  0.  1.  1.



2) glm in R

bin_data <-
data.frame(cbind(y=c(5,5,4,4),r=c(1,0,0,1),k=c(3,2,2,2),x=c(0.5,0.5,1.0,1.0)))
glm(r/k ~ x, family=binomial(link='cloglog'), data=bin_data, offset=log(y))

 
Coefficients:
(Intercept)x  
-3.9911.358 

'log Lik.' -0.9400073 (df=2)
-- 
View this message in context: 
http://www.nabble.com/Genmod-in-SAS-vs.-glm-in-R-tp19402751p19402751.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] fBasics package: dnig

2008-09-09 Thread Rajdeep Das
Hi,

I am trying to calculate probability density of normal inverse gaussian 
distribution. I am using dnig function of fBasics package. However, I am 
getting following result. The density at x = 0.003042866 is:

> dnig(x= 0.003042866, alpha=5.184868, beta= 0.11841, delta= 0.06038513, mu= 
> -0.0003520626)
[1] 6.550251 


I am not sure why it is 6.550251. Can anyone tell me why density is more than 
1?  Thank you for your time.

--Raj

__
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] Package installation in Windows

2008-09-09 Thread boxyzzy
As a sys admin, how do I install packages so that there is one common
library for all users of the MS Windows computer, instead of the
default individual location for each user?

I've done this for Linux.

Thanks, in advance, for your help.

Mike

__
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 member with question on multiple comparisons in mixed effects models

2008-09-09 Thread Giuliano Matessi
Dear fellow R.users/.lovers,
 
I am very new to both R and this list, so I hope you will be patient with me in 
the beginning if my enquiries are inappropriate/unclear.
 
I am trying to perform some rather complex statistical modelling using 
mixed-effects models.
 
I have, after a rather difficult beginning, finally boiled down my model (using 
the lme function in nlme) to a couple of fixed effects and their interactions, 
plus a couple of nested random effects. 
 
For the moment I will not include the details because the dataset is rather 
large and without it is difficult to be more specific, but I can provide them 
if requested.
 
My question is maybe a bit trivial, but I would like to get out of the model 
the pairwise comparisons for all the factor levels using TukeyHSD, but when I 
try to do this using the "glht" method in the multcomp library I get an error 
message which seems to indicate a wrong synthax, yet I think I am following the 
instructions given on the package documentation. Below are the code lines and 
the R reply.
 
> glht(inner.exch.M9.lme,linfct=mcp(Personality:Day = "Tukey"))
Error: unexpected '=' in "glht(inner.exch.M9.lme,linfct=mcp(Personality:Day ="

(inner.exch.M9.lme is the model object, Personality and Day are the two fixed 
factors the levels of which I want to compare)
 
I also tried without the interaction symbol and only one factor, with the same 
result.
 
As I understand it, the multcomp package is new so maybe the method is not 
implemented for complex designs yet.
 
Any suggestion will be appreciated (including such as "read the instructions" 
if they can point me to such instructions!).
 
 
Thank you very much in advance and all the best
 
Giuliano
 
 
 

__
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] test for a single variance

2008-09-09 Thread Edna Bell
Dear R Gurus:

Is there a test for a single variance available in R, please?

Thanks,
Edna Bell

__
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] "figure margins too large" issue

2008-09-09 Thread Hui-Yi Chu
Hi everyone,

I updated R from 2.6.2 to 2.7.2 recently but keep getting the error "figure
margins too large" when plot pictures which never happened to me when using
2.6.2. After googling and searching the mailing list, I still have no idea
how to optimize it. One of my packages fixed bugs in 2.7.2 version, so that
I have to use it. Any suggestions are really appreciated!!!

Best regards,
Hui-Yi Chu

[[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] Modality Test

2008-09-09 Thread Bert Gunter
Here is a function that tests for equality of however many distributions as
you like:

equaldist <- function(...){
## ... numeric sample vectors from the possibly different distributions to
be tested
## returns TRUE only if the distributions are the same
FALSE
}

;-)

-- Bert Gunter
Genentech 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Mark Difford
Sent: Tuesday, September 09, 2008 1:23 PM
To: r-help@r-project.org
Subject: Re: [R] Modality Test


Hi Amin,

And I have just remembered that there is a function called curveRep in Frank
Harrell's Hmisc package that might be useful, even if not quite in the
channel of your enquiry. curveRep was added to the package after my
struggles, so I never used it and so don't know how well it performs (quite
well, I would think).

Regards, Mark.


Amin W. Mugera wrote:
> 
> 
> Dear Readers:
> 
> I have two issues in nonparametric statistical analysis that i need
> help:
> 
> First, does R have a package that can implement the multimodality test,
> e.g., the Silverman test, DIP test, MAP test or Runt test. I have seen
> an earlier thread (sometime in 2003) where someone was trying to write
> a code for the Silverman test of multimodality. Is there any other
> tests that can enable me to know how many modes are in a distribution?
> 
> Second, i would like to test whether two distributions are equal. Does R
> have a  package than can implement the Li (1996) test of the equality
> of two distributions? Is there any other test i can use rather than the
> Li test?
> 
> Thank you in advance for your help.
> 
> Amin Mugera
> Graduate Student
> AgEcon Dept. Kansas State 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.
> 
> 

-- 
View this message in context:
http://www.nabble.com/Modality-Test-tp19396085p19400426.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-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] [R-pkgs] survey package

2008-09-09 Thread Thomas Lumley


Version 3.9 of the survey package is now on CRAN.  Since the last 
announcement (version 3.6-11, about a year ago) the main changes are
 - Database-backed survey objects: the data can live in a SQLite (or other 
DBI-compatible) database and be loaded as needed.

 - Ordinal logistic regression
 - Support for the 'mitools' package and multiply-imputed data
 - Conditioning plots, transparent scatterplots, survival and CDF plots.

There is more information on the package web page at
http://faculty.washington.edu/tlumley/survey/

-thomas

Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

__
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] naive variance in GEE

2008-09-09 Thread Thomas Lumley


Sorry, I misread your message. Prof Ripley is right, as usual -- the 
estimates use different stopping criteria and so are just numerically 
different.


-thomas

On Tue, 9 Sep 2008, Thomas Lumley wrote:


On Mon, 8 Sep 2008, Qiong Yang wrote:


Hi,

The standard error from logistic regression is slightly different from the 
naive SE from GEE under independence working correlation structure.


Yes


Shouldn't they be identical? Anyone has insight about this?


No, they shouldn't. They are different estimators of the same quantity, like 
the mean and median of a symmetric distribution.


-thomas





Thanks,
Qiong

a<-rbinom(1000,1)
b<-rbinom(1000,2,0.1)
c<-rbinom(1000,10,0.5)
summary(gee(a~b, id=c,family="binomial",corstr="independence"))$coef
summary(glm(a~b,family="binomial"))

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



Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle



Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

__
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] naive variance in GEE

2008-09-09 Thread Thomas Lumley

On Mon, 8 Sep 2008, Qiong Yang wrote:


Hi,

The standard error from logistic regression is slightly different from the 
naive SE from GEE under independence working correlation structure.


Yes


Shouldn't they be identical? Anyone has insight about this?


No, they shouldn't. They are different estimators of the same quantity, 
like the mean and median of a symmetric distribution.


-thomas





Thanks,
Qiong

a<-rbinom(1000,1)
b<-rbinom(1000,2,0.1)
c<-rbinom(1000,10,0.5)
summary(gee(a~b, id=c,family="binomial",corstr="independence"))$coef
summary(glm(a~b,family="binomial"))

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



Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

__
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] Binning

2008-09-09 Thread jim holtman
This should do what you want.

#--x <- read.table('clipboard', header=TRUE, as.is=TRUE)
# convert dates
x$date <- as.POSIXct(strptime(x$SampleDate, "%m/%d/%Y"))
# put ForkLength into bins
x$bins <- cut(x$ForkLength, breaks=c(32, 34, 37, 40), include.lowest=TRUE)
# count the bins
tapply(x$Count, x$bins, sum)
# plot the data
plot(x$date, x$ForkLength, col=c('green', 'red', 'orange')[x$bins])






On Tue, Sep 9, 2008 at 3:12 PM, Felipe Carrillo
<[EMAIL PROTECTED]> wrote:
> Dear List:
> I have a dataset with over 5000 records and I would like to put the Count in 
> bins
>  based on the ForkLength. e.g.
>  Forklength   Count
> 32-34?
> 35-37?
> 38-40?
> and so on...
> and lastly I would like to plot (scatterplot) including the SampleDate
> along the X axis and ForkLength along the Y axis. I recently saw an
>  example similar to this one here but I don't want a histogram I  
> just want to see the ForkLength ranges with different colors. For example:
>  ForkLength 32-34---green
>  ForkLength 35-37---red
>  ForkLength 38-40--Orange
>  Thanks in advance
>
>  SampleDate   ForkLength Count
> 112/4/2007 32 2
> 212/6/2007 33 1
> 312/7/2007 33 2
> 412/7/2007 33 2
> 512/7/2007 34 1
> 612/9/2007 31 1
> 712/9/2007 33 2
> 8   12/10/2007 33 5
> 9   12/10/2007 34 1
> 10  12/11/2007 33 2
> 11  12/15/2007 34 1
> 12  12/16/2007 33 2
> 13  12/17/2007 35 1
> 14  12/19/2007 33 1
> 15  12/19/2007 35 1
> 16  12/20/2007 31 1
> 17  12/20/2007 32 1
> 18  12/20/2007 33 1
> 19  12/20/2007 34 3
> 20  12/21/2007 31 1
> 21  12/21/2007 32 3
> 22  12/21/2007 33 4
> 23  12/21/2007 3411
> 24  12/21/2007 3516
> 25  12/21/2007 36 3
> 26  12/21/2007 37 1
> 27  12/22/2007 32 1
> 28  12/22/2007 33 3
> 29  12/22/2007 34 1
> 30  12/22/2007 35 2
> 31  12/23/2007 32 1
> 32  12/23/2007 35 1
> 33  12/25/2007 32 1
> 34  12/25/2007 36 1
> 35  12/26/2007 34 1
> 36  12/26/2007 35 2
> 37  12/26/2007 36 1
> 38  12/27/2007 34 4
> 39  12/27/2007 35 2
> 40  12/27/2007 36 2
> 41  12/28/2007 32 1
> 42  12/28/2007 33 1
> 43  12/28/2007 34 1
> 44  12/28/2007 35 3
> 45  12/28/2007 36 4
> 46  12/28/2007 37 6
> 47  12/28/2007 38 2
> 48  12/28/2007 39 2
> 49  12/29/2007 34 1
> 50  12/29/2007 35 5
> 51  12/29/2007 36 2
> 52  12/29/2007 37 1
> 53  12/30/2007 33 3
> 54  12/30/2007 3410
> 55  12/30/2007 3510
> 56  12/30/2007 36 6
> 57  12/30/2007 3715
> 58  12/30/2007 38 3
> 59  12/31/2007 33 3
> 60  12/31/2007 34 8
> 61  12/31/2007 35 9
> 62  12/31/2007 36 6
> 63  12/31/2007 37 3
> 64  12/31/2007 38 1
> 651/1/2008 34 6
> 661/1/2008 35 6
> 671/1/2008 35 1
> 681/1/2008 36 6
> 691/1/2008 37 9
> 701/1/2008 38 1
> 711/2/2008 34 2
> 721/2/2008 34 1
> 731/2/2008 35 2
> 741/2/2008 36 2
> 751/2/2008 37 2
> 761/2/2008 39 1
> 771/3/2008 34 3
> 781/3/2008 35 3
> 791/3/2008 36 2
> 801/3/2008 37 3
> 811/8/2008 32 1
> 821/8/2008 33 7
> 831/8/2008 34 6
> 841/8/2008 3510
> 851/8/2008 3616
> 861/8/2008 37 7
> 871/8/2008 38 1
> 881/8/2008 39 1
> 891/9/2008 33 1
> 901/9/2008 3420
> 911/9/2008 3549
> 921/9/2008 3649
> 931/9/2008 3739
> 941/9/2008 37 1
> 951/9/2008 3818
> 961/9/2008 39 1
> 971/9/2008 40 1
> 98   1/10/2008 32 3
> 99   1/10/2008 3313
> 100  1/10/2008 3456
> 101  1/10/2008 3533
> 102  1/10/2008 3624
> 103  1/10/2008 3718
> 104  1/10/2008 39 1
> 105  1/11/2008 33 7
> 106  1/11/2008 3446
> 107  1/11/2008 3541
> 108  1/11/2008 3628
> 109  1/11/2008 3729
>
> Felipe D. Carrillo
> Supervisory Fishery Biologist
> Department of the Interior
> US Fish & Wildlife Service
> Cali

Re: [R] Help with 'spectrum'

2008-09-09 Thread Prof Brian Ripley
This is why some help pages have references: please use them (Venables & 
Ripley explain the exact formulae used in R).


On Tue, 9 Sep 2008, [EMAIL PROTECTED] wrote:


For the command 'spectrum' I read:

The spectrum here is defined with scaling 1/frequency(x), following 
S-PLUS. This makes the spectral density a density over the range 
(-frequency(x)/2, +frequency(x)/2], whereas a more common scaling is 2π 
and range (-0.5, 0.5] (e.g., Bloomfield) or 1 and range (-π, π].



Forgive my ignorance but I am having a hard time interpreting this. Does 
this mean that in the spectrum output every element of the $spec array 
is scaled by 1/frequency(x)? I am having a hard time determing what is 
meant by 'frequency'.


So please do look up the help for frequency().

 Say I define a time series for a year with samples 
for every day. I input a 'frequency' of 365 (which in my mind is the 
period).


The point is that your time unit is 1 year, and your measurements are 
every 1/365 year.  That is unrelated to the 'period' (no one mentioned 
periodicity yet).


On the output of 'spectrum' would this mean that every element 
of the $spec array is scaled by 1/365? There is a corresponding 
frequency array on the output from 'spectrum'. If the frequency is 365 
and an element in the frequency array output from 'spectrum' is .1 am I 
to assume that the period is 36.5 and a corresponding sin wave would be 
sin(2 * pi * 36.5/365)?


Hmm, you need a 't' in there (and a phase).  The issue is the units for t. 
A frequency in the 'freq' element of the output of 0.1 corresponds to 10 
cycles per unit of time, and in your example the unit of time is 365 
observations.  So the sine (sic) wave is sin(2*pi*0.1*t + phi), where the 
increments in 't' are 1/365: that gives 10 complete cycles in observations 
at, say, c(1990, 1) ... c(1990, 365), the days of 1990 (not a leap year).



Thank you in advance for helping me clear up some confusion.

Kevin


--
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] splitting time vector into days

2008-09-09 Thread jim holtman
Here is one way of doing it:

> x <- data.frame(dates=seq(as.POSIXct('2008-09-08'), by='7 hours', length=10),
+ values=1:10)
> # split into days
> x.s <- split(x, format(x$dates, "%Y%m%d"))
> x.s
$`20080908`
dates values
1 2008-09-08 00:00:00  1
2 2008-09-08 07:00:00  2
3 2008-09-08 14:00:00  3
4 2008-09-08 21:00:00  4

$`20080909`
dates values
5 2008-09-09 04:00:00  5
6 2008-09-09 11:00:00  6
7 2008-09-09 18:00:00  7

$`20080910`
 dates values
8  2008-09-10 01:00:00  8
9  2008-09-10 08:00:00  9
10 2008-09-10 15:00:00 10

> lapply(x.s, function(.df) mean(.df$values))
$`20080908`
[1] 2.5

$`20080909`
[1] 6

$`20080910`
[1] 9

>


On Tue, Sep 9, 2008 at 3:25 PM, Alexy Khrabrov <[EMAIL PROTECTED]> wrote:
> Greetings -- I have a dataframe a with one element a vector, time, of
> POSIXct values.  What's a good way to split the data frame into periods of
> a$time, e.g. days, and apply a function, e.g. mean, to some other column of
> the dataframe, e.g. a$value?
>
> Cheers,
> Alexy
>
> __
> 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 that 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] building a package that contains S4 classes and methods

2008-09-09 Thread Marie Pierre Sylvestre
Hello R users,

I am trying to make a my first package and I get an error that I can
understand. The package is build out of three files (one for functions, 1
for s4 classes and 1 for s4 methods).

Once I source them I run 

package.skeleton( name="TDC" )

within a R session and I get 

Creating directories ...
Creating DESCRIPTION ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in './TDC/Read-and-delete-me'.
Warning messages:
1: In dump(internalObjs, file = file.path(code_dir,
sprintf("%s-internal.R",  :
  deparse of an S4 object will not be source()able
2: In dump(internalObjs, file = file.path(code_dir,
sprintf("%s-internal.R",  :
  deparse of an S4 object will not be source()able
3: In dump(internalObjs, file = file.path(code_dir,
sprintf("%s-internal.R",  :
  deparse of an S4 object will not be source()able
4: In dump(internalObjs, file = file.path(code_dir,
sprintf("%s-internal.R",  :
  deparse may be incomplete


I keep going in spite of the warnings with 
R CMD check --no-examples TDC

and I get 
* checking for working pdflatex ... OK
* using log directory
'/home/mariepierre/Packages/PermAlgo/PermAlgo/PermAlgo2/TDC.Rcheck'
* using R version 2.7.1 (2008-06-23)
* using session charset: UTF-8
* checking for file 'TDC/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'TDC' version '1.0'
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking whether package 'TDC' can be installed ... ERROR
Installation failed.

The error file says:
 
* Installing *source* package 'TDC' ...
** R
** preparing package for lazy loading
Error in parse(n = -1, file = file) : unexpected '<' at
102: `.__C__BindArgs` <-
103: <
Calls:  -> code2LazyLoadDB -> sys.source -> parse
Execution halted
ERROR: lazy loading failed for package 'TDC'
** Removing
'/home/mariepierre/Packages/PermAlgo/PermAlgo/PermAlgo2/TDC.Rcheck/TDC'

The problem is with my classes and methods. The respective files contain:

setClass("BindArgs",  signature( "function" ))
setClass("BindArgs2", signature( "function" )) 

and

setMethod("initialize", "BindArgs", function( .Object, f, ... )
  callNextMethod( .Object, function( x ) f( x, ... ) )) 

setMethod("initialize", "BindArgs2", function( .Object, f, ...)
  callNextMethod( .Object, function( x, y ) f( x, y, ... ) )) 

Everything works well within a R session but I can build the package.

If I look at the internal R file that this created I get

`.__C__BindArgs` <-

`.__C__BindArgs2` <-

`.__M__initialize:methods` <-

`.__T__initialize:methods` <-


Well, let just say that I am new to classes so this confuses me greatly. I
have checked the documentation and tried a few things but I reached my
personal limits!

I am using R 2.7.1 on Linux Fedora 8.

Any comments on what is happening and/or help would be greatly appreciated.

MP

__
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] NMDS and varimax rotation

2008-09-09 Thread stephen sefick
have you looked at the vegan viginette- I know there is proscrutes rotation.

On Tue, Sep 9, 2008 at 3:54 PM, Bernd Panassiti
<[EMAIL PROTECTED]> wrote:
> hello,
>
> subsequently to a NMDS analysis (performed with metaMDS or isoMDS) is
> it possible to
> rotate the axis through a varimax-rotation?
>
> Thanks in advance.
>
> Bernd Panassiti
>
> __
> 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.
>



-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods. We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
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] splitting time vector into days

2008-09-09 Thread stephen sefick
?aggregate
?window.zoo
?rollapply

anyway have a look at package zoo

On Tue, Sep 9, 2008 at 3:25 PM, Alexy Khrabrov <[EMAIL PROTECTED]> wrote:
> Greetings -- I have a dataframe a with one element a vector, time, of
> POSIXct values.  What's a good way to split the data frame into periods of
> a$time, e.g. days, and apply a function, e.g. mean, to some other column of
> the dataframe, e.g. a$value?
>
> Cheers,
> Alexy
>
> __
> 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.
>



-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods. We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
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] tsdiag error

2008-09-09 Thread rkevinburton
Does anyone know why I get the following error when trying tsdiag?

Error in UseMethod("tsdiag") : no applicable method for "tsdiag"

I am invoking it as: tsdiag(mar).

Thank you.

Kevin

__
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] csaps in R?

2008-09-09 Thread Dr Carbon
Is there is function in R equivalent to Matlab's csaps? I need a
spline function with the same calculation of the smoothing parameter
in csaps to compare some results. AFAIK, the spar in smooth.spline is
related but not the same.

__
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] NMDS and varimax rotation

2008-09-09 Thread Bernd Panassiti
hello,

subsequently to a NMDS analysis (performed with metaMDS or isoMDS) is 
it possible to 
rotate the axis through a varimax-rotation?

Thanks in advance.

Bernd Panassiti

__
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] Modality Test

2008-09-09 Thread Mark Difford

Hi Amin,

And I have just remembered that there is a function called curveRep in Frank
Harrell's Hmisc package that might be useful, even if not quite in the
channel of your enquiry. curveRep was added to the package after my
struggles, so I never used it and so don't know how well it performs (quite
well, I would think).

Regards, Mark.


Amin W. Mugera wrote:
> 
> 
> Dear Readers:
> 
> I have two issues in nonparametric statistical analysis that i need
> help:
> 
> First, does R have a package that can implement the multimodality test,
> e.g., the Silverman test, DIP test, MAP test or Runt test. I have seen
> an earlier thread (sometime in 2003) where someone was trying to write
> a code for the Silverman test of multimodality. Is there any other
> tests that can enable me to know how many modes are in a distribution?
> 
> Second, i would like to test whether two distributions are equal. Does R
> have a  package than can implement the Li (1996) test of the equality
> of two distributions? Is there any other test i can use rather than the
> Li test?
> 
> Thank you in advance for your help.
> 
> Amin Mugera
> Graduate Student
> AgEcon Dept. Kansas State 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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Modality-Test-tp19396085p19400426.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.


Re: [R] Information on the number of CPU's

2008-09-09 Thread Luke Tierney

The wmic command line utility can also be used to query this; on a
dual-core Vista laptop I get

C:\Users\luke>wmic cpu get NumberOfCores,NumberOfLogicalProcessors
NumberOfCores  NumberOfLogicalProcessors
2  2

luke

--

Luke Tierney
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
   Actuarial Science
241 Schaeffer Hall  email:  [EMAIL PROTECTED]
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu

On Tue, 9 Sep 2008, [EMAIL PROTECTED] wrote:


Many thanks, that's very helpful.
Regards,
Tolga


- Original Message -
From: Prof Brian Ripley [EMAIL PROTECTED]
Sent: 09/09/2008 20:57 CET
To: Tolga Uzuner
Cc: r-help@r-project.org
Subject: Re: [R] Information on the number of CPU's



On Tue, 9 Sep 2008, [EMAIL PROTECTED] wrote:


Dear R Users,
I am on Windows XP SP2 platform, using R version 2.7.2 . I was wondering
if there is a way to find out, within R, the number of CPU's on my machine
? I would use this information to set the number of nodes in a cluster,
depending on the machine. Sys.info() and .Platform do not carry this
information.


Correct, since

a) R does not make use of more than 1.

b) It is really not portable, and not even well-defined.  (How many CPUs has 
a hyperthreaded dual Xeon?  Some say 2, some say 4.  Do you want CPUs or 
cores?  If this is a virtualized OS, is the physical number or the logical 
number?)


In the case of Windows, how depends on the Windows version.  The w32api (XP 
or later) call GetNativeSystemInfo will tell you the number of CPUs, for some 
(unstated) definition of 'CPU'.  Later versions have 
GetLogicalProcessorInformation, which can give the number of cores.



Thanks in advance,
Tolga Uzuner


--
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
Generally, this communication is for informational purposes only
and it is not intended as an offer or solicitation for the purchase
or sale of any financial instrument or as an official confirmation
of any transaction. In the event you are receiving the offering
materials attached below related to your interest in hedge funds or
private equity, this communication may be intended as an offer or
solicitation for the purchase or sale of such fund(s).  All market
prices, data and other information are not warranted as to
completeness or accuracy and are subject to change without notice.
Any comments or statements made herein do not necessarily reflect
those of JPMorgan Chase & Co., its subsidiaries and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.
Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to UK legal entities.

__
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] Modality Test

2008-09-09 Thread Mark Difford

Whoops! I think that should be Stuetzle --- though I very much doubt that he
reads the list.


Mark Difford wrote:
> 
> Hi Amin,
> 
>>> First, does R have a package that can implement the multimodality test, 
>>> e.g., the Silverman test, DIP test, MAP test or Runt test.
> 
> Jeremy Tantrum (a Ph.D. student of Werner Steutzle's, c. 2003/04) did some
> work on this. There is some useful code on Steutzle's website:
> 
> http://www.stat.washington.edu/wxs/Stat593-s03/Code/jeremy-unimodality.R
> 
> I used it last year when I was trying to solve the problem of how best to
> compare lots of density curves (age distributions of 3 spp. of tree
> euphorbias from about very different 35 sites). In particular I had to
> ensure that I wasn't creating spurious bimodality at a particular age
> range when combining sites.
> 
> You might find it useful. Feel free to contact me off list if the code has
> gone, as I think I still have it (somewhere).
> 
> Regards, Mark.
> 
> 
> Amin W. Mugera wrote:
>> 
>> 
>> Dear Readers:
>> 
>> I have two issues in nonparametric statistical analysis that i need
>> help:
>> 
>> First, does R have a package that can implement the multimodality test,
>> e.g., the Silverman test, DIP test, MAP test or Runt test. I have seen
>> an earlier thread (sometime in 2003) where someone was trying to write
>> a code for the Silverman test of multimodality. Is there any other
>> tests that can enable me to know how many modes are in a distribution?
>> 
>> Second, i would like to test whether two distributions are equal. Does R
>> have a  package than can implement the Li (1996) test of the equality
>> of two distributions? Is there any other test i can use rather than the
>> Li test?
>> 
>> Thank you in advance for your help.
>> 
>> Amin Mugera
>> Graduate Student
>> AgEcon Dept. Kansas State 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.
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Modality-Test-tp19396085p19400138.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.


Re: [R] Modality Test

2008-09-09 Thread Mark Difford

Hi Amin,

>> First, does R have a package that can implement the multimodality test, 
>> e.g., the Silverman test, DIP test, MAP test or Runt test.

Jeremy Tantrum (a Ph.D. student of Werner Steutzle's, c. 2003/04) did some
work on this. There is some useful code on Steutzle's website:

http://www.stat.washington.edu/wxs/Stat593-s03/Code/jeremy-unimodality.R

I used it last year when I was trying to solve the problem of how best to
compare lots of density curves (age distributions of 3 spp. of tree
euphorbias from about very different 35 sites). In particular I had to
ensure that I wasn't creating spurious bimodality at a particular age range
when combining sites.

You might find it useful. Feel free to contact me off list if the code has
gone, as I think I still have it (somewhere).

Regards, Mark.


Amin W. Mugera wrote:
> 
> 
> Dear Readers:
> 
> I have two issues in nonparametric statistical analysis that i need
> help:
> 
> First, does R have a package that can implement the multimodality test,
> e.g., the Silverman test, DIP test, MAP test or Runt test. I have seen
> an earlier thread (sometime in 2003) where someone was trying to write
> a code for the Silverman test of multimodality. Is there any other
> tests that can enable me to know how many modes are in a distribution?
> 
> Second, i would like to test whether two distributions are equal. Does R
> have a  package than can implement the Li (1996) test of the equality
> of two distributions? Is there any other test i can use rather than the
> Li test?
> 
> Thank you in advance for your help.
> 
> Amin Mugera
> Graduate Student
> AgEcon Dept. Kansas State 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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Modality-Test-tp19396085p19400095.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.


Re: [R] Information on the number of CPU's

2008-09-09 Thread tolga . i . uzuner

Many thanks, that's very helpful.
Regards,
Tolga


- Original Message -
From: Prof Brian Ripley [EMAIL PROTECTED]
Sent: 09/09/2008 20:57 CET
To: Tolga Uzuner
Cc: r-help@r-project.org
Subject: Re: [R] Information on the number of CPU's



On Tue, 9 Sep 2008, [EMAIL PROTECTED] wrote:


Dear R Users,
I am on Windows XP SP2 platform, using R version 2.7.2 . I was wondering
if there is a way to find out, within R, the number of CPU's on my machine
? I would use this information to set the number of nodes in a cluster,
depending on the machine. Sys.info() and .Platform do not carry this
information.


Correct, since

a) R does not make use of more than 1.

b) It is really not portable, and not even well-defined.  (How many CPUs 
has a hyperthreaded dual Xeon?  Some say 2, some say 4.  Do you want 
CPUs or cores?  If this is a virtualized OS, is the physical number or the 
logical number?)


In the case of Windows, how depends on the Windows version.  The w32api 
(XP or later) call GetNativeSystemInfo will tell you the number of CPUs, 
for some (unstated) definition of 'CPU'.  Later versions have 
GetLogicalProcessorInformation, which can give the number of cores.



Thanks in advance,
Tolga Uzuner


--
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
Generally, this communication is for informational purposes only
and it is not intended as an offer or solicitation for the purchase
or sale of any financial instrument or as an official confirmation
of any transaction. In the event you are receiving the offering
materials attached below related to your interest in hedge funds or
private equity, this communication may be intended as an offer or
solicitation for the purchase or sale of such fund(s).  All market
prices, data and other information are not warranted as to
completeness or accuracy and are subject to change without notice.
Any comments or statements made herein do not necessarily reflect
those of JPMorgan Chase & Co., its subsidiaries and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.
Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to UK legal entities.

__
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] Information on the number of CPU's

2008-09-09 Thread Prof Brian Ripley

On Tue, 9 Sep 2008, [EMAIL PROTECTED] wrote:


Dear R Users,
I am on Windows XP SP2 platform, using R version 2.7.2 . I was wondering
if there is a way to find out, within R, the number of CPU's on my machine
? I would use this information to set the number of nodes in a cluster,
depending on the machine. Sys.info() and .Platform do not carry this
information.


Correct, since

a) R does not make use of more than 1.

b) It is really not portable, and not even well-defined.  (How many CPUs 
has a hyperthreaded dual Xeon?  Some say 2, some say 4.  Do you want 
CPUs or cores?  If this is a virtualized OS, is the physical number or the 
logical number?)


In the case of Windows, how depends on the Windows version.  The w32api 
(XP or later) call GetNativeSystemInfo will tell you the number of CPUs, 
for some (unstated) definition of 'CPU'.  Later versions have 
GetLogicalProcessorInformation, which can give the number of cores.



Thanks in advance,
Tolga Uzuner


--
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] cluster/snow question

2008-09-09 Thread tolga . i . uzuner
Understood, that's what I'll do. I'm thinking of exporting the number of 
nodes to all nodes and passing in the node rank as 1:nonodes through 
clusterApply.
Thanks all,
Tolga




Luke Tierney <[EMAIL PROTECTED]> 
09/09/2008 20:11

To
[EMAIL PROTECTED]
cc
[EMAIL PROTECTED], r-help@r-project.org
Subject
Re: [R] cluster/snow question






On Tue, 9 Sep 2008, [EMAIL PROTECTED] wrote:

> Hi Markus,
>
> Many thanks. Is the "cluster" variable you mention below available in 
the
> environment of the nodes ? Specifically, within that environment, how
> could one identify the rank of that specific node ?

No -- that isn't the way snow works.  With snow the partitioning is
done on the master. If you need a node to know how many other nodes
there are or which index it represents in a clusterApply call then you
need to pass that information in the arguments.

luke

>
> My code would use that information to partition the problem.
>
> Thanks,
> Tolga
>
>
>
>
> Markus Schmidberger <[EMAIL PROTECTED]>
> 09/09/2008 07:11
> Please respond to
> [EMAIL PROTECTED]
>
>
> To
> [EMAIL PROTECTED]
> cc
> r-help@r-project.org
> Subject
> Re: [R] cluster/snow question
>
>
>
>
>
>
> Hi Tolga,
>
> in SNOW you have to start a cluster with the command
>
> > library(snow)
> > cluster <- makeCluster(#nodes)
>
> The object "cluster" is a list with an object for each node and each
> object again is a list with all informations (rank, comm, tags)
> The size of the cluster is the length of the list.
>
> > #nodes == length(cluster)
>
> E.g. the rank for node one you can get by
> > cluster[[1]]$rank
>
> Best
> Markus
>
> [EMAIL PROTECTED] schrieb:
>> Dear R Users,
>>
>> I am attempting to use the snow package for clustering. Is there a way
> to
>> identfy, in the environment of each node, a rank for that node and 
also,
>
>> the total size of the cluster ?
>>
>> By way of analogy, I am looking for the functions in snow equivalent to
>> mpi.comm.rank() and mpi.comm.size() from RMPI, in case that makes 
things
>
>> clearer.
>>
>> Thanks in advance,
>> Tolga
>>
>> Generally, this communication is for informational purposes only
>> and it is not intended as an offer or solicitation for the purchase
>> or sale of any financial instrument or as an official confirmation
>> of any transaction. In the event you are receiving the offering
>> materials attached below related to your interest in hedge funds or
>> private equity, this communication may be intended as an offer or
>> solicitation for the purchase or sale of such fund(s).  All market
>> prices, data and other information are not warranted as to
>> completeness or accuracy and are subject to change without notice.
>> Any comments or statements made herein do not necessarily reflect
>> those of JPMorgan Chase & Co., its subsidiaries and affiliates.
>>
>> This transmission may contain information that is privileged,
>> confidential, legally privileged, and/or exempt from disclosure
>> under applicable law. If you are not the intended recipient, you
>> are hereby notified that any disclosure, copying, distribution, or
>> use of the information contained herein (including any reliance
>> thereon) is STRICTLY PROHIBITED. Although this transmission and any
>> attachments are believed to be free of any virus or other defect
>> that might affect any computer system into which it is received and
>> opened, it is the responsibility of the recipient to ensure that it
>> is virus free and no responsibility is accepted by JPMorgan Chase &
>> Co., its subsidiaries and affiliates, as applicable, for any loss
>> or damage arising in any way from its use. If you received this
>> transmission in error, please immediately contact the sender and
>> destroy the material in its entirety, whether in electronic or hard
>> copy format. Thank you.
>> Please refer to http://www.jpmorgan.com/pages/disclosures for
>> disclosures relating to UK legal entities.
>>[[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.
>>
>
>
> --
> Dipl.-Tech. Math. Markus Schmidberger
>
> Ludwig-Maximilians-Universit?? M??chen
> IBE - Institut f?? medizinische Informationsverarbeitung,
> Biometrie und Epidemiologie
> Marchioninistr. 15, D-81377 Muenchen
> URL: http://ibe.web.med.uni-muenchen.de
> Mail: Markus.Schmidberger [at] ibe.med.uni-muenchen.de
> Tel: +49 (089) 7095 - 4599
>
>
>
>
>
> Generally, this communication is for informational purposes only
> and it is not intended as an offer or solicitation for the purchase
> or sale of any financial instrument or as an official confirmation
> of any transaction. In the event you are receiving the offering
> materials attached below related to your interest in hedge funds or
> private equity, this communicatio

[R] splitting time vector into days

2008-09-09 Thread Alexy Khrabrov
Greetings -- I have a dataframe a with one element a vector, time, of  
POSIXct values.  What's a good way to split the data frame into  
periods of a$time, e.g. days, and apply a function, e.g. mean, to some  
other column of the dataframe, e.g. a$value?


Cheers,
Alexy

__
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] Modality Test

2008-09-09 Thread roger koenker

the diptest package, perhaps?


url:www.econ.uiuc.edu/~rogerRoger Koenker
email[EMAIL PROTECTED]Department of Economics
vox: 217-333-4558University of Illinois
fax:   217-244-6678Champaign, IL 61820



On Sep 9, 2008, at 11:23 AM, Amin W. Mugera wrote:



Dear Readers:

I have two issues in nonparametric statistical analysis that i need
help:

First, does R have a package that can implement the multimodality  
test,

e.g., the Silverman test, DIP test, MAP test or Runt test. I have seen
an earlier thread (sometime in 2003) where someone was trying to write
a code for the Silverman test of multimodality. Is there any other
tests that can enable me to know how many modes are in a distribution?

Second, i would like to test whether two distributions are equal.  
Does R

have a  package than can implement the Li (1996) test of the equality
of two distributions? Is there any other test i can use rather than  
the

Li test?

Thank you in advance for your help.

Amin Mugera
Graduate Student
AgEcon Dept. Kansas State 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-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] cluster/snow question

2008-09-09 Thread Luke Tierney

On Tue, 9 Sep 2008, [EMAIL PROTECTED] wrote:


Hi Markus,

Many thanks. Is the "cluster" variable you mention below available in the
environment of the nodes ? Specifically, within that environment, how
could one identify the rank of that specific node ?


No -- that isn't the way snow works.  With snow the partitioning is
done on the master. If you need a node to know how many other nodes
there are or which index it represents in a clusterApply call then you
need to pass that information in the arguments.

luke



My code would use that information to partition the problem.

Thanks,
Tolga




Markus Schmidberger <[EMAIL PROTECTED]>
09/09/2008 07:11
Please respond to
[EMAIL PROTECTED]


To
[EMAIL PROTECTED]
cc
r-help@r-project.org
Subject
Re: [R] cluster/snow question






Hi Tolga,

in SNOW you have to start a cluster with the command

> library(snow)
> cluster <- makeCluster(#nodes)

The object "cluster" is a list with an object for each node and each
object again is a list with all informations (rank, comm, tags)
The size of the cluster is the length of the list.

> #nodes == length(cluster)

E.g. the rank for node one you can get by
> cluster[[1]]$rank

Best
Markus

[EMAIL PROTECTED] schrieb:

Dear R Users,

I am attempting to use the snow package for clustering. Is there a way

to

identfy, in the environment of each node, a rank for that node and also,



the total size of the cluster ?

By way of analogy, I am looking for the functions in snow equivalent to
mpi.comm.rank() and mpi.comm.size() from RMPI, in case that makes things



clearer.

Thanks in advance,
Tolga

Generally, this communication is for informational purposes only
and it is not intended as an offer or solicitation for the purchase
or sale of any financial instrument or as an official confirmation
of any transaction. In the event you are receiving the offering
materials attached below related to your interest in hedge funds or
private equity, this communication may be intended as an offer or
solicitation for the purchase or sale of such fund(s).  All market
prices, data and other information are not warranted as to
completeness or accuracy and are subject to change without notice.
Any comments or statements made herein do not necessarily reflect
those of JPMorgan Chase & Co., its subsidiaries and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.
Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to UK legal entities.
   [[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.




--
Dipl.-Tech. Math. Markus Schmidberger

Ludwig-Maximilians-Universit?? M??chen
IBE - Institut f?? medizinische Informationsverarbeitung,
Biometrie und Epidemiologie
Marchioninistr. 15, D-81377 Muenchen
URL: http://ibe.web.med.uni-muenchen.de
Mail: Markus.Schmidberger [at] ibe.med.uni-muenchen.de
Tel: +49 (089) 7095 - 4599





Generally, this communication is for informational purposes only
and it is not intended as an offer or solicitation for the purchase
or sale of any financial instrument or as an official confirmation
of any transaction. In the event you are receiving the offering
materials attached below related to your interest in hedge funds or
private equity, this communication may be intended as an offer or
solicitation for the purchase or sale of such fund(s).  All market
prices, data and other information are not warranted as to
completeness or accuracy and are subject to change without notice.
Any comments or statements made herein do not necessarily reflect
those of JPMorgan Chase & Co., its subsidiaries and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, 

[R] Binning

2008-09-09 Thread Felipe Carrillo
Dear List:
I have a dataset with over 5000 records and I would like to put the Count in 
bins
 based on the ForkLength. e.g.
  Forklength   Count
 32-34?
 35-37?
 38-40?
 and so on...
 and lastly I would like to plot (scatterplot) including the SampleDate
 along the X axis and ForkLength along the Y axis. I recently saw an
  example similar to this one here but I don't want a histogram I  just 
want to see the ForkLength ranges with different colors. For example:
  ForkLength 32-34---green
  ForkLength 35-37---red
  ForkLength 38-40--Orange
  Thanks in advance
 
 SampleDate   ForkLength Count
112/4/2007 32 2
212/6/2007 33 1
312/7/2007 33 2
412/7/2007 33 2
512/7/2007 34 1
612/9/2007 31 1
712/9/2007 33 2
8   12/10/2007 33 5
9   12/10/2007 34 1
10  12/11/2007 33 2
11  12/15/2007 34 1
12  12/16/2007 33 2
13  12/17/2007 35 1
14  12/19/2007 33 1
15  12/19/2007 35 1
16  12/20/2007 31 1
17  12/20/2007 32 1
18  12/20/2007 33 1
19  12/20/2007 34 3
20  12/21/2007 31 1
21  12/21/2007 32 3
22  12/21/2007 33 4
23  12/21/2007 3411
24  12/21/2007 3516
25  12/21/2007 36 3
26  12/21/2007 37 1
27  12/22/2007 32 1
28  12/22/2007 33 3
29  12/22/2007 34 1
30  12/22/2007 35 2
31  12/23/2007 32 1
32  12/23/2007 35 1
33  12/25/2007 32 1
34  12/25/2007 36 1
35  12/26/2007 34 1
36  12/26/2007 35 2
37  12/26/2007 36 1
38  12/27/2007 34 4
39  12/27/2007 35 2
40  12/27/2007 36 2
41  12/28/2007 32 1
42  12/28/2007 33 1
43  12/28/2007 34 1
44  12/28/2007 35 3
45  12/28/2007 36 4
46  12/28/2007 37 6
47  12/28/2007 38 2
48  12/28/2007 39 2
49  12/29/2007 34 1
50  12/29/2007 35 5
51  12/29/2007 36 2
52  12/29/2007 37 1
53  12/30/2007 33 3
54  12/30/2007 3410
55  12/30/2007 3510
56  12/30/2007 36 6
57  12/30/2007 3715
58  12/30/2007 38 3
59  12/31/2007 33 3
60  12/31/2007 34 8
61  12/31/2007 35 9
62  12/31/2007 36 6
63  12/31/2007 37 3
64  12/31/2007 38 1
651/1/2008 34 6
661/1/2008 35 6
671/1/2008 35 1
681/1/2008 36 6
691/1/2008 37 9
701/1/2008 38 1
711/2/2008 34 2
721/2/2008 34 1
731/2/2008 35 2
741/2/2008 36 2
751/2/2008 37 2
761/2/2008 39 1
771/3/2008 34 3
781/3/2008 35 3
791/3/2008 36 2
801/3/2008 37 3
811/8/2008 32 1
821/8/2008 33 7
831/8/2008 34 6
841/8/2008 3510
851/8/2008 3616
861/8/2008 37 7
871/8/2008 38 1
881/8/2008 39 1
891/9/2008 33 1
901/9/2008 3420
911/9/2008 3549
921/9/2008 3649
931/9/2008 3739
941/9/2008 37 1
951/9/2008 3818
961/9/2008 39 1
971/9/2008 40 1
98   1/10/2008 32 3
99   1/10/2008 3313
100  1/10/2008 3456
101  1/10/2008 3533
102  1/10/2008 3624
103  1/10/2008 3718
104  1/10/2008 39 1
105  1/11/2008 33 7
106  1/11/2008 3446
107  1/11/2008 3541
108  1/11/2008 3628
109  1/11/2008 3729

Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish & Wildlife Service
California, 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] : writeMat

2008-09-09 Thread Henrik Bengtsson
Hi,

On Tue, Sep 9, 2008 at 9:53 AM, erola pairo <[EMAIL PROTECTED]> wrote:
> I write a .mat file using the writeMat() command, but when i try to load it
> in Matlab it says that  file may be corrupt. I did it a month ago and it
> worked. It exists any option that I can change for making the file readable
> to Matlab?
>
>> A  <-  c(1:10)
>> dim(A) <- c(2,5)
>> library(R.matlab)
>> writeMat('A.mat', A=A)
>
> And what matlab say is:
> "file may be corrupt"

you need to provide much more information that this.  Please see the
posting guides for the list (see footer), and provide sessionInfo() so
we know what version of R and R.matlab you are using.  What version of
Matlab are you using?  If it worked a month ago, what have you changed
since then?

Cheers

Henrik
(author of R.matlab)

>
> Regards
>
>[[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] Information on the number of CPU's

2008-09-09 Thread tolga . i . uzuner
Dear R Users,
I am on Windows XP SP2 platform, using R version 2.7.2 . I was wondering 
if there is a way to find out, within R, the number of CPU's on my machine 
? I would use this information to set the number of nodes in a cluster, 
depending on the machine. Sys.info() and .Platform do not carry this 
information.
Thanks in advance,
Tolga Uzuner

Generally, this communication is for informational purposes only
and it is not intended as an offer or solicitation for the purchase
or sale of any financial instrument or as an official confirmation
of any transaction. In the event you are receiving the offering
materials attached below related to your interest in hedge funds or
private equity, this communication may be intended as an offer or
solicitation for the purchase or sale of such fund(s).  All market
prices, data and other information are not warranted as to
completeness or accuracy and are subject to change without notice.
Any comments or statements made herein do not necessarily reflect
those of JPMorgan Chase & Co., its subsidiaries and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.
Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to UK legal entities.
[[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] cluster/snow question

2008-09-09 Thread tolga . i . uzuner
Hi Markus,

Many thanks. Is the "cluster" variable you mention below available in the 
environment of the nodes ? Specifically, within that environment, how 
could one identify the rank of that specific node ?

My code would use that information to partition the problem.

Thanks,
Tolga




Markus Schmidberger <[EMAIL PROTECTED]> 
09/09/2008 07:11
Please respond to
[EMAIL PROTECTED]


To
[EMAIL PROTECTED]
cc
r-help@r-project.org
Subject
Re: [R] cluster/snow question






Hi Tolga,

in SNOW you have to start a cluster with the command

 > library(snow)
 > cluster <- makeCluster(#nodes)

The object "cluster" is a list with an object for each node and each 
object again is a list with all informations (rank, comm, tags)
The size of the cluster is the length of the list.

 > #nodes == length(cluster)

E.g. the rank for node one you can get by
 > cluster[[1]]$rank

Best
Markus

[EMAIL PROTECTED] schrieb:
> Dear R Users,
>
> I am attempting to use the snow package for clustering. Is there a way 
to 
> identfy, in the environment of each node, a rank for that node and also, 

> the total size of the cluster ? 
>
> By way of analogy, I am looking for the functions in snow equivalent to 
> mpi.comm.rank() and mpi.comm.size() from RMPI, in case that makes things 

> clearer.
>
> Thanks in advance,
> Tolga
>
> Generally, this communication is for informational purposes only
> and it is not intended as an offer or solicitation for the purchase
> or sale of any financial instrument or as an official confirmation
> of any transaction. In the event you are receiving the offering
> materials attached below related to your interest in hedge funds or
> private equity, this communication may be intended as an offer or
> solicitation for the purchase or sale of such fund(s).  All market
> prices, data and other information are not warranted as to
> completeness or accuracy and are subject to change without notice.
> Any comments or statements made herein do not necessarily reflect
> those of JPMorgan Chase & Co., its subsidiaries and affiliates.
>
> This transmission may contain information that is privileged,
> confidential, legally privileged, and/or exempt from disclosure
> under applicable law. If you are not the intended recipient, you
> are hereby notified that any disclosure, copying, distribution, or
> use of the information contained herein (including any reliance
> thereon) is STRICTLY PROHIBITED. Although this transmission and any
> attachments are believed to be free of any virus or other defect
> that might affect any computer system into which it is received and
> opened, it is the responsibility of the recipient to ensure that it
> is virus free and no responsibility is accepted by JPMorgan Chase &
> Co., its subsidiaries and affiliates, as applicable, for any loss
> or damage arising in any way from its use. If you received this
> transmission in error, please immediately contact the sender and
> destroy the material in its entirety, whether in electronic or hard
> copy format. Thank you.
> Please refer to http://www.jpmorgan.com/pages/disclosures for
> disclosures relating to UK legal entities.
>[[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.
> 


-- 
Dipl.-Tech. Math. Markus Schmidberger

Ludwig-Maximilians-Universität München
IBE - Institut für medizinische Informationsverarbeitung,
Biometrie und Epidemiologie
Marchioninistr. 15, D-81377 Muenchen
URL: http://ibe.web.med.uni-muenchen.de 
Mail: Markus.Schmidberger [at] ibe.med.uni-muenchen.de
Tel: +49 (089) 7095 - 4599





Generally, this communication is for informational purposes only
and it is not intended as an offer or solicitation for the purchase
or sale of any financial instrument or as an official confirmation
of any transaction. In the event you are receiving the offering
materials attached below related to your interest in hedge funds or
private equity, this communication may be intended as an offer or
solicitation for the purchase or sale of such fund(s).  All market
prices, data and other information are not warranted as to
completeness or accuracy and are subject to change without notice.
Any comments or statements made herein do not necessarily reflect
those of JPMorgan Chase & Co., its subsidiaries and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defec

Re: [R] Hardwarefor R cpu 64 vs 32, dual vs quad

2008-09-09 Thread Henrik Bengtsson
On Tue, Sep 9, 2008 at 6:31 AM, Nic Larson <[EMAIL PROTECTED]> wrote:
> Need to buy fast computer for running R on. Today we use 2,8 MHz intel D cpu
> and the calculations takes around 15 days. Is it possible to get the same
> calculations down to minutes/hours by only changing the hardware?
> Should I go for an really fast dual 32 bit cpu and run R over linux or xp or
> go for an quad core / 64 bit cpu?
> Is it effective to run R on 64 bit (and problem free
> (running/installing))???
> Have around 2000-3000 euro to spend

Faster machines won't do that much.  Without knowing what methods and
algorithms you are running, I bet you a beer that it can be made twice
as fast by just optimizing the code.  My claim applies recursively.
In other words, by optimizing the algorithms/code you can speed up
things quite a bit.  From experience, it is not unlikely to find
bottlenecks in generic algorithms that can be made 10-100 times
faster.  Here is *one* example illustrating that even when you think
the code is "fully optimized" you can still squeeze out more:

  http://wiki.r-project.org/rwiki/doku.php?id=tips:programming:code_optim2

So, start profiling your code to narrow down the parts that takes most
of the CPU time.  help(Rprof) is a start.  There is also a Section
'Profiling R code for speed' in 'Writing R Extensions'.  Good old
verbose print out of system.time() also helps.

My $.02 ...or 2000-3000USD if it was bounty?! ;)

/Henrik

> Thanx for any tip
>
>[[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] creating table of averages

2008-09-09 Thread Lawrence Hanser
Perfect!

Thanks.


On Tue, Sep 9, 2008 at 11:27 AM, Duncan Murdoch <[EMAIL PROTECTED]>wrote:

> On 9/9/2008 2:12 PM, Adam D. I. Kramer wrote:
>
>> Maybe something like this:
>>
>> by(df[,c(77,81,86,90,94,98,101,106)],df$category,apply,2,mean)
>>
>> ...which would then need to be reformatted into a data frame (there is
>> probably an easy way to do this which I don't know).
>>
>
> sparseby() in the reshape package is more flexible than by(). If the
> function returns a vector with a consistent length, you'll get a dataframe
> with columns corresponding to its entries.
>
> Duncan Murdoch
>
>
>
>> aggregate seems like a more reasonable choice, but the function for
>> aggregate must return scalars, not rows...tapply doesn't take data.frame
>> inputs. Maybe someone else has a suggestion?
>>
>> --Adam
>>
>> On Tue, 9 Sep 2008, Lawrence Hanser wrote:
>>
>>  Dear Colleagues,
>>>
>>> I have a dataframe with variables:
>>>
>>>  [1] "ID" "category"   "a11""a12"
>>> "a13""a21"
>>>  [7] "a22""a23""a31""a32"
>>> "b11""b12"
>>> [13] "b13""b21""b31""b32"
>>> "b33""b41"
>>> [19] "b42""c11""c12""c21"
>>> "c22""c23"
>>> [25] "c31""c32""c33""d11"
>>> "d12""d13"
>>> [31] "d14""d21""d22""d23"
>>> "d24""d25"
>>> [37] "d31""d32""d33""e11"
>>> "e12""e13"
>>> [43] "e21""e22""e23""e31"
>>> "e32""e33"
>>> [49] "f11""f12""f13""f14"
>>> "f21""f22"
>>> [55] "f23""f24""g11""g12"
>>> "g13""g14"
>>> [61] "g21""g22""g23""g24"
>>> "g31""g32"
>>> [67] "g33""g41""g42""g43"
>>> "h11""h12"
>>> [73] "h13""h21""h22""h23"
>>> "C1.Employ"  "SC11.Ops"
>>> [79] "SC12.Unit"  "SC13.Nonadvers" "C2.Enterprise"  "SC21.Structure"
>>> "SC22.Gov"   "SC23.Culture"
>>> [85] "SC24.Stratcomm" "C3.Manage"  "SC31.Resource"  "SC32.Change"
>>> "SC33.Continue"  "C4.Stratthink"
>>> [91] "SC41.Vision""SC42.Decision"  "SC43.Adapt" "C5.Lead"
>>> "SC51.Develop"   "SC52.Care"
>>> [97] "SC53.Diversity" "C6.Foster"  "SC61.Teams" "SC62.Negotiate"
>>> "C7.Embody"  "SC71.Ethical"
>>> [103] "SC72.Follower"  "SC73.Warrior"   "SC74.Develop"   "C8.Comm"
>>> "C81.Speak"  "C82.Listen"
>>> [109] "OverallImp"
>>>
>>> The variable "category" has four values: Regular, CCM, CFM, and Other
>>>
>>> I'd like to create a table like this to feed into barplot2:
>>>
>>> row.name  C1.Employ C2.Enterprise  C3.Manage  C4.Stratthink  C5.Lead
>>> C6.Foster  C7.Embody  C8.Comm
>>> Regular 3.68  4.27 3.22
>>> etc..
>>> CCM 4.32  4.56  etc.
>>> CFM  etc.
>>> Other etc.
>>>
>>> So far, I have been able to get this far:
>>>
>>> >
>>>
>>> mean(subset(impchiefs08,category=="Regular",select=c(C1.Employ,C2.Enterprise,C3.Manage,C4.Stratthink,C5.Lead,C6.Foster,C7.Embody,C8.Comm
>>> )))
>>>   C1.Employ C2.Enterprise C3.Manage C4.Stratthink   C5.Lead
>>> C6.Foster C7.Embody   C8.Comm
>>>3.60  3.85  4.48  4.346667  4.608889
>>> 4.44  4.60  4.49
>>>


>>> But I am stumped as to how to get what I want.
>>>
>>> Thanks in advance.
>>>
>>> Larry
>>>
>>>[[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.
>

[[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] creating table of averages

2008-09-09 Thread Duncan Murdoch

On 9/9/2008 2:12 PM, Adam D. I. Kramer wrote:

Maybe something like this:

by(df[,c(77,81,86,90,94,98,101,106)],df$category,apply,2,mean)

...which would then need to be reformatted into a data frame (there is
probably an easy way to do this which I don't know).


sparseby() in the reshape package is more flexible than by(). If the 
function returns a vector with a consistent length, you'll get a 
dataframe with columns corresponding to its entries.


Duncan Murdoch



aggregate seems like a more reasonable choice, but the function for
aggregate must return scalars, not rows...tapply doesn't take data.frame
inputs. Maybe someone else has a suggestion?

--Adam

On Tue, 9 Sep 2008, Lawrence Hanser wrote:


Dear Colleagues,

I have a dataframe with variables:

 [1] "ID" "category"   "a11""a12"
"a13""a21"
 [7] "a22""a23""a31""a32"
"b11""b12"
[13] "b13""b21""b31""b32"
"b33""b41"
[19] "b42""c11""c12""c21"
"c22""c23"
[25] "c31""c32""c33""d11"
"d12""d13"
[31] "d14""d21""d22""d23"
"d24""d25"
[37] "d31""d32""d33""e11"
"e12""e13"
[43] "e21""e22""e23""e31"
"e32""e33"
[49] "f11""f12""f13""f14"
"f21""f22"
[55] "f23""f24""g11""g12"
"g13""g14"
[61] "g21""g22""g23""g24"
"g31""g32"
[67] "g33""g41""g42""g43"
"h11""h12"
[73] "h13""h21""h22""h23"
"C1.Employ"  "SC11.Ops"
[79] "SC12.Unit"  "SC13.Nonadvers" "C2.Enterprise"  "SC21.Structure"
"SC22.Gov"   "SC23.Culture"
[85] "SC24.Stratcomm" "C3.Manage"  "SC31.Resource"  "SC32.Change"
"SC33.Continue"  "C4.Stratthink"
[91] "SC41.Vision""SC42.Decision"  "SC43.Adapt" "C5.Lead"
"SC51.Develop"   "SC52.Care"
[97] "SC53.Diversity" "C6.Foster"  "SC61.Teams" "SC62.Negotiate"
"C7.Embody"  "SC71.Ethical"
[103] "SC72.Follower"  "SC73.Warrior"   "SC74.Develop"   "C8.Comm"
"C81.Speak"  "C82.Listen"
[109] "OverallImp"

The variable "category" has four values: Regular, CCM, CFM, and Other

I'd like to create a table like this to feed into barplot2:

row.name  C1.Employ C2.Enterprise  C3.Manage  C4.Stratthink  C5.Lead
C6.Foster  C7.Embody  C8.Comm
Regular 3.68  4.27 3.22
etc..
CCM 4.32  4.56  etc.
CFM  etc.
Other etc.

So far, I have been able to get this far:

>
mean(subset(impchiefs08,category=="Regular",select=c(C1.Employ,C2.Enterprise,C3.Manage,C4.Stratthink,C5.Lead,C6.Foster,C7.Embody,C8.Comm
)))
   C1.Employ C2.Enterprise C3.Manage C4.Stratthink   C5.Lead
C6.Foster C7.Embody   C8.Comm
3.60  3.85  4.48  4.346667  4.608889
4.44  4.60  4.49




But I am stumped as to how to get what I want.

Thanks in advance.

Larry

[[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] creating table of averages

2008-09-09 Thread Adam D. I. Kramer

Maybe something like this:

by(df[,c(77,81,86,90,94,98,101,106)],df$category,apply,2,mean)

...which would then need to be reformatted into a data frame (there is
probably an easy way to do this which I don't know).

aggregate seems like a more reasonable choice, but the function for
aggregate must return scalars, not rows...tapply doesn't take data.frame
inputs. Maybe someone else has a suggestion?

--Adam

On Tue, 9 Sep 2008, Lawrence Hanser wrote:


Dear Colleagues,

I have a dataframe with variables:

 [1] "ID" "category"   "a11""a12"
"a13""a21"
 [7] "a22""a23""a31""a32"
"b11""b12"
[13] "b13""b21""b31""b32"
"b33""b41"
[19] "b42""c11""c12""c21"
"c22""c23"
[25] "c31""c32""c33""d11"
"d12""d13"
[31] "d14""d21""d22""d23"
"d24""d25"
[37] "d31""d32""d33""e11"
"e12""e13"
[43] "e21""e22""e23""e31"
"e32""e33"
[49] "f11""f12""f13""f14"
"f21""f22"
[55] "f23""f24""g11""g12"
"g13""g14"
[61] "g21""g22""g23""g24"
"g31""g32"
[67] "g33""g41""g42""g43"
"h11""h12"
[73] "h13""h21""h22""h23"
"C1.Employ"  "SC11.Ops"
[79] "SC12.Unit"  "SC13.Nonadvers" "C2.Enterprise"  "SC21.Structure"
"SC22.Gov"   "SC23.Culture"
[85] "SC24.Stratcomm" "C3.Manage"  "SC31.Resource"  "SC32.Change"
"SC33.Continue"  "C4.Stratthink"
[91] "SC41.Vision""SC42.Decision"  "SC43.Adapt" "C5.Lead"
"SC51.Develop"   "SC52.Care"
[97] "SC53.Diversity" "C6.Foster"  "SC61.Teams" "SC62.Negotiate"
"C7.Embody"  "SC71.Ethical"
[103] "SC72.Follower"  "SC73.Warrior"   "SC74.Develop"   "C8.Comm"
"C81.Speak"  "C82.Listen"
[109] "OverallImp"

The variable "category" has four values: Regular, CCM, CFM, and Other

I'd like to create a table like this to feed into barplot2:

row.name  C1.Employ C2.Enterprise  C3.Manage  C4.Stratthink  C5.Lead
C6.Foster  C7.Embody  C8.Comm
Regular 3.68  4.27 3.22
etc..
CCM 4.32  4.56  etc.
CFM  etc.
Other etc.

So far, I have been able to get this far:

>
mean(subset(impchiefs08,category=="Regular",select=c(C1.Employ,C2.Enterprise,C3.Manage,C4.Stratthink,C5.Lead,C6.Foster,C7.Embody,C8.Comm
)))
   C1.Employ C2.Enterprise C3.Manage C4.Stratthink   C5.Lead
C6.Foster C7.Embody   C8.Comm
3.60  3.85  4.48  4.346667  4.608889
4.44  4.60  4.49




But I am stumped as to how to get what I want.

Thanks in advance.

Larry

[[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] Compiling date

2008-09-09 Thread Dr Eberhard W Lisse

Is this Month-Day or Day-Month or a mixture of both?

I still think using the Format -> Cell -> Date will work
much better...

el


On 09 Sep 2008, at 11:21 , David Scott wrote:


On Mon, 8 Sep 2008, Megh Dal wrote:


Hi,

I have following kind of dataset (all are dates) in my Excel sheet.

09/08/08
09/05/08
09/04/08
09/02/08
09/01/08
29/08/2008
28/08/2008
27/08/2008
26/08/2008
25/08/2008
22/08/2008
21/08/2008
20/08/2008
18/08/2008
14/08/2008
13/08/2008
08/12/08
08/11/08
08/08/08
08/07/08

However I want to use R to compile those data to make all dates in  
same format. Can anyone please tell me any automated way for doing  
that?




Well you have to read them in as character first. Then use sub to  
make the two digit years into four digits. The following could  
probably be improved by a regular expression whiz, but works:



strngs <- c("06/05/08","23/11/2008")
sub("([0-9][0-9]/[0-9][0-9]/)([0-9][0-9]$)","\\120\\2",strngs)

[1] "06/05/2008" "23/11/2008"


David Scott


__
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] randomForest

2008-09-09 Thread Kate Behrman
I am combining many different random forest objects run on the same data set
using the combine ( ) function. After combining the forests I am not sure
whether the variable importance, local importance, and rsq predictors are
recalculated for the new random forest object  or are calculated
individually for each tree ensemble? Is it  possible to  calculate these
predictors for the new random forest object after calling the combine
function? Any help would be greatly apprecaited. Thanks, Kate

[[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] creating table of averages

2008-09-09 Thread Lawrence Hanser
Dear Colleagues,

I have a dataframe with variables:

  [1] "ID" "category"   "a11""a12"
"a13""a21"
  [7] "a22""a23""a31""a32"
"b11""b12"
 [13] "b13""b21""b31""b32"
"b33""b41"
 [19] "b42""c11""c12""c21"
"c22""c23"
 [25] "c31""c32""c33""d11"
"d12""d13"
 [31] "d14""d21""d22""d23"
"d24""d25"
 [37] "d31""d32""d33""e11"
"e12""e13"
 [43] "e21""e22""e23""e31"
"e32""e33"
 [49] "f11""f12""f13""f14"
"f21""f22"
 [55] "f23""f24""g11""g12"
"g13""g14"
 [61] "g21""g22""g23""g24"
"g31""g32"
 [67] "g33""g41""g42""g43"
"h11""h12"
 [73] "h13""h21""h22""h23"
"C1.Employ"  "SC11.Ops"
 [79] "SC12.Unit"  "SC13.Nonadvers" "C2.Enterprise"  "SC21.Structure"
"SC22.Gov"   "SC23.Culture"
 [85] "SC24.Stratcomm" "C3.Manage"  "SC31.Resource"  "SC32.Change"
"SC33.Continue"  "C4.Stratthink"
 [91] "SC41.Vision""SC42.Decision"  "SC43.Adapt" "C5.Lead"
"SC51.Develop"   "SC52.Care"
 [97] "SC53.Diversity" "C6.Foster"  "SC61.Teams" "SC62.Negotiate"
"C7.Embody"  "SC71.Ethical"
[103] "SC72.Follower"  "SC73.Warrior"   "SC74.Develop"   "C8.Comm"
"C81.Speak"  "C82.Listen"
[109] "OverallImp"

The variable "category" has four values: Regular, CCM, CFM, and Other

I'd like to create a table like this to feed into barplot2:

row.name  C1.Employ C2.Enterprise  C3.Manage  C4.Stratthink  C5.Lead
C6.Foster  C7.Embody  C8.Comm
Regular 3.68  4.27 3.22
etc..
CCM 4.32  4.56  etc.
CFM  etc.
Other etc.

So far, I have been able to get this far:

 >
mean(subset(impchiefs08,category=="Regular",select=c(C1.Employ,C2.Enterprise,C3.Manage,C4.Stratthink,C5.Lead,C6.Foster,C7.Embody,C8.Comm
)))
C1.Employ C2.Enterprise C3.Manage C4.Stratthink   C5.Lead
C6.Foster C7.Embody   C8.Comm
 3.60  3.85  4.48  4.346667  4.608889
4.44  4.60  4.49
>

But I am stumped as to how to get what I want.

Thanks in advance.

Larry

[[alternative HTML version deleted]]

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


Re: [R] help on wavelet

2008-09-09 Thread stephen sefick
It depends on what you want to do.  In wavelet speak frequency is scale.
these are the libraries:
wmtsa - wavCWT (make sure that you pick the wavelet.  I suggest morlet
because it is compactly supported (disappears to zero quickly))
I would also suggest the fields packages for the tim.colors function
which produces the familiar red to blue color scheme.
sowas- more complex stuff here take a look very interesting if you are
trying to tell if two signals are coherent.

hope this helps

stephen

On Tue, Sep 9, 2008 at 12:03 PM, giov <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I have little experience using wavelet and I would like to know if it is
> possible,using R wavelet package, to have a plot of frequency versus time.
>
> thank you
>
> giov
> --
> View this message in context: 
> http://www.nabble.com/help-on-wavelet-tp19395583p19395583.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.
>



-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods. We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
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] printing all rows

2008-09-09 Thread Adam D. I. Kramer

options("max.print")

$max.print
[1] 9


options(max.print=10)
options("max.print")

$max.print
[1] 1e+05

...so check what your max.print is, and figure out whether you need to
set it to nrow, ncol, or nrow*ncol of your data frame...then do so...though
of course, this is a global variable, so everything you print from then on
will just keep printing and printing.

Really, though, you might get more utility out of write.table and then using
a word processor to read the data in your table.

--Adam

On Tue, 9 Sep 2008, ANJAN PURKAYASTHA wrote:


Hi,
my data table has 38939 rows. R prints  the first 1 columns and then
prints an error message:[ reached getOption("max.print") -- omitted 27821
rows ]].
is it possible to set the maxprint parameter so that R prints all the rows?

tia,
anjan

--
=
anjan purkayastha, phd
bioinformatics analyst
whitehead institute for biomedical research
nine cambridge center
cambridge, ma 02142

purkayas [at] wi [dot] mit [dot] edu
703.740.6939

[[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] binomial(link="inverse")

2008-09-09 Thread Ben Bolker

  this may be a better question for r-devel, but ...

  Is there a particular reason (and if so, what is it) that
the inverse link is not in the list of allowable link functions
for the binomial family?  I initially thought this might
have something to do with the properties of canonical
vs non-canonical link functions, but since other link functions
(probit, cloglog, cauchit, log) are allowed, I can't think
of any good reason.  In fact, it's sort of a mystery to me
why the sets of link functions for each family are restricted.
Is this from painful experience that some link functions just
don't work well?

  I can go ahead and hack my own version that allows inverse
link, but it would be nice to know if I'm doing something dumb.

  (The reason I want to do this is that the inverse link
linearizes the Michaelis-Menten function, y = a*x/(b+x) ...)

  cheers
Ben Bolker




signature.asc
Description: OpenPGP digital signature
__
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 on wavelet

2008-09-09 Thread giov

Hi,
I have little experience using wavelet and I would like to know if it is
possible,using R wavelet package, to have a plot of frequency versus time. 

thank you

giov
-- 
View this message in context: 
http://www.nabble.com/help-on-wavelet-tp19395583p19395583.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] : writeMat

2008-09-09 Thread erola pairo
I write a .mat file using the writeMat() command, but when i try to load it
in Matlab it says that  file may be corrupt. I did it a month ago and it
worked. It exists any option that I can change for making the file readable
to Matlab?

> A  <-  c(1:10)
> dim(A) <- c(2,5)
> library(R.matlab)
> writeMat('A.mat', A=A)

And what matlab say is:
"file may be corrupt"

Regards

[[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] puzzle about contrasts

2008-09-09 Thread Peter Dalgaard
Peter Dalgaard skrev:
> Prof Brian Ripley skrev:
>   
>> -0.5*(A+B) is not a contrast, which is the seat of your puzzlement.
>>
>> All you can get from y ~ x is an intercept (a column of ones) and a
>> single 'contrast' column for 'x'.
>>
>> If you use y ~ 0+x you can get two columns for 'x', but R does not
>> give you an option of what columns in the case: see the source of
>> contrasts(). So you would need to replace contrasts(), which I think
>> will be hard as model.matrix.default will look in the 'stats'
>> namespace.  It would probably be easier to create the model matrix
>> yourself.
>>
>> 
> Or accept the default and do the parameter transformations yourself.
>
> l <- lm(y~x)
> T <- rbind(
> c(-1,-.5),
> c(0,1))
>
> c2 <- T%*%coef(l)
> V2 <- T%*%vcov(l) %*% t(T)
>
> cbind(coef=c(c2), s.e.=sqrt(diag(V2)))
>   

I forgot: Also have a look at estimable() from the gmodels packages.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
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 with 'spectrum'

2008-09-09 Thread rkevinburton
For the command 'spectrum' I read:

The spectrum here is defined with scaling 1/frequency(x), following S-PLUS. 
This makes the spectral density a density over the range (-frequency(x)/2, 
+frequency(x)/2], whereas a more common scaling is 2π and range (-0.5, 0.5] 
(e.g., Bloomfield) or 1 and range (-π, π]. 


Forgive my ignorance but I am having a hard time interpreting this. Does this 
mean that in the spectrum output every element of the $spec array is scaled by 
1/frequency(x)? I am having a hard time determing what is meant by 
'frequency'.Say I define a time series for a year with samples for every day. I 
input a 'frequency' of 365 (which in my mind is the period). On the output of 
'spectrum' would this mean that every element of the $spec array is scaled by 
1/365? There is a corresponding frequency array on the output from 'spectrum'. 
If the frequency is 365 and an element in the frequency array output from 
'spectrum' is .1 am I to assume that the period is 36.5 and a corresponding sin 
wave would be sin(2 * pi * 36.5/365)?

Thank you in advance for helping me clear up some confusion.

Kevin

__
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] puzzle about contrasts

2008-09-09 Thread Peter Dalgaard
Prof Brian Ripley skrev:
> -0.5*(A+B) is not a contrast, which is the seat of your puzzlement.
>
> All you can get from y ~ x is an intercept (a column of ones) and a
> single 'contrast' column for 'x'.
>
> If you use y ~ 0+x you can get two columns for 'x', but R does not
> give you an option of what columns in the case: see the source of
> contrasts(). So you would need to replace contrasts(), which I think
> will be hard as model.matrix.default will look in the 'stats'
> namespace.  It would probably be easier to create the model matrix
> yourself.
>
Or accept the default and do the parameter transformations yourself.

l <- lm(y~x)
T <- rbind(
c(-1,-.5),
c(0,1))

c2 <- T%*%coef(l)
V2 <- T%*%vcov(l) %*% t(T)

cbind(coef=c(c2), s.e.=sqrt(diag(V2)))


> On Tue, 9 Sep 2008, Kenneth Knoblauch wrote:
>
>> Hi,
>>
>> I'm trying to redefine the contrasts for a linear model.
>> With a 2 level factor, x, with levels A and B, a two level
>> factor outputs A and B - A from an lm fit, say
>> lm(y ~ x). I would like to set the contrasts so that
>> the coefficients output are -0.5 (A + B) and B - A,
>> but I can't get the sign correct for the first coefficient
>> (Intercept).
>>
>> Here is a toy example,
>>
>> set.seed(12161952)
>> y <- rnorm(10)
>> x <- factor(rep(letters[1:2], each = 5))
>> ##  so  A and B =
>> tapply(y, x, mean)
>>
>>   a  b
>> -0.719  0.8323837
>>
>> ## and with treatment contrasts
>> coef(lm(y ~ x))  ## A and B - A
>>
>> (Intercept)  xb
>> -0.719   1.5522724
>>
>> Then, I try to redefine the contrasts
>>
>> ### would like contrasts: -0.5 (A + B) and B - A
>> D1 <- matrix( c(-0.5, -0.5,
>> -1, 1),
>> 2, 2, byrow = TRUE)
>> C1 <- solve(D1)
>> Cnt <- C1[, -1]
>> contrasts(x) <- Cnt
>> coef(lm(y ~ x))
>>
>> (Intercept)  x1
>> 0.05624745  1.55227241
>>
>> but note that the desired value is
>> -0.5 * sum(tapply(y, x, mean))
>>
>> [1] -0.05624745
>>
>> I note that the first column of C1 is -1's not +1's
>> and that working by hand, if I tamper with the model matrix
>>
>> mm <- model.matrix(y ~ x)
>> mm[, 1] <- -1
>>
>> mm
>>  (Intercept)   x1
>> 1   -1 -0.5
>> 2   -1 -0.5
>> 3   -1 -0.5
>> 4   -1 -0.5
>> 5   -1 -0.5
>> 6   -1  0.5
>> 7   -1  0.5
>> 8   -1  0.5
>> 9   -1  0.5
>> 10  -1  0.5
>> attr(,"assign")
>> [1] 0 1
>> attr(,"contrasts")
>> attr(,"contrasts")$x
>> [,1]
>> a -0.5
>> b  0.5
>>
>> solve(t(mm) %*% mm) %*% t(mm) %*% y  ##Yes, I know. Use QR
>>  [,1]
>> (Intercept) -0.05624745
>> x1   1.55227241
>>
>> gives the correct sign.
>>
>> So, I guess my question reduces to how one would set the
>> contrasts for the model.matrix to be correct
>> for this to work out correctly?
>>
>> Thank you.
>>
>> Ken
>>
>>
>> -- 
>> Ken Knoblauch
>> Inserm U846
>> Institut Cellule Souche et Cerveau
>> Département Neurosciences Intégratives
>> 18 avenue du Doyen Lépine
>> 69500 Bron
>> France
>> tel: +33 (0)4 72 91 34 77
>> fax: +33 (0)4 72 91 34 61
>> portable: +33 (0)6 84 10 64 10
>> http://www.sbri.fr
>>
>> __
>> 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.
>   


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
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] Linear Modeling the best alternative

2008-09-09 Thread Ben Bolker
stephen sefick  gmail.com> writes:

> 
> I have a data set of mean velocity, discharge, and mean depth.  I need
> to find out which model best fits them out of log linear, linear, some
> other kind of model...  Using excel I have found that linear is not
> that bad and log10(discharge) vs. the other two variables (I am trying
> to predict velocity and depth from discharge) is not that bad either.
> How do I test and see which one of these models is better...  better
> R-squared...  I know this is a stats question and not particularly an
> R question, but I will use R for the models vetting process.
> any ideas would be greatly appreciated,


  AIC is not bad, but see
http://www.unc.edu/courses/2006spring/ecol/145/001/docs/lectures/lecture18.htm
for computing AIC to compare models where some have transformed
response variables ...

  Ben Bolker

__
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] passing graph image data from remote Rserve

2008-09-09 Thread Patil, Prasad
I believe I have found my solution, so please disregard. 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] Modality Test

2008-09-09 Thread Amin W. Mugera

Dear Readers:

I have two issues in nonparametric statistical analysis that i need
help:

First, does R have a package that can implement the multimodality test,
e.g., the Silverman test, DIP test, MAP test or Runt test. I have seen
an earlier thread (sometime in 2003) where someone was trying to write
a code for the Silverman test of multimodality. Is there any other
tests that can enable me to know how many modes are in a distribution?

Second, i would like to test whether two distributions are equal. Does R
have a  package than can implement the Li (1996) test of the equality
of two distributions? Is there any other test i can use rather than the
Li test?

Thank you in advance for your help.

Amin Mugera
Graduate Student
AgEcon Dept. Kansas State 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] passing graph image data from remote Rserve

2008-09-09 Thread Patil, Prasad
Hello,

 

I am using Rserve to create a dedicated computational back-engine. I
generate and pass an array of data to a java application on a separate
server. I was wondering if the same is possible for an image. I believe
that Rserve supports passing certain R objects and JRclient can cast
these objects into their Java counterparts. If I generate a barplot in R
(remotely), can I pass the graph image back to the Java application for
display? Currently, I am reduced to saving the graph as a .pdf locally,
passing the .pdf's filepath to the Java application and allowing the
application access to the file, which is not an ideal structure.

 

Thanks for your help,

 

Prasad


[[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] puzzle about contrasts

2008-09-09 Thread Prof Brian Ripley

-0.5*(A+B) is not a contrast, which is the seat of your puzzlement.

All you can get from y ~ x is an intercept (a column of ones) and a single 
'contrast' column for 'x'.


If you use y ~ 0+x you can get two columns for 'x', but R does not give 
you an option of what columns in the case: see the source of contrasts(). 
So you would need to replace contrasts(), which I think will be hard as 
model.matrix.default will look in the 'stats' namespace.  It would 
probably be easier to create the model matrix yourself.


On Tue, 9 Sep 2008, Kenneth Knoblauch wrote:


Hi,

I'm trying to redefine the contrasts for a linear model.
With a 2 level factor, x, with levels A and B, a two level
factor outputs A and B - A from an lm fit, say
lm(y ~ x). I would like to set the contrasts so that
the coefficients output are -0.5 (A + B) and B - A,
but I can't get the sign correct for the first coefficient
(Intercept).

Here is a toy example,

set.seed(12161952)
y <- rnorm(10)
x <- factor(rep(letters[1:2], each = 5))
##  so  A and B =
tapply(y, x, mean)

  a  b
-0.719  0.8323837

## and with treatment contrasts
coef(lm(y ~ x))  ## A and B - A

(Intercept)  xb
-0.719   1.5522724

Then, I try to redefine the contrasts

### would like contrasts: -0.5 (A + B) and B - A
D1 <- matrix( c(-0.5, -0.5,
-1, 1),
2, 2, byrow = TRUE)
C1 <- solve(D1)
Cnt <- C1[, -1]
contrasts(x) <- Cnt
coef(lm(y ~ x))

(Intercept)  x1
0.05624745  1.55227241

but note that the desired value is
-0.5 * sum(tapply(y, x, mean))

[1] -0.05624745

I note that the first column of C1 is -1's not +1's
and that working by hand, if I tamper with the model matrix

mm <- model.matrix(y ~ x)
mm[, 1] <- -1

mm
 (Intercept)   x1
1   -1 -0.5
2   -1 -0.5
3   -1 -0.5
4   -1 -0.5
5   -1 -0.5
6   -1  0.5
7   -1  0.5
8   -1  0.5
9   -1  0.5
10  -1  0.5
attr(,"assign")
[1] 0 1
attr(,"contrasts")
attr(,"contrasts")$x
[,1]
a -0.5
b  0.5

solve(t(mm) %*% mm) %*% t(mm) %*% y  ##Yes, I know. Use QR
 [,1]
(Intercept) -0.05624745
x1   1.55227241

gives the correct sign.

So, I guess my question reduces to how one would set the
contrasts for the model.matrix to be correct
for this to work out correctly?

Thank you.

Ken


--
Ken Knoblauch
Inserm U846
Institut Cellule Souche et Cerveau
Département Neurosciences Intégratives
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.sbri.fr

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


[R] Linear Modeling the best alternative

2008-09-09 Thread stephen sefick
I have a data set of mean velocity, discharge, and mean depth.  I need
to find out which model best fits them out of log linear, linear, some
other kind of model...  Using excel I have found that linear is not
that bad and log10(discharge) vs. the other two variables (I am trying
to predict velocity and depth from discharge) is not that bad either.
How do I test and see which one of these models is better...  better
R-squared...  I know this is a stats question and not particularly an
R question, but I will use R for the models vetting process.
any ideas would be greatly appreciated,
-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods. We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
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] PCA and % variance explained

2008-09-09 Thread ngottlieb
I did PCA stuff years there is a thing that is called a scree score 
Which will give an indication of the number of PCA's and the variance
explained.

Might want to web search on scree score and PCA.



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of pgseye
Sent: Tuesday, September 09, 2008 5:39 AM
To: r-help@r-project.org
Subject: [R] PCA and % variance explained


After doing a PCA using princomp, how do you view how much each
component contributes to variance in the dataset. I'm still quite new to
the theory of PCA - I have a little idea about eigenvectors and
eigenvalues (these determine the variance explained?). Are the
eigenvalues related to loadings in R?

Thanks,

Paul
--
View this message in context:
http://www.nabble.com/PCA-and---variance-explained-tp19388970p19388970.h
tml
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.




This information is being sent at the recipient's reques...{{dropped:16}}

__
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] exporting tapply objects to csv-files

2008-09-09 Thread hadley wickham
On Tue, Sep 9, 2008 at 3:48 AM, Kunzler, Andreas <[EMAIL PROTECTED]> wrote:
> Dear Everyone,
>
> I try to create a cvs-file with different results form the table function.
>
> Imagine a data-frame with two vectors a and b where b is of the class factor.
>
> I use the tapply function to count a for the different values of b.
>
> tapply(a,b,table)
>
> and I use the table function to have a look of the frequencies as a total
>
> table(a)
>
> I would like to put both results together in one txt or csv file that I can 
> import to e.g. Excel.
>
> The export file should have a layout like
>
> 1,2,3,4,5,6,7 (possible values of a)
> 3,6,7,8,8,8,1 (Counts of a total)
> 1,2,3,4,5,3,0 (Counts of a where b==A)
> 2,4,4,4,3,5,1 (Counts of a where b==B)
>
> I tried to change the class of the table result to a matrix but I could not 
> find a way to use the results of tapply. I use tapply because b has 15 
> different values.

An alternative would be to use reshape (http://had.co.nz/reshape):

mydf <- data.frame( a = sample(7, 100, rep = T), b =
sample(letters[1:15], 100, rep = T))

library(reshape)
mydf$value <- 1
cast(mydf, b ~ a, sum, margins="row.major", fill = 0)

Regards,

Hadley

-- 
http://had.co.nz/

__
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] puzzle about contrasts

2008-09-09 Thread Kenneth Knoblauch

Hi,

I'm trying to redefine the contrasts for a linear model.
With a 2 level factor, x, with levels A and B, a two level
factor outputs A and B - A from an lm fit, say
lm(y ~ x). I would like to set the contrasts so that
the coefficients output are -0.5 (A + B) and B - A,
but I can't get the sign correct for the first coefficient
(Intercept).

Here is a toy example,

set.seed(12161952)
y <- rnorm(10)
x <- factor(rep(letters[1:2], each = 5))
##  so  A and B =
tapply(y, x, mean)

a  b
-0.719  0.8323837

## and with treatment contrasts
coef(lm(y ~ x))  ## A and B - A

(Intercept)  xb
 -0.719   1.5522724

Then, I try to redefine the contrasts

### would like contrasts: -0.5 (A + B) and B - A
D1 <- matrix( c(-0.5, -0.5,
-1, 1),
2, 2, byrow = TRUE)
C1 <- solve(D1)
Cnt <- C1[, -1]
contrasts(x) <- Cnt
coef(lm(y ~ x))

(Intercept)  x1
 0.05624745  1.55227241

but note that the desired value is
-0.5 * sum(tapply(y, x, mean))

[1] -0.05624745

I note that the first column of C1 is -1's not +1's
and that working by hand, if I tamper with the model matrix

mm <- model.matrix(y ~ x)
mm[, 1] <- -1

mm
   (Intercept)   x1
1   -1 -0.5
2   -1 -0.5
3   -1 -0.5
4   -1 -0.5
5   -1 -0.5
6   -1  0.5
7   -1  0.5
8   -1  0.5
9   -1  0.5
10  -1  0.5
attr(,"assign")
[1] 0 1
attr(,"contrasts")
attr(,"contrasts")$x
  [,1]
a -0.5
b  0.5

solve(t(mm) %*% mm) %*% t(mm) %*% y  ##Yes, I know. Use QR
   [,1]
(Intercept) -0.05624745
x1   1.55227241

gives the correct sign.

So, I guess my question reduces to how one would set the
contrasts for the model.matrix to be correct
for this to work out correctly?

Thank you.

Ken


--
Ken Knoblauch
Inserm U846
Institut Cellule Souche et Cerveau
Département Neurosciences Intégratives
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.sbri.fr

__
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] Hardwarefor R cpu 64 vs 32, dual vs quad

2008-09-09 Thread Prof Brian Ripley

On Tue, 9 Sep 2008, Nic Larson wrote:


Need to buy fast computer for running R on. Today we use 2,8 MHz intel D cpu
and the calculations takes around 15 days. Is it possible to get the same
calculations down to minutes/hours by only changing the hardware?


No: you would need to arrange to parallelize the computations.  I'd be 
surprised if you got a computer within your budget that was 3x faster on a 
single CPU than your current one, and R will only use (unaided) one CPU 
for most tasks (the exception being some matrix algebra).



Should I go for an really fast dual 32 bit cpu and run R over linux or xp or
go for an quad core / 64 bit cpu?
Is it effective to run R on 64 bit (and problem free
(running/installing))???


All answered in the R-admin manual, so please RTFM.


Have around 2000-3000 euro to spend
Thanx for any tip

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


[R] printing all rows

2008-09-09 Thread ANJAN PURKAYASTHA
Hi,
my data table has 38939 rows. R prints  the first 1 columns and then
prints an error message:[ reached getOption("max.print") -- omitted 27821
rows ]].
is it possible to set the maxprint parameter so that R prints all the rows?

tia,
anjan

-- 
=
anjan purkayastha, phd
bioinformatics analyst
whitehead institute for biomedical research
nine cambridge center
cambridge, ma 02142

purkayas [at] wi [dot] mit [dot] edu
703.740.6939

[[alternative HTML version deleted]]

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


Re: [R] How does predict.lm work?

2008-09-09 Thread Marc Schwartz
on 09/09/2008 09:59 AM Williams, Robin wrote:
> Hi, 
>   Please could someone explain how this element of predict.lm works?
>>From the help file 
> `
> newdata 
> An optional data frame in which to look for variables with which to
> predict. If omitted, the fitted values are used.
> ' 
>   Does this dataframe (newdata) need to have the same variable names as
> was used in the original data frame used to fit the model? 

Yes. Also, see the Note in ?predict.lm:

"Variables are first looked for in newdata and then searched for in the
usual way (which will include the environment of the formula used in the
fit). A warning will be given if the variables found are not of the same
length as those in newdata if it was supplied."


It also says "Variables", not columns.

> Or will R
> just look across consecutive columns of newdata, and apply them to the
> call as appropriate?

No.

>   For example, if I have fitted a model with four variables
> (x1,x2,x3,x4) in my original dataframe, and then have a second dataframe
> which I want to supply to the newdata argument in predict.lm with
> variable names (x5, x6, x7, x8), do I need to change the variable names
> in my newdata dataframe to match those of the original dataframe? 

Yes.

> Or
> will R treat x5 as x1, x6 as x2, etc, when using predict.lm? 
>   I would like to know so that I can design the structure of some
> somewhat larger dataframes in a manner which will make using predict.lm
> straight forward and quick.
> Hope this makes sense.
> Many thanks for any help. 

HTH,

Marc Schwartz

__
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 does predict.lm work?

2008-09-09 Thread Gabor Grothendieck
Just try it:

> BOD # built in data frame
  Time demand
118.3
22   10.3
33   19.0
44   16.0
55   15.6
67   19.8
> BOD.lm <- lm(demand ~ Time, BOD)
> predict(BOD.lm, list(Time = 10))
   1
25.73571
> predict(BOD.lm, list(10))
Error in eval(expr, envir, enclos) : object "Time" not found


On Tue, Sep 9, 2008 at 10:59 AM, Williams, Robin
<[EMAIL PROTECTED]> wrote:
> Hi,
>  Please could someone explain how this element of predict.lm works?
> >From the help file
> `
> newdata
> An optional data frame in which to look for variables with which to
> predict. If omitted, the fitted values are used.
> '
>  Does this dataframe (newdata) need to have the same variable names as
> was used in the original data frame used to fit the model? Or will R
> just look across consecutive columns of newdata, and apply them to the
> call as appropriate?
>  For example, if I have fitted a model with four variables
> (x1,x2,x3,x4) in my original dataframe, and then have a second dataframe
> which I want to supply to the newdata argument in predict.lm with
> variable names (x5, x6, x7, x8), do I need to change the variable names
> in my newdata dataframe to match those of the original dataframe? Or
> will R treat x5 as x1, x6 as x2, etc, when using predict.lm?
>  I would like to know so that I can design the structure of some
> somewhat larger dataframes in a manner which will make using predict.lm
> straight forward and quick.
> Hope this makes sense.
> Many thanks for any help.
>   Robin Williams
> Met Office summer intern - Health Forecasting
> [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] How does predict.lm work?

2008-09-09 Thread Williams, Robin
Hi, 
  Please could someone explain how this element of predict.lm works?
>From the help file 
`
newdata   
An optional data frame in which to look for variables with which to
predict. If omitted, the fitted values are used.
' 
  Does this dataframe (newdata) need to have the same variable names as
was used in the original data frame used to fit the model? Or will R
just look across consecutive columns of newdata, and apply them to the
call as appropriate?
  For example, if I have fitted a model with four variables
(x1,x2,x3,x4) in my original dataframe, and then have a second dataframe
which I want to supply to the newdata argument in predict.lm with
variable names (x5, x6, x7, x8), do I need to change the variable names
in my newdata dataframe to match those of the original dataframe? Or
will R treat x5 as x1, x6 as x2, etc, when using predict.lm? 
  I would like to know so that I can design the structure of some
somewhat larger dataframes in a manner which will make using predict.lm
straight forward and quick.
Hope this makes sense.
Many thanks for any help. 
   Robin Williams
Met Office summer intern - Health Forecasting
[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.


Re: [R] Gumbell distribution - minimum case

2008-09-09 Thread Aaron Mackey
If you mean you want an EVD with a fat left tail (instead of a fat
right tail), then can;t you just multiply all the values by -1 to
"reverse" the distribution?  A new location parameter could then shift
the distribution wherever you want along the number line ...

-Aaron

On Mon, Sep 8, 2008 at 5:22 PM, Richard Gwozdz <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I would like to sample from a Gumbell (minimum) distribution.  I have
> installed package {evd} but the Gumbell functions there appear to refer to
> the maximum case.  Unfortunately, setting the scale parameter negative does
> not appear to work.
>
> Is there a separate package for the Gumbell minimum?
>
>
> --
> _
> Rich Gwozdz
> Fire and Mountain Ecology Lab
> College of Forest Resources
> University of Washington
> cell: 206-769-6808 office: 206-543-9138
> [EMAIL PROTECTED]
>
> __
> 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] R_USER - in which file should I include it?

2008-09-09 Thread Eduardo M. A. M.Mendes
Many thanks. I shall look at it. In case I run into trouble again, I'll try
to clarify the "the same".

Ed
 

-Original Message-
From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 09, 2008 10:46 AM
To: Eduardo M. A. M.Mendes
Cc: r-help@r-project.org
Subject: Re: [R] R_USER - in which file should I include it?

You might look at ?.libPaths
(note the dot) and play around with adding a .libPaths command
to your Rprofile.site and again you may need Administrator rights
when editing it.  If that does not help then you can try clarifying
the problem.   In particular what "the same" refers to and what
is happening now and what you want to happen.

On Tue, Sep 9, 2008 at 9:14 AM, Eduardo M. A. M.Mendes
<[EMAIL PROTECTED]> wrote:
> Hello
>
> Many thanks.  It works just fine.
>
> How about the packages issue?  That is, same thing for the installation
> path.
>
> Cheers
>
> Ed
>
>
> -Original Message-
> From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 08, 2008 10:01 PM
> To: Eduardo M. A. M.Mendes
> Cc: r-help@r-project.org
> Subject: Re: [R] R_USER - in which file should I include it?
>
> Try adding this at the end of your etc/Rprofile.site file.  That file
> should already be there so you don't have to create it,
> just edit it.
>
> cat("Hello from Rprofile.site\n")
> setwd("C:/Users/eduardo/Documents")
>
> You may need to edit it as Administrator.   You should
> see the Hello message in which case you will know that the
> Rprofile.site file is being run.
>
> That should work unless Tinn-R runs R in such a way as to
> ignore Rprofile.site.
>
> On Mon, Sep 8, 2008 at 8:11 PM, Eduardo M. A. M.Mendes
> <[EMAIL PROTECTED]> wrote:
>> Hello
>>
>> I am not sure whether R starts from the same dir.  For instance:
>>
>> a) if I double-click on R-2.7.2 icon and then issue the command getwd(),
> the
>> result is:
>>
>>> getwd()
>> [1] "C:/Users/eduardo/Documents"
>>
>> b) If R starts from within Tinn-R, the result is:
>>
>> getwd()
>> [1] "C:/Program Files/R/R-2/bin"
>>
>> I want that no matter which calling R method I am using if I issue the
>> command getwd() (first command) the result is:
>>
>> "C:/Users/eduardo/Documents/R"
>>
>>
>> Moreover all new packages go to
"C:/Users/eduardo/Documents/R/win-library"
>>
>>
>> Thanks
>>
>> Ed
>>
>> -Original Message-
>> From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
>> Sent: Monday, September 08, 2008 8:57 PM
>> To: Eduardo M. A. M.Mendes
>> Cc: r-help@r-project.org
>> Subject: Re: [R] R_USER - in which file should I include it?
>>
>> Could you explain more clearly what you mean by "the same"?
>> Do you mean that each time you click on R 2.7.2 icon on your
>> desktop that running this from the R console:
>>
>> getwd()
>>
>> is the same directory on each startup?  Isn't that already the case?
>> I don't think you need to set any environment variables at all.  If
>> you don't set
>> any environment variables then what specifically is happening that
>> you don't want to happen?
>>
>> On Mon, Sep 8, 2008 at 7:10 PM, Eduardo M. A. M.Mendes
>> <[EMAIL PROTECTED]> wrote:
>>> Hello
>>>
>>> I am a newbie.  I had my R upgraded from 2.7.1 to 2.7.2 and in doing so
I
>>> decided to install all 2.7 versions under c:\program files\R\2.7 from
now
>>> on (2.7.1 is located under .\2.7.1)
>>>
>>> Although I don't like the idea (I am running Vista), I have edited
>>> etc\Renviron.site to contain:
>>>
>>>
>>> R_USER=c:/Users/eduardo/Documents/R
>>> R_LIBS_USER=c:/Users/eduardo/Documents/R/win-library/2.7
>>>
>>> As far as R starting always from the same location, that is,
>>> c:/Users/eduardo/Documents/R, etc\Renviron.site didn't help.  So I
wonder
>>> whether someone from the list could help me to:
>>>
>>> a) force R to start always from the same location
>>> b) force R to install all new packages in the same location
>>>
>>>
>>> Many thanks
>>>
>>> Ed
>>>
>>> PS. Before sending this email, I read windows FAQ and browsed the
> archives
>>> (too many posts in the subject!).
>>>
>>> __
>>> 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] Question

2008-09-09 Thread Veronique.Pinard
Hi,
 
I'm trying to verify the assumption of homogeneity of variance of residuals in 
an ANOVA with levene.test. I don't know how to define the groups. I have 3 
factors : A, B and C(AxB).
 
What do I have to change or to add in the command to set that I'm working with 
the residuals and to set the groups?
 
library(car)
attach(anova.sns2)
levene.test(residuals ~ ???)


[[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] Vorticity and Divergence

2008-09-09 Thread Ravi Varadhan
Both vorticity and divergence are defined in terms of partial derivatives.
You can compute these derivatives using the `grad' function in "numDeriv"
package.

U <- function(X) { your U function}
V <- function(X) { your V function} 
# where X = c(x,y)

library(numDeriv)

grU <- function(X) grad(X, func=U)
grV <- function(X) grad(X, func=V)

# For a 2-dimensional vector field

vortivcity <- function(X) grV(X)[2] - grU(X)[1]
divergence <- function(X) grU(X)[1] + grV(X)[2]


# Here is an example:

U <- function(X) X[1]^2 + X[1] * X[2]
V <- function(X) X[2]^2 - X[1] * X[2]

> vorticity(c(2,1))
[1] -5
> divergence(c(2,1))
[1] 5
>

Does this help?

Ravi.

---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 





-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Igor Oliveira
Sent: Monday, September 08, 2008 11:37 AM
To: r-help@r-project.org
Subject: [R] Vorticity and Divergence

Hi all,

I have some wind data (U and V components) and I would like to compute
Vorticity and Divergence of these fields. Is there any R function that can
easily do that?

Thanks in advance for any help

Igor Oliveira
CSAG, Dept. Environmental & Geographical Science, University of Cape Town,
Private Bag X3, Rondebosch 7701. Tel.: +27 (0)21 650 5774
South Africa Fax: +27 (0)21 650 5773
  http:///www.csag.uct.ac.za/~igor

__
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] plotting group means

2008-09-09 Thread hadley wickham
On Tue, Sep 9, 2008 at 8:38 AM, Erich Studerus
<[EMAIL PROTECTED]> wrote:
> Thanks for all the suggestions, but it seems, that all these functions need
> a rearrangement of my data, since in my case, the dependent variables are in
> different columns. The error.bars.by-function seems to be the only plotting
> function, that does not need a rearrangement. Are there other functions,
> which can do that or is there an easy way to rearrange the columns into one?

Try:

library(reshape)
melt(x)

Hadley

-- 
http://had.co.nz/

__
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] PCA and % variance explained

2008-09-09 Thread pgseye

After doing a PCA using princomp, how do you view how much each component
contributes to variance in the dataset. I'm still quite new to the theory of
PCA - I have a little idea about eigenvectors and eigenvalues (these
determine the variance explained?). Are the eigenvalues related to loadings
in R?

Thanks,

Paul
-- 
View this message in context: 
http://www.nabble.com/PCA-and---variance-explained-tp19388970p19388970.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.


Re: [R] R_USER - in which file should I include it?

2008-09-09 Thread Gabor Grothendieck
You might look at ?.libPaths
(note the dot) and play around with adding a .libPaths command
to your Rprofile.site and again you may need Administrator rights
when editing it.  If that does not help then you can try clarifying
the problem.   In particular what "the same" refers to and what
is happening now and what you want to happen.

On Tue, Sep 9, 2008 at 9:14 AM, Eduardo M. A. M.Mendes
<[EMAIL PROTECTED]> wrote:
> Hello
>
> Many thanks.  It works just fine.
>
> How about the packages issue?  That is, same thing for the installation
> path.
>
> Cheers
>
> Ed
>
>
> -Original Message-
> From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 08, 2008 10:01 PM
> To: Eduardo M. A. M.Mendes
> Cc: r-help@r-project.org
> Subject: Re: [R] R_USER - in which file should I include it?
>
> Try adding this at the end of your etc/Rprofile.site file.  That file
> should already be there so you don't have to create it,
> just edit it.
>
> cat("Hello from Rprofile.site\n")
> setwd("C:/Users/eduardo/Documents")
>
> You may need to edit it as Administrator.   You should
> see the Hello message in which case you will know that the
> Rprofile.site file is being run.
>
> That should work unless Tinn-R runs R in such a way as to
> ignore Rprofile.site.
>
> On Mon, Sep 8, 2008 at 8:11 PM, Eduardo M. A. M.Mendes
> <[EMAIL PROTECTED]> wrote:
>> Hello
>>
>> I am not sure whether R starts from the same dir.  For instance:
>>
>> a) if I double-click on R-2.7.2 icon and then issue the command getwd(),
> the
>> result is:
>>
>>> getwd()
>> [1] "C:/Users/eduardo/Documents"
>>
>> b) If R starts from within Tinn-R, the result is:
>>
>> getwd()
>> [1] "C:/Program Files/R/R-2/bin"
>>
>> I want that no matter which calling R method I am using if I issue the
>> command getwd() (first command) the result is:
>>
>> "C:/Users/eduardo/Documents/R"
>>
>>
>> Moreover all new packages go to "C:/Users/eduardo/Documents/R/win-library"
>>
>>
>> Thanks
>>
>> Ed
>>
>> -Original Message-
>> From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
>> Sent: Monday, September 08, 2008 8:57 PM
>> To: Eduardo M. A. M.Mendes
>> Cc: r-help@r-project.org
>> Subject: Re: [R] R_USER - in which file should I include it?
>>
>> Could you explain more clearly what you mean by "the same"?
>> Do you mean that each time you click on R 2.7.2 icon on your
>> desktop that running this from the R console:
>>
>> getwd()
>>
>> is the same directory on each startup?  Isn't that already the case?
>> I don't think you need to set any environment variables at all.  If
>> you don't set
>> any environment variables then what specifically is happening that
>> you don't want to happen?
>>
>> On Mon, Sep 8, 2008 at 7:10 PM, Eduardo M. A. M.Mendes
>> <[EMAIL PROTECTED]> wrote:
>>> Hello
>>>
>>> I am a newbie.  I had my R upgraded from 2.7.1 to 2.7.2 and in doing so I
>>> decided to install all 2.7 versions under c:\program files\R\2.7 from now
>>> on (2.7.1 is located under .\2.7.1)
>>>
>>> Although I don't like the idea (I am running Vista), I have edited
>>> etc\Renviron.site to contain:
>>>
>>>
>>> R_USER=c:/Users/eduardo/Documents/R
>>> R_LIBS_USER=c:/Users/eduardo/Documents/R/win-library/2.7
>>>
>>> As far as R starting always from the same location, that is,
>>> c:/Users/eduardo/Documents/R, etc\Renviron.site didn't help.  So I wonder
>>> whether someone from the list could help me to:
>>>
>>> a) force R to start always from the same location
>>> b) force R to install all new packages in the same location
>>>
>>>
>>> Many thanks
>>>
>>> Ed
>>>
>>> PS. Before sending this email, I read windows FAQ and browsed the
> archives
>>> (too many posts in the subject!).
>>>
>>> __
>>> 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] plotting group means

2008-09-09 Thread Erich Studerus
Thanks for all the suggestions, but it seems, that all these functions need
a rearrangement of my data, since in my case, the dependent variables are in
different columns. The error.bars.by-function seems to be the only plotting
function, that does not need a rearrangement. Are there other functions,
which can do that or is there an easy way to rearrange the columns into one?

Thanks

Erich


-Ursprüngliche Nachricht-
Von: hadley wickham [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 9. September 2008 15:02
An: ONKELINX, Thierry
Cc: Erich Studerus; r-help@r-project.org
Betreff: Re: [R] plotting group means

On Tue, Sep 9, 2008 at 6:56 AM, ONKELINX, Thierry
<[EMAIL PROTECTED]> wrote:
> Dear Erich,
>
> Have a look at ggplot2
>
> library(ggplot2)
> dataset <- expand.grid(x = 1:20, y = factor(LETTERS[1:4]), value = 1:10)
> dataset$value <- rnorm(nrow(dataset), sd = 0.5) + as.numeric(dataset$y)

Or with stat_summary:

qplot(x, value, data=dataset, colour=y, group = y) +
stat_summary(geom="line", fun="mean",size=2)


-- 
http://had.co.nz/

__
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] Hardwarefor R cpu 64 vs 32, dual vs quad

2008-09-09 Thread Nic Larson
Need to buy fast computer for running R on. Today we use 2,8 MHz intel D cpu
and the calculations takes around 15 days. Is it possible to get the same
calculations down to minutes/hours by only changing the hardware?
Should I go for an really fast dual 32 bit cpu and run R over linux or xp or
go for an quad core / 64 bit cpu?
Is it effective to run R on 64 bit (and problem free
(running/installing))???
Have around 2000-3000 euro to spend
Thanx for any tip

[[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] R_USER - in which file should I include it?

2008-09-09 Thread Eduardo M. A. M.Mendes
Hello

Many thanks.  It works just fine.

How about the packages issue?  That is, same thing for the installation
path.

Cheers

Ed


-Original Message-
From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 08, 2008 10:01 PM
To: Eduardo M. A. M.Mendes
Cc: r-help@r-project.org
Subject: Re: [R] R_USER - in which file should I include it?

Try adding this at the end of your etc/Rprofile.site file.  That file
should already be there so you don't have to create it,
just edit it.

cat("Hello from Rprofile.site\n")
setwd("C:/Users/eduardo/Documents")

You may need to edit it as Administrator.   You should
see the Hello message in which case you will know that the
Rprofile.site file is being run.

That should work unless Tinn-R runs R in such a way as to
ignore Rprofile.site.

On Mon, Sep 8, 2008 at 8:11 PM, Eduardo M. A. M.Mendes
<[EMAIL PROTECTED]> wrote:
> Hello
>
> I am not sure whether R starts from the same dir.  For instance:
>
> a) if I double-click on R-2.7.2 icon and then issue the command getwd(),
the
> result is:
>
>> getwd()
> [1] "C:/Users/eduardo/Documents"
>
> b) If R starts from within Tinn-R, the result is:
>
> getwd()
> [1] "C:/Program Files/R/R-2/bin"
>
> I want that no matter which calling R method I am using if I issue the
> command getwd() (first command) the result is:
>
> "C:/Users/eduardo/Documents/R"
>
>
> Moreover all new packages go to "C:/Users/eduardo/Documents/R/win-library"
>
>
> Thanks
>
> Ed
>
> -Original Message-
> From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 08, 2008 8:57 PM
> To: Eduardo M. A. M.Mendes
> Cc: r-help@r-project.org
> Subject: Re: [R] R_USER - in which file should I include it?
>
> Could you explain more clearly what you mean by "the same"?
> Do you mean that each time you click on R 2.7.2 icon on your
> desktop that running this from the R console:
>
> getwd()
>
> is the same directory on each startup?  Isn't that already the case?
> I don't think you need to set any environment variables at all.  If
> you don't set
> any environment variables then what specifically is happening that
> you don't want to happen?
>
> On Mon, Sep 8, 2008 at 7:10 PM, Eduardo M. A. M.Mendes
> <[EMAIL PROTECTED]> wrote:
>> Hello
>>
>> I am a newbie.  I had my R upgraded from 2.7.1 to 2.7.2 and in doing so I
>> decided to install all 2.7 versions under c:\program files\R\2.7 from now
>> on (2.7.1 is located under .\2.7.1)
>>
>> Although I don't like the idea (I am running Vista), I have edited
>> etc\Renviron.site to contain:
>>
>>
>> R_USER=c:/Users/eduardo/Documents/R
>> R_LIBS_USER=c:/Users/eduardo/Documents/R/win-library/2.7
>>
>> As far as R starting always from the same location, that is,
>> c:/Users/eduardo/Documents/R, etc\Renviron.site didn't help.  So I wonder
>> whether someone from the list could help me to:
>>
>> a) force R to start always from the same location
>> b) force R to install all new packages in the same location
>>
>>
>> Many thanks
>>
>> Ed
>>
>> PS. Before sending this email, I read windows FAQ and browsed the
archives
>> (too many posts in the subject!).
>>
>> __
>> 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] plotting group means

2008-09-09 Thread hadley wickham
On Tue, Sep 9, 2008 at 6:56 AM, ONKELINX, Thierry
<[EMAIL PROTECTED]> wrote:
> Dear Erich,
>
> Have a look at ggplot2
>
> library(ggplot2)
> dataset <- expand.grid(x = 1:20, y = factor(LETTERS[1:4]), value = 1:10)
> dataset$value <- rnorm(nrow(dataset), sd = 0.5) + as.numeric(dataset$y)

Or with stat_summary:

qplot(x, value, data=dataset, colour=y, group = y) +
stat_summary(geom="line", fun="mean",size=2)


-- 
http://had.co.nz/

__
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] plotting group means

2008-09-09 Thread Jim Lemon

Hi Erich,
Have a look at brkdn.plot in the plotrix package.

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.


Re: [R] PCA and % variance explained

2008-09-09 Thread Mark Difford

Hi Paul,

>> how do you view how much each component contributes to variance in the
>> dataset ...

It helps to read the help:

?princomp
?prcomp

Contributions to inertia or variance are reported as standard deviations
(princomp.obj$sdev). So square these values to get the variance accounted
for by each component. For the rest, see loadings sub Value in the help
file.

Regards, Mark.


pgseye wrote:
> 
> After doing a PCA using princomp, how do you view how much each component
> contributes to variance in the dataset. I'm still quite new to the theory
> of PCA - I have a little idea about eigenvectors and eigenvalues (these
> determine the variance explained?). Are the eigenvalues related to
> loadings in R?
> 
> Thanks,
> 
> Paul
> 

-- 
View this message in context: 
http://www.nabble.com/PCA-and---variance-explained-tp19388970p19391466.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.


Re: [R] Compiling date

2008-09-09 Thread stephen sefick
this is day month year?
look at chron or maybe the easiest is to use excel to change the format

On Tue, Sep 9, 2008 at 7:12 AM, Dr Eberhard Lisse <[EMAIL PROTECTED]> wrote:
> Why not Format -> Cell in Excell?
>
> el
>
> on 9/9/08 1:03 PM Henrique Dallazuanna said the following:
>> Try this:
>>
>> strptime(x, ifelse(nchar(x) == 8, '%d/%m/%y', '%d/%m/%Y'))
>>
>> On Tue, Sep 9, 2008 at 3:48 AM, Megh Dal <[EMAIL PROTECTED]> wrote:
>>
>>> Hi,
>>>
>>> I have following kind of dataset (all are dates) in my Excel sheet.
>>>
>>> 09/08/08
>>> 09/05/08
>>> 09/04/08
>>> 09/02/08
>>> 09/01/08
>>> 29/08/2008
>>> 28/08/2008
>>> 27/08/2008
>>> 26/08/2008
>>> 25/08/2008
>>> 22/08/2008
>>> 21/08/2008
>>> 20/08/2008
>>> 18/08/2008
>>> 14/08/2008
>>> 13/08/2008
>>> 08/12/08
>>> 08/11/08
>>> 08/08/08
>>> 08/07/08
>>>
>>> However I want to use R to compile those data to make all dates in same
>>> format. Can anyone please tell me any automated way for doing that?
>
> __
> 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.
>



-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods. We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
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] write dataframes

2008-09-09 Thread Williams, Robin
Hi,
Just a thought.
You wrote:
ob1<-object1$ORF
ob2<-object2$ORF
and then use cbind like,
HG<-cbind(on1,ob2)
but there is an error. Is there any other function I can use? 

  If you copied and pasted this from R, then your problem is 
Hg <- cbind(on1,ob2)
  You mean 
Hg <- cbind(ob1,ob2) 
  So perhaps just a typo.
HTH,
Robin Williams 
Met Office summer intern - Health Forecasting 
[EMAIL PROTECTED] 
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Roberto 
Olivares-Hernández
Sent: Tuesday, September 09, 2008 12:47 PM
To: r-help@r-project.org
Subject: [R] write dataframes

Hi,

After manipulate my data I have ended up with 5 different data frames with 
different number of observations but the same number of variables (columns)

An example, if I write str(object1), I see this,

data.frame':   47 obs. of  3 variables:
 $ ORF: Factor w/ 245 levels "YAL038W","YAL054C",..: 10 19 38 39 44 
45 50 51 59 60 ...
 $ mRNA   : num  0.891 1.148 1.202 1.479 1.445 ...
 $ Protein: num  1.230 1.288 1.175 0.724 0.851 ..

str(object2)
'data.frame':   21 obs. of  3 variables:
 $ ORF: Factor w/ 245 levels "YAL038W","YAL054C",..: 11 25 40 55 66 
78 104 119 141 153 ...
 $ mRNA   : num  0.794 0.741 0.676 1.047 0.912 ...
 $ Protein: num  0.427 0.363 0.468 0.501 0.661 ...

using the  column $ORF from each object , how can I  compose/write the results 
in a file that contains columns with different length ?

I have tried to generate objects like
ob1<-object1$ORF
ob2<-object2$ORF
and then use cbind like,
HG<-cbind(on1,ob2)
but there is an error. Is there any other function I can use?

Thanks for the help

Roberto

__
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] plotting group means

2008-09-09 Thread ONKELINX, Thierry
Dear Erich,

Have a look at ggplot2

library(ggplot2)
dataset <- expand.grid(x = 1:20, y = factor(LETTERS[1:4]), value = 1:10)
dataset$value <- rnorm(nrow(dataset), sd = 0.5) + as.numeric(dataset$y)
plotdata <- aggregate(dataset$value, list(x = dataset$x, y = dataset$y),
mean)
plotdata <- merge(plotdata, aggregate(dataset$value, list(x = dataset$x,
y = dataset$y), sd))
plotdata$min <- plotdata$x.x - plotdata$x.y
plotdata$max <- plotdata$x.x + plotdata$x.y
ggplot(plotdata, aes(x = x, y = x.x, colour = y, min = min, max = max))
+ geom_pointrange() + geom_line() + geom_point()

HTH,

Thierry 




ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
[EMAIL PROTECTED] 
www.inbo.be 

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Namens Erich Studerus
Verzonden: dinsdag 9 september 2008 12:49
Aan: r-help@r-project.org
Onderwerp: [R] plotting group means

Hi all,



I want to plot the grouped means of some variables. The dependent
variables
and the grouping factor are stored in different columns. I want to draw
a
simple line-plot of means, in which the x-axis represents the variables
and
y-axis represents the means. The means of the groups should be connected
by
lines. So far, the only function that I could find comes closest to what
I'm
looking for, is the error.bars.by-function in the psych-package. To
know,
what I'm looking for, just type:



library(psych)
x <- matrix(rnorm(500),ncol=20)
y <- sample(4,25 ,replace=TRUE)
x <- x+y
error.bars.by(x,y,ci=0)



Now, I want to put a legend for the grouping factor of this graph. I
also
would like to manipulate the linetypes and colors of the lines. I've
read
the documentation, but it was not clear to me, how to do this. Are there
other plotting functions in R, which can do the same?



Erich





Erich Studerus
Lic. Phil. Klinische Psychologie
Psychiatric University Hospital Zurich
Division of Clinical Research
Lenggstr. 31
CH-8008 Zurich
Switzerland
Mail: [EMAIL PROTECTED]
Office: +41 44 384 26 66
Mobile: +41 76 563 31 54





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

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en 
binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is 
door een geldig ondertekend document. The views expressed in  this message and 
any annex are purely those of the writer and may not be regarded as stating an 
official position of INBO, as long as the message is not confirmed by a duly 
signed document.

__
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] plotting group means

2008-09-09 Thread Chuck Cleland
On 9/9/2008 6:49 AM, Erich Studerus wrote:
> Hi all,
> 
>  
> 
> I want to plot the grouped means of some variables. The dependent variables
> and the grouping factor are stored in different columns. I want to draw a
> simple line-plot of means, in which the x-axis represents the variables and
> y-axis represents the means. The means of the groups should be connected by
> lines. So far, the only function that I could find comes closest to what I'm
> looking for, is the error.bars.by-function in the psych-package. To know,
> what I'm looking for, just type:
> 
>  
> 
> library(psych)
> x <- matrix(rnorm(500),ncol=20)
> y <- sample(4,25 ,replace=TRUE)
> x <- x+y
> error.bars.by(x,y,ci=0)
> 
>  
> 
> Now, I want to put a legend for the grouping factor of this graph. I also
> would like to manipulate the linetypes and colors of the lines. I've read
> the documentation, but it was not clear to me, how to do this. Are there
> other plotting functions in R, which can do the same?

  Here is an approach which uses xyplot() in the lattice package and
shows how to control line types and colors:

mydf <- data.frame(x=rep(paste("Group", 1:4, sep=""), 6),
   v=rep(paste("Variable", 1:6, sep=""), each=4),
   y=runif(24))

library(lattice)

xyplot(y ~ v, groups = x, data = mydf, type="b",
  xlab="Dependent Variables", ylab="Mean",
  auto.key=list(lines=TRUE, points=TRUE, space="right"),
  par.settings = list(superpose.symbol =
   list(pch=c(16,8,1,5),
col=c("black","red","green","blue"),
lty=c(1,2,3,4)),
  superpose.line =
   list(col=c("black","red","green","blue"),
lty=c(1,2,3,4

> Erich
> 
>  
> 
> 
> 
> Erich Studerus
> Lic. Phil. Klinische Psychologie
> Psychiatric University Hospital Zurich
> Division of Clinical Research
> Lenggstr. 31
> CH-8008 Zurich
> Switzerland
> Mail: [EMAIL PROTECTED]
> Office: +41 44 384 26 66
> Mobile: +41 76 563 31 54
> 
> 
>  
> 
> 
>   [[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. 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc. (www.ndri.org)
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

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


  1   2   >