Re: [R] text command - how to get a white background to cover grid lines

2012-02-06 Thread Jim Lemon

On 02/06/2012 08:23 AM, Henry wrote:

New to R - rookie question.
I'm a mechanical engineer and enjoying using R to make high quality graphs.

I've searched.

I want to put text notation on graph plot areas and have the text background
box white to cover over the grid lines.

my command so far
text(15,5200,Air Flow,cex=.8,col=blue, background=white) # this
doesn't work...

I've tried bg=white, background color=white and a number of other
attempts.

The text is getting placed on the chart where I want it.


Hi Henry,
have a look at the boxed.labels function 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] R-RApache to develop Knowledge Base

2012-02-06 Thread Daróczi Gergely
Hi,

I am not sure about your data structure, but if you do not alter those
often from third-party programs, then storing the information in R's native
file formats (like RData) might give you some performance boost against
always querying MySQL. Of course this depends on data structure and
volume. Also,
checking out some NoSQL techniques (like CouchDB or redis) might be a good
idea for a web service - if your data is not profiting from relational
database structure. Well, you need some benchmarks here.
About plots: I would not say that the base graphics library (or even
lattice) would be slow, although ggplot2 has some issues. So IMHO it
depends on what type of plots would you generate, but I would say there
would be no serious performance issues.
After all: I think going the direct R way is great option :)

Best,
Gergely


On Mon, Feb 6, 2012 at 07:36, MLSC mlscm...@gmail.com wrote:

 Hi all,

 I need your opinion about using R-Rapache to build a knowlegde base to
 bioinformatics field.

 I have copious amount of genotype information (some few million records)
 and would like to store it in MySQL database. Then, using RMySQL connector
 I would like to use it for further analysis using R over a web interface.
 The web interface which I am thnking off, just does not serve the purose of
 statistical analysis, it should also serve as displaying data in grids and
 interactive maps etc on web interface.

 I had thought of doing the same using python-MySQLdb to store data and
 then R-rpy for further statistical analysis. But as R is now directly made
 to work on web I am very much excited about RApache project. Very recently
 I was introducing Rapache project and concept of building knowledge base
 using Rapache-R-MySQL combination to our team memebrs, Unfortunately few
 memebers were not that happy with using R directly in middle tier. There
 were serious comments about R that it is slow and generating plots on the
 fly wont be too fast. there was also discussion about maturity of RMySQL
 database connector, i mean fastness of querying MySQL will vary
 significantly with RMySQL when campared to MySQLdb connector?

 It would be nice if you give me a detailed opinion on this.

 Thanking you all in anticipation.

 Regards,
 mlsc

 --
 You received this message because you are subscribed to the Google Groups
 rapache group.
 To post to this group, send email to rapa...@googlegroups.com.
 To unsubscribe from this group, send email to
 rapache+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/rapache?hl=en.


[[alternative HTML version deleted]]

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


Re: [R] Problem with Snowball RWeka

2012-02-06 Thread Milan Bouchet-Valat
Le jeudi 12 janvier 2012 à 15:18 -0800, plecto a écrit :
 Thanks! 
 I read your shoer term solution and thanks to it was able to make stemming
 working in R for Mac OS X.
 I actually used Sys.setenv(NOAWT=TRUE) instead of Sys.setenv(NOAWT,
 true), as the latter produces the following error message: Error in
 Sys.setenv(NOAWT, true) : all arguments must be named.
For people that might bump on this thread later while searching for
help: if this solution did not work for you, make sure you run
Sys.setenv(NOAWT= true)
*before* loading Snowball/RWeka/rJava via library(). Else it won't have
any effect.

Hope this will save you some time ;-)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Makefile to compile .so in src

2012-02-06 Thread Uwe Ligges



On 05.02.2012 23:17, Matyas Sustik wrote:

Hi Uwe,


1. I don't believe you really need all the flags from above. If so, within a
package, use a Makevars file.

2. R CMD SHLIB QUIC.cpp shoudl do the trick already, perhaps some linker
flags are required for blas that can be specified in the same line, see R
CMD SHLIB --help


Thanks, I think I understand now better.  I was not familiar with
Makevars files (I only dealt with Makefiles before).

I ended up simply using in the Makevars file:

PKG_LIBS = $(LAPACK_LIBS) $(FLIBS) $(BLAS_LIBS)
PKG_CXXFLAGS = -D_LANG_R

which seems to do the job.  I am just slightly uncertain about the $()
notation; in some docs I saw @BLAS_LIBS@ to appear.  So is
$() ok? Is it the right syntax?



The @BLAS_LIBS@ should typically appear in an .in file only rather than 
the Makevars file itself.


Uwe Ligges



Thanks again!
-Matyas


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Simple lm/regression question

2012-02-06 Thread Achim Zeileis

On Mon, 6 Feb 2012, James Annan wrote:

I am trying to use lm for a simple linear fit with weights. The results 
I get from IDL (which I am more familiar with) seem correct and 
intuitive, but the lm function in R gives outputs that seem strange to 
me.


Unweighted case:


x-1:4
y-(1:4)^2
summary(lm(y~x))


Call:
lm(formula = y ~ x)

Residuals:
1  2  3  4
1 -1 -1  1

Coefficients:
   Estimate Std. Error t value Pr(|t|)
(Intercept)  -5. 1.7321  -2.887   0.1020
x 5. 0.6325   7.906   0.0156 *

So far, so good - IDL does much the same:

IDL vec=linfit(x,y,sigma=sig)
IDL print,vec,sig
-5.0  5.0
 1.73205 0.632456

Now, if the dependent variable has known (measurement) uncertainties (10, 
say) then it is appropriate to use weights defined as the inverse of the 
variances, right?


If you think that in y = x'b + e the error has

E(e^2) = sigma^2 * w

then you should use

weights = 1/w

in R because that is how the weights enter the objective function

sum 1/w (y - x'b)^2


summary(lm(y~x,weights=c(.01,.01,.01,.01)))


Call:
lm(formula = y ~ x, weights = c(0.01, 0.01, 0.01, 0.01))

Residuals:
  1234
0.1 -0.1 -0.1  0.1

Coefficients:
   Estimate Std. Error t value Pr(|t|)
(Intercept)  -5. 1.7321  -2.887   0.1020
x 5. 0.6325   7.906   0.0156 *

But here the *residuals* have changed and are no longer the actual 
response minus fitted values. (They seem to be scaled by the sqrt of the 
weights).


The summary() shows under Residuals the contributions to the objective 
function, i.e. sqrt(1/w) (y - x'b) in the notation above.


However, by using the residuals extractor function you can get the 
unweighted residuals:


residuals(lm(y~x,weights=c(.01,.01,.01,.01)))

The uncertainties on the parameter estimates, however, have 
*not* changed, which seems very odd to me.


lm() interprets the weights as precision weights, not as case weights.

Thus, the scaling in the variances is done by the number of (non-zero) 
weights, not by the sum of weights.



The behaviour of IDL is rather different and intuitive to me:

IDL vec=linfit(x,y,sigma=sig,measure_errors=[1,1,1,1])
IDL print,vec,sig
-5.0  5.0
 1.22474 0.447214

IDL vec=linfit(x,y,sigma=sig,measure_errors=[10,10,10,10])
IDL print,vec,sig
-5.0  5.0
 12.2474  4.47214


This appears to use sandwich standard errors. If you load the sandwich and 
lmtest package you can do


coeftest(m, vcov = sandwich)

where 'm' is the fitted lm object.

Hope that helps,
Z


Note that the uncertainties are 10* larger when the errors are 10* larger.

My question is really how to replicate these results in R. I suspect there is 
some terminology or convention that I'm confused by. But in the lm help page 
documentation, even the straightforward definition of residual seems 
incompatible with what the code actually returns:


residuals: the residuals, that is response minus fitted values.

But, in the weighted case, this is not actually true...

James
--
James D Annan jdan...@jamstec.go.jp Tel: +81-45-778-5618 (Fax 5707)
Senior Scientist, Research Institute for Global Change, JAMSTEC
Yokohama Institute for Earth Sciences, 3173-25 Showamachi,
Kanazawa-ku, Yokohama City, Kanagawa, 236-0001 Japan
http://www.jamstec.go.jp/frcgc/research/d5/jdannan/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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's memory capabilities

2012-02-06 Thread Alaios
Dear all,
I have tried to create a diagonal matrix of size diag(65536)

I am getting the message that the array function can not create so big array as 
the value I ask is larger than the


environment: namespace:base
 .Machine$integer
[1] 2147483647


as you will see my .Machine$integer is the one above. What that variable means? 
I am using R in a system that has 500 GB of ram available. Would it be 
something wrong in the installation?

Regards
Alex

[[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] Simple lm/regression question

2012-02-06 Thread peter dalgaard

On Feb 6, 2012, at 10:57 , Achim Zeileis wrote:

 On Mon, 6 Feb 2012, James Annan wrote:
 
 
 The summary() shows under Residuals the contributions to the objective 
 function, i.e. sqrt(1/w) (y - x'b) in the notation above.
 
 However, by using the residuals extractor function you can get the unweighted 
 residuals:
 
 residuals(lm(y~x,weights=c(.01,.01,.01,.01)))
 
 The uncertainties on the parameter estimates, however, have *not* changed, 
 which seems very odd to me.
 
 lm() interprets the weights as precision weights, not as case weights.
 
 Thus, the scaling in the variances is done by the number of (non-zero) 
 weights, not by the sum of weights.
 
 The behaviour of IDL is rather different and intuitive to me:
 
 IDL vec=linfit(x,y,sigma=sig,measure_errors=[1,1,1,1])
 IDL print,vec,sig
-5.0  5.0
 1.22474 0.447214
 
 IDL vec=linfit(x,y,sigma=sig,measure_errors=[10,10,10,10])
 IDL print,vec,sig
-5.0  5.0
 12.2474  4.47214
 
 This appears to use sandwich standard errors. 

Actually, I think the issue is slightly different:  IDL assumes that the errors 
_are_ something (notice that setting measure_errors to 1 is not equvalent to 
omitting them), R assumes that they are _proportional_ to the inverse weights, 
and proportionality to c(.01,.01,.01,.01) is not different from proportionality 
to c(1,1,1,1)...

There are a couple of ways to avoid the use of the estimated multiplicative 
dispersion parameter in R, one is to extract cov.unscaled from the summary, 
another is to use summary.glm with dispersion=1, but I'm not quite sure how 
they interact with weights (and I don't have the time to check just now.)

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

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


Re: [R] R's memory capabilities

2012-02-06 Thread peter dalgaard

On Feb 6, 2012, at 11:15 , Alaios wrote:

 Dear all,
 I have tried to create a diagonal matrix of size diag(65536)
 
 I am getting the message that the array function can not create so big array 
 as the value I ask is larger than the
 
 
 environment: namespace:base
 .Machine$integer
 [1] 2147483647
 
 
 as you will see my .Machine$integer is the one above. What that variable 
 means? I am using R in a system that has 500 GB of ram available. Would it be 
 something wrong in the installation?

Well, it means what it says. Indexing is limited by the size of a 32-bit 
integer and (2^16)^2 is too big for that. So you are limited to roughly 16 GB 
for any single object in R. 

This issue has been foreseeable for some time. It can only be fixed by internal 
changes in the R engine, but switching to long integers has various issues, so 
it is not a straightforward modification.

Meanwhile, you might want to consider whether you really do need a diagonal 
matrix of that size stored in full. It's an awful lot of zeroes to carry 
around

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

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

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


[R] creating more vectors out of one

2012-02-06 Thread Marion Wenty
Dear R-helpers,


I have got a vector which looks like the following:


apkz - c(1,2,3,4,5,6,1,1,2,1,2,3,4)


now I am trying to find a way to automatically create several vectors,
each starting with the number 1, namely:


First vector

1 2 3 4 5 6


Second vector

1

Thrid vector

1 2

Fourth vector

1 2 3 4


Does anyone know how to do that?


Thank you very much for your help in advance!


Marion

[[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 more vectors out of one

2012-02-06 Thread Paul Hiemstra
Hi,

This piece of R code does the trick:

do.call(c, sapply(c(6,1,2,4), seq, from = 1))

regards,
Paul

On 02/06/2012 11:15 AM, Marion Wenty wrote:
 Dear R-helpers,


 I have got a vector which looks like the following:


 apkz - c(1,2,3,4,5,6,1,1,2,1,2,3,4)


 now I am trying to find a way to automatically create several vectors,
 each starting with the number 1, namely:


 First vector

 1 2 3 4 5 6


 Second vector

 1

 Thrid vector

 1 2

 Fourth vector

 1 2 3 4


 Does anyone know how to do that?


 Thank you very much for your help in advance!


 Marion

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


-- 
Paul Hiemstra, Ph.D.
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494

http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 more vectors out of one

2012-02-06 Thread Petr PIKAL
Hi

 
 Dear R-helpers,
 
 
 I have got a vector which looks like the following:
 
 
 apkz - c(1,2,3,4,5,6,1,1,2,1,2,3,4)
 
 
 now I am trying to find a way to automatically create several vectors,
 each starting with the number 1, namely:
 
 
 First vector
 
 1 2 3 4 5 6
 
 
 Second vector
 
 1
 
 Thrid vector
 
 1 2
 
 Fourth vector
 
 1 2 3 4
 
 
 Does anyone know how to do that?

This came to my mind as first, but I believe there are other options.

split(apkz, cumsum(apkz==1))

Regards
Petr

 
 
 Thank you very much for your help in advance!
 
 
 Marion
 
[[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] fractional cointegration

2012-02-06 Thread mamush bukana
Some typo in my question below:
I am *attempting*  to...not stempting...


Regards

Mamush

-- Forwarded message --
From: mamush bukana mamushbuk...@gmail.com
Date: Sun, Feb 5, 2012 at 12:13 AM
Subject: fractional cointegration
To: r-help@r-project.org


Dear folk,
I am stempting to estimate a vector error correction model using a
seemingly fractionally integrated multivariate time series. The
*fracdiff *package
provides tools to estimate degree of fractional integration. But
*fracdiff *can't
help me to:
  1. test equality of two degrees of fractional integration, say d1=d2?
  2. estimate a multivariate cointegrating error correction model, like*
ca.jo *function in* urca* does for standard cointegration.

Can anyone suggest me if there is a way to do these in R please?


Thanks in advance

Mamush.

[[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] R-Censoring

2012-02-06 Thread Grace Kambey
Hi there,
can somebody give me a guide as to how to generate data from weibull
distribution with censoring
for example, the code below generates only failure data, what do i add to
get the censored data, either right or interval censoring
q-rweibull(100,2,10).

Thank you

Grace Kam
student, University of Ghana

[[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] R enterprise for linux

2012-02-06 Thread Alaios
Dear all,
I would like to ask you if it would be possible  to install R enterprise in 
opensuse.
Actually it seems that there are only Red Hat packages and I was wondering if 
their source code is available so one to try and compile it.

I would like to thank you in advance for your reply

Regards
Alex

[[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] glht (multicomparisons) with a binomial response variable

2012-02-06 Thread Frank Harrell
Making sure you have the most recent version of rms, try
require(rms)
dd - datadist(catroj, month); options(datadist='dd')
f - lrm(catroj ~ month)
contrast(f, list(month=2:12), list(month=1), conf.type='simultaneous')

The actual coding will depend on how month is defined.  The contrast above
contrasts January with all other months, with simultaneous confidence
intervals provided by glht.
Frank

gaiarrido wrote
 
 Hi,
 I,ve a run a model like this
 mcrm-glm(catroj~month,binomial)
   being catroj a binary response variable with two levels (infected
 and non infected) 
 
 anova(mcrm3,test=Chisq)
  Df Deviance Resid. Df Resid. Dev P(|Chi|)
 NULL   520 149.81  
 mes   316.86   517 132.94 0.0007551 ***
 
 When I´m trying to do a post comparisons between factors i tried with glht
 of multcomp package by Torsten Hothorn I use Tukey contrast, but dídn't
 get diferencies
   summary(glht(mcrm3,linfct=mcp(month=Tukey)))
 Estimate Std. Error z value Pr(|z|)  
 may - april == 0   -18.2470  1555.0564  -0.012   1.  
 june - april == 0   -1.9436 0.8307  -2.340   0.0671 .
 july - april == 0   -0.6253 0.5477  -1.142   0.6133  
 june - may == 016.3034  1555.0565   0.010   1.  
 july - may == 017.6216  1555.0563   0.011   1.  
 july - june == 01.3182 0.7899   1.669   0.2870  
 
 I'm afraid Tukey it is not the correct contrast, but, What should i use
 for a binary response variable?
 Any advice, please?
 


-
Frank Harrell
Department of Biostatistics, Vanderbilt University
--
View this message in context: 
http://r.789695.n4.nabble.com/glht-multicomparisons-with-a-binomial-response-variable-tp4360898p4361171.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] coxme with frailty--variance of random effect?

2012-02-06 Thread Terry Therneau
In answer to the several questions:

1. Variance of the random effect:  Your example is not reproducable
since you didn't give the random number seed.  Instead I'll use one of
the data sets that comes with the survival package.
 library(coxme)
 fit - coxme(Surv(tstart, tstop, status) ~ treat + (1|center), cgd)
 VarCorr(fit)$center
Intercept 
0.1643779 

 var(ranef(fit)$center)
Intercept 
[1] 0.06261608

 Yes, it is true that for a random effects model, the estimated variance
of the random effect is not equal to var(estimated per center effects).
Exactly the same is true of a linear mixed effects model: try the same
with lmer
 library(lme4)
 lfit(status ~ treat + (1|center), cgd)
 VarCorr(lfit)$center
 var(ranef(lfit)$center)

Why? It's a statistical insight that took me a while, so I don't think I
can explain it over email.  Find someone familiar with mixed efffects
models and have a chat.

2. coxph( +frailty(center)) and coxme give different results.
 Read the documentation.  One of them is fitting a gamma distribution
for the random effect, the other a Gaussian.

Terry Therneau

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] 'deparse(substitute'))' then 'assign' in a S4 methods

2012-02-06 Thread cgenolin
Thanks Bill,

In France, there is a famous joke about politician: Tell me what you need,
I will explain you how to do without... But in my specific case, I can not
use the classical - and [, it is why I ask my question.

More precisely, my fonction fooBis can be very long to end. So I want to
update the value of my variable from time to time. 
'assign' + break will work, whereas `fooBis-` - function(x, value) { x -
4 ; for(i in 1:1000){};x }  + break will not work.

Christophe

--
View this message in context: 
http://r.789695.n4.nabble.com/deparse-substitute-then-assign-in-a-S4-methods-tp4356748p4361210.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 enterprise for linux

2012-02-06 Thread Paul Hiemstra
Dear Alex,

By Enterprise R, do you mean Revolution R? I can also only find red hat
packages. You could send them an e-mail to ask for sources. They
probably want to help you, especially when you pay. But why do you need
RevoR and not standard R.

Paul

On 02/06/2012 12:55 PM, Alaios wrote:
 Dear all,
 I would like to ask you if it would be possible  to install R enterprise in 
 opensuse.
 Actually it seems that there are only Red Hat packages and I was wondering if 
 their source code is available so one to try and compile it.

 I would like to thank you in advance for your reply

 Regards
 Alex

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


-- 
Paul Hiemstra, Ph.D.
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494

http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770


[[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's memory capabilities

2012-02-06 Thread Ben Bolker
peter dalgaard pdalgd at gmail.com writes:

 
 
 On Feb 6, 2012, at 11:15 , Alaios wrote:
 
  Dear all,
  I have tried to create a diagonal matrix of size diag(65536)
  

  [snip ...]
 
 Well, it means what it says. Indexing is limited by the size of a
 32-bit integer and (2^16)^2 is too big for that. So you are limited
 to roughly 16 GB for any single object in R.  This issue has been
 foreseeable for some time. It can only be fixed by internal changes
 in the R engine, but switching to long integers has various issues,
 so it is not a straightforward modification.  Meanwhile, you might
 want to consider whether you really do need a diagonal matrix of
 that size stored in full. It's an awful lot of zeroes to carry
 around

  What Peter is hinting at (I think) is that you depending
on your application you may be able to get away with using
sparse matrices, which only store the positions and values
of non-zero elements rather than the values of all elements.
For example:

library(Matrix)
d - Diagonal(2^16)
str(d)

  Formal class 'ddiMatrix' [package Matrix] with 4 slots
  ..@ diag: chr U
  ..@ Dim : int [1:2] 65536 65536
  ..@ Dimnames:List of 2
  .. ..$ : NULL
  .. ..$ : NULL
  ..@ x   : num(0) 

object.size(d)
  652 bytes


vignette(Intro2Matrix)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] GAM (mgcv) warning: matrix not positive definite

2012-02-06 Thread Arnaud Mosnier
Thanks for the explanation !
Happy to know there is no problem with my models.

Have a good day,

Arnaud

2012/2/3 Simon Wood s.w...@bath.ac.uk

 It is completely safe to ignore this. Here is what is going on...

 mgcv routine 'mroot' is calling R routine 'chol' to find the *pivoted*
 Choleski factor of a positive semi definite matrix. This is deliberate, and
 completely ok to do, but 'chol' issues a warning when a matrix is only
 positive semi-definite (as opposed to strictly +ve def), even if pivoting
 has been requested. 'mroot' therefore suppresses the warning.

 best,
 Simon


 On 03/02/12 20:38, Arnaud Mosnier wrote:

 Dear list,


 I fitted the same GAM model using directly the function gam(mgcv) ...
 then as a parameter of another function that capture the warnings
 messages (see below).
 In the first case, there is no warning message printed, but in the last
 one, the function find two warning messages stating matrix not positive
 definite

 So my question is: Do I have to worry about those warnings and then why
 are they not printed in the simple use of the gam function.

 ##**###

 Here is some further description:

 ## Simple use of gam

 gam(USE ~ X1 + s(X2) + s(X3), family = binomial, data = data,
 method=REML) # print no warning message.

 ## Using a function that capture warnings

 Model_n_Warnings - function(expr) {
 localWarnings - list()
 outModel - withCallingHandlers(expr,
 warning = function(w) {
 localWarnings[[length(**localWarnings)+1]] - w$message  #
 store warning message
 invokeRestart(muffleWarning) # avoid printing warning
 message to console
 })
 list(outModel=outModel, warnings=localWarnings)
   }

 out - Model_n_Warnings (gam(USE ~ X1 + s(X2) + s(X3), family =
 binomial, data = data, method=REML))

 out$warnings

 [[1]]
 [1] matrix not positive definite

 [[2]]
 [1] matrix not positive definite


 Thanks,

 Arnaud



 --
 Simon Wood, Mathematical Science, University of Bath BA2 7AY UK
 +44 (0)1225 386603   http://people.bath.ac.uk/sw283


[[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] Covariate model in nlme

2012-02-06 Thread Ben Bolker
SHAILLY MEHROTRA shaillymehrotra at gmail.com writes:

 I am using nlme to fit a pharmacokinetic model. The base model is
 parameterized in terms of CL, V1, V2 and Q.
 
 basemodel-nlme(Conc ~TwoCompModel(CL,Q,V1,V2,Time,ID),
 data = data2, fixed=list(CL+Q+V1+V2~1),
 random = pdDiag(CL+V1+V2~1),
 start=c(CL=log(20),Q=log(252),V1=log(24.9),V2=log(120)),
 control=list(returnObject=TRUE,msVerbose=TRUE,
 msMaxIter=20,pnlsMaxIter=20,pnlsTol=1),
 verbose=TRUE).
 
 Now, I want to include covariates (age and weight) in the base model. The
 relationships between CL and covariate is linear and given as the following
 equation.
 
 CL=TVCL+a*wt-b*age, where TVCL is mean clearance, a and b are coefficients
 of weight and age, respectively.

  I believe you want something like

fixed=list(Q+V1+V2~1,CL~wt+age)

  Questions about mixed models may in general have better
success on the r-sig-mixed-models at r-project.org
mailing list.

 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] R enterprise for linux

2012-02-06 Thread Alaios
Actually, I would like to speed up matrix multiplication

which is really too slow.
MatrixA %*% MatrixB (each one is a [128,128] table) is running four hours 
now... and just imagine that I want to calculate many of those.

Which other alternative do I have?

Regards
Alex



 From: Paul Hiemstra paul.hiems...@knmi.nl

Cc: R-help@r-project.org R-help@r-project.org 
Sent: Monday, February 6, 2012 2:30 PM
Subject: Re: [R] R enterprise for linux


Dear Alex,

By Enterprise R, do you mean Revolution R? I can also only find red
hat packages. You could send them an e-mail to ask for sources. They
probably want to help you, especially when you pay. But why do you
need RevoR and not standard R.

Paul

On 02/06/2012 12:55 PM, Alaios wrote: 
Dear all,
I would like to ask you if it would be possible  to install R enterprise in 
opensuse.
Actually it seems that there are only Red Hat packages and I was wondering if 
their source code is available so one to try and compile it. I would like to 
thank you in advance for your reply Regards
Alex [[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. 


-- 
Paul Hiemstra, Ph.D.
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494 http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
[[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 enterprise for linux

2012-02-06 Thread R. Michael Weylandt
Are you sure?

I just ran

N - 128
system.time(matrix(rnorm(N^2),N) %*% matrix(rnorm(N^2),N))

and it took less than 0.044s on my (old-ish) laptop while doing other
things (and that includes the expensive rng calls). There might be
some other issues in play here. Even N - 1280 takes  5 seconds with
the rng call.

Michael

On Mon, Feb 6, 2012 at 9:29 AM, Alaios ala...@yahoo.com wrote:
 Actually, I would like to speed up matrix multiplication

 which is really too slow.
 MatrixA %*% MatrixB (each one is a [128,128] table) is running four hours 
 now... and just imagine that I want to calculate many of those.

 Which other alternative do I have?

 Regards
 Alex


 
  From: Paul Hiemstra paul.hiems...@knmi.nl

 Cc: R-help@r-project.org R-help@r-project.org
 Sent: Monday, February 6, 2012 2:30 PM
 Subject: Re: [R] R enterprise for linux


 Dear Alex,

 By Enterprise R, do you mean Revolution R? I can also only find red
    hat packages. You could send them an e-mail to ask for sources. They
    probably want to help you, especially when you pay. But why do you
    need RevoR and not standard R.

 Paul

 On 02/06/2012 12:55 PM, Alaios wrote:
 Dear all,
 I would like to ask you if it would be possible  to install R enterprise in 
 opensuse.
 Actually it seems that there are only Red Hat packages and I was wondering if 
 their source code is available so one to try and compile it. I would like to 
 thank you in advance for your reply Regards
 Alex [[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.


 --
 Paul Hiemstra, Ph.D.
 Global Climate Division
 Royal Netherlands Meteorological Institute (KNMI)
 Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
 P.O. Box 201 | 3730 AE | De Bilt
 tel: +31 30 2206 494 http://intamap.geo.uu.nl/~paul
 http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
        [[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] R enterprise for linux

2012-02-06 Thread Rich Shepard

On Mon, 6 Feb 2012, Alaios wrote:


Actually, I would like to speed up matrix multiplication which is really
too slow.


  I believe that R supports openmp during configuration. This is the
multi-processor library that allows threads to run on different cores or
processors.

  In addition to Red Hat packages you can build Slackware packages using the
scripts at www.slackbuilds.org.

Rich

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

2012-02-06 Thread Ana
I am looking for R packages that can make a Logistic Regression model
with parameter estimation by Maximum Likelihood Estimation.


Many thanks for helping out.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 enterprise for linux

2012-02-06 Thread Ernest Adrogué
 6-02-2012, 06:29 (-0800); Alaios escriu:
 Actually, I would like to speed up matrix multiplication
 
 which is really too slow.
 MatrixA %*% MatrixB (each one is a [128,128] table) is running four hours 
 now... and just imagine that I want to calculate many of those.

It doesn't seem normal to me... in my computer such a multiplication
takes a fraction of a second:

system.time(array(rnorm(128*128), c(128,128)) %*%
array(rnorm(128*128), c(128,128)))
   user  system elapsed 
  0.008   0.000   0.006 

Am I missing something?

Cheers,
Ernest

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 enterprise for linux

2012-02-06 Thread Alaios
My bad..

these are the real matrices

 G-DiagonalGaussian( NumberOfImagePixels,sd=Gsd)
 str(G)
 num [1:16384, 1:16384] 1400 0 0 0 0 ...
 S-PointSamplingMatrix(EffectiveSensors,NumberOfImagePixels)
 str(S)
 num [1:10650, 1:16384] 0 0 0 0 0 0 0 0 0 0 ...
 A-S %*% G






 From: R. Michael Weylandt michael.weyla...@gmail.com

Cc: Paul Hiemstra paul.hiems...@knmi.nl; R-help@r-project.org 
R-help@r-project.org 
Sent: Monday, February 6, 2012 3:39 PM
Subject: Re: [R] R enterprise for linux

Are you sure?

I just ran

N - 128
system.time(matrix(rnorm(N^2),N) %*% matrix(rnorm(N^2),N))

and it took less than 0.044s on my (old-ish) laptop while doing other
things (and that includes the expensive rng calls). There might be
some other issues in play here. Even N - 1280 takes  5 seconds with
the rng call.

Michael


 Actually, I would like to speed up matrix multiplication

 which is really too slow.
 MatrixA %*% MatrixB (each one is a [128,128] table) is running four hours 
 now... and just imagine that I want to calculate many of those.

 Which other alternative do I have?

 Regards
 Alex


 
  From: Paul Hiemstra paul.hiems...@knmi.nl

 Cc: R-help@r-project.org R-help@r-project.org
 Sent: Monday, February 6, 2012 2:30 PM
 Subject: Re: [R] R enterprise for linux


 Dear Alex,

 By Enterprise R, do you mean Revolution R? I can also only find red
    hat packages. You could send them an e-mail to ask for sources. They
    probably want to help you, especially when you pay. But why do you
    need RevoR and not standard R.

 Paul

 On 02/06/2012 12:55 PM, Alaios wrote:
 Dear all,
 I would like to ask you if it would be possible  to install R enterprise in 
 opensuse.
 Actually it seems that there are only Red Hat packages and I was wondering if 
 their source code is available so one to try and compile it. I would like to 
 thank you in advance for your reply Regards
 Alex [[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.


 --
 Paul Hiemstra, Ph.D.
 Global Climate Division
 Royal Netherlands Meteorological Institute (KNMI)
 Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
 P.O. Box 201 | 3730 AE | De Bilt
 tel: +31 30 2206 494 http://intamap.geo.uu.nl/~paul
 http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
        [[alternative HTML version deleted]]


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

[[alternative HTML version deleted]]

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


Re: [R] Logistic Regression

2012-02-06 Thread Sarah Goslee
Hi,

On Mon, Feb 6, 2012 at 10:08 AM, Ana rrast...@gmail.com wrote:
 I am looking for R packages that can make a Logistic Regression model
 with parameter estimation by Maximum Likelihood Estimation.

How are you looking? Did you perhaps try Google

https://www.google.com/#q=r-help+Logistic+Regression+Maximum+Likelihood+Estimation

or rseek.org

http://www.rseek.org/?cx=010923144343702598753%3Aboaz1reyxd4newwindow=1q=Logistic+Regression+Maximum+Likelihood+Estimationsa=Search+functions%2C+lists%2C+and+morecof=FORID%3A11siteurl=rseek.org%2F

or one of the other R-centric search functions out there, like the
ones built right into R?

How did what you found not meet your needs?

Sarah


 Many thanks for helping out.



-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Writing to a file

2012-02-06 Thread Felicity
Dear All!!

I am also new in R 
and trying to write my results into a file I post here..hopefully is the
proper place
To be more secific  I have this loop 


counter = 0
 for (i in 1:nrow(y))
 {
 for (j in 1:ncol(y))
 {
 if (y[i,j]==Func_0005634) {
 counter = counter + 1 }
 if(y[i,j]==Func_0005737){
 counter = counter + 1 } 
 if(y[i,j]==Func_0005515){
counter = counter + 1 }
}
 if(counter == 2) {
 k-structure(list(print(y[i,1])), class = data.frame)
}
 if(counter == 3 ){
 l-structure(list(print(y[i,1])), class = data.frame)
}
 counter = 0
 }


for counter==2 or counter ==3 
I want to get print(y[i,1]) 
where in column 1 exists the name of the protein
whereas in the rest columns exist somewhere randomly the strings im looking
for 

I want to get the names of the proteins in a file and those that have either
2 or 3 functions be named as cancer.

the specific part of code gives me as a result in the command line this (is
a sample cause im working on 8500lines)
[1] Prot_10035
8527 Levels: Prot_0 Prot_1 Prot_10 Prot_100 Prot_1000 Prot_1 ...
Prot_9996
[1] Prot_10041
8527 Levels: Prot_0 Prot_1 Prot_10 Prot_100 Prot_1000 Prot_1 ...
Prot_9996
[1] Prot_10045
8527 Levels: Prot_0 Prot_1 Prot_10 Prot_100 Prot_1000 Prot_1 ...
Prot_9996


which is fine i can see the names of the proteins but i cant use them so to
label them
When I try to write it in a file ..then is kept only the last result because
unfortunatelly 
he overwrites himself :(

How can I use those data? How can I write them in a file and add as an extra
column the word cancel
for those containing the specific functions?

Any hint you may give me it would be more than helpful for me!
Thank you a lot in advance! 
Looking forward to your reply :)


--
View this message in context: 
http://r.789695.n4.nabble.com/Writing-to-a-file-tp3070617p4360889.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] glht (multicomparisons) with a binomial response variable

2012-02-06 Thread gaiarrido
Hi,
I,ve a run a model like this
mcrm-glm(catroj~month,binomial)
  being catroj a binary response variable with two levels (infected and
non infected) 

 anova(mcrm3,test=Chisq)
 Df Deviance Resid. Df Resid. Dev P(|Chi|)
NULL   520 149.81  
mes   316.86   517 132.94 0.0007551 ***

When I´m trying to do a post comparisons between factors i tried with glht
of multcomp package by Torsten Hothorn I use Tukey contrast, but dídn't
get diferencies
  summary(glht(mcrm3,linfct=mcp(month=Tukey)))
Estimate Std. Error z value Pr(|z|)  
may - april == 0   -18.2470  1555.0564  -0.012   1.  
june - april == 0   -1.9436 0.8307  -2.340   0.0671 .
july - april == 0   -0.6253 0.5477  -1.142   0.6133  
june - may == 016.3034  1555.0565   0.010   1.  
july - may == 017.6216  1555.0563   0.011   1.  
july - june == 01.3182 0.7899   1.669   0.2870  

I'm afraid Tukey it is not the correct contrast, but, What should i use
for a binary response variable?
Any advice, please?


-
Mario Garrido Escudero
PhD student
Dpto. de Biología Animal, Ecología, Parasitología, Edafología y Qca. Agrícola
Universidad de Salamanca
--
View this message in context: 
http://r.789695.n4.nabble.com/glht-multicomparisons-with-a-binomial-response-variable-tp4360898p4360898.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] AIC for piecewise and cuadratic comparison

2012-02-06 Thread Angel Marley
Hi everybody, I would like to compare using the Akaike Information Criteria 
(AIC) a quadratic model and a piecewise fitted model.
Is it correct to use AIC to compare this models with such a different structure?
Thanks in advance
Angel


# A simple example
a-1
b-2
xx-seq(-15,15,length=50) # Generate sequence of xs
yy- 2 + 1.2*xx -0.2*xx^2 + runif(50, 0,8) #add some noise

## FIT models
lmXX-lm(yy~xx) # Fit linear model
cuad-lm(yy~xx+I(xx^2)) # Fit quadratic model

require(quantreg)
segXX-segmented(lmXX,seg.Z=~xx,psi=list(xx=5)) # Fit piecewise model

## Visualize results
plot(xx,yy)
plot.segmented(segXX,add=T)
lines(xx,coef(cuad)[1]+coef(cuad)[2]*xx + coef(cuad)[3]*xx^2,col=blue)

c(AIC_cuadratic=AIC(cuad),AIC_segmented=AIC(segXX)) # Obviously AIC for the 
cuadratic model is lower than piecewise, so I would chose this model over a 
piecewise fit in this case. But is the use of AIC 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] appending variable's values in table like fashion

2012-02-06 Thread sagarnikam123
i have two variable
 pyar
[1] M  12 34 13
 gita
[1] U  22 33 44
want to append gita object below pyar object as
 want to take in anther variable

 M  12 34 13
 U  22 33 44

 write it in table fashion inside file

--
View this message in context: 
http://r.789695.n4.nabble.com/appending-variable-s-values-in-table-like-fashion-tp4360966p4360966.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] how to access values from functions

2012-02-06 Thread Aparna Sampath
Hi All

I would like to know how to access the values of the variable
lambda.mu and and see what abs(lambdas[1])
 does since lambdas is not a keyword.

Snippet of the code:

scoreFunction - function(lambdas)
  {
lambda.mu - abs(lambdas[1])

sme.em(yi,tmei,Xi,Ni,G,lambda.mu,lambda.v)$AICc
  }

Thanks in advance.

Regards
Ap


-- 
Aparna Sampath
Master of Science (Bioinformatics)
Nanyang Technological University
Mob no : +65 91601854

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] using file in hdfs for data mining algorithms in r

2012-02-06 Thread Karthi KN
hi all, i am new to r , i am trying to run data mining algorithms using map
reduce framework.. *
*i have few basic doubts*

*1. can i give file in hdfs to kmeans( ) ?  ?I tried as
 file1 = hdfs.file(testdata/synthetic_control.data)
 isf = hdfs.read(lsf,5242880,0)
l = kmeans(isf,2,10)

its not working..  please help

2. How to access the file in hdfs and give as input to algorithms ?

please reply..

Regards,
./T.karthik*
*

[[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] multiple comparisons in nested design

2012-02-06 Thread José Trujillo Carmona
Dear professors and collegues

I need to perform a analysis of dates from a nested experimental design.

 From

Bioestatical Analysis of Zar
Bimetry of Sokal  Rohlf
Design and Analysis of Experiments of Montgomery

I have:

Sum (mean(x)_i - mean(x)_T)2 / (a-1) - var(epsilon) + n sigma2_B + n b 
(sum alfa_i)2 / (a-1)
Sum (mean(x)_ij - mean(x)_i)2 / (ba-a) - var(epsilon) + n sigma2_B
Sum (x_ijl - mean(x)_ij)2 / (abn-ab) - var(epsilon)

Dates for the execution of a example:

# Mesures - as.data.frame(matrix(rnorm(45*1, mean=10, sd=1), ncol=1))
# colnames(Mesures) - VR
# Mesures$trat - as.factor(rep(1:5,rep(9,5)))
# Mesures$patient - as.factor(rep(1:15,rep(3,15)))

The Analysis of Variance could be:

# AnovaModel.1 -aov(VR ~ trat + trat/patient, data=Mesures)
# summary(AnovaModel.1)
   Df Sum Sq Mean Sq F value Pr(F)
trat  4  1.580  0.3950   0.751  0.565
trat:patient 10  4.811  0.4811   0.915  0.533
Residuals30 15.778  0.5259

But this methods causes pseudoreplication because the F is the ratio of 
MS of trat and MS of res. However the variability of trat is at 
least as big as the variability of patient.

The correct analysis suggested by ?aov is:

# AnovaModel.2 - aov(VR ~ trat + Error(patient),data=Mesures)
# summary(AnovaModel.2)

Error: patient
   Df Sum Sq Mean Sq F value Pr(F)
trat   4  1.580  0.3950   0.821  0.541
Residuals 10  4.811  0.4811

Error: Within
   Df Sum Sq Mean Sq F value Pr(F)
Residuals 30  15.78  0.5259

Althougth the Anova Model object it isn't a object of class aov but a 
object of classaovlist:

# attr(AnovaModel.2,class)
[1] aovlist listof

This class isn't suitable for the glht function neither TukeyHSD function.

I can extract a object of class aov through:

# ls.str(pat=AnovaModel.2)
AnovaModel.2 : List of 3
  $ (Intercept):List of 9
  $ patient:List of 9
  $ Within :List of 6
# AnovaModel.3-AnovaModel.2$patient
# attr(AnovaModel.3,class)
[1] aov lm

This model is suitable for confidence intervals:

# confint(AnovaModel.3)
2.5 %97.5 %
trat2 -0.9107959 0.5462655
trat3 -0.9848351 0.4722263
trat4 -1.2997235 0.1573379
trat5 -1.0623118 0.3947496

But it is useless for multiple comparisons:

# Pairs - glht(AnovaModel.3, linfct = mcp(Tratamiento = Tukey))
Error in model.matrix.default(model, data = structure(list(method = lm), 
.Names = method),  :
model structure is invalid
Error in factor_contrasts(model) :
   no 'model.matrix' method for 'model' found!

# TukeyHSD(AnovaModel.3, Tratamiento)
Error in model.tables.aov(x, means) :
   this fit does not inherit from lm

Another way of analysis is through lme4 package:

# AnovaModel.3 - lmer(VR ~ trat+(1|trat/patient), data=Mesures)

But the anova test isn't the correct ratio above shown:

# anova(AnovaModel.3)
Analysis of Variance Table
  Df  Sum Sq Mean Sq F value
trat  4 0.43112 0.10778  0.2094

Other options for lmer:

# anova(AnovaModel.4)
Analysis of Variance Table
  Df Sum Sq Mean Sq F value
trat  4 1.5801 0.39501  0.7675

Neither is the F ratio searched and above shown:

# summary(AnovaModel.2)

Error: patient
   Df Sum Sq Mean Sq F value Pr(F)
trat   4  1.580  0.3950   0.821  0.541
Residuals 10  4.811  0.4811

I can also take the mean of treatment, but if a measures of some patient 
fails, and the design becomes unbalanced, the results would be very 
difficult.

Can anyone give me the right model and multiple comparisons?

Thanks very much for the help and please excuse for my bad english.




-- 
_---^---_

Univ. de Extremadura
Dept. Matemáticas.
Despacho B29
Tf: + 34 924 289 300
Ext. 86823


[[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] Orthogonal contrasts in mixed-effect models

2012-02-06 Thread xavi sole
Hello all,

I am wiriting here to look for help!!!

I am running a mixed-model effect lmer() relating the total species richnees
observed in one place with some landscape indicators depending on three
positions at field scale (Boundary, edge, centre)  nested to the location
where the survey was conducted. The model follow the next instruction

lmer(a~position*%naturalvegetation + position*P/A+ (1|location)

However, running the model in this way it is not possible to compare
position between them and I have to run orthogonal contrast for this
porpouse.

my data matrix has the following structure


   Richness  Location%NVP/A   Location
 3   1  34.3  0,43 
B
 5  2  45.2  0.33  B
12  3  21.2  0.21  E 
64  11.2  0.21 E
   
   
8 135 76.3 0.29  C
 
How can I run the orthogonal contrast. Somebody now how tu run it and the
necessary code.

Excuse me because I am not an stadistic people. I am botanic

Thanks!

--
View this message in context: 
http://r.789695.n4.nabble.com/Orthogonal-contrasts-in-mixed-effect-models-tp4361007p4361007.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] multiple comparisons in nested design (error correction)

2012-02-06 Thread José Trujillo Carmona
The last model is:

AnovaModel.4 - lmer(VR ~ trat+(1|patient:trat), data=Mesures)

Sorry.



El 06/02/12 13:43, José Trujillo Carmona escribió:
 Dear professors and collegues

 I need to perform a analysis of dates from a nested experimental design.

 From

 Bioestatical Analysis of Zar
 Bimetry of Sokal  Rohlf
 Design and Analysis of Experiments of Montgomery

 I have:

 Sum (mean(x)_i - mean(x)_T)2 / (a-1) - var(epsilon) + n sigma2_B + n 
 b (sum alfa_i)2 / (a-1)
 Sum (mean(x)_ij - mean(x)_i)2 / (ba-a) - var(epsilon) + n sigma2_B
 Sum (x_ijl - mean(x)_ij)2 / (abn-ab) - var(epsilon)

 Dates for the execution of a example:

 # Mesures - as.data.frame(matrix(rnorm(45*1, mean=10, sd=1), ncol=1))
 # colnames(Mesures) - VR
 # Mesures$trat - as.factor(rep(1:5,rep(9,5)))
 # Mesures$patient - as.factor(rep(1:15,rep(3,15)))

 The Analysis of Variance could be:

 # AnovaModel.1 -aov(VR ~ trat + trat/patient, data=Mesures)
 # summary(AnovaModel.1)
   Df Sum Sq Mean Sq F value Pr(F)
 trat  4  1.580  0.3950   0.751  0.565
 trat:patient 10  4.811  0.4811   0.915  0.533
 Residuals30 15.778  0.5259

 But this methods causes pseudoreplication because the F is the ratio 
 of MS of trat and MS of res. However the variability of trat is 
 at least as big as the variability of patient.

 The correct analysis suggested by ?aov is:

 # AnovaModel.2 - aov(VR ~ trat + Error(patient),data=Mesures)
 # summary(AnovaModel.2)

 Error: patient
   Df Sum Sq Mean Sq F value Pr(F)
 trat   4  1.580  0.3950   0.821  0.541
 Residuals 10  4.811  0.4811

 Error: Within
   Df Sum Sq Mean Sq F value Pr(F)
 Residuals 30  15.78  0.5259

 Althougth the Anova Model object it isn't a object of class aov but 
 a object of classaovlist:

 # attr(AnovaModel.2,class)
 [1] aovlist listof

 This class isn't suitable for the glht function neither TukeyHSD function.

 I can extract a object of class aov through:

 # ls.str(pat=AnovaModel.2)
 AnovaModel.2 : List of 3
  $ (Intercept):List of 9
  $ patient:List of 9
  $ Within :List of 6
 # AnovaModel.3-AnovaModel.2$patient
 # attr(AnovaModel.3,class)
 [1] aov lm

 This model is suitable for confidence intervals:

 # confint(AnovaModel.3)
2.5 %97.5 %
 trat2 -0.9107959 0.5462655
 trat3 -0.9848351 0.4722263
 trat4 -1.2997235 0.1573379
 trat5 -1.0623118 0.3947496

 But it is useless for multiple comparisons:

 # Pairs - glht(AnovaModel.3, linfct = mcp(Tratamiento = Tukey))
 Error in model.matrix.default(model, data = structure(list(method = 
 lm), .Names = method),  :
 model structure is invalid
 Error in factor_contrasts(model) :
   no 'model.matrix' method for 'model' found!

 # TukeyHSD(AnovaModel.3, Tratamiento)
 Error in model.tables.aov(x, means) :
   this fit does not inherit from lm

 Another way of analysis is through lme4 package:

 # AnovaModel.3 - lmer(VR ~ trat+(1|trat/patient), data=Mesures)

 But the anova test isn't the correct ratio above shown:

 # anova(AnovaModel.3)
 Analysis of Variance Table
  Df  Sum Sq Mean Sq F value
 trat  4 0.43112 0.10778  0.2094

 Other options for lmer:

 # anova(AnovaModel.4)
 Analysis of Variance Table
  Df Sum Sq Mean Sq F value
 trat  4 1.5801 0.39501  0.7675

 Neither is the F ratio searched and above shown:

 # summary(AnovaModel.2)

 Error: patient
   Df Sum Sq Mean Sq F value Pr(F)
 trat   4  1.580  0.3950   0.821  0.541
 Residuals 10  4.811  0.4811

 I can also take the mean of treatment, but if a measures of some 
 patient fails, and the design becomes unbalanced, the results would be 
 very difficult.

 Can anyone give me the right model and multiple comparisons?

 Thanks very much for the help and please excuse for my bad english.




 -- 
 _---^---_

 Univ. de Extremadura
 Dept. Matemáticas.
 Despacho B29
 Tf: + 34 924 289 300
 Ext. 86823


-- 
_---^---_

Univ. de Extremadura
Dept. Matemáticas.
Despacho B29
Tf: + 34 924 289 300
Ext. 86823


[[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] MLEs using optim

2012-02-06 Thread djbanana
I am trying to use the optim command to get the MLEs for a number of
parameters based on some data. Is it possible to write a program that
maximizes the likelihood and stores the parameters (many times)? I need to
do this a lot of times, each time the data will be updated with more entries
(rows). I need to see how the new data is affecting the previous parameter
estimates of the model. What is the best way to do it?

Thanks.

--
View this message in context: 
http://r.789695.n4.nabble.com/MLEs-using-optim-tp4361361p4361361.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] Multi-page PDF using dev.copy2pdf(filename, onefile=TRUE)?

2012-02-06 Thread Doug Hill
Hi all. I want to generate a sequence of n plots and save them into a single 
PDF file, one plot per page. From the R docs and other sources I gather the 
basic way to do this is save plot 1 into a file then append the 2:n plots to 
the same file. 
This code shows my basic approach, but for some reason only the last plot is 
saved into the pdf. I've tried different variations (e.g. using onefile only in 
the second call, or only in the first), to no avail. The comments show what I 
see if I step through the code one line at a time: 
scratch-function() { 
graphics.off() 
plot(1:7, 1:7) # Opens a graphics window and displays a 7-point plot in it, as 
expected 
dev.copy2pdf(file=test.pdf, onefile=TRUE) # I see the 7-point plot in Adobe 
reader, as expected 
plot(1:5, 1:5) # Overwrites in the graphics window the 7-point plot with a 
5-point, as expected 
dev.copy2pdf(file=test.pdf, onefile=TRUE) # Overwrites test.pdf so that it 
contains only the 7-point plot 
} 
A couple things: 
(1) The reason I don't just use something like pdf(filename) plot(...) 
plot(...) dev.off() is that I also want to see the plots before they're saved 
(I pause after each plot() command). But according to the docs for 
dev.copy2pdf(), that function accepts the same args as pdf() does, including 
onefile. 
(2) I wrap my code in a function to be able to use it in the StatEt debugger in 
Eclipse. 
If you know what I'm doing wrong, or know of a different/better way, advise 
away! Thanks, Doug
[[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] Colors vector based on group

2012-02-06 Thread Filoche
Hi everyone.

I have a vector like this:

x =
c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2)

I would like to associate a colour to each of these entry. For example, I
could use /topo.colors(3)/ (since I have 3 groups).

I know it is easy to do this with  /if/else/ statements, but I would like to
find a proper way to do this.

Thanks in advance,
Phil



--
View this message in context: 
http://r.789695.n4.nabble.com/Colors-vector-based-on-group-tp4361425p4361425.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] lmer with spatial and temporal random factors, not nested

2012-02-06 Thread Marte Lilleeng
Hi, I am new to this list.
I have a question regarding including both spatial and temporal random
factors in lmer. These two are not nested, and an example of model I
try to fit is

model1-lmer(Richness~Y+Canopy+Veg_cm+Treatment+(1|Site/Block/Plot)+(1|Year),
family=poisson, REML=FALSE),
where
richness = integer
Y  Treatment = factor
Canopy  Veg_cm = numerical, continous
Site/Block/Plot= factor
Year = integer

I get the following warning message:

Warning messages:
1: In mer_finalize(ans) :
  Cholmod warning 'not positive definite' at
file:../Cholesky/t_cholmod_rowfac.c, line 432
2: In mer_finalize(ans) : singular convergence (7)

Is this due to the nature of my fixed/random factors or the way I put
up the random factors?

In lme I could include a component for autocorrelation,
ex:cor=corAR1(form=~Year|Site/Block/ID). Does the equivalent exist for
lmer?

I will be very happy if someone can help me!


-- 
Thanks a lot

Marte

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 enterprise for linux

2012-02-06 Thread David Winsemius


On Feb 6, 2012, at 10:17 AM, Alaios wrote:


My bad..

these are the real matrices


G-DiagonalGaussian( NumberOfImagePixels,sd=Gsd)
str(G)

 num [1:16384, 1:16384] 1400 0 0 0 0 ...

S-PointSamplingMatrix(EffectiveSensors,NumberOfImagePixels)
str(S)

 num [1:10650, 1:16384] 0 0 0 0 0 0 0 0 0 0 ...

A-S %*% G




You seems confused about the size of your objects. You earlier said  
they were  [128,128] which we took to mean 128 x 128 matrices, they  
are far larger than that. I'm guessing that you are consuming all of  
your RAM and paging out to disk. But that is just a guess since you  
provided none of the system information that the Posting Guide suggests.


--
David.


___
From: R. Michael Weylandt michael.weyla...@gmail.com

Cc: Paul Hiemstra paul.hiems...@knmi.nl; R-help@r-project.org R-help@r-project.org 


Sent: Monday, February 6, 2012 3:39 PM
Subject: Re: [R] R enterprise for linux

Are you sure?

I just ran

N - 128
system.time(matrix(rnorm(N^2),N) %*% matrix(rnorm(N^2),N))

and it took less than 0.044s on my (old-ish) laptop while doing other
things (and that includes the expensive rng calls). There might be
some other issues in play here. Even N - 1280 takes  5 seconds with
the rng call.

Michael



Actually, I would like to speed up matrix multiplication

which is really too slow.
MatrixA %*% MatrixB (each one is a [128,128] table) is running four  
hours now... and just imagine that I want to calculate many of those.


Which other alternative do I have?

Regards
Alex



 From: Paul Hiemstra paul.hiems...@knmi.nl

Cc: R-help@r-project.org R-help@r-project.org
Sent: Monday, February 6, 2012 2:30 PM
Subject: Re: [R] R enterprise for linux


Dear Alex,

By Enterprise R, do you mean Revolution R? I can also only find red
   hat packages. You could send them an e-mail to ask for sources.  
They

   probably want to help you, especially when you pay. But why do you
   need RevoR and not standard R.

Paul

On 02/06/2012 12:55 PM, Alaios wrote:
Dear all,
I would like to ask you if it would be possible  to install R  
enterprise in opensuse.
Actually it seems that there are only Red Hat packages and I was  
wondering if their source code is available so one to try and  
compile it. I would like to thank you in advance for your reply  
Regards

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


--
Paul Hiemstra, Ph.D.
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494 http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
   [[alternative HTML version deleted]]


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


[[alternative HTML version deleted]]

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


David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 enterprise for linux

2012-02-06 Thread Alaios
That was my bad. (doing two things at same time)
I am not out of memory by no means it is just that it only runs at one 
core. IF somehow R was able to see the many cores in my system.

Regards
Alex




 From: David Winsemius dwinsem...@comcast.net

Cc: R. Michael Weylandt michael.weyla...@gmail.com; R-help@r-project.org 
R-help@r-project.org 
Sent: Monday, February 6, 2012 4:31 PM
Subject: Re: [R] R enterprise for linux


On Feb 6, 2012, at 10:17 AM, Alaios wrote:

 My bad..
 
 these are the real matrices
 
 G-DiagonalGaussian( NumberOfImagePixels,sd=Gsd)
 str(G)
  num [1:16384, 1:16384] 1400 0 0 0 0 ...
 S-PointSamplingMatrix(EffectiveSensors,NumberOfImagePixels)
 str(S)
  num [1:10650, 1:16384] 0 0 0 0 0 0 0 0 0 0 ...
 A-S %*% G
 

You seems confused about the size of your objects. You earlier said they were  
[128,128] which we took to mean 128 x 128 matrices, they are far larger than 
that. I'm guessing that you are consuming all of your RAM and paging out to 
disk. But that is just a guess since you provided none of the system 
information that the Posting Guide suggests.

--David.

 ___
 From: R. Michael Weylandt michael.weyla...@gmail.com
 
 Cc: Paul Hiemstra paul.hiems...@knmi.nl; R-help@r-project.org 
 R-help@r-project.org
 Sent: Monday, February 6, 2012 3:39 PM
 Subject: Re: [R] R enterprise for linux
 
 Are you sure?
 
 I just ran
 
 N - 128
 system.time(matrix(rnorm(N^2),N) %*% matrix(rnorm(N^2),N))
 
 and it took less than 0.044s on my (old-ish) laptop while doing other
 things (and that includes the expensive rng calls). There might be
 some other issues in play here. Even N - 1280 takes  5 seconds with
 the rng call.
 
 Michael
 
 
 Actually, I would like to speed up matrix multiplication
 
 which is really too slow.
 MatrixA %*% MatrixB (each one is a [128,128] table) is running four hours 
 now... and just imagine that I want to calculate many of those.
 
 Which other alternative do I have?
 
 Regards
 Alex
 
 
 
  From: Paul Hiemstra paul.hiems...@knmi.nl
 
 Cc: R-help@r-project.org R-help@r-project.org
 Sent: Monday, February 6, 2012 2:30 PM
 Subject: Re: [R] R enterprise for linux
 
 
 Dear Alex,
 
 By Enterprise R, do you mean Revolution R? I can also only find red
    hat packages. You could send them an e-mail to ask for sources. They
    probably want to help you, especially when you pay. But why do you
    need RevoR and not standard R.
 
 Paul
 
 On 02/06/2012 12:55 PM, Alaios wrote:
 Dear all,
 I would like to ask you if it would be possible  to install R enterprise in 
 opensuse.
 Actually it seems that there are only Red Hat packages and I was wondering 
 if their source code is available so one to try and compile it. I would like 
 to thank you in advance for your reply Regards
 Alex [[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.
 
 
 --
 Paul Hiemstra, Ph.D.
 Global Climate Division
 Royal Netherlands Meteorological Institute (KNMI)
 Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
 P.O. Box 201 | 3730 AE | De Bilt
 tel: +31 30 2206 494 http://intamap.geo.uu.nl/~paul
 http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
        [[alternative HTML version deleted]]
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
     [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT
[[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] Colors vector based on group

2012-02-06 Thread David Winsemius


On Feb 6, 2012, at 9:40 AM, Filoche wrote:


Hi everyone.

I have a vector like this:

x =
c
(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2
)

I would like to associate a colour to each of these entry. For  
example, I

could use /topo.colors(3)/ (since I have 3 groups).

I know it is easy to do this with  /if/else/ statements, but I would  
like to

find a proper way to do this.



topo.colors(3)[c(1,2,3,1,2,3)]
[1] #4C00 #00FF4DFF #00FF #4C00 #00FF4DFF  
#00FF


--

David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] appending variable's values in table like fashion

2012-02-06 Thread David Winsemius


On Feb 6, 2012, at 6:29 AM, sagarnikam123 wrote:


i have two variable

pyar

[1] M  12 34 13

gita

[1] U  22 33 44
want to append gita object below pyar object as
 want to take in anther variable



You could make a character matrix:

cmat - matrix(c(pyar,gita), nrow=2, byrow=T)



M  12 34 13
U  22 33 44

 write it in table fashion inside file


write.table(cmat, row.names=F, col.names=F)
M 12 34 13
U 22 33 44

--

David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Colors vector based on group

2012-02-06 Thread Achim Zeileis

On Mon, 6 Feb 2012, Filoche wrote:


Hi everyone.

I have a vector like this:

x =
c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2)

I would like to associate a colour to each of these entry. For example, I
could use /topo.colors(3)/ (since I have 3 groups).

I know it is easy to do this with  /if/else/ statements, but I would like to
find a proper way to do this.


Simply use 'x' for subsetting, i.e., with your example topo.colors(3)[x].

See also the packages 'colorspace' or 'RColorBrewer' (amongst others) for 
different color palettes.


hth,
Z


Thanks in advance,
Phil



--
View this message in context: 
http://r.789695.n4.nabble.com/Colors-vector-based-on-group-tp4361425p4361425.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.


Re: [R] R's memory capabilities

2012-02-06 Thread Daniel Nordlund
 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of Alaios
 Sent: Monday, February 06, 2012 3:11 AM
 To: peter dalgaard
 Cc: R-help@r-project.org
 Subject: Re: [R] R's memory capabilities
 
 Thanks a lot for your answer :)
 actually I am converting a 256*256 image to a vector so to apply some 1-d
 transformations. Is it possible to  create in R a sparse matrix instead of
 carrying all those zeros?
 
 So that means that I want to have a diagonal sparse matrix..
 
 Thanks a lot
 
 Alex
 

maybe look at ?as.vector.  But it is really hard to know without knowing what 
you expect your vector to look like or what transforms you will be doing.

Hope this is helpful,

Dan

Daniel Nordlund
Bothell, WA 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] R-RApache to develop Knowledge Base

2012-02-06 Thread Spencer Graves
Have you tried Bioconductor (www.bioconductor.org 
http://www.bioconductor.org/)?  Spencer


On 2/5/2012 10:36 PM, MLSC wrote:
 Hi all,

 I need your opinion about using R-Rapache to build a knowlegde base to
 bioinformatics field.

 I have copious amount of genotype information (some few million records)
 and would like to store it in MySQL database. Then, using RMySQL connector
 I would like to use it for further analysis using R over a web interface.
 The web interface which I am thnking off, just does not serve the purose of
 statistical analysis, it should also serve as displaying data in grids and
 interactive maps etc on web interface.

 I had thought of doing the same using python-MySQLdb to store data and then
 R-rpy for further statistical analysis. But as R is now directly made to
 work on web I am very much excited about RApache project. Very recently I
 was introducing Rapache project and concept of building knowledge base
 using Rapache-R-MySQL combination to our team memebrs, Unfortunately few
 memebers were not that happy with using R directly in middle tier. There
 were serious comments about R that it is slow and generating plots on the
 fly wont be too fast. there was also discussion about maturity of RMySQL
 database connector, i mean fastness of querying MySQL will vary
 significantly with RMySQL when campared to MySQLdb connector?

 It would be nice if you give me a detailed opinion on this.

 Thanking you all in anticipation.

 Regards,
 mlsc

   [[alternative HTML version deleted]]

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



-- 
Spencer Graves, PE, PhD
President and Chief Technology Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San José, CA 95126
ph:  408-655-4567
web:www.structuremonitoring.com


-- 
Spencer Graves, PE, PhD
President and Chief Technology Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San José, CA 95126
ph:  408-655-4567
web:  www.structuremonitoring.com


[[alternative HTML version deleted]]

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


Re: [R] 'deparse(substitute'))' then 'assign' in a S4 methods

2012-02-06 Thread William Dunlap
The interrupt issue is somewhat orthogonal to the SV4/scoping issue
you asked about.  Trying to put things in the callers frame is
very tricky.  E.g., SV4 methods can insert new frames between
your code and the caller.  Perhaps you could try the following
sort of construct, in which your desired function is inside a
wrapper, whose only job is to collect results from the inner function.
Then make the outer function your SV4 method.

f - function (n) {
retval - NULL # just a placeholder so - from f_inner lands here
f_inner - function(n) {
on.exit({
retval - retval_inner # or could use assign(env=parent.env(), ...)
message(stashed retval_inner as retval)
})
retval_inner - 100
tryCatch(
expr = for (i in seq_len(n)) {
   Sys.sleep(1)
   retval_inner - retval_inner + 1
   },
interrupt = function(...) message(interrupted in iteration , i))
}
f_inner(n)
retval
}

E.g.,

   r - f(5)
  stashed retval_inner as retval
   r
  [1] 105
   rm(r)
   r - f(50) # hit interrupt key after a few seconds
  interrupted in iteration 4
  stashed retval_inner as retval
   r
  [1] 103
   sapply( 5:1, f) # hit interrupt key sporadically
  stashed retval_inner as retval
  interrupted in iteration 2
  stashed retval_inner as retval
  interrupted in iteration 3
  stashed retval_inner as retval
  interrupted in iteration 2
  stashed retval_inner as retval
  stashed retval_inner as retval
  [1] 105 101 102 101 101

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf Of cgenolin
 Sent: Monday, February 06, 2012 5:13 AM
 To: r-help@r-project.org
 Subject: Re: [R] 'deparse(substitute'))' then 'assign' in a S4 methods
 
 Thanks Bill,
 
 In France, there is a famous joke about politician: Tell me what you need,
 I will explain you how to do without... But in my specific case, I can not
 use the classical - and [, it is why I ask my question.
 
 More precisely, my fonction fooBis can be very long to end. So I want to
 update the value of my variable from time to time.
 'assign' + break will work, whereas `fooBis-` - function(x, value) { x -
 4 ; for(i in 1:1000){};x }  + break will not work.
 
 Christophe
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/deparse-substitute-then-assign-in-a-S4-
 methods-tp4356748p4361210.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.


Re: [R] an unusual use for R

2012-02-06 Thread Richard M. Heiberger
I love it.  I hope you are planning a talk at the UseR!2012 in Nashville.

Do remember the history that one of the origins of punchcards is the
Jaquard loom.

Rich

On Thu, Feb 2, 2012 at 5:54 PM, Sarah Goslee sarah.gos...@gmail.com wrote:

 I thought some of you might be amused by this.

 In my non-work time, I'm an avid weaver and teacher of weaving. I'm
 working on a project involving creating many detailed weaving
 patterns, so I wrote R code to automate it.

 Details here:
 http://stringpage.com/blog/?p=822

 If the overlap between R users and avid tablet weavers turns out to be
  1, I'll polish it up and turn it into a package.

 Sarah

 --
 Sarah Goslee
 http://www.functionaldiversity.org

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.htmlhttp://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] histogram

2012-02-06 Thread Francis Keyes
Thanks.  How do you suggest I use the reference population?  Sorry, I'm new
to R and just don't see it.  If i can get a plot that is counts or density
relative to my reference data it would be ideal.

On Mon, Feb 6, 2012 at 1:12 AM, David Winsemius dwinsem...@comcast.netwrote:


 On Feb 5, 2012, at 8:31 PM, Francis Keyes wrote:

  With R and the hist function, is there a way to make a histogram in which
 the y axis denotes propotion with respect to a separate sample dataset of
 the same range instead of frequency?


 hist() returns an object with both counts and density. If you had a
 reference population it should be a fairly simple matter to use one or the
 other of those.

 --
 David Winsemius, MD
 West Hartford, CT



[[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] Multi-page PDF using dev.copy2pdf(filename, onefile=TRUE)?

2012-02-06 Thread ilai
Doug,
dev.copy2pdf closes the connection after it's done, so onefile is
meaningless. To look at each plot before copy to a single pdf, you
could open a pdf(...) but revert between it and your graphic device:
graphics.off()
plot(1:7, 1:7)
x11c- dev.cur()   # your current graphics device
pdf(file=test.pdf)
dev.set(which=x11c)   # back from pdf
dev.copy()  # copy
dev.set(which=x11c)# back to graphic
plot(1:5, 1:5,col=2,pch=2)
dev.copy()
dev.set(which=x11c)
# ...   etc. however many more plots
# don't forget to close the pdf device at the end:
dev.off(which=x11c+1)
# Both plots are in 'test.pdf'

Depending on your application you might be able to simplify things
with dev.next/dev.prev, or wrap this sequence into a little helper
function to be used in a loop.

Enjoy,
Elai


On Mon, Feb 6, 2012 at 6:44 AM, Doug Hill logic...@yahoo.com wrote:
 Hi all. I want to generate a sequence of n plots and save them into a single 
 PDF file, one plot per page. From the R docs and other sources I gather the 
 basic way to do this is save plot 1 into a file then append the 2:n plots to 
 the same file.
 This code shows my basic approach, but for some reason only the last plot is 
 saved into the pdf. I've tried different variations (e.g. using onefile only 
 in the second call, or only in the first), to no avail. The comments show 
 what I see if I step through the code one line at a time:
 scratch-function() {
 graphics.off()
 plot(1:7, 1:7) # Opens a graphics window and displays a 7-point plot in it, 
 as expected
 dev.copy2pdf(file=test.pdf, onefile=TRUE) # I see the 7-point plot in Adobe 
 reader, as expected
 plot(1:5, 1:5) # Overwrites in the graphics window the 7-point plot with a 
 5-point, as expected
 dev.copy2pdf(file=test.pdf, onefile=TRUE) # Overwrites test.pdf so that it 
 contains only the 7-point plot
 }
 A couple things:
 (1) The reason I don't just use something like pdf(filename) plot(...) 
 plot(...) dev.off() is that I also want to see the plots before they're saved 
 (I pause after each plot() command). But according to the docs for 
 dev.copy2pdf(), that function accepts the same args as pdf() does, including 
 onefile.
 (2) I wrap my code in a function to be able to use it in the StatEt debugger 
 in Eclipse.
 If you know what I'm doing wrong, or know of a different/better way, advise 
 away! Thanks, Doug
        [[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] Logistic Regression

2012-02-06 Thread tw
On 02/06/2012 03:08 PM, Ana wrote:
 I am looking for R packages that can make a Logistic Regression model
 with parameter estimation by Maximum Likelihood Estimation.


 Many thanks for helping out.

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

I worked out some maximum likelihood estimates for logistic regression in
R on my website: http://www.netstorm.be/home/lrm

Best regards

Thomas

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

2012-02-06 Thread David Winsemius


On Feb 6, 2012, at 12:23 PM, Francis Keyes wrote:

Thanks.  How do you suggest I use the reference population?  Sorry,  
I'm new to R and just don't see it.  If i can get a plot that is  
counts or density relative to my reference data it would be ideal.


It is difficult to specify how when we have no what. The what is  
your responsibility, not ours. My thought was to use the ratio of the  
results of hist() on the two populations  which would then be offered  
back to hist or barplot. which (of course) requires that the  
'breaks'  be the same. Provide an example of your R representations of  
the reference population and tested population and all will become  
clear.


(And learn to post in plain text, please.)
--
David Winsemius, MD
West Hartford, CT


On Mon, Feb 6, 2012 at 1:12 AM, David Winsemius dwinsem...@comcast.net 
 wrote:


On Feb 5, 2012, at 8:31 PM, Francis Keyes wrote:

With R and the hist function, is there a way to make a histogram in  
which
the y axis denotes propotion with respect to a separate sample  
dataset of

the same range instead of frequency?

hist() returns an object with both counts and density. If you  
had a reference population it should be a fairly simple matter to  
use one or the other of those.




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


Re: [R] how to access values from functions

2012-02-06 Thread R. Michael Weylandt
You can modify the function and add either a print() statement or a
browser() call as make sense for your purposes.

Type the name of the function to get the source: copy and edit it as
desired, and then run something like

funcName - newSource

Now when you run funcName it will run your new version rather than
whatever package you are using.

Michael

On Mon, Feb 6, 2012 at 6:52 AM, Aparna Sampath
aparna.sampat...@gmail.com wrote:
 Hi All

 I would like to know how to access the values of the variable
 lambda.mu and and see what abs(lambdas[1])
  does since lambdas is not a keyword.

 Snippet of the code:

 scoreFunction - function(lambdas)
  {
    lambda.mu - abs(lambdas[1])

    sme.em(yi,tmei,Xi,Ni,G,lambda.mu,lambda.v)$AICc
  }

 Thanks in advance.

 Regards
 Ap


 --
 Aparna Sampath
 Master of Science (Bioinformatics)
 Nanyang Technological University
 Mob no : +65 91601854

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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's memory capabilities

2012-02-06 Thread R. Michael Weylandt
Use the Matrix package which provides easy access to sparse matrices.
I think (unchecked) there's even easy provision for a diagonal sparse
matrix.

That said, if you are always working with diagonal matrices, couldn't
you just keep the diagonals as vectors since the formulas for matrix
multiplication reduce nicely in that case?

Michael

On Mon, Feb 6, 2012 at 6:10 AM, Alaios ala...@yahoo.com wrote:
 Thanks a lot for your answer :)
 actually I am converting a 256*256 image to a vector so to apply some 1-d 
 transformations. Is it possible to  create in R a sparse matrix instead of 
 carrying all those zeros?

 So that means that I want to have a diagonal sparse matrix..

 Thanks a lot

 Alex


 
  From: peter dalgaard pda...@gmail.com

 Cc: R-help@r-project.org R-help@r-project.org
 Sent: Monday, February 6, 2012 11:54 AM
 Subject: Re: [R] R's memory capabilities


 On Feb 6, 2012, at 11:15 , Alaios wrote:

 Dear all,
 I have tried to create a diagonal matrix of size diag(65536)

 I am getting the message that the array function can not create so big array 
 as the value I ask is larger than the


 environment: namespace:base
 .Machine$integer
 [1] 2147483647


 as you will see my .Machine$integer is the one above. What that variable 
 means? I am using R in a system that has 500 GB of ram available. Would it 
 be something wrong in the installation?

 Well, it means what it says. Indexing is limited by the size of a 32-bit 
 integer and (2^16)^2 is too big for that. So you are limited to roughly 16 GB 
 for any single object in R.

 This issue has been foreseeable for some time. It can only be fixed by 
 internal changes in the R engine, but switching to long integers has various 
 issues, so it is not a straightforward modification.

 Meanwhile, you might want to consider whether you really do need a diagonal 
 matrix of that size stored in full. It's an awful lot of zeroes to carry 
 around


 Regards
 Alex

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

 --
 Peter Dalgaard, Professor
 Center for Statistics, Copenhagen Business School
 Solbjerg Plads 3, 2000 Frederiksberg, Denmark
 Phone: (+45)38153501
 Email: pd@cbs.dk  Priv: pda...@gmail.com
        [[alternative HTML version deleted]]


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


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


[R] na.action in stats::factanal() must be using formula interface and dataframe input to specify na.action?

2012-02-06 Thread Timothy Bates
hi,
Does factanal() force the user to use the formula interface if they wish to 
specify an na.action?

v1 - c(1,1,1,1,1,1,1,1,NA,1,3,3,3,3,3,4,5,6)
v2 - c(1,2,1,1,1,1,2,1,2,1,3,NA,3,3,3,4,6,5)
v3 - c(3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,5,4,6)
v4 - c(3,3,4,NA,3,1,1,2,1,1,1,1,2,NA,1,5,6,4)
v5 - c(1,1,1,1,1,3,3,3,3,3,1,1,1,1,1,6,4,5)
v6 - c(1,1,1,2,1,3,3,3,4,3,1,1,1,2,1,6,5,4)
m1 - data.frame(cbind(v1,v2,v3,v4,v5,v6))
factOut = factanal(m1, factors = 1,scores = Bartlett, na.action=na.exclude)
factOut = factanal(~v1+v2+v3+v4+v5+v6, data=m1, factors = 1,scores = 
Bartlett, na.action=na.exclude)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 enterprise for linux

2012-02-06 Thread R. Michael Weylandt
I think there is some support for multi-processor matrix
multiplication (google around for it) but in your case, it might
suffice to use an optimized BLAS and R's builtin parallel facilities.

As I said in your other thread -- if you are working with
diagonal/sparse matrices, it's also possible to use special cases for
efficient manipulations.

Michael

On Mon, Feb 6, 2012 at 10:47 AM, Alaios ala...@yahoo.com wrote:
 That was my bad. (doing two things at same time)
 I am not out of memory by no means it is just that it only runs at one
 core. IF somehow R was able to see the many cores in my system.

 Regards
 Alex

 
 From: David Winsemius dwinsem...@comcast.net
 To: Alaios ala...@yahoo.com
 Cc: R. Michael Weylandt michael.weyla...@gmail.com; R-help@r-project.org
 R-help@r-project.org
 Sent: Monday, February 6, 2012 4:31 PM

 Subject: Re: [R] R enterprise for linux


 On Feb 6, 2012, at 10:17 AM, Alaios wrote:

 My bad..

 these are the real matrices

 G-DiagonalGaussian( NumberOfImagePixels,sd=Gsd)
 str(G)
  num [1:16384, 1:16384] 1400 0 0 0 0 ...
 S-PointSamplingMatrix(EffectiveSensors,NumberOfImagePixels)
 str(S)
  num [1:10650, 1:16384] 0 0 0 0 0 0 0 0 0 0 ...
 A-S %*% G


 You seems confused about the size of your objects. You earlier said they
 were  [128,128] which we took to mean 128 x 128 matrices, they are far
 larger than that. I'm guessing that you are consuming all of your RAM and
 paging out to disk. But that is just a guess since you provided none of the
 system information that the Posting Guide suggests.

 --David.

 ___
 From: R. Michael Weylandt michael.weyla...@gmail.com

 Cc: Paul Hiemstra paul.hiems...@knmi.nl; R-help@r-project.org
 R-help@r-project.org
 Sent: Monday, February 6, 2012 3:39 PM
 Subject: Re: [R] R enterprise for linux

 Are you sure?

 I just ran

 N - 128
 system.time(matrix(rnorm(N^2),N) %*% matrix(rnorm(N^2),N))

 and it took less than 0.044s on my (old-ish) laptop while doing other
 things (and that includes the expensive rng calls). There might be
 some other issues in play here. Even N - 1280 takes  5 seconds with
 the rng call.

 Michael


 Actually, I would like to speed up matrix multiplication

 which is really too slow.
 MatrixA %*% MatrixB (each one is a [128,128] table) is running four hours
 now... and just imagine that I want to calculate many of those.

 Which other alternative do I have?

 Regards
 Alex


 
  From: Paul Hiemstra paul.hiems...@knmi.nl

 Cc: R-help@r-project.org R-help@r-project.org
 Sent: Monday, February 6, 2012 2:30 PM
 Subject: Re: [R] R enterprise for linux


 Dear Alex,

 By Enterprise R, do you mean Revolution R? I can also only find red
    hat packages. You could send them an e-mail to ask for sources. They
    probably want to help you, especially when you pay. But why do you
    need RevoR and not standard R.

 Paul

 On 02/06/2012 12:55 PM, Alaios wrote:
 Dear all,
 I would like to ask you if it would be possible  to install R enterprise
 in opensuse.
 Actually it seems that there are only Red Hat packages and I was
 wondering if their source code is available so one to try and compile it. I
 would like to thank you in advance for your reply Regards
 Alex [[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.


 --
 Paul Hiemstra, Ph.D.
 Global Climate Division
 Royal Netherlands Meteorological Institute (KNMI)
 Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
 P.O. Box 201 | 3730 AE | De Bilt
 tel: +31 30 2206 494 http://intamap.geo.uu.nl/~paul
 http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
        [[alternative HTML version deleted]]


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

     [[alternative HTML version deleted]]

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

 David Winsemius, MD
 West Hartford, CT




__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Writing to a file

2012-02-06 Thread R. Michael Weylandt
You don't say how you are writing to a file, but some methods have an
append = TRUE option that might be helpful.

Your code looks really inefficient as well: I don't have time to look
at it fully now, but it seems to me that you can vectorize the inner
loops quite directly:

for(j in ncol(y)){
   if(y[i,j]==Func_0005515){
   counter = counter + 1 }
   }
}

could become

counter = counter + sum(y[i, ] == Func_0005515)

Michael

On Mon, Feb 6, 2012 at 5:50 AM, Felicity felicity...@hotmail.com wrote:
 Dear All!!

 I am also new in R
 and trying to write my results into a file I post here..hopefully is the
 proper place
 To be more secific  I have this loop


 counter = 0
  for (i in 1:nrow(y))
  {
  for (j in 1:ncol(y))
  {
  if (y[i,j]==Func_0005634) {
         counter = counter + 1 }
  if(y[i,j]==Func_0005737){
         counter = counter + 1 }
  if(y[i,j]==Func_0005515){
        counter = counter + 1 }
 }
  if(counter == 2) {
         k-structure(list(print(y[i,1])), class = data.frame)
 }
  if(counter == 3 ){
         l-structure(list(print(y[i,1])), class = data.frame)
        }
  counter = 0
  }


 for counter==2 or counter ==3
 I want to get print(y[i,1])
 where in column 1 exists the name of the protein
 whereas in the rest columns exist somewhere randomly the strings im looking
 for

 I want to get the names of the proteins in a file and those that have either
 2 or 3 functions be named as cancer.

 the specific part of code gives me as a result in the command line this (is
 a sample cause im working on 8500lines)
 [1] Prot_10035
 8527 Levels: Prot_0 Prot_1 Prot_10 Prot_100 Prot_1000 Prot_1 ...
 Prot_9996
 [1] Prot_10041
 8527 Levels: Prot_0 Prot_1 Prot_10 Prot_100 Prot_1000 Prot_1 ...
 Prot_9996
 [1] Prot_10045
 8527 Levels: Prot_0 Prot_1 Prot_10 Prot_100 Prot_1000 Prot_1 ...
 Prot_9996


 which is fine i can see the names of the proteins but i cant use them so to
 label them
 When I try to write it in a file ..then is kept only the last result because
 unfortunatelly
 he overwrites himself :(

 How can I use those data? How can I write them in a file and add as an extra
 column the word cancel
 for those containing the specific functions?

 Any hint you may give me it would be more than helpful for me!
 Thank you a lot in advance!
 Looking forward to your reply :)


 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Writing-to-a-file-tp3070617p4360889.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.


Re: [R] [newbie] storage/use of user's own functions?

2012-02-06 Thread Michael Dewey

At 04:06 06/02/2012, Joshua Wiley wrote:

Hi Tom,

I don't believe there is a standard location.  You can set variables 
or have functions run (say to source other functions in) in your 
.Rprofile file.  That way, you always have them.  Once you get more 
than a handful of functions, it is probably time to consider putting 
them into your own package.  This allows you to document them etc. 
then accessing them is as easy as loading your package.  Also makes 
checking and distributing to others easier of that ever comes up.


May I endorse Josh's suggestion to consider writing your own package 
to include them. I put off doing this for too long. There is a bit of 
learning to do first but the investment will repay itself. You need 
the extensions manual, at least the early chapters.




Hope this helps,

Josh

On Feb 5, 2012, at 19:48, Tom Roche tom_ro...@pobox.com wrote:


 I'm new but am already starting to accumulate utility functions for
 the fairly specialized kinds of data files with which I work. I'd like
 to keep those functions in a single folder, or filetree rooted at a
 specific folder under my $HOME (I'm running linux), for ease of

 * source()-ing
 * git commit to bitbucket
 * scp to clusters

 I'm wondering,

 1 is there a canonical location for personal functions, notably on
  linuxen?

 2 how can one make that location most easily available? or must one
  always provide either a relative path from one's R cwd, or an FQ
  path to, the personal-functions folder?

 Apologies if this is a FAQ, but I didn't see anything about it @

 http://cran.r-project.org/doc/FAQ/R-FAQ.html
 http://cran.r-project.org/doc/manuals/R-admin.html

 or in casual rseek-ing.

 TIA, Tom Roche tom_ro...@pobox.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.


Michael Dewey
i...@aghmed.fsnet.co.uk
http://www.aghmed.fsnet.co.uk/home.html

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

2012-02-06 Thread raimund
Hi everyone,

i've been trying to make a special plot with ggplot2, but I can't get it to
fill the polygon I'd like to see filled so very very much.

I want to display the difference or change in the distribution of the
modified Rankin Scale between two groups. mRS is a scale for disability or
daily activities competence.

It looks like this.

http://r.789695.n4.nabble.com/file/n4361919/rankinplot.png 

I just wish the polygons in between the bars would fill in the same colors
as the bar segments do.
Interestingly, in the example provided by the geom_polygon help page, there
is a fill, which leads me to suspect that something with my data frame might
be wrong.

If I supply a colour argument, I get borders, but not always in the color
I defined. The attached image has such borders, to make clear what polygons
I am talking about. In the final plot I don't desire such borders, only the
as of yet unattainable fill.


Here's my code:

library(ggplot2)
library(plyr)


# define good looks

no_margins - opts(
  axis.line = theme_blank(),
  axis.text.x =   theme_blank(),
  axis.ticks =theme_blank(),
  axis.title.x = theme_text(size = 12, vjust = 0.15),
  axis.title.y = theme_text(angle = 90, size = 12, vjust = 0.2),
  axis.ticks.length = unit(0, cm),
  axis.ticks.margin = unit(0, cm),
  panel.background =  theme_blank(),
  panel.grid.major =  theme_blank(),
  panel.grid.minor =  theme_blank(),
  plot.background =   theme_blank(),
  plot.title =theme_blank(),
  plot.margin =   unit(c(1, 1, 1, 1.5), lines)
  )   

sfm = scale_fill_manual(mRS, c(0=darkgreen,
 1=forestgreen,
 2=mediumseagreen,
 3=coral,
 4=red,
 5=darkred,
 6=black))

barwidth = 0.6

# good looks defined

smalldummy = data.frame(
  mRS = as.factor(rep(0:6,2)),
  rsfreq = sample(0:6,14,replace=T),
  treatment = factor(rep(c(one,two),each=7))
  )

smalldummy = ddply(smalldummy, .(treatment), transform,
   textpos = cumsum(rsfreq/sum(rsfreq)) -
rsfreq/sum(rsfreq)/2, # center within segment
   lineposx = cumsum(rsfreq/sum(rsfreq)))  
# segment borders without 0



# make the xs of the polygon
polylo = 1 + barwidth/2
polyhi = 2 - barwidth/2
xs = rep(c(polylo,polyhi,polyhi,polylo), 7)

# make the ys of the polygon
tmp1 = c(0, smalldummy$lineposx[1:7])
tmp2 = c(0, smalldummy$lineposx[8:14])
ys = c()
for(i in 1:7) {
  nu = c(tmp1[i], tmp2[i], tmp2[i+1], tmp1[i+1])
  ys = c(ys, nu)
}
m = as.factor(rep(0:6, each=4))
tmpdf = data.frame(xs, ys, mRS = m)


bigdummy = merge(smalldummy, tmpdf, by = mRS)

ggplot(data = bigdummy, aes(x = treatment, y = rsfreq, fill = mRS)) +
  geom_bar(aes(width = barwidth),stat=identity,position=fill) +
  geom_text(aes(label=as.character(mRS),
y = ifelse(rsfreq != 0, textpos, NA)),
size = 8, colour = white) +
  geom_polygon(aes(x = xs, y = ys, group = mRS, fill = mRS)) +
  ylab(Modified Rankin Scale) + xlab(Treatment) +
  coord_flip() + theme_bw() + opts(legend.position = none) + no_margins +
sfm




--
View this message in context: 
http://r.789695.n4.nabble.com/ggplot2-geom-polygon-fill-tp4361919p4361919.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] Colors vector based on group

2012-02-06 Thread Rui Barradas
Hello,

 I have a vector like this:
 
 x =
 c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2)
 
 I would like to associate a colour to each of these entry. For example, I
 could use topo.colors(3) (since I have 3 groups).
 
 I know it is easy to do this with  if/else statements, but I would like to
 find a proper way to do this.

Easy, after knowing how many colors are there, just use 'x' as an index
vector:

ncolrs - length(unique(x))
colrs  - topo.colors(ncolrs)
xcolrs - colrs[x]

Or, in one instruction,

xcolrs2 - topo.colors(length(unique(x)))[x]
all.equal(xcolrs, xcolrs2)

Hope this helps,

Rui Barradas


--
View this message in context: 
http://r.789695.n4.nabble.com/Colors-vector-based-on-group-tp4361425p4361662.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] UTF8

2012-02-06 Thread Norma
trying to change the locale like this

* Sys.setlocale(Macintosh HD)*

failed with the following error: 

*Error in Sys.setlocale(Macintosh HD) : invalid 'category' argument*



--
View this message in context: 
http://r.789695.n4.nabble.com/UTF8-tp873280p4361803.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] Colors vector based on group

2012-02-06 Thread Filoche
Hi there.

I should have thought about that myself (/shame).

Thank you very much for your time.

Phil

--
View this message in context: 
http://r.789695.n4.nabble.com/Colors-vector-based-on-group-tp4361425p4361686.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] UTF8

2012-02-06 Thread Norma
As far as I can see it, those are two problems. The default locale and the
language problem. I have exactly the same, I am using Mac OSX 10.6.8. 

I have also tried installation of packages. When installing a package I get
a related error message: 

*tar: Failed to set default locale*

if I enter
* Sys.getlocale()* 
the results is 
*[1]=C*

so, I guess I have to tell R that the default system disk it shall work with
is Macintosh HD ... but how do I do that? 

Additionally I have this language/ASCII problem, and the help suggested by
the R Cran Project (to enter

 *defaults write org.R-project.R force.LANG 'en_US'.UTF-8*) 

does not work. I get the message 

*Error: unexpected symbol in defaults write*

I am new to R and just installed it onto my computer, after a basic training
course ... maybe someone could help us? 
Thank you,
Norma

--
View this message in context: 
http://r.789695.n4.nabble.com/UTF8-tp873280p4361777.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] Heckman selection Model with HLM structure

2012-02-06 Thread Nita Umashankar
Hello,
I am trying to estimate a 2-stage selection Model where the first probit stage 
is whether the customer bought (0/1) and the second stage is given that the 
customer bought, how much did they spend (revenue).

However, in my data, customers are nested within customer service agents and 
customer service agents are nested within countries, thereby requiring an mixed 
model or HLM format.

Do you know of code that would accommodate this? I found code for a Heckit 
model and one more HLM models but not one that combines both.

Any help would be greatly appreciated.  Thanks in advance.

Nita

[[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] an unusual use for R

2012-02-06 Thread Barry Rowlingson
On Mon, Feb 6, 2012 at 5:14 PM, Richard M. Heiberger r...@temple.edu wrote:
 I love it.  I hope you are planning a talk at the UseR!2012 in Nashville.

 Maybe we'll have hand-woven R-logo lanyards for our conference
badges? Get weaving Sarah!

Barry

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Disable contrasts in lme

2012-02-06 Thread Saskia Freytag

Dear all,

I am trying to disable the contrast statement in the lme function of the 
package nlme. Is there a way to do this? This is needed as I have only 
one group.


Thank you so much in advance,

Saskia Freytag
--

Saskia Freytag
Department of Genetic Epidemiology
Georg-August University Göttingen
Humboltallee 32
37073 Göttingen
Germany

Office Phone: +49 551 39 14234

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

2012-02-06 Thread David Winsemius


On Feb 6, 2012, at 11:26 AM, Norma wrote:


trying to change the locale like this

* Sys.setlocale(Macintosh HD)*

failed with the following error:

*Error in Sys.setlocale(Macintosh HD) : invalid 'category' argument*


You are confused about what the locale setting is used for. They are  
for your geographic location (to have reasonable defaults for language  
and character sets), not for manipulating your hardware settings.


?locales

You should also post Mac-specific questipn to the Mac-SIG list   
and even more important describe what you are trying to do.


--
David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Suggestion for drop the loser design and analysis in R?

2012-02-06 Thread Tal Galili
Hello all,

I would like to plan and analyse a study with k treatments (one of which
is a control), with some binary outcome, in order to find the best
treatment (e.g: the one with a high number of successes).
If this was done with a fixed sample size, the analysis is well known.
 However, I would rather be able to drop treatment(s), if at any (or some
specific) point in the analysis, I find it (or them) inferior to the
control.

*What correction/analysis might I use in order to find the best
treatment, while dropping bad treatments during the experiment?*

After searching through google scholar, the most relevant article I found
was Drop-the-losers design: Binomial case by Michael W. Sill , Allan R.
Sampson -
yet I was not able to find an implementation for their ideas.

Thanks up front for any lead/idea on this topic.


(p.s: this question was also cross-posted to
http://stats.stackexchange.com/questions/22355/suggestion-for-drop-the-loser-design-and-analysis-in-r
)

With regards,
Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--

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

2012-02-06 Thread David Winsemius


On Feb 6, 2012, at 11:18 AM, Norma wrote:

As far as I can see it, those are two problems. The default locale  
and the

language problem. I have exactly the same, I am using Mac OSX 10.6.8.

I have also tried installation of packages. When installing a  
package I get

a related error message:

*tar: Failed to set default locale*


You should include details about the name of the package , the  
repository where you got it and the R console commands you issued. The  
error message makes me wonder if you are trying to install a source  
package without the correct settings and software, but that is very  
much a wild guess in the absence of those missing elements.




if I enter
* Sys.getlocale()*
the results is
*[1]=C*


It would be much better if you abandoned the convention of sticking  
asterisks at the ends of output. People cannot tell whether those are  
actually there. (I suspect not on the basis of my experience.)




so, I guess I have to tell R that the default system disk it shall  
work with

is Macintosh HD ... but how do I do that?

Additionally I have this language/ASCII problem, and the help  
suggested by

the R Cran Project (to enter

*defaults write org.R-project.R force.LANG 'en_US'.UTF-8*)


My settings do not have the single quotes around:   en_US.UTF-8



does not work. I get the message

*Error: unexpected symbol in defaults write*


Tjat looks like an R message. It appears you are entering that string  
at the R console. It is only going to work if you use it in a Terminal  
session ( _without_ the asterisks and probably _without_ the  
unnecessary single quotes.)




I am new to R and just installed it onto my computer, after a basic  
training

course ... maybe someone could help us?


You appear to also need to spend time studying the Mac OS, since you  
are conflating OS commands with R commands. I suggest you first  read  
through the Mac R FAQ before doing anything more to alter your system  
settings.





Thank you,
Norma

--
View this message in context: 
http://r.789695.n4.nabble.com/UTF8-tp873280p4361777.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.


David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Genetic based classification tree induction

2012-02-06 Thread Nissim Matatov
Hi , everybody

Does R has some package is able genetic based search for optimal decision
tree model

Thanks,
Nissim

[[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] I bet apply has a solution

2012-02-06 Thread LCOG1
Hi all 
For the data below, I would like to return a logical value indicating
differences in the data.

#Create data
Data..-data.frame(a=rep(1,10),b=c(rep(1,9),2),c=c(rep(1,8),2,2))

   a b c
1  1 1 1
2  1 1 1
3  1 1 1
4  1 1 1
5  1 1 1
6  1 1 1
7  1 1 1
8  1 1 1
9  1 1 2
10 1 2 2


So what I want is to return logical value telling me if all the values are
the same.  So the result would be a b c DidChange
1  1 1 1 FALSE
2  1 1 1 FALSE
3  1 1 1 FALSE
4  1 1 1 FALSE
5  1 1 1 FALSE
6  1 1 1 FALSE
7  1 1 1 FALSE
8  1 1 1 FALSE
9  1 1 2  TRUE
10 1 2 2  TRUE

I bet apply could handle this elegantly but that family of functions is
still not 100% intuitive to me.  Thoughts.  Thanks everyone

Cheers, 
 Josh


--
View this message in context: 
http://r.789695.n4.nabble.com/I-bet-apply-has-a-solution-tp4362294p4362294.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] Writing to a file

2012-02-06 Thread Felicity
maybe I could keep each line (having the strings) 
in a file or somewhere and then 
call a print function that prints them all together
from where I saved them?
Please let me know as soon as Possible!!
thank you!

--
View this message in context: 
http://r.789695.n4.nabble.com/Writing-to-a-file-tp3070617p4362340.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] Reordering levels of a factor when the factor is part of a data frame

2012-02-06 Thread Judith Flores
Hello R-users,

   I have a data frame whose names of columns I don't know a priori, but the 
user of my code will know them. The user is supposed to save the name of the 
column that will need some reordering of the levels of the factor later on. The 
name of the column will be saved in an object called:

variab

the data frame is called df.


If I try to the do following:

df[variab]-factor(df[variab], levels=c(A2B,B31,C33))

it won't work because df[variab] is a data frame. The reason for reordering the 
levels of the factor is because once that variable is plotted, the levels of 
the factor need to appear in certain order.

   How can I re-order the levels of a factor whose name I don't know?


Thank you,

Judith
[[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] I bet apply has a solution

2012-02-06 Thread Justin Haynes
How bout:

 apply(Data..,1, function(vec) !all(vec==vec[1]))
 [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE  TRUE



On Mon, Feb 6, 2012 at 10:34 AM, LCOG1 jr...@lcog.org wrote:

 Hi all
 For the data below, I would like to return a logical value indicating
 differences in the data.

 #Create data
 Data..-data.frame(a=rep(1,10),b=c(rep(1,9),2),c=c(rep(1,8),2,2))

   a b c
 1  1 1 1
 2  1 1 1
 3  1 1 1
 4  1 1 1
 5  1 1 1
 6  1 1 1
 7  1 1 1
 8  1 1 1
 9  1 1 2
 10 1 2 2


 So what I want is to return logical value telling me if all the values are
 the same.  So the result would be a b c DidChange
 1  1 1 1 FALSE
 2  1 1 1 FALSE
 3  1 1 1 FALSE
 4  1 1 1 FALSE
 5  1 1 1 FALSE
 6  1 1 1 FALSE
 7  1 1 1 FALSE
 8  1 1 1 FALSE
 9  1 1 2  TRUE
 10 1 2 2  TRUE

 I bet apply could handle this elegantly but that family of functions is
 still not 100% intuitive to me.  Thoughts.  Thanks everyone

 Cheers,
  Josh


 --
 View this message in context:
 http://r.789695.n4.nabble.com/I-bet-apply-has-a-solution-tp4362294p4362294.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.


[[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] I bet apply has a solution

2012-02-06 Thread Ista Zahn
Hi Josh,

How about

apply(Data, 1, function(row) sd(row) == 0)

?

Best,
Ista



On Mon, Feb 6, 2012 at 1:34 PM, LCOG1 jr...@lcog.org wrote:
 Hi all
 For the data below, I would like to return a logical value indicating
 differences in the data.

 #Create data
 Data..-data.frame(a=rep(1,10),b=c(rep(1,9),2),c=c(rep(1,8),2,2))

   a b c
 1  1 1 1
 2  1 1 1
 3  1 1 1
 4  1 1 1
 5  1 1 1
 6  1 1 1
 7  1 1 1
 8  1 1 1
 9  1 1 2
 10 1 2 2


 So what I want is to return logical value telling me if all the values are
 the same.  So the result would be a b c DidChange
 1  1 1 1     FALSE
 2  1 1 1     FALSE
 3  1 1 1     FALSE
 4  1 1 1     FALSE
 5  1 1 1     FALSE
 6  1 1 1     FALSE
 7  1 1 1     FALSE
 8  1 1 1     FALSE
 9  1 1 2      TRUE
 10 1 2 2      TRUE

 I bet apply could handle this elegantly but that family of functions is
 still not 100% intuitive to me.  Thoughts.  Thanks everyone

 Cheers,
  Josh


 --
 View this message in context: 
 http://r.789695.n4.nabble.com/I-bet-apply-has-a-solution-tp4362294p4362294.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.


Re: [R] Reordering levels of a factor when the factor is part of a data frame

2012-02-06 Thread Ista Zahn
Hi Judith,

You should use double brackets, like this:

df[[variab]]-factor(df[[variab]], levels=c(A2B,B31,C33))

see ?[ for details, noting that the help page assumes that you know
data.frames are list-like objects.

Best,
Ista

On Mon, Feb 6, 2012 at 2:03 PM, Judith Flores jur...@yahoo.com wrote:
 Hello R-users,

    I have a data frame whose names of columns I don't know a priori, but the 
 user of my code will know them. The user is supposed to save the name of the 
 column that will need some reordering of the levels of the factor later on. 
 The name of the column will be saved in an object called:

 variab

 the data frame is called df.


 If I try to the do following:

 df[variab]-factor(df[variab], levels=c(A2B,B31,C33))

 it won't work because df[variab] is a data frame. The reason for reordering 
 the levels of the factor is because once that variable is plotted, the levels 
 of the factor need to appear in certain order.

    How can I re-order the levels of a factor whose name I don't know?


 Thank you,

 Judith
        [[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] dividing values of each column in a dataframe

2012-02-06 Thread Abhishek Pratap
Hey Guys

I want to divide(numerically) all the columns of a data frame by
different numbers. Here is what I am  doing but getting a weird error.
The values in each column are not getting divided by the corresponding
value in the denominator vector instead by the alternative values. I
am sure I am messing up something.

Appreciate your help
-Abhi

head(counts)
   WT_CON WT_RB MU_CON MU_RB
row1   839   180477   187


head(counts/c(2,3,4,5))
   WT_CONWT_RBMU_CONMU_RB
row1  419.5  45.  238.5000  46.7500

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] I bet apply has a solution

2012-02-06 Thread ilai
duplicated(Data..)

On Mon, Feb 6, 2012 at 11:34 AM, LCOG1 jr...@lcog.org wrote:
 Hi all
 For the data below, I would like to return a logical value indicating
 differences in the data.

 #Create data
 Data..-data.frame(a=rep(1,10),b=c(rep(1,9),2),c=c(rep(1,8),2,2))

   a b c
 1  1 1 1
 2  1 1 1
 3  1 1 1
 4  1 1 1
 5  1 1 1
 6  1 1 1
 7  1 1 1
 8  1 1 1
 9  1 1 2
 10 1 2 2


 So what I want is to return logical value telling me if all the values are
 the same.  So the result would be a b c DidChange
 1  1 1 1     FALSE
 2  1 1 1     FALSE
 3  1 1 1     FALSE
 4  1 1 1     FALSE
 5  1 1 1     FALSE
 6  1 1 1     FALSE
 7  1 1 1     FALSE
 8  1 1 1     FALSE
 9  1 1 2      TRUE
 10 1 2 2      TRUE

 I bet apply could handle this elegantly but that family of functions is
 still not 100% intuitive to me.  Thoughts.  Thanks everyone

 Cheers,
  Josh


 --
 View this message in context: 
 http://r.789695.n4.nabble.com/I-bet-apply-has-a-solution-tp4362294p4362294.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.


Re: [R] dividing values of each column in a dataframe

2012-02-06 Thread David Winsemius


On Feb 6, 2012, at 2:22 PM, Abhishek Pratap wrote:


Hey Guys

I want to divide(numerically) all the columns of a data frame by
different numbers. Here is what I am  doing but getting a weird error.
The values in each column are not getting divided by the corresponding
value in the denominator vector instead by the alternative values. I
am sure I am messing up something.

Appreciate your help
-Abhi

head(counts)
  WT_CON WT_RB MU_CON MU_RB
row1   839   180477   187


head(counts/c(2,3,4,5))
  WT_CONWT_RBMU_CONMU_RB
row1  419.5  45.  238.5000  46.7500


The argument recycling is going to be done on a column basis. You  
apaear to expect it to be done on a row basis. For that you need apply


Probably:

t( apply(counts, 1, /, c(2,3,4,5)) )


But untested in absence of example.

---
David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Multi-page PDF using dev.copy2pdf(filename, onefile=TRUE)?

2012-02-06 Thread Doug Hill
Thanks Elai, that did it! I never considered using any X11 options, as I'm on 
Windows, and in the docs I read it sounded like X11 options only pertained to 
the OSX/Linux/.. world. Thanks for your help, Doug

--- On Mon, 2/6/12, ilai ke...@math.montana.edu wrote:

From: ilai ke...@math.montana.edu
Subject: Re: [R] Multi-page PDF using dev.copy2pdf(filename, onefile=TRUE)?
To: Doug Hill logic...@yahoo.com
Cc: r-help@r-project.org
Date: Monday, February 6, 2012, 12:24 PM

Doug,
dev.copy2pdf closes the connection after it's done, so onefile is
meaningless. To look at each plot before copy to a single pdf, you
could open a pdf(...) but revert between it and your graphic device:
graphics.off()
plot(1:7, 1:7)
x11c- dev.cur()       # your current graphics device
pdf(file=test.pdf)
dev.set(which=x11c)   # back from pdf
dev.copy()                  # copy
dev.set(which=x11c)    # back to graphic
plot(1:5, 1:5,col=2,pch=2)
dev.copy()
dev.set(which=x11c)
# ...   etc. however many more plots
# don't forget to close the pdf device at the end:
dev.off(which=x11c+1)
# Both plots are in 'test.pdf'

Depending on your application you might be able to simplify things
with dev.next/dev.prev, or wrap this sequence into a little helper
function to be used in a loop.

Enjoy,
Elai


On Mon, Feb 6, 2012 at 6:44 AM, Doug Hill logic...@yahoo.com wrote:
 Hi all. I want to generate a sequence of n plots and save them into a single 
 PDF file, one plot per page. From the R docs and other sources I gather the 
 basic way to do this is save plot 1 into a file then append the 2:n plots to 
 the same file.
 This code shows my basic approach, but for some reason only the last plot is 
 saved into the pdf. I've tried different variations (e.g. using onefile only 
 in the second call, or only in the first), to no avail. The comments show 
 what I see if I step through the code one line at a time:
 scratch-function() {
 graphics.off()
 plot(1:7, 1:7) # Opens a graphics window and displays a 7-point plot in it, 
 as expected
 dev.copy2pdf(file=test.pdf, onefile=TRUE) # I see the 7-point plot in Adobe 
 reader, as expected
 plot(1:5, 1:5) # Overwrites in the graphics window the 7-point plot with a 
 5-point, as expected
 dev.copy2pdf(file=test.pdf, onefile=TRUE) # Overwrites test.pdf so that it 
 contains only the 7-point plot
 }
 A couple things:
 (1) The reason I don't just use something like pdf(filename) plot(...) 
 plot(...) dev.off() is that I also want to see the plots before they're saved 
 (I pause after each plot() command). But according to the docs for 
 dev.copy2pdf(), that function accepts the same args as pdf() does, including 
 onefile.
 (2) I wrap my code in a function to be able to use it in the StatEt debugger 
 in Eclipse.
 If you know what I'm doing wrong, or know of a different/better way, advise 
 away! Thanks, Doug
        [[alternative HTML version deleted]]


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


[[alternative HTML version deleted]]

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


Re: [R] dividing values of each column in a dataframe

2012-02-06 Thread Berend Hasselman

On 06-02-2012, at 20:22, Abhishek Pratap wrote:

 Hey Guys
 
 I want to divide(numerically) all the columns of a data frame by
 different numbers. Here is what I am  doing but getting a weird error.

I don't think you are getting an error.
You are getting an unexpected result (you think).

 The values in each column are not getting divided by the corresponding
 value in the denominator vector instead by the alternative values. I
 am sure I am messing up something.
 
 Appreciate your help
 -Abhi
 
 head(counts)
   WT_CON WT_RB MU_CON MU_RB
 row1   839   180477   187
 
 
 head(counts/c(2,3,4,5))
   WT_CONWT_RBMU_CONMU_RB
 row1  419.5  45.  238.5000  46.7500

I tried this

df - data.frame(a=runif(10),b=runif(10),c=runif(10))
scal - c(2,3,4)

 df
a  b  c
1  0.47661685 0.73457617 0.90045279
2  0.06916502 0.76374600 0.07630196
3  0.17029174 0.29450289 0.07416969
4  0.03126839 0.09864740 0.08230353
5  0.23713816 0.06342224 0.91241698
6  0.21970595 0.86890690 0.47316101
7  0.46380324 0.26142304 0.87823277
8  0.81256517 0.76097474 0.98956553
9  0.74425369 0.29228545 0.27496707
10 0.65425285 0.40166967 0.12231213

 df/scal
a  b  c
1  0.23830843 0.24485872 0.22511320
2  0.02305501 0.19093650 0.03815098
3  0.04257293 0.14725144 0.02472323
4  0.01563419 0.03288247 0.02057588
5  0.07904605 0.01585556 0.45620849
6  0.05492649 0.43445345 0.15772034
7  0.23190162 0.08714101 0.21955819
8  0.27085506 0.19024369 0.49478276
9  0.18606342 0.14614273 0.09165569
10 0.32712642 0.13388989 0.03057803

Checking:
 df[4,]/scal
   a  b  c
4 0.01563419 0.03288247 0.02057588


This is what you want guessing from your description.
You haven't given us an example with desired output.

Berend

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Any R course in New York or Washington DC in March?

2012-02-06 Thread eugene dalt
Hey Folks,
 
I am looking for a R course in New York or Washington DC,  please email me any 
course announcement you know of for these dates.
 
Best - Eugene
[[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] I bet apply has a solution

2012-02-06 Thread ROLL Josh F
Ah.  That's the one.  Thank you.   

-Original Message-
From: Ista Zahn [mailto:istaz...@gmail.com] 
Sent: Monday, February 06, 2012 11:12 AM
To: ROLL Josh F
Cc: r-help@r-project.org
Subject: Re: [R] I bet apply has a solution

Hi Josh,

How about

apply(Data, 1, function(row) sd(row) == 0)

?

Best,
Ista



On Mon, Feb 6, 2012 at 1:34 PM, LCOG1 jr...@lcog.org wrote:
 Hi all
 For the data below, I would like to return a logical value indicating 
 differences in the data.

 #Create data
 Data..-data.frame(a=rep(1,10),b=c(rep(1,9),2),c=c(rep(1,8),2,2))

   a b c
 1  1 1 1
 2  1 1 1
 3  1 1 1
 4  1 1 1
 5  1 1 1
 6  1 1 1
 7  1 1 1
 8  1 1 1
 9  1 1 2
 10 1 2 2


 So what I want is to return logical value telling me if all the values 
 are the same.  So the result would be a b c DidChange
 1  1 1 1     FALSE
 2  1 1 1     FALSE
 3  1 1 1     FALSE
 4  1 1 1     FALSE
 5  1 1 1     FALSE
 6  1 1 1     FALSE
 7  1 1 1     FALSE
 8  1 1 1     FALSE
 9  1 1 2      TRUE
 10 1 2 2      TRUE

 I bet apply could handle this elegantly but that family of functions 
 is still not 100% intuitive to me.  Thoughts.  Thanks everyone

 Cheers,
  Josh


 --
 View this message in context: 
 http://r.789695.n4.nabble.com/I-bet-apply-has-a-solution-tp4362294p436
 2294.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] sqsSave() test using Test.R script returning error suggesting no values upon insert

2012-02-06 Thread Mark LoPresti
Hi.

I attempted to use RODBC and decided to execute all the tests provided in 
Test.r under the unpacked package RODBC folder.

Beginning with the following:
library(RODBC)
library(MASS)
USArrests[1,2] - NA
hills - hills[1:15,]
row.names(hills)[12] - Dollar ('$')
set.seed(1)

# MySQL
## testdb3 is ODBC/Connector 3.51.x, testdb5 is 5.1.x
channel - odbcConnect(MysqlODBC)  #my database
odbcGetInfo(channel)
sqlTypeInfo(channel)
sqlTables(channel)


sqlDrop(channel, test.USArrests,errors = FALSE)  #explicit database AND table 
call as MySQL doesn't allow general table creation 

Everything works as advertised.
---

#Then we get here.  I have the USArrests data and checked it but tried to save 
as it produced an error.

sqlSave(channel, USArrests,test.USArrests,rownames = state, addPK = TRUE)

Error in odbcUpdate(channel, query, mydata, coldata[m, ], test = test,  : 
  no parameters, so nothing to update

The database table exists and upon edit of the table fields, all table info 
created correctly.

Attempted again adding verbose=TRUE:
 sqlSave(channel, USArrests,test.USArrests,rownames = state, addPK = TRUE, 
 verbose=TRUE)
Query: CREATE TABLE test.usarrests  (`state` varchar(255) NOT NULL PRIMARY KEY, 
`murder` double, `assault` integer, `urbanpop` integer, `rape` double)
Query: INSERT INTO test.usarrests ( `` ) VALUES ( ?,?,?,?,? )
Error in odbcUpdate(channel, query, mydata, coldata[m, ], test = test,  : 
  no parameters, so nothing to update

Does anyone know what is happening? For whatever reason it is not seeing or 
ingesting the data (BOLDED Query:...


I've seen one other post that did not receive an answer (probably due to its 
lack of brevity).


I'm using Window's Vista, R 2.11.1


Here's is my MySQL info:

 odbcGetInfo(channel)
 DBMS_Name   DBMS_Ver    Driver_ODBC_Ver   
Data_Source_Name    Driver_Name Driver_Ver 
   MySQL 5.1.33-community    03.51    
MysqlODBC  myodbc5.dll   05.01.0007 
  ODBC_Ver    Server_Name 
  03.52. localhost via TCP/IP 



Thank you for your time.

Mark LoPresti
[[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] Random draws from an ANOVA-like design with given population effect sizes

2012-02-06 Thread Patrick S Forscher
Hi all,

Let's say that you have a 3-group categorical predictor x that has the
orthogonal contrasts c1 and c2. I am trying to create a function that,
given x, c1, and c2, creates a normally-distributed y such that c1 and
c2 have effect sizes r1 and r2 specified by the user.

For example, let's say that x, c1, c2, r1, and r2 were created like
the following:

x - factor(rep(c(1, 2, 3), 100))
(contrasts(x) - matrix(c(0, -.5, .5, -2/3, 1/3, 1/3), nrow = 3, ncol
= 2, dimnames = list(c(1, 2, 3), c(c1, c2

r1 - .09
r2 - 0

I'd like to create a function create.y(x, r1, r2) that returns a
vector y of identical length to x such that the effect size (delta
R^2) of c1 = r1 = .09 and the effect size (delta R^2) of c2 = r2 = 0.

Does anybody on the list have any advice about how to do this?  I know
that I should be using the rnorm function, but I'm stuck on which
population means / sds rnorm should use when it does its sampling.

Thanks in advance for your help,

--
Patrick S Forscher
PhD Candidate
University of Wisconsin-Madison

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Getting the list of lines evaluated in a function call

2012-02-06 Thread Francois Rousseu

Hello useRs
I am looking for a function that can give the list of lines that were evaluated 
or used to generatethe last output from any function, whether an error message 
was generated or not. For example, let's say I have a function like this:
foo - function( x ){   if( x10 ){ 
   ans - x+100   
}else{  ans - x-100  } ans 
}
and I type:
 foo(4)[1] -96
I would like a function that returns something like this
list.lines(foo)[1] 1 3 4 5 6
or:
 foo(hello)Error in x + 100 : non-numeric argument to binary operator
list.lines(foo)[1] 1 2
Is there already a function in R doing something similar or anybody has any 
hints for functions that I could use to create such a function?
Sincerely,Francois Rousseu 



  
[[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] Reordering levels of a factor when the factor is part of a data frame

2012-02-06 Thread Ernest Adrogué
 6-02-2012, 11:03 (-0800); Judith Flores escriu:
 The name of the column will be saved in an object called:
 
 variab
 
 the data frame is called df.
 
 
 If I try to the do following:
 
 df[variab]-factor(df[variab], levels=c(A2B,B31,C33))
 
 it won't work because df[variab] is a data frame. 

I think you need to use df[[variab]] instead.

Cheers,
Ernest

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Duplicate rows when I combine two data.frames with merge!

2012-02-06 Thread RKinzer
Hello all,

First I have done extensive searches on this forum and others and nothing
seems to work.  So I decided to post thinking someone could point me to the
write post or give me some help.

I have drawn a 100 samples from a fictitious population (N=1000), and then
randomly selected 25% of the 100 samples.  I would like to now merge the
data.frame from the 100 samples with the data.frame for the 25 individuals
from the sample.  When I do this with the following code I get duplicate
rows, when I should have at most is 100.

x-mapply(rnorm,1000,c(54,78,89),c(3.5,5.5,5.9))  #sets up 1000 random
numbers for age 3,4,5
x.3-sample(x[,1],60)  #randomly selects 60 lengths from age 3
x.4-sample(x[,2],740)
x.5-sample(x[,3],200)
length-c(x.3,x.4,x.5)  
length-round(length,digits=0)  #rounds lengths to whole number
age3-rep(3,60) 
age4-rep(4,740)
age5-rep(5,200)
age-c(age3,age4,age5)  #combines ages into one vector
unique-1:1000  #gives each fish a unique id
pop-data.frame(unique,length,age) 
pop-pop[sample(1:1000,size=1000,replace=FALSE),]  #randomized the order of
pop
c.one-pop[sample(1:1000,size=100,replace=TRUE),] 
a.one.qtr-c.one[sample(1:100,size=25,replace=TRUE),] 
merge-merge(c.one,a.one.qtr,by=unique,all=TRUE)

What I would ultimately like to have is one row for all 100 in the sample
and three columns (unique, length, age).  And then some way to identify the
25 individual selected rows.

Thank you upfront for any help.  I have been stuck for days.

Ryan



--
View this message in context: 
http://r.789695.n4.nabble.com/Duplicate-rows-when-I-combine-two-data-frames-with-merge-tp4362685p4362685.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] Multi-page PDF using dev.copy2pdf(filename, onefile=TRUE)?

2012-02-06 Thread David Winsemius


On Feb 6, 2012, at 2:51 PM, Doug Hill wrote:

Thanks Elai, that did it! I never considered using any X11 options,  
as I'm on Windows, and in the docs I read it sounded like X11  
options only pertained to the OSX/Linux/.. world. Thanks for your  
help, Doug


You are confused about the difference of a named variable and its  
contents. There is no X11 device in that solution,  just a name for  
the current device which in your case is probably not an X11 device.  
If you looked at the value of `x11c`, you would see it's just a number.


Elai is just switching back and forth between the screen device and  
the file device.


--
David.



--- On Mon, 2/6/12, ilai ke...@math.montana.edu wrote:

From: ilai ke...@math.montana.edu
Subject: Re: [R] Multi-page PDF using dev.copy2pdf(filename,  
onefile=TRUE)?

To: Doug Hill logic...@yahoo.com
Cc: r-help@r-project.org
Date: Monday, February 6, 2012, 12:24 PM

Doug,
dev.copy2pdf closes the connection after it's done, so onefile is
meaningless. To look at each plot before copy to a single pdf, you
could open a pdf(...) but revert between it and your graphic device:
graphics.off()
plot(1:7, 1:7)
x11c- dev.cur()   # your current graphics device
pdf(file=test.pdf)
dev.set(which=x11c)   # back from pdf
dev.copy()  # copy
dev.set(which=x11c)# back to graphic
plot(1:5, 1:5,col=2,pch=2)
dev.copy()
dev.set(which=x11c)
# ...   etc. however many more plots
# don't forget to close the pdf device at the end:
dev.off(which=x11c+1)
# Both plots are in 'test.pdf'

Depending on your application you might be able to simplify things
with dev.next/dev.prev, or wrap this sequence into a little helper
function to be used in a loop.

Enjoy,
Elai


On Mon, Feb 6, 2012 at 6:44 AM, Doug Hill logic...@yahoo.com wrote:
Hi all. I want to generate a sequence of n plots and save them into  
a single PDF file, one plot per page. From the R docs and other  
sources I gather the basic way to do this is save plot 1 into a  
file then append the 2:n plots to the same file.
This code shows my basic approach, but for some reason only the  
last plot is saved into the pdf. I've tried different variations  
(e.g. using onefile only in the second call, or only in the first),  
to no avail. The comments show what I see if I step through the  
code one line at a time:

scratch-function() {
graphics.off()
plot(1:7, 1:7) # Opens a graphics window and displays a 7-point  
plot in it, as expected
dev.copy2pdf(file=test.pdf, onefile=TRUE) # I see the 7-point  
plot in Adobe reader, as expected
plot(1:5, 1:5) # Overwrites in the graphics window the 7-point plot  
with a 5-point, as expected
dev.copy2pdf(file=test.pdf, onefile=TRUE) # Overwrites test.pdf  
so that it contains only the 7-point plot

}
A couple things:
(1) The reason I don't just use something like pdf(filename)  
plot(...) plot(...) dev.off() is that I also want to see the plots  
before they're saved (I pause after each plot() command). But  
according to the docs for dev.copy2pdf(), that function accepts the  
same args as pdf() does, including onefile.
(2) I wrap my code in a function to be able to use it in the StatEt  
debugger in Eclipse.
If you know what I'm doing wrong, or know of a different/better  
way, advise away! Thanks, Doug

   [[alternative HTML version deleted]]


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



[[alternative HTML version deleted]]

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


David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] nice report generator?

2012-02-06 Thread Hadley Wickham
 2. It's more flexible to construct the language object as a language object,
 rather than pasting something together and parsing it.  For one thing, that
 allows non-syntactic variable names; I think it's also easier to read.  So
 your code

 txt- paste(tabular(value*v*, LEFT , ~ ,RIGHT ,, data = m_xx,
 suppressLabels  = 2,...), sep = )
 eval(parse(text = txt ))

 could be rewritten as

 formula- substitute( value*v*LEFT ~ RIGHT, list(LEFT=LEFT, RIGHT=RIGHT))
 tabular(formula, data = m_xx, suppressLabels = 2, ...)

To be strictly correct, shouldn't that be:

formula- eval(substitute( value*v*LEFT ~ RIGHT, list(LEFT=LEFT, RIGHT=RIGHT)))

?

 It might make sense to put something like this into the tables package, but
 I don't want to have a dependency on reshape.

Would you consider making tabular generic?

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
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] How do I get the CEM (coarsened exact matching) package to run?

2012-02-06 Thread Daniel Malter
Hi, 

I am running a MacBook Pro with OS X 10.6.8. When I try to load library(cem) 
and run any function, R crashes. Any suggestions as to why this is? Thanks in 
advance. I think the problem is that I don't have all the infrastructure I 
need to run CEM, but I have no clue what to do either...




#Do I have tcltk (I have no clue what that is)

capabilities(tcltk)
tcltk 
 TRUE 



#Installing cem

trying URL 'http://r.iq.harvard.edu/src/contrib/cem_1.0.218.tar.gz'
Content type 'application/x-gzip' length 886578 bytes (865 Kb)
opened URL
==
downloaded 865 Kb

* installing *source* package ‘cem’ ...
** R
** data
** inst
** preparing package for lazy loading
Warning in fun(libname, pkgname) :
  Can't find a usable tk.tcl in the following directories: 

/System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/tk8.5 
/System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/tk8.5/Resources/Scripts
 /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/tk8.5 
/System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/tk8.5/Resources/Scripts
 ./lib/tk8.5 ./lib/tk8.5/Resources/Scripts ~/Library/Tcl/tk8.5 
~/Library/Tcl/tk8.5/Resources/Scripts /Library/Tcl/tk8.5 
/Library/Tcl/tk8.5/Resources/Scripts /System/Library/Tcl/tk8.5 
/System/Library/Tcl/tk8.5/Resources/Scripts /System/Library/Tcl/8.5/tk8.5 
/System/Library/Tcl/8.5/tk8.5/Resources/Scripts ~/Library/Frameworks/tk8.5 
~/Library/Frameworks/tk8.5/Resources/Scripts /Library/Frameworks/tk8.5 
/Library/Frameworks/tk8.5/Resources/Scripts /System/Library/Frameworks/tk8.5 
/System/Library/Frameworks/tk8.5/Resources/Scripts ./library



This probably means that tk wasn't installed properly.
** help
*** installing help indices
** building package indices ...
*** tangling vignette sources ...
   ‘cem.Rnw’ 
** testing if installed package can be loaded

How to use CEM? Type vignette(cem)
Warning message:
In fun(libname, pkgname) :
  Can't find a usable tk.tcl in the following directories: 

/System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/tk8.5 
/System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/tk8.5/Resources/Scripts
 /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/tk8.5 
/System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/tk8.5/Resources/Scripts
 ./lib/tk8.5 ./lib/tk8.5/Resources/Scripts ~/Library/Tcl/tk8.5 
~/Library/Tcl/tk8.5/Resources/Scripts /Library/Tcl/tk8.5 
/Library/Tcl/tk8.5/Resources/Scripts /System/Library/Tcl/tk8.5 
/System/Library/Tcl/tk8.5/Resources/Scripts /System/Library/Tcl/8.5/tk8.5 
/System/Library/Tcl/8.5/tk8.5/Resources/Scripts ~/Library/Frameworks/tk8.5 
~/Library/Frameworks/tk8.5/Resources/Scripts /Library/Frameworks/tk8.5 
/Library/Frameworks/tk8.5/Resources/Scripts /System/Library/Frameworks/tk8.5 
/System/Library/Frameworks/tk8.5/Resources/Scripts ./library



This probably means that tk wasn't installed properly.

* DONE (cem)

The downloaded packages are in

‘/private/var/folders/q5/q5YCJSnWH7arB5jzTZBIfTI/-Tmp-/RtmptU5v1f/downloaded_packages’





#Session info

sessionInfo()

R version 2.14.1 (2011-12-22)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

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

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




#Loading CEM and trying to execute a function

library(cem) #Version 1.0.218

Loading required package: nlme
Loading required package: lattice
Loading required package: randomForest
randomForest 4.6-6
Type rfNews() to see new features/changes/bug fixes.
Loading required package: tcltk
Loading Tcl/Tk interface ... 




#If I try to execute any function a crash occurs




#Error code that I

Resulting error message:

 *** caught segfault ***
address 0x1180, cause 'memory not mapped'

Traceback:
 1: sys.parent()
 2: sys.function(sys.parent())
 3: formals(sys.function(sys.parent()))
 4: match.arg(type)
 5: sink()
 6: args(cem)
 7: print(args(cem))
 8: eval(expr, envir, enclos)
 9: eval(expr, pf)
10: withVisible(eval(expr, pf))
11: evalVis(expr)
12: capture.output(print(args(cem)))
13: paste(capture.output(print(args(cem))), collapse = )
14: gsub(\\s+,  , paste(capture.output(print(args(cem))), collapse = ))
15: doTryCatch(return(expr), name, parentenv, handler)
16: tryCatchOne(expr, names, parentenv, handlers[[1L]])
17: tryCatchList(expr, classes, parentenv, handlers)
18: tryCatch(expr, error = function(e) {call - conditionCall(e)if 
(!is.null(call)) {if (identical(call[[1L]], quote(doTryCatch))) 
call - sys.call(-4L)dcall - deparse(call)[1L]prefix - 
paste(Error in, dcall, : )LONG - 75Lmsg - 
conditionMessage(e)sm - strsplit(msg, \n)[[1L]]w - 14L + 
nchar(dcall, type = w) + nchar(sm[1L], type = w)if (is.na(w))   
  w - 14L + nchar(dcall, 

Re: [R] Duplicate rows when I combine two data.frames with merge!

2012-02-06 Thread Petr Savicky
On Mon, Feb 06, 2012 at 12:29:53PM -0800, RKinzer wrote:
 Hello all,
 
 First I have done extensive searches on this forum and others and nothing
 seems to work.  So I decided to post thinking someone could point me to the
 write post or give me some help.
 
 I have drawn a 100 samples from a fictitious population (N=1000), and then
 randomly selected 25% of the 100 samples.  I would like to now merge the
 data.frame from the 100 samples with the data.frame for the 25 individuals
 from the sample.  When I do this with the following code I get duplicate
 rows, when I should have at most is 100.
 
 x-mapply(rnorm,1000,c(54,78,89),c(3.5,5.5,5.9))  #sets up 1000 random
 numbers for age 3,4,5
 x.3-sample(x[,1],60)  #randomly selects 60 lengths from age 3
 x.4-sample(x[,2],740)
 x.5-sample(x[,3],200)
 length-c(x.3,x.4,x.5)  
 length-round(length,digits=0)  #rounds lengths to whole number
 age3-rep(3,60) 
 age4-rep(4,740)
 age5-rep(5,200)
 age-c(age3,age4,age5)  #combines ages into one vector
 unique-1:1000  #gives each fish a unique id
 pop-data.frame(unique,length,age) 
 pop-pop[sample(1:1000,size=1000,replace=FALSE),]  #randomized the order of
 pop
 c.one-pop[sample(1:1000,size=100,replace=TRUE),] 
 a.one.qtr-c.one[sample(1:100,size=25,replace=TRUE),] 
 merge-merge(c.one,a.one.qtr,by=unique,all=TRUE)
 
 What I would ultimately like to have is one row for all 100 in the sample
 and three columns (unique, length, age).  And then some way to identify the
 25 individual selected rows.

The function merge() here includes additional columns, which
contain in the rows from a.one.qtr copies of the columns length
and age. So, the same values appear twice in the row. I am
not sure, whether this is intended.

Another representation of the subsample a.one.qtr may be done
by adding a column to c.one, which specifies, how many times
was the row selected to a.one.qtr. For example as follows.

  a.one.qtr2 - sample(1:100,size=25,replace=TRUE)
  c.one2 - cbind(c.one, selected=tabulate(a.one.qtr2, nbins=100))

  # a random result may look like

  c.one2
  
unique length age selected
  657  657 81   40
  488  488 78   41
  886  886 85   50
  448  448 82   40
  292  292 80   40
  431  431 78   40
  683  683 82   40
  3232 56   32
  740  740 80   40
  519  519 81   41
  986  986 88   50
  437  437 84   40
  247  247 88   40
  122  122 73   40
  ...

The sum of the column selected is 25.

Hope this helps.

Petr Savicky.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Colors vector based on group

2012-02-06 Thread Filoche
Thank for your answer.

Problem solved.

Regards,
Phil

--
View this message in context: 
http://r.789695.n4.nabble.com/Colors-vector-based-on-group-tp4361425p4362746.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] Duplicate rows when I combine two data.frames with merge!

2012-02-06 Thread Sarah Goslee
Hi,

Why do you need to merge them? c.one contains what I think you want,
and then you want to randomly select 25 rows from that without replacement:

c.one - cbind(c.one, a.qtr = sample(c(rep(TRUE, 25), rep(FALSE, 75
 head(c.one)
unique length age a.qtr
649649 71   4  TRUE
200200 79   4 FALSE
410410 82   4  TRUE
620620 73   4 FALSE
723723 81   4 FALSE
855855 96   5 FALSE

If what you mean by the subject line is that there are duplicate rows in the
merged data frame, of course there are, because there are duplicated rows
in c.one, because you selected sampling with replacement when selecting
rows from pop to make c.one.

Something to be VERY careful of: length, merge and unique are all base
functions, and shouldn't be used as variable names. After you named
something merge, what happens when you try to use merge()?

If I'm misunderstanding the question, then please try to explain more clearly
what you are looking for.

Sarah

On Mon, Feb 6, 2012 at 3:29 PM, RKinzer ry...@nezperce.org wrote:
 Hello all,

 First I have done extensive searches on this forum and others and nothing
 seems to work.  So I decided to post thinking someone could point me to the
 write post or give me some help.

 I have drawn a 100 samples from a fictitious population (N=1000), and then
 randomly selected 25% of the 100 samples.  I would like to now merge the
 data.frame from the 100 samples with the data.frame for the 25 individuals
 from the sample.  When I do this with the following code I get duplicate
 rows, when I should have at most is 100.

 x-mapply(rnorm,1000,c(54,78,89),c(3.5,5.5,5.9))  #sets up 1000 random
 numbers for age 3,4,5
 x.3-sample(x[,1],60)  #randomly selects 60 lengths from age 3
 x.4-sample(x[,2],740)
 x.5-sample(x[,3],200)
 length-c(x.3,x.4,x.5)
 length-round(length,digits=0)  #rounds lengths to whole number
 age3-rep(3,60)
 age4-rep(4,740)
 age5-rep(5,200)
 age-c(age3,age4,age5)  #combines ages into one vector
 unique-1:1000  #gives each fish a unique id
 pop-data.frame(unique,length,age)
 pop-pop[sample(1:1000,size=1000,replace=FALSE),]  #randomized the order of
 pop
 c.one-pop[sample(1:1000,size=100,replace=TRUE),]
 a.one.qtr-c.one[sample(1:100,size=25,replace=TRUE),]
 merge-merge(c.one,a.one.qtr,by=unique,all=TRUE)

 What I would ultimately like to have is one row for all 100 in the sample
 and three columns (unique, length, age).  And then some way to identify the
 25 individual selected rows.

 Thank you upfront for any help.  I have been stuck for days.

 Ryan



 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Duplicate-rows-when-I-combine-two-data-frames-with-merge-tp4362685p4362685.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.



-- 
Sarah Goslee
http://www.stringpage.com
http://www.sarahgoslee.com
http://www.functionaldiversity.org

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 time series (ts) object

2012-02-06 Thread Filoche
Hi everyone.

I have have a dataset with daily measurement from January 1st of 1966 up to
December 31th of 2011.

Here's the first part of the data:

DateSLEV
1/1/19661.086
1/2/19661.079
1/3/19661.133
1/4/19661.261
1/5/19661.391
1/6/19661.571
1/7/19661.728
1/8/19661.823
1/9/19661.97
1/10/1966   1.804
1/11/1966   2.02
1/12/1966   2.017
1/13/1966   1.86
1/14/1966   1.96
1/15/1966   1.813
1/16/1966   1.773
1/17/1966   1.647
1/18/1966   1.634
1/19/1966   1.815
1/20/1966   1.928
1/21/1966   1.937
1/22/1966   2.187
1/23/1966   2.133
1/24/1966   2.162
1/25/1966   2.026
1/26/1966   2.055
1/27/1966   2.051
1/28/1966   1.998
1/29/1966   2.178
1/30/1966   1.709
1/31/1966   1.79
...
12/31/2011  0.599


I would like to perform some sort of time series analysis. To do so, I'm
trying to create a ts() object with my data. However, I'm not sure how ti
create it and what frequency to use. In the help file, they say to use
/*frequency = 7*/ for daily observation, but the result don't seems
coherent:

*/Series:
Start = c(1966, 1) 
End = c(4337, 5) 
Frequency = 7/ *

Anyone can help me? 

Thank is advance,
Phil
 

--
View this message in context: 
http://r.789695.n4.nabble.com/Creating-time-series-ts-object-tp4362762p4362762.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] Creating time series (ts) object

2012-02-06 Thread R. Michael Weylandt
The documentation doesn't say what you think it says:

The value of argument ‘frequency’ is used when the series is
 sampled an integral number of times in each unit time interval.
 For example, one could use a value of ‘7’ for ‘frequency’ when the
 data are sampled daily, and the natural time period is a week, 

If your natural time period is a year, then there are 365 samples
per time period and that's your frequency. Of course, this might have
problems with leap days: good luck with that.

Michael

On Mon, Feb 6, 2012 at 3:53 PM, Filoche pmassico...@hotmail.com wrote:
 Hi everyone.

 I have have a dataset with daily measurement from January 1st of 1966 up to
 December 31th of 2011.

 Here's the first part of the data:

 Date    SLEV
 1/1/1966        1.086
 1/2/1966        1.079
 1/3/1966        1.133
 1/4/1966        1.261
 1/5/1966        1.391
 1/6/1966        1.571
 1/7/1966        1.728
 1/8/1966        1.823
 1/9/1966        1.97
 1/10/1966       1.804
 1/11/1966       2.02
 1/12/1966       2.017
 1/13/1966       1.86
 1/14/1966       1.96
 1/15/1966       1.813
 1/16/1966       1.773
 1/17/1966       1.647
 1/18/1966       1.634
 1/19/1966       1.815
 1/20/1966       1.928
 1/21/1966       1.937
 1/22/1966       2.187
 1/23/1966       2.133
 1/24/1966       2.162
 1/25/1966       2.026
 1/26/1966       2.055
 1/27/1966       2.051
 1/28/1966       1.998
 1/29/1966       2.178
 1/30/1966       1.709
 1/31/1966       1.79
 ...
 12/31/2011      0.599


 I would like to perform some sort of time series analysis. To do so, I'm
 trying to create a ts() object with my data. However, I'm not sure how ti
 create it and what frequency to use. In the help file, they say to use
 /*frequency = 7*/ for daily observation, but the result don't seems
 coherent:

 */Series:
 Start = c(1966, 1)
 End = c(4337, 5)
 Frequency = 7/ *

 Anyone can help me?

 Thank is advance,
 Phil


 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Creating-time-series-ts-object-tp4362762p4362762.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.


Re: [R] histogram

2012-02-06 Thread Francis Keyes
Hi David,

I have 2 tables, each with several columns and rows of data.  I am
only interested in the data from column 6, which contains values in
the range -PI to PI.  I want to plot the data from tableD with the y
axis denoting percentage with respect to tableR.  So if data points in
the break 2 - 3 appear half as often in tableD as in tableR, the y
axis should show 50 percent.  Does that make sense?
I've been plotting the data like this to date:

hist(tableD[,6],ylab=frequency, xlab=angle)

Thanks a lot for your help



On Mon, Feb 6, 2012 at 1:31 PM, David Winsemius dwinsem...@comcast.net wrote:


 On Feb 6, 2012, at 12:23 PM, Francis Keyes wrote:

 Thanks.  How do you suggest I use the reference population?  Sorry, I'm new 
 to R and just don't see it.  If i can get a plot that is counts or density 
 relative to my reference data it would be ideal.


 It is difficult to specify how when we have no what. The what is your 
 responsibility, not ours. My thought was to use the ratio of the results of 
 hist() on the two populations  which would then be offered back to hist or 
 barplot. which (of course) requires that the 'breaks'  be the same. 
 Provide an example of your R representations of the reference population and 
 tested population and all will become clear.

 (And learn to post in plain text, please.)

 --
 David Winsemius, MD
 West Hartford, CT


 On Mon, Feb 6, 2012 at 1:12 AM, David Winsemius dwinsem...@comcast.net 
 wrote:

 On Feb 5, 2012, at 8:31 PM, Francis Keyes wrote:

 With R and the hist function, is there a way to make a histogram in which
 the y axis denotes propotion with respect to a separate sample dataset of
 the same range instead of frequency?

 hist() returns an object with both counts and density. If you had a 
 reference population it should be a fairly simple matter to use one or the 
 other of those.







__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Disable contrasts in lme

2012-02-06 Thread Ben Bolker
Saskia Freytag saskia.freytag at med.uni-goettingen.de writes:

 I am trying to disable the contrast statement in the lme function of the 
 package nlme. Is there a way to do this? This is needed as I have only 
 one group.


  Can you be more specific please?  My first interpretation of this
question is if you only have one group why do you need to fit a mixed-
effects model?, but with further explanation you might get some useful
advice.

  Also, it would be best to follow up to r-sig-mixed-mod...@r-project.org
where you can get more specialized help with (n)lme.

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