[R] problems with too many NA in the function ideal() from pscl package.

2008-09-19 Thread Antonio P. Ramos
Hi all,

I'm trying to run some monte carlo simulation for my roll call data
using the ideal() function, which resides in the pscl package.
However, I'm receiving an error message that I don't understand.

Error in ideal(a, maxiter = 1000, thin = 10, burnin = 50, store.item = TRUE,  :
  NA/NaN/Inf in foreign function call (arg 13)


my code is simple the following:


 m_a - ideal(a, maxiter = 1000, thin = 10, burnin = 50,
+  store.item = TRUE,  normalize=T,
+   
priors=list(xp=1e-12,xpv=1e-12,bp=1e-12,bpv=1e-12), verbose=T)
ideal: analysis of roll call data via Markov chain Monte Carlo methods.

Subsetting rollcall object a using dropList
Using the following codes to represent roll call votes:
Yea: 1
Nay: 0
Abstentions: NA
Not In Legislature:  9

Ideal Point Estimation

Number of Legislators30
Number of Items  1172

checking for any user-supplied priors...

checking start values...
will use eigen-decomposition method to get start values for ideal points...done
running 1172 vote-specific probit GLMs
 for start values for item/bill parameters
 conditional on start values for ideal points...done
using the following start values for ideal points (summary follows):
   V1
 Min.   :-0.7573
 1st Qu.:-0.1583
 Median : 0.
 Mean   :-0.0342
 3rd Qu.: 0.
 Max.   : 0.8160
using the following start values for item parameters (summary follows):
   V1  V2
 Min.   :-131.2397   Min.   :-49.27293
 1st Qu.:  -1.9090   1st Qu.: -1.33518
 Median :  -1.5156   Median : -0.34876
 Mean   :   0.5443   Mean   : -0.07001
 3rd Qu.:   1.6978   3rd Qu.:  1.22064
 Max.   : 553.5285   Max.   : 65.19820
 NA's   : 573.

Starting MCMC Iterations...
Error in ideal(a, maxiter = 1000, thin = 10, burnin = 50, store.item = TRUE,  :
  NA/NaN/Inf in foreign function call (arg 13)
+


The problem, I think, is that many data matrix has too many NA. Does
anybody have any suggestion?

Thanks in advance,

Antonio.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Mixed effects model with binomial errors - problem

2008-09-19 Thread RFTW

anyone?


RFTW wrote:
 
 ok... the model now runs properly (say, without errors). Now about the
 result.
 These are the averages per treatments
 
 tapply(VecesArbolCo.VecesCo.C1,T2,mean)
   a b  c d 
 0.49 0.56 0.45 0.58 
 
 
 I run this very simple model
 
 summary(model1-lmer(cbind(VisitsExpTree,TotalVisits-VisitsExpTree)~
 treatment +(1|Individual), family=binomial, data=r))
 
 Generalized linear mixed model fit by the Laplace approximation 
 Formula: cbind(VisitsExpTree,TotalVisits-VisitsExpTree)~ treatment
 +(1|Individual)  
Data: r 
AIC   BIC logLik deviance
  242.3 255.9 -116.2232.3
 Random effects:
  GroupsNameVariance Std.Dev.
  Individuo (Intercept) 0.14075  0.37517 
 Number of obs: 112, groups: Individuo, 37
 
 Fixed effects:
 Estimate Std. Error z value Pr(|z|)   
 (Intercept)  0.372280.19031  1.9562  0.05044 . 
 treatmentb  0.033670.24520  0.1373  0.89079   
 treatmentc -0.606060.23330 -2.5978  0.00938 **
 treatmentd -0.255040.22790 -1.1191  0.26311   
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
 
 Correlation of Fixed Effects:
 (Intr) T2bT2c   
 T2b -0.675  
 T2c -0.697  0.543   
 T2d -0.720  0.544  0.581
 
 
 wouldnt we expect the intercept to be roughtly the mean of treatment a?
 and thus the estimate of treatmentb to be +0.07, c: -0.04 and d: +0.09
 roughly?
 
 Is this model just completely not estimating well, or are the estimates
 not the 'real values'. 
 
 I tried to get teh predict function to give me the 4 predicted values
 based on the model, but i havent succeeded in doing so. maybe someone can
 help me on that one too (predict(model1,type=response) doesnt work)
 
 thnx
 

-- 
View this message in context: 
http://www.nabble.com/Mixed-effects-model-with-binomial-errorsproblem-tp19413327p19566778.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] help on sampling from the truncated normal/gamma distribution on the far end (probability is very low)

2008-09-19 Thread Peter Dalgaard

Daniel Davis wrote:

Hi, guys,

I am trying to sample from a truncated normal/gamma distribution.
But only the far end of the distribution (where the probability is very low)
is left. e.g.

mu = - 4;
sigma = 0.1;
The distribution is Normal(mu,sigma^2) truncated on [0,+Inf];

How can I get a sample? I tried to use inverse CDF method, but got Inf as
answers. Please help me out.

  
You were on track, but you need more awareness of the cancellation 
issues. Two hints: Use logarithms and look at the correct tail.  So:


T - pnorm(0, -4, .1, lower=F, log=T)
z - qnorm(T-rexp(1000), -4, .1, lower=F, log=T)
hist(z)


Also, pls help me on the similar situation on gamma dist'n.

  

Exercise for the reader

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

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


Re: [R] how to keep up with R?

2008-09-19 Thread Robin Hankin

Hi Wensei.


Why not do as I do?  Find an interesting area of numerical
computation (perhaps not statistical) that has not been
implemented in open-source.  Then write an R package
for it, under GPL-2, then write an article about the new
package in  R-news or JSS.

works for me.


Best wishes


Robin


Wensui Liu wrote:

Dear Listers,

I've been a big fan of R since graduate school. After working in the
industry for years, I haven't had many opportunities to use R and am mainly
using SAS. However, I am still forcing myself really hard to stay close to R
by reading R-help and books and writing R code by myself for fun. But by and
by, I start realizing I have hard time to keep up with R and am afraid that
I would totally forget how to program in R.

I really like it and am very unwilling to give it up. Is there any idea how
I might keep touch with R without using it in work on daily basis? I really
appreciate it.

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



--
Robin K. S. Hankin
Senior Research Associate
Cambridge Centre for Climate Change Mitigation Research (4CMR)
Faculty of Economics
The University of Cambridge
[EMAIL PROTECTED]
01223-764877

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

2008-09-19 Thread Hans W. Borchers
Shengqiao Li shli at stat.wvu.edu writes:
 
 Hello,

 I want to do regression or missing value imputation by knn. I searched 
 r-help mailing list. This question was asked in 2005. ksmooth and loess 
 were recommended. But my case is different. I have many predictors 
 (p20) and I really want try knn with a given k. ksmooth and loess use 
 band width to define neighborhood size. This contrasts to knn's variable 
 band width via fixing a k. Are there any such functions I can use in R 
 packages? 
 

The R package 'knnFinder' provides a nearest neighbor search based on the 
approach through kd-tree data structures. Therefore, it is extremely fast 
even for very large data sets. It returns as many neighbors as you need 
and can also be used, e.g., for determining distance-based outliers.

Hans Werner Borchers
ABB Corporate Research

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


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

2008-09-19 Thread Barry Rowlingson
2008/9/19 Wensui Liu [EMAIL PROTECTED]:
 Dear Listers,

 I've been a big fan of R since graduate school. After working in the
 industry for years, I haven't had many opportunities to use R and am mainly
 using SAS. However, I am still forcing myself really hard to stay close to R
 by reading R-help and books and writing R code by myself for fun. But by and
 by, I start realizing I have hard time to keep up with R and am afraid that
 I would totally forget how to program in R.

 I really like it and am very unwilling to give it up. Is there any idea how
 I might keep touch with R without using it in work on daily basis? I really
 appreciate it.


 How about doing some kind of presentation on R at your work? It's
possible that some of the old fossils don't even know about it at all,
and use SAS because to them the alternative is SPSS. Do some R
evangelization. Find a task that R does better than SAS (not
difficult) and illustrate that to your superiors. Then when they ask
how much a corporate R license is, you tell them it's free, or say
it'll cost them a 2% raise in your salary, or say it will cost them
your resignation if you are feeling brave!

 Sure you may be tied to SAS for some other reasons, but there's no
reason why you can't use R for other things. Work out how to get it
into your corporate framework. Encourage your colleagues to look at it
for their tasks. Enthuse.

 The good thing about training and evangelization is that at first you
don't need mad skillz at R to do it. I have trouble understanding some
of the tips on R-help (especially when do.call() is used), but you can
teach new people with a good knowledge of the basics, which you should
still have. Eventually the hope is that enough people use R at your
workplace to develop a community where everyone keeps everyone else on
their toes with R questions!

 Good luck!

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] Type I SS and Type III SS problem

2008-09-19 Thread leeznar
Dear all:
I m a newer on R.  I have some problem when I use anova function.  I use anova 
function to get Type I SS results, but I also need to get Type III SS results.  
However, in my code, there is some different between the result of Type I SS 
and Type III SS.  I don’t know why the “seqe” factor disappeared in the result 
of Type III SS.  How can I do?  

Here is my example and result.
a-c(1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14)
b-c(1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2)
c-c(2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2)
d-c(2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1)
e-c(1739,1633,1481,1837,1780,2073,1374,1629,1555,1385,1756,1522,1566,1643,
 1939,1615,1475,1759,1388,1483,1127,1682,1542,1247,1235,1605,1598,1718 )
KK-data.frame(subj=as.factor(a), drug=as.factor(b), per=as.factor(c),  
seqe=as.factor(d), Cmax=e)
M- lm(Cmax ~ seqe+ subj:seqe + per + drug , data=KK)
anova(M)
drop1(M, test=F)

The result of Type I SS: 
Analysis of Variance Table
Response: Cmax
  Df Sum Sq Mean Sq F value Pr(F)
seqe   1    585 585  0.0160 0.9014
per    1  63175   63175  1.7293 0.2131
drug   1  58149   58149  1.5917 0.2311
seqe:subj 12 634325   52860  1.4469 0.2660
Residuals 12 438395   36533

The result of Type III SS: 
Single term deletions
Model:
AUCt ~ seqe + subj:seqe + per + drug
  Df Sum of Sq  RSS  AIC F value  Pr(F)
none 63208187  442
per    1   2100484 65308672  441  0.3988 0.5396
drug   1   4714183 67922370  442  0.8950 0.3628
seqe:subj 12  35813062 99021249  430  0.5666 0.8308

Best regards,
HY Lee


  
_
想知道無聊生活如何大變身嘛? http://tw.promote.mail.yahoo.com/dc/change.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.


Re: [R] How to find a shift between two curves or data sets

2008-09-19 Thread Hans W. Borchers

Dear Sébastien,

identifying similarity in curves or time series is one of the main tasks 
in the quite recent field of 'Functional Data analysis' (FDA). See the 
2005 book by Silverman from Springer Verlag or the corresponding Web page 
at url{http://www.psych.mcgill.ca/misc/fda/}.

The 'fda' package on CRAN contains functions developed by Silverman and 
Ramsey and described in that book. You may also be interested in the 'dtw' 
package that provides functions for comparing times series under time 
'warping', i.e., distortions along the time axis.

Hans Werner Borchers
ABB Corporate Research



Sébastien Durand wrote:
 
 Hello,
 
 I have a issue here!
 
 I need to find the offset or shift between two data sets.
 
 Each data set does not start nor end at the same time and dont even have 
 the same sampling interval (which by the way isn't constant in any of 
 the data set).
 
 It must be known that the data expressed in both the data set are 
 comming from the same sensor so they should be the same!
 
 What I am looking for is a way to minimize the differences between the 
 two curves by applying an x offset.
 
 Would any body have a clue how to perform such action, I simply have no 
 idea were to start.
 
 Thank you very very much.
 
 S.
 

-- 
View this message in context: 
http://www.nabble.com/How-to-find-a-shift-between-two-curves-or-data-sets-tp19561272p19567696.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] frequency table across multiple variables

2008-09-19 Thread Ralikwen

Dear R users,

I have a dataframe like this:

x1-c(1,2,3,4,NA ,NA ,NA, 3, 1, 1, 1, 1, 2, 2, 3, 4, 4)
x2-c(2,3,4,3,4,3,4,2,2,3,4,NA,NA,NA,NA,4,3)
x3-c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,1,2)
m-data.frame(x1,x2,x3)

I would like to create a frequency table like this:

  x1  x2  x3
NA
1
2
3
4

where the values in each cell would be the count of the value for that
variable.
How can I do this?

Thanks for the help.
Balázs

 
-- 
View this message in context: 
http://www.nabble.com/frequency-table-across-multiple-variables-tp19567838p19567838.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] PDF fonts problem

2008-09-19 Thread Mihalicza Péter

Dear Dr. Murrel,

Thank you for all the clarifications!

Paul Murrell írta:

Hi




#CMS
pdf(tryfont-cms.pdf, family=CMS)
grid.text(gg\u151hh\uF6ii\uF3jj kk\u171ll\uFCmm\uFAnn)
dev.off()
#u151 and u171 doesn't show, though the other accented ones do

embedFonts(tryfont-cms.pdf,
outfile=tryfont-cms-embed.pdf,
fontpaths=/cm-super/afm/)
#after embedding the same slipping occurs



The 'fontpaths' argument describes where the PFB files are, not where 
the AFM files are.  So this is probably failing to embed the fonts 
because it can't find the fonts.  Does it work if you change to 
something like ...


 embedFonts(tryfont-cms.pdf,
   outfile=tryfont-cms-embed.pdf,
   fontpaths=cm-super/pfb/)

Paul


This solved my problem, so I am really very grateful! I am not too 
familiar with font protocols.
Just for the sake of knowledge: if my embedFonts specification should 
not have made any difference, why did the output pdf differed from the 
one before embedding?


Thanks again,
Peter



--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Mixed effects model with binomial errors - problem

2008-09-19 Thread ONKELINX, Thierry

First of all I'm forwarding this mail to the R-SIG-mixed-models, which
is more appropriate to your question.

Remember that family = bionomial uses by default the logit link. Hence
all parameters will be on the logit scale. So you will need to
backtransform them for comparison. Then you'll see that the parameters
are much closer to the averages. They still differ, but that is due to
the difference in model. Your averages are essentially something like
summary(model1-glm(cbind(VisitsExpTree,TotalVisits-VisitsExpTree)~
treatment +(1|Individual), family=binomial, data=r))

 library(boot)
 intercept - 0.37228
 treatmentb - 0.03367
 treatmentc - -0.60606
 treatmentd - -0.25504
 inv.logit(intercept)
[1] 0.5920098
 inv.logit(intercept + treatmentb)
[1] 0.6001164
 inv.logit(intercept + treatmentc)
[1] 0.4418197
 inv.logit(intercept + treatmentd)
[1] 0.5292765

HTH,

Thierry



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

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

The plural of anecdote is not data.
~ Roger Brinner

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

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Namens RFTW
Verzonden: vrijdag 19 september 2008 8:16
Aan: r-help@r-project.org
Onderwerp: Re: [R] Mixed effects model with binomial errors - problem


anyone?


RFTW wrote:
 
 ok... the model now runs properly (say, without errors). Now about the
 result.
 These are the averages per treatments
 
 tapply(VecesArbolCo.VecesCo.C1,T2,mean)
   a b  c d 
 0.49 0.56 0.45 0.58 
 
 
 I run this very simple model
 
 summary(model1-lmer(cbind(VisitsExpTree,TotalVisits-VisitsExpTree)~
 treatment +(1|Individual), family=binomial, data=r))
 
 Generalized linear mixed model fit by the Laplace approximation 
 Formula: cbind(VisitsExpTree,TotalVisits-VisitsExpTree)~ treatment
 +(1|Individual)  
Data: r 
AIC   BIC logLik deviance
  242.3 255.9 -116.2232.3
 Random effects:
  GroupsNameVariance Std.Dev.
  Individuo (Intercept) 0.14075  0.37517 
 Number of obs: 112, groups: Individuo, 37
 
 Fixed effects:
 Estimate Std. Error z value Pr(|z|)   
 (Intercept)  0.372280.19031  1.9562  0.05044 . 
 treatmentb  0.033670.24520  0.1373  0.89079   
 treatmentc -0.606060.23330 -2.5978  0.00938 **
 treatmentd -0.255040.22790 -1.1191  0.26311   
 ---
 Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
 
 Correlation of Fixed Effects:
 (Intr) T2bT2c   
 T2b -0.675  
 T2c -0.697  0.543   
 T2d -0.720  0.544  0.581
 
 
 wouldnt we expect the intercept to be roughtly the mean of treatment
a?
 and thus the estimate of treatmentb to be +0.07, c: -0.04 and d: +0.09
 roughly?
 
 Is this model just completely not estimating well, or are the
estimates
 not the 'real values'. 
 
 I tried to get teh predict function to give me the 4 predicted values
 based on the model, but i havent succeeded in doing so. maybe someone
can
 help me on that one too (predict(model1,type=response) doesnt work)
 
 thnx
 

-- 
View this message in context:
http://www.nabble.com/Mixed-effects-model-with-binomial-errorsproble
m-tp19413327p19566778.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.

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

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


Re: [R] frequency table across multiple variables

2008-09-19 Thread Philipp Pagel
 I have a dataframe like this:
 
 x1-c(1,2,3,4,NA ,NA ,NA, 3, 1, 1, 1, 1, 2, 2, 3, 4, 4)
 x2-c(2,3,4,3,4,3,4,2,2,3,4,NA,NA,NA,NA,4,3)
 x3-c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,1,2)
 m-data.frame(x1,x2,x3)
 
 I would like to create a frequency table like this:
 
   x1  x2  x3
 NA
 1
 2
 3
 4
 
 where the values in each cell would be the count of the value for that
 variable.
 How can I do this?

The following will work IF all columns are integer:


 apply(m, 2, function(x){tabulate(na.omit(x))})
 x1 x2 x3
[1,]  5  0  5
[2,]  3  3  5
[3,]  3  5  4
[4,]  3  5  3

Please note that the result will look slightly different, if some columns 
contain 
the largest value and others don't:

 x1-as.integer(c(1,2,3,4,NA ,NA ,NA, 3, 1, 1, 1, 1, 2, 2, 3, 4, 5))
 m-data.frame(x1,x2,x3)
 apply(m, 2, function(x){tabulate(na.omit(x))})
$x1
[1] 5 3 3 2 1

$x2
[1] 0 3 5 5

$x3
[1] 5 5 4 3


cu
Philipp


-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
http://mips.gsf.de/staff/pagel

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Type I SS and Type III SS problem

2008-09-19 Thread Peter Dalgaard
leeznar wrote:
 Dear all:
 I m a newer on R.  I have some problem when I use anova function.  I use 
 anova function to get Type I SS results, but I also need to get Type III SS 
 results.  However, in my code, there is some different between the result of 
 Type I SS and Type III SS.  I don’t know why the “seqe” factor disappeared in 
 the result of Type III SS.  How can I do?  

   
Well, first make sure that you copy/paste correctly. Your drop1()
results appear not to come from the model M!!

 drop1(M, test=F)
Single term deletions

Model:
Cmax ~ seqe + subj:seqe + per + drug
  Df Sum of Sq RSS AIC F value  Pr(F)
none  438395 302
per1 63175  501570 304  1.7293 0.2131
drug   1 58149  496544 304  1.5917 0.2311
seqe:subj 12634325 1072719 303  1.4469 0.2660

So things are not massively different, which is because this is a nicely
balanced cross-over trial. In an unbalanced trial, the type I anova
would be order-dependent.

Now, seqe is nested in subj:seqe, in fact it is even nested in subj
(because each subject gets the two treatments in only one order,
right?), so taking seqe out of the model doesn't change the fit, as long
as, and this is the important bit, subj:seqe. The drop1() function knows
this and doesn't do the test. In contrast, anova looks at the effect
_before_ subj:seqe was in the model.

Since subj:seqe is equivalent to subj, it can be illuminating to write
the model in this (equivalent) way and notic the differences:

 M- lm(Cmax ~ subj + seqe + per + drug , data=KK)
 anova(M)
Analysis of Variance Table

Response: Cmax
  Df Sum Sq Mean Sq F value Pr(F)
subj  13 634910   48839  1.3369 0.3109
per1  63175   63175  1.7293 0.2131
drug   1  58149   58149  1.5917 0.2311
Residuals 12 438395   36533
 drop1(M)
Single term deletions

Model:
Cmax ~ subj + seqe + per + drug
   Df  Sum of Sq RSS AIC
none438395 302
subj   12 634325 1072719 303
seqe0 -1.630e-09  438395 302
per 1  63175  501570 304
drug1  58149  496544 304

And (I think I've said this before on the list): When things are nicely
balanced, aov() can be preferable:

 summary(aov(Cmax ~ per*drug + Error(subj) , data=KK))

Error: subj
  Df Sum Sq Mean Sq F value Pr(F)
per:drug   1585 585  0.0111  0.918
Residuals 12 634325   52860

Error: Within
  Df Sum Sq Mean Sq F value Pr(F)
per1  63175   63175  1.7293 0.2131
drug   1  58149   58149  1.5917 0.2311
Residuals 12 438395   36533



 Here is my example and result.
 a-c(1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14)
 b-c(1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2)
 c-c(2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2)
 d-c(2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1)
 e-c(1739,1633,1481,1837,1780,2073,1374,1629,1555,1385,1756,1522,1566,1643,
  1939,1615,1475,1759,1388,1483,1127,1682,1542,1247,1235,1605,1598,1718 )
 KK-data.frame(subj=as.factor(a), drug=as.factor(b), per=as.factor(c),  
 seqe=as.factor(d), Cmax=e)
 M- lm(Cmax ~ seqe+ subj:seqe + per + drug , data=KK)
 anova(M)
 drop1(M, test=F)

 The result of Type I SS: 
 Analysis of Variance Table
 Response: Cmax
   Df Sum Sq Mean Sq F value Pr(F)
 seqe   1585 585  0.0160 0.9014
 per1  63175   63175  1.7293 0.2131
 drug   1  58149   58149  1.5917 0.2311
 seqe:subj 12 634325   52860  1.4469 0.2660
 Residuals 12 438395   36533

 The result of Type III SS: 
 Single term deletions
 Model:
 AUCt ~ seqe + subj:seqe + per + drug
   Df Sum of Sq  RSS  AIC F value  Pr(F)
 none 63208187  442
 per1   2100484 65308672  441  0.3988 0.5396
 drug   1   4714183 67922370  442  0.8950 0.3628
 seqe:subj 12  35813062 99021249  430  0.5666 0.8308

 Best regards,
 HY Lee


   
 _
 想知道無聊生活如何大變身嘛? http://tw.promote.mail.yahoo.com/dc/change.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.
   


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

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


Re: [R] frequency table across multiple variables

2008-09-19 Thread Ivar Herfindal

Hi

Here is an alternative solution which will include count of the NA. It 
may not be formally correct, but it seems to work:


 mapply(function(x) table(factor(ifelse(is.na(x), NA, x), 
levels=c(NA,1,2,3,4))), m)

  x1 x2 x3
NA  3  4  0
1   5  0  5
2   3  3  5
3   3  5  4
4   3  5  3


Hope this helps

Ivar Herfindal

Philipp Pagel skrev:

I have a dataframe like this:

x1-c(1,2,3,4,NA ,NA ,NA, 3, 1, 1, 1, 1, 2, 2, 3, 4, 4)
x2-c(2,3,4,3,4,3,4,2,2,3,4,NA,NA,NA,NA,4,3)
x3-c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,1,2)
m-data.frame(x1,x2,x3)

I would like to create a frequency table like this:

  x1  x2  x3
NA
1
2
3
4

where the values in each cell would be the count of the value for that
variable.
How can I do this?



The following will work IF all columns are integer:


  

apply(m, 2, function(x){tabulate(na.omit(x))})


 x1 x2 x3
[1,]  5  0  5
[2,]  3  3  5
[3,]  3  5  4
[4,]  3  5  3

Please note that the result will look slightly different, if some columns contain 
the largest value and others don't:


  

x1-as.integer(c(1,2,3,4,NA ,NA ,NA, 3, 1, 1, 1, 1, 2, 2, 3, 4, 5))
m-data.frame(x1,x2,x3)
apply(m, 2, function(x){tabulate(na.omit(x))})


$x1
[1] 5 3 3 2 1

$x2
[1] 0 3 5 5

$x3
[1] 5 5 4 3


cu
Philipp





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

2008-09-19 Thread ONKELINX, Thierry
Steve,

- Use tranparancy to prevent overplotting: more details on p. 16 of the
ggplot2 book: http://had.co.nz/ggplot2/book/
- You can choose your own colour with scale_manual():
http://had.co.nz/ggplot2/scale_manual.html 
- The backgroundcolor can be set with ggopt(background.color = white):
http://rweb.stat.umn.edu/R/library/ggplot/html/build-options-8a.html

HTH,

Thierry




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

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

The plural of anecdote is not data.
~ Roger Brinner

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

-Oorspronkelijk bericht-
Van: Steve Murray [mailto:[EMAIL PROTECTED] 
Verzonden: donderdag 18 september 2008 19:08
Aan: r-help@r-project.org; ONKELINX, Thierry; [EMAIL PROTECTED];
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Onderwerp: RE: [R] Use of colour in plots


Dear Thierry and all,

I've tried out ggplot from the ggplot2 package and it seems to provide
much more favourable results!

Just a few questions I have after consulting the 'help' file for ggplot.

Is there a way of preventing overplotting? Some of the red points are
being obscured by the green ones. I've tried changing the size of the
points (using size=1) but this doesn't resolve the issue, as there are
many points quite densely packed in some parts of the graph.

Also how would I change the colours if I wished (for future plots of a
similar format)? And how do you customise the legend?

Finally, is there a way of changing the grey background of the graph to
white?

Sorry for all the questions, it's just that I'm new to the ggplot2
package and can't find the answers in the help file or on the associated
website!

Many thanks to anyone who's able to offer any advice.

Best wishes,

Steve



 Subject: RE: [R] Use of colour in plots
 Date: Thu, 18 Sep 2008 14:52:57 +0200
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
 CC: r-help@r-project.org

 Steve,

 Have a look at the ggplot2 package:

 library(ggplot2)
 ggplot(Jan, aes(x = PopDensity, y = Average.Burnt.Area.Fraction,
colour
 = factor(Urban.Rural 1.25))) + geom_point()




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

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

 The plural of anecdote is not data.
 ~ Roger Brinner

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

 -Oorspronkelijk bericht-
 Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
 Namens Steve Murray
 Verzonden: donderdag 18 september 2008 13:58
 Aan: Petr PIKAL; [EMAIL PROTECTED]
 CC: r-help@r-project.org
 Onderwerp: Re: [R] Use of colour in plots


 Dear all,

 I've finally got round to plotting my data and trying to apply colour
 (had some problems with the data which I needed to rectify first!).
I'm
 having trouble however getting the colour to work as I'd hoped,
despite
 the help offered in previous messages.

 Just to recap, and with more specifics this time, I have a data frame
as
 follows:


 head(Jan)
 Latitude Longitude Urban.Rural Average.Burnt.Area.Fraction PopDensity
 GDP
 1 -0.25 -49.25 1.00 9e-05 1.8703090
 25694
 2 -0.25 -50.25 1.00 2e-05 2.5962470
 32205
 3 -0.25 -50.75 1.00 0e+00 3.5221470
 39312
 4 -0.25 -51.25 1.042432 5e-06 14.2919000
 87685
 5 -0.25 -51.75 1.00 1e-05 0.5721315
 11376
 6 -0.25 -52.25 1.00 4e-05 0.7262031
 11083
 Cropland.Area..km.2.grid.cell.
 1 0.4260444
 2 0.3401146
 3 0.3036076
 4 0.3147694
 5 0.2843388
 6 0.1734099


 I hope to plot Average.Burnt.Area.Fraction (ABAF) against PopDensity
 (which I have done using: plot(Jan[,3],Jan[,4]) ).

 However, the twist is, I hope these points to be coloured according to
 the values of Urban.Rural (but don't want this column to actually be
 plotted). I am looking to do, if Urban.Rural1.25 then colour the
point
 

[R] panel data analysis possible with mle2 (bbmle)?

2008-09-19 Thread Erich STRIESSNIG
Dear R community,

I want to estimate coefficients in a (non-linear) system of equations using
'mle2' from the bbmle package. Right now the whole data is read in as just
one long time series, when it's actually 9 cross sections with 30 observations
each. I would like to be able to test and correct for autocorrelation but
haven't found a way to do this in this package. 
On the other hand I have found a package called plm serving for panel
likelihood maximization, but here the regression formula apparently must be
one single equation, whereas I have a system of equations.

In order to give you an idea of what I'm trying to do, I have written this -as
short as possible- sketch of the model - sorry I couldn't make it any shorter:


cross - 3;years - 13 #cross sections and years to be included

frontr-vector(length=years);ggwth - 0.03; frontr[1]=17
for (i in 2:years) {frontr[i]=frontr[i-1]*(1+ggwth)}
frontr - rep(frontr,times=cross)

atech - matrix(0,years,cross);rr1 - matrix(0,years,cross)
agwth - matrix(0,years,cross);cfgwth - matrix(0,years,cross)

aobs -
c(15.89,16.69,17.93,17.49,18.3,19.1,19.2,19.4,20.29,21.13,21.42,22.76,23.83,
  
14.1,14.4,13.4,14.9,15.23,15.4,15.55,16.7,17.8,18.87,18.99,19.24,20.59,
  14.3,14.4,14.7,14.9,15.2,15.43,15.5,17.1,17.5,18,18.3,18.7,19);
dim(aobs) - c(years,cross)

ra - c(-0.62, -0.81, -1.05, -0.97, -0.87, -0.66, -0.67, -0.56,
-0.333, -0.219, -0.13, -0.116, -0.474, -0.838, -0.821, -0.95,
-1.03, -1.26, -1.21, -1.12, -1.19, -1.14, -1, -0.97,
-0.92, -1.05, 0.04, 0.02, -0.11, -0.36, -0.57, -0.7,
-0.71, -0.61, -0.68, -0.9, -1, -1.04, -1.1)

sa - c(1.79, 1.81, 1.81, 1.81, 1.81, 1.81, 1.81, 1.81, 1.81,
1.82, 1.8, 1.79, 1.783, 0.93, 0.96, 0.99, 1.02, 1.04, 1.07,
1.1, 1.12, 1.14, 1.17, 1.19, 1.21, 1.23, 1.35, 1.4,
1.45, 1.5, 1.56, 1.61, 1.66, 1.71, 1.75, 1.81, 1.85,
1.89, 1.93)

ta - c(-1.06, -1.01, -0.97, -0.94, -0.89, -0.82, -0.75, -0.69,
-0.58, -0.54, -0.49, -0.39, -0.31, 0.02, 0.07, 0.087,
0.138, 0.132, 0.244, 0.354, 0.421, 0.606, 0.74, 0.818, 1.048,
1.229, -1.17, -1.159, -1.16, -1.143, -1.137, -1.085, -1.028,
-0.965, -0.919, -0.942, -0.902, -0.828, -0.79)
this is the function that is called by mle2
exfunc - function(c1,c2,c3,cs1,cs2,cs3,ic1,ic2,ic3,cc1,cc2,cc3,alstar,beta1){
x-matrix(0,years*cross,3)
   x[,1] - 1
   x[,2] - ra
   x[,3] - sa
coeffs - vector(length=3)
   coeffs[1] - c1
   coeffs[2] - c2
   coeffs[3] - c3

csp - rep(c(cs1,cs2,cs3),each=years)
e1 - (x %*% coeffs);frfact - csp*plogis(e1);cfrontr - frfact*frontr;
cfrontr1 - cfrontr;dim(cfrontr1) - c(years,cross)
cfgwth[2:years,] - (cfrontr1[2:years,]/cfrontr1[1:(years-1),])-1

x-matrix(1,years*cross,3)
   x[,1] - 1
   x[,2] - sa
   x[,3] - ta
coeffs - vector(length=3)
   coeffs[1] - cc1
   coeffs[2] - cc2
   coeffs[3] - cc3

e1 - (x %*% coeffs);alpha1 - alstar*plogis(e1);dim(alpha1) - c(years,cross)

icfr - c(ic1,ic2,ic3)
atech[1,1:cross] - icfr[1:cross]*cfrontr1[1,1:cross]
rr1[1,1:cross] - atech[1,1:cross]/cfrontr1[1,1:cross]

for (i in 2:years) {
 
agwth[i,1:cross]=(rr1[i-1,1:cross]-alpha1[i-1,1:cross])*beta1*(1-rr1[i-1,1:cross])+cfgwth[i,1:cross]
  atech[i,1:cross]=atech[i-1,1:cross]*(1+agwth[i,1:cross])
  rr1[i,1:cross]=atech[i,1:cross]/cfrontr1[i,1:cross]}

pcdiffun - function(a,b) (a-b)/b
pcdif - pcdiffun(atech[2:years,],aobs[2:years,]);sd1 = sd(pcdif)
rt1 = -sum(dnorm(pcdif,mean=0,sd=sd1,log=TRUE))}
##here is where the function ends 
library(bbmle)
maxlk - mle2(exfunc,
  start=list(c1 = -3.74466306894815,c2 = -0.240135942405391,c3 =
4.44168922065451,
  cs1 = 0.962506678868304,cs2 = 0.965725991431272,cs3 =
0.80188688385734,
  ic1 = 2.25406162804465,ic2 = 1.68235691305909,ic3 =
2.13468107737406,
  cc1 = -8.564358,cc2 = 10.7195144315809,cc3 = 0,
  alstar = -2.59819924393425,beta1 = 0.0937403319000222),
  method=BFGS,control=list(maxit=1000))
summary(maxlk)


The question now is, if anybody knows a way to make a panel data analysis with
'mle2' or alternatively, how to enter a system of equations instead of just a
single formula in 'plm'.

Thanks in advance,
Erich

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

2008-09-19 Thread Thomas Sattler
Dear list

I try to run a bootstrap with lmer.

I often, but not always, get the error message:

Error in objective(.par, ...) :
   Leading minor of order 6 in downdated X'X is not positive definite

(with the number (here 6) varying)


In R-archives I came across some threads that treated this problem, 
nevertheless they refer to lmer when using it with family = binomial, so 
the solutions that were offered did not solve my problem 
(family=quasipoisson) (e.g. adding 
control=list(usePQL=FALSE,msVerbose=TRUE) does not make sense nor changes 
anything - error remains).

A sample data (d.rba) set is pasted at the end.

attach (d.rba)
y - d.rba$ms
cut2 - d.rba$cut^2

boot - 10
index - seq(1, length(y), 1)
cut.pred - seq(0,20,2)
cut2.pred-cut.pred^2
pred - matrix(data = NA, nrow=boot, ncol=length(cut.pred))


for (j in 1 : boot){

id - sample(index, replace=T)

y.boot - y[id]
age_insects.boot - age_insects[id]
cut.boot - cut[id]
cut2.boot - cut2[id]
rV.rGb.boot - rV.rGb[id]
ECON_MN.boot - ECON_MN[id]
SHDI.boot - SHDI[id]
city.boot - city[id]

lmer.5 -lmer(y.boot ~ cut.boot + cut2.boot + rV.rGb.boot + 
age_insects.boot +  ECON_MN.boot + SHDI.boot + 
(1|city.boot),family=quasipoisson)


for (i in 1:length(cut.pred)){
 pred[j,i] - exp ([EMAIL PROTECTED] + [EMAIL PROTECTED] + 
[EMAIL PROTECTED] + [EMAIL PROTECTED] 
mean(rV.rGb)[EMAIL PROTECTED](age_insects) + 
[EMAIL PROTECTED](ECON_MN) + [EMAIL PROTECTED](SHDI))
 }
}



 sessionInfo()
R version 2.6.0 (2007-10-03)
i386-pc-mingw32

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

other attached packages:
[1] lme4_0.99875-9Matrix_0.999375-4 lattice_0.16-5

loaded via a namespace (and not attached):
[1] grid_2.6.0  nlme_3.1-85


I found two hypothesis that could be the source of the problem but I cannot 
figure out how to test them nor how to solve them.
1) it's a loop-matrix interaction (=batch-) problem. Even though I 
sometimes do get the error message when I run it individually. Nevertheless 
this was suggested as the potential error in one response but no solution 
was offered (http://tolstoy.newcastle.edu.au/R/e2/help/06/10/2918.html)
2) the selected samples out of my data set (id) to run the predictions 
create the problem (maybe if some x values = 0?)

Thanks a lot for your time! I very much appreciate the help.

Thomas



Here a chunk of the data:

(n = 30, ntotal = 96)

location ms cut age_insects city rV.rGb ECON_MN SHDI
101 328 3 6 ZH 78.46 32.13 0.926
102 211 8 2 ZH 77.60 7.54 0.614
103 306 1 3 ZH 60.23 20.57 0.831
104 195 3 1 ZH 67.48 18.33 0.872
105 232 11 49 ZH 58.90 8.67 0.682
106 291 2 20 ZH 2.49 70.45 0.637
107 297 9 44 ZH 22.85 5.73 0.522
108 281 11 55 ZH 47.71 7.83 0.533
109 278 5 54 ZH 48.10 23.81 0.657
110 309 12 36 ZH 23.57 42.95 0.346
201 256 12 34 LU 42.03 8.61 0.528
202 240 8 10 LU 58.88 8.50 0.680
203 274 3 3 LU 62.23 47.09 1.070
204 305 7 46 LU 55.33 21.95 0.722
205 269 9 86 LU 7.72 29.87 0.896
206 367 9 49 LU 42.13 33.77 0.932
207 249 10 12 LU 39.22 13.36 0.964
208 336 2 21 LU 15.03 55.44 0.814
209 190 6 4 LU 70.16 12.00 0.744
210 302 6 71 LU 78.45 7.27 0.645
301 258 6 31 LG 73.64 7.80 0.669
302 257 11 36 LG 69.70 20.90 0.716
303 323 12 20 LG 56.42 19.70 0.522
304 213 20 13 LG 47.55 18.00 0.908
305 261 12 14 LG 61.13 8.18 0.511
306 169 12 1 LG 47.90 31.28 0.761
307 242 9 30 LG 42.68 7.47 0.417
308 222 12 16 LG 31.73 16.14 0.742
309 255 5 36 LG 80.45 7.48 0.666
310 320 2 71 LG 64.24 31.96 0.676


___

Thomas Sattler

Swiss Federal Research Institute WSL
Bellinzona, Birmensdorf

 Conservation Biology
Institute of Ecology and Evolution (IEE), University of Bern

http://www.wsl.ch/personal_homepages/sattlerhttp://www.wsl.ch/personal_homepages/sattler
  
[[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] Still no R-2.7.2 rpms for Redhat Enterprise Linux

2008-09-19 Thread Martyn Plummer
We'll see what we can do.  I have forwarded your email to Bob Kinney,
who builds the RHEL RPMS.

Martyn

On Thu, 2008-09-18 at 14:57 -0700, Waichler, Scott R wrote:
 There's already an announcement about R 2.8.0, and yet there are still
 no R-2.7.2 binaries (rpms) for Redhat Enterprise Linux 4 and 5.  Can the
 usual responsible party get on it?  Can the system be improved to get
 more timely builds out on CRAN?
 
 Thanks,
 Scott Waichler
 Pacific Northwest National Laboratory

---
This message and its attachments are strictly confidenti...{{dropped:8}}

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

2008-09-19 Thread Ralikwen

Hi,
I went for a slight alteration of your solution

x1-c(1,2,3,4,NA ,NA ,NA, 3, 1, 1, 1, 1, 2, 2, 3, 4, 4)
x2-c(2,3,4,3,4,3,4,2,2,3,4,NA,NA,NA,NA,4,3)
x3-c(1,1,1,1,aaa,2,2,2,3,3,3,3,4,4,4,1,2)
m-data.frame(x1,x2,x3)
m-replace(m,is.na(m),NA)
levels=unique(as.vector(as.matrix(m)))
mapply(function(x) table(factor(levels)), m)

Many thanks for the help of both of you.
Balázs




Ivar Herfindal wrote:
 
 
   mapply(function(x) table(factor(ifelse(is.na(x), NA, x), 
 levels=c(NA,1,2,3,4))), m)
 
 

-- 
View this message in context: 
http://www.nabble.com/frequency-table-across-multiple-variables-tp19567838p19569510.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] migrating data from s-plus to R

2008-09-19 Thread Patrizio Frederic
Dear all,
is there any way to transform a .Data directory created in S-plus 6.1
for windows in a .RData file?
Thanks in advance,

Patrizio Frederic

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

2008-09-19 Thread Kenn Konstabel
or ...
sapply(m,function(x) table(factor(x, levels=c(NA, 1:4), exclude=NULL)))


On Fri, Sep 19, 2008 at 12:59 PM, Ralikwen [EMAIL PROTECTED] wrote:


 Hi,
 I went for a slight alteration of your solution

 x1-c(1,2,3,4,NA ,NA ,NA, 3, 1, 1, 1, 1, 2, 2, 3, 4, 4)
 x2-c(2,3,4,3,4,3,4,2,2,3,4,NA,NA,NA,NA,4,3)
 x3-c(1,1,1,1,aaa,2,2,2,3,3,3,3,4,4,4,1,2)
 m-data.frame(x1,x2,x3)
 m-replace(m,is.na(m),NA)
 levels=unique(as.vector(as.matrix(m)))
 mapply(function(x) table(factor(levels)), m)

 Many thanks for the help of both of you.
 Balázs




 Ivar Herfindal wrote:
 
 
mapply(function(x) table(factor(ifelse(is.na(x), NA, x),
  levels=c(NA,1,2,3,4))), m)
 
 

 --
 View this message in context:
 http://www.nabble.com/frequency-table-across-multiple-variables-tp19567838p19569510.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] R on a eeepc 901 ?

2008-09-19 Thread Agustin Lobo

The one with Linux (Xandros)

As an alternative in case I don't get through
with the R installation(s) in Xandros,
I've installed ubuntu-eee on a usb memory stick
for booting from it and plan to go on with a regular ubuntu
R installation, but have not decided yet whether
I'll be erasing the Xandros OS in the internal SSD.
So I'd appreciate help to install
and test R on Xandros to compare.

Thanks

Agus


Agustin,

which EEE PC 901 is it? The one for Windoze or Linux (Xandros)?

el

on 9/16/08 6:50 PM Agustin Lobo said the following:

Hi!

it seems that the directions in
http://wiki.r-project.org/rwiki/doku.php?id=getting-started:installation:eeepc


refer to installing R on a eeepc 701 and actually
fail for a 901 at the first step.

Does anyone have any experience on installing R on a eeepc 901?

Thanks





--
Dr. Agustin Lobo
Institut de Ciencies de la Terra Jaume Almera (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: [EMAIL PROTECTED]
http://www.ija.csic.es/gt/obster

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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: Adding 1 month to a dataframe column

2008-09-19 Thread ANGELO.LINARDI
It works great!
Thank you so much Gabor

Angelo Linardi

-Messaggio originale-
Da: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 
Inviato: giovedì 18 settembre 2008 21.16
A: LINARDI ANGELO
Cc: r-help@r-project.org
Oggetto: Re: [R] Adding 1 month to a dataframe column

Try this:

  # example data - Jan 31/00, Feb 29/00, Mar 31/00, ..., Dec 31/00
  d - seq(as.Date(2000-02-01), by = month, length = 12) - 1
  d

  # find beginning of next month
  nextmon  - function(d) as.Date(cut(as.Date(cut(d, month)) + 32, month))

  # add number of days from start of current month to next month
  nextmon(d) + as.POSIXlt(d)$mday - 1

  # If all your dates are at month end and  you want the plus 1 month
  # to be at month end too then replace last line with:

  nextmon(nextmon(d)) - 1

The last one can be done even more easily with as.yearmon from zoo.
It converts the dates to a year plus 0 for jan, 1/12 for feb, etc. Also,
as.Date.yearmon(..., frac = 1) converts back from yearmon class to
Date class using end of month for the result so:

  library(zoo)
  as.Date(as.yearmon(d) + 1/12, frac = 1)


On Thu, Sep 18, 2008 at 12:24 PM,  [EMAIL PROTECTED] wrote:
 Dear R experts,
 I have a problem in modifying one column of a dataframe with a datatime
 format using a datetime operator.
 Here is my dataframe A:

 DATACONT PROVINCIA VALORE
 1  2007-12-31MI  1
 2  2007-12-31PV  2
 3  2007-12-31NA  3
 4  2007-12-31MI  4
 5  2007-12-31RM  5
 6  2007-12-31RM  6
 7  2007-12-31MI  7
 8  2008-12-31MI 11
 9  2008-12-31PV 12
 10 2008-12-31NA 13
 11 2008-12-31MI 14
 12 2008-12-31RM 15
 13 2008-12-31RM 16
 14 2008-12-31MI 17
 15 2006-12-31MI -9
 16 2006-12-31PV -8
 17 2006-12-31NA -7
 18 2006-12-31MI -6
 19 2006-12-31RM -5
 20 2006-12-31RM -4
 21 2006-12-31MI -3

 Suppose I want to shift all dates by 1 year, obtaining the following
 dataframe B:

 DATACONT PROVINCIA VALORE
 1  2008-12-31MI  1
 2  2008-12-31PV  2
 3  2008-12-31NA  3
 4  2008-12-31MI  4
 5  2008-12-31RM  5
 6  2008-12-31RM  6
 7  2008-12-31MI  7
 8  2009-12-31MI 11
 9  2009-12-31PV 12
 10 2009-12-31NA 13
 11 2009-12-31MI 14
 12 2009-12-31RM 15
 13 2009-12-31RM 16
 14 2009-12-31MI 17
 15 2007-12-31MI -9
 16 2007-12-31PV -8
 17 2007-12-31NA -7
 18 2007-12-31MI -6
 19 2007-12-31RM -5
 20 2007-12-31RM -4
 21 2007-12-31MI -3

 I tried with seq.Date:
 seq.Date(a$DATA,by=1 month,len=2)[2]

 but it works only for single values (the from must have length=1).
 Any hints ?
 Thank you in advance

 Angelo Linardi

 ** Le e-mail provenienti dalla Banca d'Italia sono trasmesse in buona fede e 
 non
 comportano alcun vincolo ne' creano obblighi per la Banca stessa, salvo che 
 cio' non
 sia espressamente previsto da un accordo scritto.
 Questa e-mail e' confidenziale. Qualora l'avesse ricevuta per errore, La 
 preghiamo di
 comunicarne via e-mail la ricezione al mittente e di distruggerne il 
 contenuto. La
 informiamo inoltre che l'utilizzo non autorizzato del messaggio o dei suoi 
 allegati
 potrebbe costituire reato. Grazie per la collaborazione.
 -- E-mails from the Bank of Italy are sent in good faith but they are neither 
 binding on
 the Bank nor to be understood as creating any obligation on its part except 
 where
 provided for in a written agreement. This e-mail is confidential. If you have 
 received it
 by mistake, please inform the sender by reply e-mail and delete it from your 
 system.
 Please also note that the unauthorized disclosure or use of the message or any
 attachments could be an offence. Thank you for your cooperation. **

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


** Le e-mail provenienti dalla Banca d'Italia sono trasmesse in buona fede e 
non 
comportano alcun vincolo ne' creano obblighi per la Banca stessa, salvo che 
cio' non 
sia espressamente previsto da un accordo scritto.
Questa e-mail e' confidenziale. Qualora l'avesse ricevuta per errore, La 
preghiamo di 
comunicarne via e-mail la ricezione al mittente e di distruggerne il contenuto. 
La 
informiamo inoltre che l'utilizzo non autorizzato del messaggio o dei suoi 
allegati 
potrebbe costituire reato. Grazie per la collaborazione.
-- E-mails from the Bank of Italy are sent in good faith but they are neither 
binding on 
the Bank nor to be understood as creating any obligation 

[R] spatstat - tabulate point pattern

2008-09-19 Thread Paulo Cardoso
Hi,

Is it possible to tabulate (count) points generated by spatstat ppp() using
any regular Grid created with owin()?
The idea is to count No of points in each grid cell.
Any other method available?

Paulo

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] migrating data from s-plus to R

2008-09-19 Thread John Kane
You might find something about this in the R manual  R Data Import/Export


--- On Fri, 9/19/08, Patrizio Frederic [EMAIL PROTECTED] wrote:

 From: Patrizio Frederic [EMAIL PROTECTED]
 Subject: [R] migrating data from s-plus to R
 To: r-help@r-project.org r-help@r-project.org
 Received: Friday, September 19, 2008, 7:33 AM
 Dear all,
 is there any way to transform a .Data directory created in
 S-plus 6.1
 for windows in a .RData file?
 Thanks in advance,
 
 Patrizio Frederic
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained,
 reproducible code.


  __
[[elided Yahoo spam]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 show complete time values in a plot x axis

2008-09-19 Thread Sébastien Durand

Dear Yihui,

The resulting plot produced by dotchart is not what I wish for!
I need to produce a time axis that is consequent to the time values.
When dotchart is used, time values are simply considered as labels.
What I wish for is a way to produce a numerical time axis that really 
takes into account the given time values. With plot I have been able to 
do so, the only issue is the labelling.

I wish to represent the complete time on the axis ticks...

Cheers

Sébastien Durand
CIDCO

Yihui Xie a écrit :

Hi, I'd suggest you use dotchart() instead of plot(). I believe this
is what you expected:

dotchart(value, time)

Regards,
Yihui
--
Yihui Xie [EMAIL PROTECTED]
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China



On Fri, Sep 19, 2008 at 3:10 AM, Sébastien Durand
[EMAIL PROTECTED] wrote:
  

Hello,

I have the following data and I try to properly
import it in R and plot the 4th column relative to time

  1   2008-249 17:44:17.973-2.27  : Accepted
  2   2008-249 17:44:18.014-2.28  : Accepted
  3   2008-249 17:44:18.064-2.29  : Accepted
  4   2008-249 17:44:18.123-2.29  : Accepted
  5   2008-249 17:44:18.174-2.29  : Accepted
  6   2008-249 17:44:18.225-2.29  : Accepted
  7   2008-249 17:44:18.274-2.28  : Accepted
  8   2008-249 17:44:18.325-2.28  : Accepted
  9   2008-249 17:44:18.375-2.28  : Accepted
 10   2008-249 17:44:18.424-2.27  : Accepted
 11   2008-249 17:44:18.475-2.26  : Accepted
 12   2008-249 17:44:18.514-2.24  : Accepted
 13   2008-249 17:44:18.565-2.23  : Accepted
 14   2008-249 17:44:18.615-2.20  : Accepted
 15   2008-249 17:44:18.674-2.17  : Accepted
 16   2008-249 17:44:18.725-2.15  : Accepted
 17   2008-249 17:44:18.774-2.12  : Accepted
 18   2008-249 17:44:18.825-2.09  : Accepted
 19   2008-249 17:44:18.875-2.06  : Accepted
 20   2008-249 17:44:18.925-2.03  : Accepted
 21   2008-249 17:44:18.975-2.00  : Accepted
 22   2008-249 17:44:19.026-1.97  : Accepted
 23   2008-249 17:44:19.055-1.95  : Accepted

#I copy the previous data then in R dat=readLines(clipboard)
options(digits.secs=6)
tmp=unlist(lapply(dat,function(x){unlist(strsplit(x,\\
+,perl=TRUE))[3:5]}))
tmp=matrix(tmp,ncol=3,byrow=TRUE)
tmp=cbind(paste(tmp[,1],tmp[,2]),tmp[,3])
time=strptime(tmp[,1], format=%Y-%j %H:%M:%OS)
value=as.numeric(tmp[,2])
plot(time,value)
#How can I show in the x axis the complete time values including the
decimals.

Thanks a lot

N.B.: I am running the lastest version of R and using it under Windows XP

S.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] How to show complete time values in a plot x axis

2008-09-19 Thread Duncan Murdoch

On 9/19/2008 9:14 AM, Sébastien Durand wrote:

Dear Yihui,

The resulting plot produced by dotchart is not what I wish for!
I need to produce a time axis that is consequent to the time values.
When dotchart is used, time values are simply considered as labels.
What I wish for is a way to produce a numerical time axis that really 
takes into account the given time values. With plot I have been able to 
do so, the only issue is the labelling.

I wish to represent the complete time on the axis ticks...


Ask plot not to produce an axis, then construct the labels yourself and 
add them.  The axis.POSIXct() function will be helpful in this.


Duncan Murdoch



Cheers

Sébastien Durand
CIDCO

Yihui Xie a écrit :

Hi, I'd suggest you use dotchart() instead of plot(). I believe this
is what you expected:

dotchart(value, time)

Regards,
Yihui
--
Yihui Xie [EMAIL PROTECTED]
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China



On Fri, Sep 19, 2008 at 3:10 AM, Sébastien Durand
[EMAIL PROTECTED] wrote:
  

Hello,

I have the following data and I try to properly
import it in R and plot the 4th column relative to time

  1   2008-249 17:44:17.973-2.27  : Accepted
  2   2008-249 17:44:18.014-2.28  : Accepted
  3   2008-249 17:44:18.064-2.29  : Accepted
  4   2008-249 17:44:18.123-2.29  : Accepted
  5   2008-249 17:44:18.174-2.29  : Accepted
  6   2008-249 17:44:18.225-2.29  : Accepted
  7   2008-249 17:44:18.274-2.28  : Accepted
  8   2008-249 17:44:18.325-2.28  : Accepted
  9   2008-249 17:44:18.375-2.28  : Accepted
 10   2008-249 17:44:18.424-2.27  : Accepted
 11   2008-249 17:44:18.475-2.26  : Accepted
 12   2008-249 17:44:18.514-2.24  : Accepted
 13   2008-249 17:44:18.565-2.23  : Accepted
 14   2008-249 17:44:18.615-2.20  : Accepted
 15   2008-249 17:44:18.674-2.17  : Accepted
 16   2008-249 17:44:18.725-2.15  : Accepted
 17   2008-249 17:44:18.774-2.12  : Accepted
 18   2008-249 17:44:18.825-2.09  : Accepted
 19   2008-249 17:44:18.875-2.06  : Accepted
 20   2008-249 17:44:18.925-2.03  : Accepted
 21   2008-249 17:44:18.975-2.00  : Accepted
 22   2008-249 17:44:19.026-1.97  : Accepted
 23   2008-249 17:44:19.055-1.95  : Accepted

#I copy the previous data then in R dat=readLines(clipboard)
options(digits.secs=6)
tmp=unlist(lapply(dat,function(x){unlist(strsplit(x,\\
+,perl=TRUE))[3:5]}))
tmp=matrix(tmp,ncol=3,byrow=TRUE)
tmp=cbind(paste(tmp[,1],tmp[,2]),tmp[,3])
time=strptime(tmp[,1], format=%Y-%j %H:%M:%OS)
value=as.numeric(tmp[,2])
plot(time,value)
#How can I show in the x axis the complete time values including the
decimals.

Thanks a lot

N.B.: I am running the lastest version of R and using it under Windows XP

S.

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







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


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


[R] intToUtf8

2008-09-19 Thread Christian Hennig

Hi there,

any explanation for this?


intToUtf8(66)

Error in intToUtf8(66) : argument 'x' must be an integer vector

intToUtf8(c(66,55))

Error in intToUtf8(c(66, 55)) : argument 'x' must be an integer vector

intToUtf8(c(66,55),multiple=TRUE)

Error in intToUtf8(c(66, 55)) : argument 'x' must be an integer vector

Errr... 66 and c(66,55) are as integer vectorish as anything can be, aren't 
they?



version

   _
platform   i686-pc-linux-gnu
arch   i686
os linux-gnu
system i686, linux-gnu
status
major  2
minor  6.0
year   2007
month  10
day03
svn rev43063
language   R
version.string R version 2.6.0 (2007-10-03)

Thanks,
Christian

*** --- ***
Christian Hennig
University College London, Department of Statistical Science
Gower St., London WC1E 6BT, phone +44 207 679 1698
[EMAIL PROTECTED], www.homepages.ucl.ac.uk/~ucakche

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

2008-09-19 Thread Steve Murray

Jim,

Thanks for this - I've looked into cluster.overplot in particular which, 
judging by the help file, sounds quite useful (count.overplot seems less 
relevant).

I'm finding however, that when I execute cluster.overplot, it simply returns 
many values (which total the number in the dataset I'm using, 54041), but 
doesn't produce, or alter my graph! Is this to be expected? If so, what do the 
ouput values represent? Because not *all* of the values overplot, so I'm 
confused as to why the number of cluster.overplot output values equals the 
number of values in my dataset!

Thanks,

Steve




 Date: Fri, 19 Sep 2008 21:57:03 +1000
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Re: [R] Use of colour in plots

 Steve Murray wrote:
 Greg,

[[elided Hotmail spam]]

 One (hopefully final!) question I have is, is there any way of preventing 
 overplotting? I'm finding that many of the red points are being obscured by 
 the greens - I've tried making the point sizes small (cex=0.1) but this 
 doesn't fully solve the problem.

 Or even, is there a way of changing the order of which the points are 
 plotted?

 Hi again,
 Maybe cluster.overplot or count.overplot 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.


[R] getting line breaks with xtable

2008-09-19 Thread Erich Studerus
Sorry, for asking the same question again, but I got no reactions the last
time. Maybe it was just overseen by the experts.
I'm using the xtable function with Sweave and Lyx and I would like to know
how to get automatic line breaks for long strings in a column of the table.
I've learned from the Lyx wiki that the Latex command \linebreak produces
table cells with multiple lines. I tried to insert \linebreak into the
character string, but it didn't work out, because Sweave transforms it
automatically to $\backslash$linebreak. 

Any help is highly appreciated.

Erich

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

2008-09-19 Thread Steve Murray

Thierry,

Thanks - I've had a look into using the transparency option, but can't seem to 
work out where to place it within the command I'm using:

 ggplot(Jan, aes(x = PopDensity, y = Average.Burnt.Area.Fraction, colour = 
 factor(Urban.Rural 1.25))) + geom_point()

I'm assuming that it has to go in the 'aes' section somewhere, but I seem to be 
encountering errors wherever I insert it. This doesn't seem to be mentioned in 
the book, so do you have any tips?!

Also, out of interest, what does the 'geom_point()' command do?

Thanks again,

Steve



 Subject: RE: [R] Use of colour in plots
 Date: Fri, 19 Sep 2008 10:31:58 +0200
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; r-help@r-project.org

 Steve,

 - Use tranparancy to prevent overplotting: more details on p. 16 of the
 ggplot2 book: http://had.co.nz/ggplot2/book/
 - You can choose your own colour with scale_manual():
 http://had.co.nz/ggplot2/scale_manual.html
 - The backgroundcolor can be set with ggopt(background.color = white):
 http://rweb.stat.umn.edu/R/library/ggplot/html/build-options-8a.html

 HTH,

 Thierry


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

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

 The plural of anecdote is not data.
 ~ Roger Brinner

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

 -Oorspronkelijk bericht-
 Van: Steve Murray [mailto:[EMAIL PROTECTED]
 Verzonden: donderdag 18 september 2008 19:08
 Aan: r-help@r-project.org; ONKELINX, Thierry; [EMAIL PROTECTED];
 [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Onderwerp: RE: [R] Use of colour in plots


 Dear Thierry and all,

 I've tried out ggplot from the ggplot2 package and it seems to provide
 much more favourable results!

 Just a few questions I have after consulting the 'help' file for ggplot.

 Is there a way of preventing overplotting? Some of the red points are
 being obscured by the green ones. I've tried changing the size of the
 points (using size=1) but this doesn't resolve the issue, as there are
 many points quite densely packed in some parts of the graph.

 Also how would I change the colours if I wished (for future plots of a
 similar format)? And how do you customise the legend?

 Finally, is there a way of changing the grey background of the graph to
 white?

 Sorry for all the questions, it's just that I'm new to the ggplot2
 package and can't find the answers in the help file or on the associated
 website!

 Many thanks to anyone who's able to offer any advice.

 Best wishes,

 Steve



 Subject: RE: [R] Use of colour in plots
 Date: Thu, 18 Sep 2008 14:52:57 +0200
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
 CC: r-help@r-project.org

 Steve,

 Have a look at the ggplot2 package:

 library(ggplot2)
 ggplot(Jan, aes(x = PopDensity, y = Average.Burnt.Area.Fraction,
 colour
 = factor(Urban.Rural 1.25))) + geom_point()



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

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

 The plural of anecdote is not data.
 ~ Roger Brinner

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

 -Oorspronkelijk bericht-
 Van: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]
 Namens Steve Murray
 Verzonden: donderdag 18 september 2008 13:58
 Aan: Petr PIKAL; [EMAIL PROTECTED]
 CC: r-help@r-project.org
 Onderwerp: Re: [R] Use of colour in plots


 Dear all,

 I've finally got round to plotting my data and trying to apply colour
 (had some problems with the data which I needed to rectify first!).
 I'm
 having trouble however getting the colour to work as I'd hoped,
 despite
 the help offered in previous messages.

 Just to recap, and with more specifics this time, I have a data frame
 as
 follows:


 head(Jan)
 Latitude Longitude Urban.Rural 

[R] Plot availability

2008-09-19 Thread john crepezzi

Is it possible to see if a plot is already open before I call lines()?
-- 
View this message in context: 
http://www.nabble.com/Plot-availability-tp19572437p19572437.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] misalignement of secondary axis in multhist

2008-09-19 Thread Angel Marley
Hi everybody,
I'm trying a multiple histogram, and I'd like to add on it a secondary axis 
with a line (cumulative frequencies, or wathever lines), and the 0 intercept 
doesnt coincide in y1 and y2, which dificult interpretation and makes 
presentation not nice. I had seen some related answer for boxplot, but I could 
not understand the code. Is there any general solution?
Thanks in advance
Angel
   
#example ploting a line in a multhist
a - rnorm(100)
b- rnorm(100)
x- list(a,b)

require(plotrix)
multhist(x)
par(new = TRUE)
plot(-2:2, 0:4, xaxt = n, yaxt = n, xlab=, ylab=,type =l)#see 
#difference in 0 in y1 and y2
axis(4)

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

2008-09-19 Thread Jason Thibodeau
On a related note, I am trying to do some matching using conditional
statements. These NULL values are being brought in to my data frame as NA,
as expected, but in a conditional if() statement, I cannot compare then to a
integer value, it fails the program. Here is a small snippet of where the
error occurs.

 while(col_loop1570)
{
data_filter - data[c(col_loop)]
print(data_filter)
if(data_filter == trigger)
{
trigger_count - trigger_count +1
}
col_loop - col_loop +1

}

Here: trigger_count, and trigger are both integers. The print statement was
debug to see why it was failing and this is what it returned:
snip
  V1415
1 0
  V1416
1 0
  V1417
1 1
  V1418
1 1
  V1419
1 1
  V1420
1NA
Error in if (data_filter == trigger) { :
  missing value where TRUE/FALSE needed

Thanks for any help you can provide.

On Thu, Sep 18, 2008 at 2:12 PM, Hutchinson,David [PYR] 
[EMAIL PROTECTED] wrote:

 Try length(na.omit(the particular data column))

 Here's an example:

 data - runif(100,0,10)
 data[runif(20,0,100)] - NA
 file.contents - matrix(data, ncol = 5, byrow = TRUE)
 for (i in 1:5) {
  print (length(na.omit(file.contents[,i])))
 }


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 On Behalf Of Jason Thibodeau
 Sent: Thursday, September 18, 2008 10:12 AM
 To: r-help@r-project.org
 Subject: [R] detecting null values in a CSV file

 Hello all,

 I have a CSV file, that is 2411 columns wide. There are certain
 instances in
 teh file, where null values are located. That is: two commas together,
 without anything in the middle. In a certain section, the only possible
 values are NULL, 0,1,and 2. I need to be able to detect these NULL's and
 be
 able to have them counted. For example, in a frequency table. How can I
 accomplish this?

 Thanks in advance for the help.

 --
 Jason Thibodeau

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




-- 
Jason Thibodeau

[[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] getting line breaks with xtable

2008-09-19 Thread Gabor Grothendieck
Read the last line to every message to r-help to find out
one reason you may be getting no responses.

On Fri, Sep 19, 2008 at 9:39 AM, Erich Studerus
[EMAIL PROTECTED] wrote:
 Sorry, for asking the same question again, but I got no reactions the last
 time. Maybe it was just overseen by the experts.
 I'm using the xtable function with Sweave and Lyx and I would like to know
 how to get automatic line breaks for long strings in a column of the table.
 I've learned from the Lyx wiki that the Latex command \linebreak produces
 table cells with multiple lines. I tried to insert \linebreak into the
 character string, but it didn't work out, because Sweave transforms it
 automatically to $\backslash$linebreak.

 Any help is highly appreciated.

 Erich

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

2008-09-19 Thread Duncan Murdoch

On 9/19/2008 9:32 AM, Christian Hennig wrote:

Hi there,

any explanation for this?


intToUtf8(66)

Error in intToUtf8(66) : argument 'x' must be an integer vector

intToUtf8(c(66,55))

Error in intToUtf8(c(66, 55)) : argument 'x' must be an integer vector

intToUtf8(c(66,55),multiple=TRUE)

Error in intToUtf8(c(66, 55)) : argument 'x' must be an integer vector

Errr... 66 and c(66,55) are as integer vectorish as anything can be, aren't 
they?


No, they're numeric.  integer here is a type, not the mathematical 
thing.  This works:


intToUtf8(as.integer(c(66,55)))

The docs don't mention this requirement, and it does seem somewhat 
unnecessary; I'll look into it.






version

_
platform   i686-pc-linux-gnu
arch   i686
os linux-gnu
system i686, linux-gnu
status
major  2
minor  6.0
year   2007
month  10
day03
svn rev43063
language   R
version.string R version 2.6.0 (2007-10-03)


You're lucky I didn't read to the end of your message:  that's a pretty 
old version.  Please test on current versions before reporting problems.


Duncan Murdoch

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


Re: [R] intToUtf8

2008-09-19 Thread Christian Hennig

Dear Duncan,

No, they're numeric.  integer here is a type, not the mathematical thing. 
This works:


intToUtf8(as.integer(c(66,55)))

The docs don't mention this requirement, and it does seem somewhat 
unnecessary; I'll look into it.


Thanks!

You're lucky I didn't read to the end of your message:  that's a pretty old 
version.  Please test on current versions before reporting problems.


Sorry but people won't always install the most recent version when running 
into smallish problems like this. Particularly not when they're working on 
machines where they are not superuser. We have other things to do than 
updating every two months. I may be egoist here but I think 
the list has to live with requests concerning old versions. (I use version so 
that people can tell me has been fixed in the meantime if this is the 
case.)
If you personally don't respond to them, that's your choice of course. But 
it doesn't work as a policy.


Regards,
Christian

*** --- ***
Christian Hennig
University College London, Department of Statistical Science
Gower St., London WC1E 6BT, phone +44 207 679 1698
[EMAIL PROTECTED], www.homepages.ucl.ac.uk/~ucakche

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

2008-09-19 Thread Steve Murray

Sorry - I should've maybe also pointed out that the command I've been trying to 
use is: alpha(col=green, 1/10)

On its own this results in the following error: [1] #00FF001A  and I haven't 
been able to successfully incorporate it into the main formula just yet (please 
see my previous message).

Without wanting to get too far ahead of myself, is there also a way of making 
the red points transparent too? (within this command - I've tried using '' but 
this results in an error).

Many thanks again for any advice you can offer,

Steve



 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; r-help@r-project.org
 Subject: RE: [R] Use of colour in plots
 Date: Fri, 19 Sep 2008 13:45:43 +


 Thierry,

 Thanks - I've had a look into using the transparency option, but can't seem 
 to work out where to place it within the command I'm using:

 ggplot(Jan, aes(x = PopDensity, y = Average.Burnt.Area.Fraction, colour = 
 factor(Urban.Rural 1.25))) + geom_point()

 I'm assuming that it has to go in the 'aes' section somewhere, but I seem to 
 be encountering errors wherever I insert it. This doesn't seem to be 
 mentioned in the book, so do you have any tips?!

 Also, out of interest, what does the 'geom_point()' command do?

 Thanks again,

 Steve



 Subject: RE: [R] Use of colour in plots
 Date: Fri, 19 Sep 2008 10:31:58 +0200
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; r-help@r-project.org

 Steve,

 - Use tranparancy to prevent overplotting: more details on p. 16 of the
 ggplot2 book: http://had.co.nz/ggplot2/book/
 - You can choose your own colour with scale_manual():
 http://had.co.nz/ggplot2/scale_manual.html
 - The backgroundcolor can be set with ggopt(background.color = white):
 http://rweb.stat.umn.edu/R/library/ggplot/html/build-options-8a.html

 HTH,

 Thierry


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

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

 The plural of anecdote is not data.
 ~ Roger Brinner

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

 -Oorspronkelijk bericht-
 Van: Steve Murray [mailto:[EMAIL PROTECTED]
 Verzonden: donderdag 18 september 2008 19:08
 Aan: r-help@r-project.org; ONKELINX, Thierry; [EMAIL PROTECTED];
 [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Onderwerp: RE: [R] Use of colour in plots


 Dear Thierry and all,

 I've tried out ggplot from the ggplot2 package and it seems to provide
 much more favourable results!

 Just a few questions I have after consulting the 'help' file for ggplot.

 Is there a way of preventing overplotting? Some of the red points are
 being obscured by the green ones. I've tried changing the size of the
 points (using size=1) but this doesn't resolve the issue, as there are
 many points quite densely packed in some parts of the graph.

 Also how would I change the colours if I wished (for future plots of a
 similar format)? And how do you customise the legend?

 Finally, is there a way of changing the grey background of the graph to
 white?

 Sorry for all the questions, it's just that I'm new to the ggplot2
 package and can't find the answers in the help file or on the associated
 website!

 Many thanks to anyone who's able to offer any advice.

 Best wishes,

 Steve



 Subject: RE: [R] Use of colour in plots
 Date: Thu, 18 Sep 2008 14:52:57 +0200
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
 CC: r-help@r-project.org

 Steve,

 Have a look at the ggplot2 package:

 library(ggplot2)
 ggplot(Jan, aes(x = PopDensity, y = Average.Burnt.Area.Fraction,
 colour
 = factor(Urban.Rural 1.25))) + geom_point()



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

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

 The plural of anecdote is not data.
 ~ Roger Brinner

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

Re: [R] Plot availability

2008-09-19 Thread Duncan Murdoch

On 9/19/2008 9:32 AM, john crepezzi wrote:

Is it possible to see if a plot is already open before I call lines()?


I don't think so.  You can see if a graphics device is open by looking 
at dev.cur(), but I don't think there's a test for plot.new().  I'd just 
wrap the call in try() if you're not sure it will work.


Duncan Murdoch

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


Re: [R] getting line breaks with xtable

2008-09-19 Thread Erich Studerus
Ok. Sorry, here's a reproducible example:

library(xtable)
x-as.table(cbind(1:3,rep(this is an example for a long character string
that I want break into several lines)))
xtable(x)

Regards

Erich


-Ursprüngliche Nachricht-
Von: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 19. September 2008 15:50
An: Erich Studerus
Cc: r-help@r-project.org
Betreff: Re: [R] getting line breaks with xtable

Read the last line to every message to r-help to find out
one reason you may be getting no responses.

On Fri, Sep 19, 2008 at 9:39 AM, Erich Studerus
[EMAIL PROTECTED] wrote:
 Sorry, for asking the same question again, but I got no reactions the last
 time. Maybe it was just overseen by the experts.
 I'm using the xtable function with Sweave and Lyx and I would like to know
 how to get automatic line breaks for long strings in a column of the
table.
 I've learned from the Lyx wiki that the Latex command \linebreak produces
 table cells with multiple lines. I tried to insert \linebreak into the
 character string, but it didn't work out, because Sweave transforms it
 automatically to $\backslash$linebreak.

 Any help is highly appreciated.

 Erich

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

2008-09-19 Thread ONKELINX, Thierry
Steve,

You want something like this:

library(ggplot2)
n - 1000
dataset - data.frame(x = round(rnorm(n), 2), y = round(rnorm(n), 1), z
= rnorm(n))
ggplot(dataset, aes(x = x, y = y, colour = factor(z  1))) +
geom_point() + scale_colour_manual(values = c(alpha(red, 1/4),
green))

HTH,

Thierry 




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

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

The plural of anecdote is not data.
~ Roger Brinner

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

-Oorspronkelijk bericht-
Van: Steve Murray [mailto:[EMAIL PROTECTED] 
Verzonden: vrijdag 19 september 2008 16:01
Aan: ONKELINX, Thierry; r-help@r-project.org
Onderwerp: RE: [R] Use of colour in plots


Sorry - I should've maybe also pointed out that the command I've been
trying to use is: alpha(col=green, 1/10)

On its own this results in the following error: [1] #00FF001A  and I
haven't been able to successfully incorporate it into the main formula
just yet (please see my previous message).

Without wanting to get too far ahead of myself, is there also a way of
making the red points transparent too? (within this command - I've tried
using '' but this results in an error).

Many thanks again for any advice you can offer,

Steve



 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; r-help@r-project.org
 Subject: RE: [R] Use of colour in plots
 Date: Fri, 19 Sep 2008 13:45:43 +


 Thierry,

 Thanks - I've had a look into using the transparency option, but can't
seem to work out where to place it within the command I'm using:

 ggplot(Jan, aes(x = PopDensity, y = Average.Burnt.Area.Fraction,
colour = factor(Urban.Rural 1.25))) + geom_point()

 I'm assuming that it has to go in the 'aes' section somewhere, but I
seem to be encountering errors wherever I insert it. This doesn't seem
to be mentioned in the book, so do you have any tips?!

 Also, out of interest, what does the 'geom_point()' command do?

 Thanks again,

 Steve



 Subject: RE: [R] Use of colour in plots
 Date: Fri, 19 Sep 2008 10:31:58 +0200
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; r-help@r-project.org

 Steve,

 - Use tranparancy to prevent overplotting: more details on p. 16 of
the
 ggplot2 book: http://had.co.nz/ggplot2/book/
 - You can choose your own colour with scale_manual():
 http://had.co.nz/ggplot2/scale_manual.html
 - The backgroundcolor can be set with ggopt(background.color =
white):
 http://rweb.stat.umn.edu/R/library/ggplot/html/build-options-8a.html

 HTH,

 Thierry




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

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

 The plural of anecdote is not data.
 ~ Roger Brinner

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

 -Oorspronkelijk bericht-
 Van: Steve Murray [mailto:[EMAIL PROTECTED]
 Verzonden: donderdag 18 september 2008 19:08
 Aan: r-help@r-project.org; ONKELINX, Thierry; [EMAIL PROTECTED];
 [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Onderwerp: RE: [R] Use of colour in plots


 Dear Thierry and all,

 I've tried out ggplot from the ggplot2 package and it seems to
provide
 much more favourable results!

 Just a few questions I have after consulting the 'help' file for
ggplot.

 Is there a way of preventing overplotting? Some of the red points are
 being obscured by the green ones. I've tried changing the size of the
 points (using size=1) but this doesn't resolve the issue, as there
are
 many points quite densely packed in some parts of the graph.

 Also how would I change the colours if I wished (for future plots of
a
 similar format)? And how do you customise the legend?

 Finally, is there a way of changing the grey background of the graph
to
 white?

 Sorry for all the questions, it's just that I'm new to the ggplot2
 package and can't find the answers in the help 

Re: [R] intToUtf8

2008-09-19 Thread Duncan Murdoch

On 9/19/2008 9:58 AM, Christian Hennig wrote:

Dear Duncan,

No, they're numeric.  integer here is a type, not the mathematical thing. 
This works:


intToUtf8(as.integer(c(66,55)))

The docs don't mention this requirement, and it does seem somewhat 
unnecessary; I'll look into it.


Thanks!

You're lucky I didn't read to the end of your message:  that's a pretty old 
version.  Please test on current versions before reporting problems.


Sorry but people won't always install the most recent version when running 
into smallish problems like this. Particularly not when they're working on 
machines where they are not superuser. We have other things to do than 
updating every two months. I may be egoist here but I think 
the list has to live with requests concerning old versions. (I use version so 
that people can tell me has been fixed in the meantime if this is the 
case.)
If you personally don't respond to them, that's your choice of course. But 
it doesn't work as a policy.


It works for us.

Duncan Murdoch

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


Re: [R] How to do knn regression?

2008-09-19 Thread Shengqiao Li


 Date: Fri, 19 Sep 2008 07:00:33 + (UTC)

From: Hans W. Borchers [EMAIL PROTECTED]
Subject: Re: [R] How to do knn regression?
To: [EMAIL PROTECTED]
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=us-ascii

Shengqiao Li shli at stat.wvu.edu writes:


Hello,

I want to do regression or missing value imputation by knn. I searched
r-help mailing list. This question was asked in 2005. ksmooth and loess
were recommended. But my case is different. I have many predictors
(p20) and I really want try knn with a given k. ksmooth and loess use
band width to define neighborhood size. This contrasts to knn's 

variable

band width via fixing a k. Are there any such functions I can use in R
packages?



The R package 'knnFinder' provides a nearest neighbor search based on 
the approach through kd-tree data structures. Therefore, it is extremely 
fast even for very large data sets. It returns as many neighbors as you 
need  and can also be used, e.g., for determining distance-based 
outliers.




Thanks for your info. But it seems that there are problems to use 
knnFinder. knnFinder doesn't distinguish Test data and Train data. It 
searches in all data. New data with unknow Y's may appear in neighbors in 
the X space. The mask arg. seems not solving this problems. In addtion, I 
notice that there are several other possible problems with knnFinder:


(1) Ties are ignored.
(2) knnFinder is slower than class::knn when number of 
variables is relatively small, eg. 70. 
(3) Memory leakage.

(4) Maximum distance is small.
(5) One extra column is needed.

I rewrote knnFinder code to solve the last three problems for other 
purposes for which the self-match is not allowed. But self-math option is 
not a function parameter. It's a MACRO variable. So this option cannot be 
changed once the library is compiled. For regression, ties should be 
used. I have to compile two versions. This is not neat.


Any other convenient ways?



Hans Werner Borchers
ABB Corporate Research



Your help is highly appreciated.

Shengqiao Li

__
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 

http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.






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

2008-09-19 Thread Richard . Cotton
  The good thing about training and evangelization ...
I spent quite a lot of time evangelizing about R when I first started my 
current job.  Eventually my boss told me I was an R-Soul, or something 
that sounded like that anyway. ; )

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 show complete time values in a plot x axis

2008-09-19 Thread Yihui Xie
Sorry, I thought the time values were equal-spaced...

Regards,
Yihui
--
Yihui Xie [EMAIL PROTECTED]
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China



On Fri, Sep 19, 2008 at 3:10 AM, Sébastien Durand
[EMAIL PROTECTED] wrote:
 Hello,

 I have the following data and I try to properly
 import it in R and plot the 4th column relative to time

   1   2008-249 17:44:17.973-2.27  : Accepted
   2   2008-249 17:44:18.014-2.28  : Accepted
   3   2008-249 17:44:18.064-2.29  : Accepted
   4   2008-249 17:44:18.123-2.29  : Accepted
   5   2008-249 17:44:18.174-2.29  : Accepted
   6   2008-249 17:44:18.225-2.29  : Accepted
   7   2008-249 17:44:18.274-2.28  : Accepted
   8   2008-249 17:44:18.325-2.28  : Accepted
   9   2008-249 17:44:18.375-2.28  : Accepted
  10   2008-249 17:44:18.424-2.27  : Accepted
  11   2008-249 17:44:18.475-2.26  : Accepted
  12   2008-249 17:44:18.514-2.24  : Accepted
  13   2008-249 17:44:18.565-2.23  : Accepted
  14   2008-249 17:44:18.615-2.20  : Accepted
  15   2008-249 17:44:18.674-2.17  : Accepted
  16   2008-249 17:44:18.725-2.15  : Accepted
  17   2008-249 17:44:18.774-2.12  : Accepted
  18   2008-249 17:44:18.825-2.09  : Accepted
  19   2008-249 17:44:18.875-2.06  : Accepted
  20   2008-249 17:44:18.925-2.03  : Accepted
  21   2008-249 17:44:18.975-2.00  : Accepted
  22   2008-249 17:44:19.026-1.97  : Accepted
  23   2008-249 17:44:19.055-1.95  : Accepted

 #I copy the previous data then in R dat=readLines(clipboard)
 options(digits.secs=6)
 tmp=unlist(lapply(dat,function(x){unlist(strsplit(x,\\
 +,perl=TRUE))[3:5]}))
 tmp=matrix(tmp,ncol=3,byrow=TRUE)
 tmp=cbind(paste(tmp[,1],tmp[,2]),tmp[,3])
 time=strptime(tmp[,1], format=%Y-%j %H:%M:%OS)
 value=as.numeric(tmp[,2])
 plot(time,value)
 #How can I show in the x axis the complete time values including the
 decimals.

 Thanks a lot

 N.B.: I am running the lastest version of R and using it under Windows XP

 S.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] plot order in multi-panel figure

2008-09-19 Thread Stephen Tucker
Hi, 

Does anyone know if there is a way to 'reset the plot number' on a traditional 
graphics device?

For instance, I want to have two plots on stacked top of each other 
(mfrow=c(2,1)) but with underlying grid lines spanning both figures vertically. 
I can put the grid lines on top if I add them last:

par(mfrow=c(2,1))
plot.new()
plot.window(c(0,1),c(0,1))
for( i in 1:2) axis(i)
box(bty=L)
rect(0.2,0.2,0.5,0.5,col=8)

plot.new()
plot.window(c(0,1),c(0,1))
for( i in 1:2) axis(i)
box(bty=L)

par(mfrow=c(1,1))
plot.window(c(0,1),c(0,1))
abline(v=seq(0,1,by=0.2),lty=3)

But ideally I would like to draw the grid lines before drawing other objects on 
top of it, but something like

par(mfrow=c(1,1))
plot.new()
plot.window(c(0,1),c(0,1))
abline(v=seq(0,1,by=0.2),lty=3)

par(mfrow=c(2,1))
plot.window(c(0,1),c(0,1))
for( i in 1:2) axis(i)
box(bty=L)
rect(0.2,0.2,0.5,0.5,col=8)

plot.new()
plot.window(c(0,1),c(0,1))
for( i in 1:2) axis(i)
box(bty=L)

does not work because the first of the two plots appears in the bottom of the 
figure and not the top (as it is interpreted as the second of the mfrow=c(2,1) 
plots). I've also played around with layout() but I also get the same behavior.

I suspect I can do this eventually with grid graphics but was wondering if it 
is also possible in traditional graphics. I would appreciate any help - thanks 
very much!
Stephen

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

2008-09-19 Thread Gabor Grothendieck
Try placing your text in a parbox:

x-as.table(cbind(1:3,rep(\\parbox{5cm}{this is an example for a long
character string that I want break into several lines})))
print(xtable(x), sanitize.text = force)

You may need to fix up the vertical spacing as well.

On Fri, Sep 19, 2008 at 10:11 AM, Erich Studerus
[EMAIL PROTECTED] wrote:
 Ok. Sorry, here's a reproducible example:

 library(xtable)
 x-as.table(cbind(1:3,rep(this is an example for a long character string
 that I want break into several lines)))
 xtable(x)

 Regards

 Erich


 -Ursprüngliche Nachricht-
 Von: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
 Gesendet: Freitag, 19. September 2008 15:50
 An: Erich Studerus
 Cc: r-help@r-project.org
 Betreff: Re: [R] getting line breaks with xtable

 Read the last line to every message to r-help to find out
 one reason you may be getting no responses.

 On Fri, Sep 19, 2008 at 9:39 AM, Erich Studerus
 [EMAIL PROTECTED] wrote:
 Sorry, for asking the same question again, but I got no reactions the last
 time. Maybe it was just overseen by the experts.
 I'm using the xtable function with Sweave and Lyx and I would like to know
 how to get automatic line breaks for long strings in a column of the
 table.
 I've learned from the Lyx wiki that the Latex command \linebreak produces
 table cells with multiple lines. I tried to insert \linebreak into the
 character string, but it didn't work out, because Sweave transforms it
 automatically to $\backslash$linebreak.

 Any help is highly appreciated.

 Erich

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


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


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


Re: [R] getting line breaks with xtable

2008-09-19 Thread Marc Schwartz
I don't believe that \linebreak will work within a tabular environment
as you expect here. Plus, be aware, that it is print.xtable() and not
LaTeX that is adding the additional $\backslash$ characters, as part of
the text sanitization process.

I think that you basically have two options:

1. Define a so-called 'p' column for the wide text column, which
essentially creates a paragraph environment within each cell in that
column, and therefore allows for line wrapping. See the 'align' argument
in ?xtable. So use something like this:

  xtable(x, align = lrp{3in})

'p' columns can have undesirable effects as well depending upon certain
details, so you can also look at the following option.


2. Use a LaTeX macro and embed that in the character vector. I have
created three such macros, one each for Right, Left and Center
justification of the text within the cell:

[EMAIL PROTECTED]@{}}#1\end{tabular}}
[EMAIL PROTECTED]@{}}#1\end{tabular}}
[EMAIL PROTECTED]@{}}#1\end{tabular}}


Put these in your .Rnw file, after the \begin{document} declaration.
This essentially creates a tabular environment within the cell in the
parent table. Then modify your long vectors by using something like:

# See ?strwrap. Wrap each vector at max char length 20
LVec - lapply(x[, 2], strwrap, 20)

 LVec
$A
[1] this is an example for a long character string
[4] that I want break  into several lines

$B
[1] this is an example for a long character string
[4] that I want break  into several lines

$C
[1] this is an example for a long character string
[4] that I want break  into several lines


# Beware of any line wrapping in the e-mail here
# Add in the line breaks and macro text
FinalVec - paste(\\multilineL{, sapply(LVec, paste, collapse =
), })

 FinalVec
[1] \\multilineL{ this is an examplefor a longcharacter
stringthat I want breakinto several lines }
[2] \\multilineL{ this is an examplefor a longcharacter
stringthat I want breakinto several lines }
[3] \\multilineL{ this is an examplefor a longcharacter
stringthat I want breakinto several lines }


# Modify the second column in the table
x[, 2] - FinalVec


Now use:

  print(xtable(x), sanitize.text.function = function(x){x})

which will output the table and leave the LaTeX directives intact. Watch
line wrapping in the e-mail again here:

% latex table generated in R 2.7.2 by xtable 1.5-3 package
% Fri Sep 19 09:54:10 2008
\begin{table}[ht]
\begin{center}
\begin{tabular}{rll}
  \hline
  A  B \\
  \hline
A  1  \multilineL{ this is an example\\for a long\\character
string\\that I want break\\into several lines } \\
  B  2  \multilineL{ this is an example\\for a long\\character
string\\that I want break\\into several lines } \\
  C  3  \multilineL{ this is an example\\for a long\\character
string\\that I want break\\into several lines } \\
   \hline
\end{tabular}
\end{center}
\end{table}


HTH,

Marc Schwartz


on 09/19/2008 09:11 AM Erich Studerus wrote:
 Ok. Sorry, here's a reproducible example:
 
 library(xtable)
 x-as.table(cbind(1:3,rep(this is an example for a long character string
 that I want break into several lines)))
 xtable(x)
 
 Regards
 
 Erich
 
 
 -Ursprüngliche Nachricht-
 Von: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 
 Gesendet: Freitag, 19. September 2008 15:50
 An: Erich Studerus
 Cc: r-help@r-project.org
 Betreff: Re: [R] getting line breaks with xtable
 
 Read the last line to every message to r-help to find out
 one reason you may be getting no responses.
 
 On Fri, Sep 19, 2008 at 9:39 AM, Erich Studerus
 [EMAIL PROTECTED] wrote:
 Sorry, for asking the same question again, but I got no reactions the last
 time. Maybe it was just overseen by the experts.
 I'm using the xtable function with Sweave and Lyx and I would like to know
 how to get automatic line breaks for long strings in a column of the
 table.
 I've learned from the Lyx wiki that the Latex command \linebreak produces
 table cells with multiple lines. I tried to insert \linebreak into the
 character string, but it didn't work out, because Sweave transforms it
 automatically to $\backslash$linebreak.

 Any help is highly appreciated.

 Erich


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] plot order in multi-panel figure

2008-09-19 Thread Mark Lyman
Stephen Tucker brown_emu at yahoo.com writes:

 Hi, 
 
 Does anyone know if there is a way to 'reset the plot number' on a 
traditional graphics device?
 
 For instance, I want to have two plots on stacked top of each other (mfrow=c
(2,1)) but with underlying grid
 lines spanning both figures vertically.


Below is one approach using split.screen. See ?split.screen for details.

 split.screen(c(1,1))
[1] 1
 screen(1)
 plot.window(c(0,1),c(0,1))
 abline(v=seq(0,1,by=0.2),lty=3)
 split.screen(c(2,1))
[1] 2 3
 screen(2)
 plot.new()
 plot.window(c(0,1),c(0,1))
 for(i in 1:2) axis(i)
 box(bty=L)
 rect(0.2,0.2,0.5,0.5,col=8)
 screen(3)
 plot.new()
 plot.window(c(0,1),c(0,1))
 for( i in 1:2) axis(i)
 box(bty=L)
 close.screen()
[1] 1 2 3

Mark Lyman

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

2008-09-19 Thread Greg Snow
Peter showed you the %in% operator, you may also want to look at the subset, 
transform, with, and within functions for future use as ways to reduce the need 
to type the name of an object multiple times.

Hope this helps,

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
801.408.8111

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 project.org] On Behalf Of Mark Na
 Sent: Thursday, September 18, 2008 6:11 PM
 To: [EMAIL PROTECTED]
 Subject: [R] Multiple logical operations in a subscript

 Hello,

 I would like to select cases using multiple logical operations (e.g. X
 or Y or Z) without having to repeat the dataframe$variable within the
 subscript. My working code (with a single logical operator) currently
 looks like this:

 dataframe$newvariable[data$oldvariable==X]-group1

 I thought this next line of code might do what I wanted, but it
 doesn't:

 dataframe$newvariable[data$oldvariable==X | Y | Z]-group1

 I'd appreciate any suggestions. I've tried playing around with grep,
 but
 can't make it work.

 Thanks! Mark

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

2008-09-19 Thread Saptarshi Guha
Hello,
I have a multi-page display each consisting of two-panels above each  
other.
I need to draw a line from the top panel to bottom panel. Using  
current.vpTree()
i find that plot1.panel.1.2.vp and plot1.panel.1.1.vp are the top  
and bottom ones respectively.
I am using the following code(inspired by Paul Murrell's R Graphics)  
to draw a line.
(All the co-ordinates lie well within the ranges of the respective  
panels)

seekViewport(plot1.panel.1.2.vp)
grid.move.to(unit(0.72,native),unit(3.8,native))
seekViewport(plot1.panel.1.1.vp)
grid.line.to(unit(1.2,native),unit(3.5,native))

However, I can see the line in the bottom panel, but nothing in the  
top. Is there some
clipping going on?

Thanks
Saptarshi

Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha


[[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] Use of colour in plots

2008-09-19 Thread Steve Murray

Hi Thierry and all,

Thanks very much for your suggestion. I've given it a go and played around with 
the transparency values, but seem to be having a problem in that some of the 
red values are made transparent, even though there are no green values being 
overplotted!

The code I used to display the image was:

ggplot(Jan, aes(x = Jan[,4], y = Jan[,5], colour = factor(Jan$Urban.Rural 
1.25))) +
geom_point() + scale_colour_manual(values = c(alpha(red,1/10),
green))

Do you have any ideas to put me on the right tracks with this?

Thanks again for your help,

Steve





 Subject: RE: [R] Use of colour in plots
 Date: Fri, 19 Sep 2008 16:15:39 +0200
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; r-help@r-project.org

 Steve,

 You want something like this:

 library(ggplot2)
 n - 1000
 dataset - data.frame(x = round(rnorm(n), 2), y = round(rnorm(n), 1), z
 = rnorm(n))
 ggplot(dataset, aes(x = x, y = y, colour = factor(z 1))) +
 geom_point() + scale_colour_manual(values = c(alpha(red, 1/4),
 green))

 HTH,

 Thierry


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

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

 The plural of anecdote is not data.
 ~ Roger Brinner

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

 -Oorspronkelijk bericht-
 Van: Steve Murray [mailto:[EMAIL PROTECTED]
 Verzonden: vrijdag 19 september 2008 16:01
 Aan: ONKELINX, Thierry; r-help@r-project.org
 Onderwerp: RE: [R] Use of colour in plots


 Sorry - I should've maybe also pointed out that the command I've been
 trying to use is: alpha(col=green, 1/10)

 On its own this results in the following error: [1] #00FF001A and I
 haven't been able to successfully incorporate it into the main formula
 just yet (please see my previous message).

 Without wanting to get too far ahead of myself, is there also a way of
 making the red points transparent too? (within this command - I've tried
 using '' but this results in an error).

 Many thanks again for any advice you can offer,

 Steve



 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; r-help@r-project.org
 Subject: RE: [R] Use of colour in plots
 Date: Fri, 19 Sep 2008 13:45:43 +


 Thierry,

 Thanks - I've had a look into using the transparency option, but can't
 seem to work out where to place it within the command I'm using:

 ggplot(Jan, aes(x = PopDensity, y = Average.Burnt.Area.Fraction,
 colour = factor(Urban.Rural 1.25))) + geom_point()

 I'm assuming that it has to go in the 'aes' section somewhere, but I
 seem to be encountering errors wherever I insert it. This doesn't seem
 to be mentioned in the book, so do you have any tips?!

 Also, out of interest, what does the 'geom_point()' command do?

 Thanks again,

 Steve



 Subject: RE: [R] Use of colour in plots
 Date: Fri, 19 Sep 2008 10:31:58 +0200
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; r-help@r-project.org

 Steve,

 - Use tranparancy to prevent overplotting: more details on p. 16 of
 the
 ggplot2 book: http://had.co.nz/ggplot2/book/
 - You can choose your own colour with scale_manual():
 http://had.co.nz/ggplot2/scale_manual.html
 - The backgroundcolor can be set with ggopt(background.color =
 white):
 http://rweb.stat.umn.edu/R/library/ggplot/html/build-options-8a.html

 HTH,

 Thierry



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

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

 The plural of anecdote is not data.
 ~ Roger Brinner

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

 -Oorspronkelijk bericht-
 Van: Steve Murray [mailto:[EMAIL PROTECTED]
 Verzonden: donderdag 18 september 2008 19:08
 Aan: r-help@r-project.org; ONKELINX, Thierry; [EMAIL PROTECTED];
 [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Onderwerp: RE: [R] Use of colour in plots


 Dear Thierry and all,

 

[R] ggplot2 - accessing legend data

2008-09-19 Thread Pedro Barros

Hi All,

I am trying to build a set of plots, and build a common legend to all of
them. Because I want to use a multi-line, multi-column legend layout, I
cannot use the common ggplot2 legends (if I can, please tell me how).
So, I would like to know how can I access the properties of a legend, so
that I can extract the colours/symbols/patterns and the corresponding
labels, so that I can then build my own legend.
I tried using gglegend, but I cannot find out how to access its properties.

Thanks,
Pedro
-- 
View this message in context: 
http://www.nabble.com/ggplot2---accessing-legend-data-tp19575314p19575314.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 logical operations in a subscript

2008-09-19 Thread Ted Harding

On 19-Sep-08 16:03:45, Greg Snow wrote:
 Peter showed you the %in% operator, you may also want to look at the
 subset, transform, with, and within functions for future use as ways to
 reduce the need to type the name of an object multiple times.
 
 Hope this helps,

Let me add my perhaps very simple-minded suggestion. What I usually
do in such a situation is to define a working variable with a short name.
So, in the case of your example:

  dataframe$newvariable[data$oldvariable==X | Y | Z]-group1

I would:

  Old-data$oldvariable
  dataframe$newvariable[(Old==X)|(Old==Y)|(Old==Z)] - group1

which is what I take your intended meaning to be -- if so, then your
formulation of the condition is wrong, since

  data$oldvariable==X | Y | Z

will first (because of precedence rules -- see ?Syntax) evaluate
  data$oldvariable==X
(to TRUE or FALSE), and then try to OR (|) this with the values
of X and Z. Since these are character strings, the operation is
not permitted:

  Y|Z
  Error in Y | Z : 
operations are possible only for numeric or logical types

On the other hand:

  1|(-2)|(3.14159)
  [1] TRUE

Hoping this helps,
Ted.


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 project.org] On Behalf Of Mark Na
 Sent: Thursday, September 18, 2008 6:11 PM
 To: [EMAIL PROTECTED]
 Subject: [R] Multiple logical operations in a subscript

 Hello,

 I would like to select cases using multiple logical operations (e.g. X
 or Y or Z) without having to repeat the dataframe$variable within the
 subscript. My working code (with a single logical operator) currently
 looks like this:

 dataframe$newvariable[data$oldvariable==X]-group1

 I thought this next line of code might do what I wanted, but it
 doesn't:

 dataframe$newvariable[data$oldvariable==X | Y | Z]-group1

 I'd appreciate any suggestions. I've tried playing around with grep,
 but
 can't make it work.

 Thanks! Mark

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


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 19-Sep-08   Time: 17:28:20
-- XFMail --

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] evaluate return values of commands executed with system()

2008-09-19 Thread Rainer M Krug
Hi

I would like to check the return value of commands executed with system()

I am using Linux (Ubuntu Hardy) and I am executing GRASS commands and
would like to call stop() when they return an error (i.e. return code
= 1).

Thanks

Rainer





-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Faculty of Science
Natural Sciences Building
Private Bag X1
University of Stellenbosch
Matieland 7602
South Africa

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Novice question about getting data into R

2008-09-19 Thread Ted Byers

I found it easy to use R when typing data manually into it.  Now I need to
read data from a file, and I get the following errors:

 refdata =
 read.table(K:\\MerchantData\\RiskModel\\refund_distribution.csv, header
 = TRUE)
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, 
: 
  line 1 did not have 42 elements
 refdata =
 read.table(K:\\MerchantData\\RiskModel\\refund_distribution.csv)
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, 
: 
  line 2 did not have 42 elements


(I'd tried the first version above because the first record has column
names.)

First, I don't know why R expects 42 elements in a record.  
There is one column for a time variable (weeks since a given week of samples
were taken) and one for each week of sampling in the data file (Week 18
through Week 37 inclusive).  And there is only 19 rows.
The samples represented by the columns are independant, and the numbers in
the columns are the fraction of events sampled that result in an event of
another kind in the week since the sample was taken.

The samples are not the same size, and starting with week 20, the number of
values progressively gets smaller since there have been fewer than 37  weeks
since the samples were taken.

I can show you the contents of the data file if you wish.  It is
unremarkable, csv, with strings used for column names enclosed in double
quotes.

I don't have to manually separate the samples into their own files do I?  I
was hoping to write a function that estimates the density function that best
fits each sample individually, and then iterate of the columns, applying
that function to each in turn.

What is the best way to handle this?

Thanks

Ted


-- 
View this message in context: 
http://www.nabble.com/Novice-question-about-getting-data-into-R-tp19576065p19576065.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] Cbind help

2008-09-19 Thread Rajasekaramya

Hi there

I want to cbind a vector(contains 20 values) to a dataframe containg (18
rows).The missing value in the dataframe is however a repeated values  but
still i want to retain the repeats in the vector and the dataframe values
can even get enterd twice.

how should i go about it
Example:

Vector(contains repeating entry)
ab de dc ab be

dataframe(unique entry)
ab a b c d e
dc e f g h i
de  l m n o p

Result :
vector D.F
ab  ab a b c d e
dc  dc e f g h i
ab  ab a b c d e
de  de  l m n o p

Ramya

-- 
View this message in context: 
http://www.nabble.com/Cbind-help-tp19576177p19576177.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] Novice question about getting data into R

2008-09-19 Thread Peter Dalgaard
Ted Byers wrote:
 I found it easy to use R when typing data manually into it.  Now I need to
 read data from a file, and I get the following errors:

   
 refdata =
 read.table(K:\\MerchantData\\RiskModel\\refund_distribution.csv, header
 = TRUE)
 
 Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, 
 : 
   line 1 did not have 42 elements
   
 refdata =
 read.table(K:\\MerchantData\\RiskModel\\refund_distribution.csv)
 
 Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, 
 : 
   line 2 did not have 42 elements
   

 (I'd tried the first version above because the first record has column
 names.)

 First, I don't know why R expects 42 elements in a record.  
   
Hard to tell. One guess is that you have 42 header names. Spaces inside
any of them? Is this really a CSV file? (As in Comma Separated Values).
If so, you at least need to set the sep= argument, but how about
read.csv()? or if TAB separated, read.delim().
 There is one column for a time variable (weeks since a given week of samples
 were taken) and one for each week of sampling in the data file (Week 18
 through Week 37 inclusive).  And there is only 19 rows.
 The samples represented by the columns are independant, and the numbers in
 the columns are the fraction of events sampled that result in an event of
 another kind in the week since the sample was taken.

 The samples are not the same size, and starting with week 20, the number of
 values progressively gets smaller since there have been fewer than 37  weeks
 since the samples were taken.

 I can show you the contents of the data file if you wish.  It is
 unremarkable, csv, with strings used for column names enclosed in double
 quotes.
   
You might well have to. One man's unremarkable can be remarkably
different from others'...
 I don't have to manually separate the samples into their own files do I?  I
 was hoping to write a function that estimates the density function that best
 fits each sample individually, and then iterate of the columns, applying
 that function to each in turn.

 What is the best way to handle this?

 Thanks

 Ted


   


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

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


Re: [R] Novice question about getting data into R

2008-09-19 Thread John Kane
Try read.csv(K:\\MerchantData\\RiskModel\\refund_distribution.csv,header = 
TRUE)


--- On Fri, 9/19/08, Ted Byers [EMAIL PROTECTED] wrote:

 From: Ted Byers [EMAIL PROTECTED]
 Subject: [R]  Novice question about getting data into R
 To: r-help@r-project.org
 Received: Friday, September 19, 2008, 1:01 PM
 I found it easy to use R when typing data manually into it. 
 Now I need to
 read data from a file, and I get the following errors:
 
  refdata =
 
 read.table(K:\\MerchantData\\RiskModel\\refund_distribution.csv,
 header
  = TRUE)
 Error in scan(file, what, nmax, sep, dec, quote, skip,
 nlines, na.strings, 
 : 
   line 1 did not have 42 elements
  refdata =
 
 read.table(K:\\MerchantData\\RiskModel\\refund_distribution.csv)
 Error in scan(file, what, nmax, sep, dec, quote, skip,
 nlines, na.strings, 
 : 
   line 2 did not have 42 elements
 
 
 (I'd tried the first version above because the first
 record has column
 names.)
 
 First, I don't know why R expects 42 elements in a
 record.  
 There is one column for a time variable (weeks since a
 given week of samples
 were taken) and one for each week of sampling in the data
 file (Week 18
 through Week 37 inclusive).  And there is only 19 rows.
 The samples represented by the columns are independant, and
 the numbers in
 the columns are the fraction of events sampled that result
 in an event of
 another kind in the week since the sample was taken.
 
 The samples are not the same size, and starting with week
 20, the number of
 values progressively gets smaller since there have been
 fewer than 37  weeks
 since the samples were taken.
 
 I can show you the contents of the data file if you wish. 
 It is
 unremarkable, csv, with strings used for column names
 enclosed in double
 quotes.
 
 I don't have to manually separate the samples into
 their own files do I?  I
 was hoping to write a function that estimates the density
 function that best
 fits each sample individually, and then iterate of the
 columns, applying
 that function to each in turn.
 
 What is the best way to handle this?
 
 Thanks
 
 Ted
 
 
 -- 
 View this message in context:
 http://www.nabble.com/Novice-question-about-getting-data-into-R-tp19576065p19576065.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] Lines between panels in lattice

2008-09-19 Thread Saptarshi Guha
Got it. It should be plot1.panel.1.2.off.vp and likewise.
Thanks
Saptarshi

On Sep 19, 2008, at 12:08 PM, Saptarshi Guha wrote:

 Hello,
 I have a multi-page display each consisting of two-panels above each  
 other.
 I need to draw a line from the top panel to bottom panel. Using  
 current.vpTree()
 i find that plot1.panel.1.2.vp and plot1.panel.1.1.vp are the  
 top and bottom ones respectively.
 I am using the following code(inspired by Paul Murrell's R Graphics)  
 to draw a line.
 (All the co-ordinates lie well within the ranges of the respective  
 panels)

 seekViewport(plot1.panel.1.2.vp)
 grid.move.to(unit(0.72,native),unit(3.8,native))
 seekViewport(plot1.panel.1.1.vp)
 grid.line.to(unit(1.2,native),unit(3.5,native))

 However, I can see the line in the bottom panel, but nothing in the  
 top. Is there some
 clipping going on?

 Thanks
 Saptarshi

 Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha


Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha
After years of research, scientists recently reported that there is,
indeed, arroz in Spanish Harlem.


[[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] reproduce this graph in ggplot2 (code and data included)

2008-09-19 Thread Juliet Hannah
How can I reproduce this graph in ggplot2 (regression lines and data
point superimposed). Thanks, Juliet

filename=http://personality-project.org/r/datasets/heating.txt;
heating=read.table(filename,header=TRUE)
symb=c(19,25,3,23)
colors=c(black,red,green,blue)
plot(degreedays,therms,pch=symb[Location],col=colors[Location],bg=colors[Location],cex=1.0)
by(heating,Location,function(x) abline(lm(therms~degreedays,data=x)))

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] reproduce this graph in ggplot2 (code and data included)

2008-09-19 Thread hadley wickham
Here's one way:

qplot(degreedays, therms, data=heating, colour = Location, shape = Location) +
 geom_smooth(method = lm, fullrange = T, se = F)

Hadley

On Fri, Sep 19, 2008 at 12:45 PM, Juliet Hannah [EMAIL PROTECTED] wrote:
 How can I reproduce this graph in ggplot2 (regression lines and data
 point superimposed). Thanks, Juliet

 filename=http://personality-project.org/r/datasets/heating.txt;
 heating=read.table(filename,header=TRUE)
 symb=c(19,25,3,23)
 colors=c(black,red,green,blue)
 plot(degreedays,therms,pch=symb[Location],col=colors[Location],bg=colors[Location],cex=1.0)
 by(heating,Location,function(x) abline(lm(therms~degreedays,data=x)))

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




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

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


Re: [R] Coloring spaces between lines in xyplot

2008-09-19 Thread hadley wickham
On Thu, Sep 18, 2008 at 5:14 PM, Seth W Bigelow [EMAIL PROTECTED] wrote:

 Greetings:
  I wish to create a stacked line graph in xyplot, adding color to the
 spaces between the lines. For example, the code below creates a plot with
 two lines extending across it, and I want to color the rhomboid that is
 between the upper and lower line, and between the lower line and the bottom
 of the frame.
 Suggestions appreciated

Well, if you relax the condition to use lattice, try

install.packages(ggplot2)
library(ggplot2)

x - rep(seq(1,10), 2)
y - c(1+1.5*(1:10), 0.2 + 1.3*(1:10) )
trt - rep(c(low, high), each = 10)

qplot(x, y, fill=trt, geom=area)

Hadley

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

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


Re: [R] R on a eeepc 901 ?

2008-09-19 Thread Agustin Lobo

Sigbert,

When I do:
apt-get install ksmserver kicker

I get a message stating that there is no header in
the package (Xandros came in Spanish, so I have to translate
the message, which is not easy)

Aterwards, I have to Edit sources.list file and create
a preferences file. As the repositories that are mentioned
in
http://wiki.r-project.org/rwiki/doku.php?id=getting-started:installation:eeepc 


are for the 701, I don't think this is safe, I could just get wrong
updates and screw up everything.

The page states
If anyone has experiences with a EEE PC 901 then please add them here! 
which means that these directions are not for 901. I'm willing to try, 
but would need someone to guide me. Probably it's just a matter of

setting the appropriate repositories and priorities for the 901

Agus



Hi,

it seems that the directions in
http://wiki.r-project.org/rwiki/doku.php?id=getting-started:installation:eeepc 



refer to installing R on a eeepc 701 and actually

Yes, it does :)


fail for a 901 at the first step.

What exactly failed? You are actually do not need the KDE desktop.

Greetings Sigbert




--
Dr. Agustin Lobo
Institut de Ciencies de la Terra Jaume Almera (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: [EMAIL PROTECTED]
http://www.ija.csic.es/gt/obster

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Novice question about getting data into R

2008-09-19 Thread Silvia Lomascolo


 refdata =
 read.table(K:\\MerchantData\\RiskModel\\refund_distribution.csv, header
 = TRUE)
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, 
: 
  line 1 did not have 42 elements
 refdata =
 read.table(K:\\MerchantData\\RiskModel\\refund_distribution.csv)
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, 
: 
  line 2 did not have 42 elements

R interprets that you have 42 columns from the variable names. Do you? See
if removing spaces between column names helps (e.g., week.1 instead of
week 1).  Also, because yours is a csv file, fields are separated by
comas.  You can either use the read.csv command instead of the
read.table (see ?read.table for details), or add the argument sep=, to
tell R that fields are separated by comas.  You might also need to specify,
if you have empty cells, what to do with them (e.g., na.strings=)




-- 
View this message in context: 
http://www.nabble.com/Novice-question-about-getting-data-into-R-tp19576065p19576350.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] how to keep up with R?

2008-09-19 Thread Adaikalavan Ramasamy
I agree! The best way to learn (and remember for longer) is to teach 
someone else about it.


And there is not reason not to repeat some of the anlysis done on SAS 
with R. That way you can verify your outputs or compare the 
presentations. If you consistently find differences in the outputs, then 
trying to figure out the reason may lead you to better understand the 
methods (e.g. different optimization or estimation procedures).


Regards, Adai



Barry Rowlingson wrote:

2008/9/19 Wensui Liu [EMAIL PROTECTED]:

Dear Listers,

I've been a big fan of R since graduate school. After working in the
industry for years, I haven't had many opportunities to use R and am mainly
using SAS. However, I am still forcing myself really hard to stay close to R
by reading R-help and books and writing R code by myself for fun. But by and
by, I start realizing I have hard time to keep up with R and am afraid that
I would totally forget how to program in R.

I really like it and am very unwilling to give it up. Is there any idea how
I might keep touch with R without using it in work on daily basis? I really
appreciate it.



 How about doing some kind of presentation on R at your work? It's
possible that some of the old fossils don't even know about it at all,
and use SAS because to them the alternative is SPSS. Do some R
evangelization. Find a task that R does better than SAS (not
difficult) and illustrate that to your superiors. Then when they ask
how much a corporate R license is, you tell them it's free, or say
it'll cost them a 2% raise in your salary, or say it will cost them
your resignation if you are feeling brave!

 Sure you may be tied to SAS for some other reasons, but there's no
reason why you can't use R for other things. Work out how to get it
into your corporate framework. Encourage your colleagues to look at it
for their tasks. Enthuse.

 The good thing about training and evangelization is that at first you
don't need mad skillz at R to do it. I have trouble understanding some
of the tips on R-help (especially when do.call() is used), but you can
teach new people with a good knowledge of the basics, which you should
still have. Eventually the hope is that enough people use R at your
workplace to develop a community where everyone keeps everyone else on
their toes with R questions!

 Good luck!

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

2008-09-19 Thread john crepezzi

I'm not so sure the original way I stated my issue was clear enough, so I'll
attempt to elaborate a little bit.

I'd like to make a function that is passed the name of a plot object, and a
lines/point specification, and graphs them all on the same plot.

I don't want to redraw the plot each time, and I don't want the code to have
any concept of a first entry instantiating the plot with plot() in place
of lines().

Ideally, I'd like something to the effect of:

plot - createPlot(main = Hello World, sub = tiny, little world, xlim =
c(-3, 3), ylim = c(-3, 3))

plot - addElement(plot, lines(col = 'BLUE', x = c(0, 1, 2, 3), y = c(3, 2,
1, 0)))

Hopefully this laid my problem out a little better.

Thanks in advance for any help you might be able to offer
-John Crepezzi
-- 
View this message in context: 
http://www.nabble.com/Plot-Accessibility-tp19575437p19575437.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] Plot availability

2008-09-19 Thread john crepezzi
I'm not so sure the original way I stated my issue was clear enough,
so I'll attempt to elaborate a little bit.

I'd like to make a function that is passed the name of a plot object,
and a lines/point specification, and graphs them all on the same plot.

I don't want to redraw the plot each time, and I don't want the code
to have any concept of a first entry instantiating the plot with
plot() in place of lines().

Ideally, I'd like something to the effect of:

plot - createPlot(main = Hello World, sub = tiny, little world,
xlim = c(-3, 3), ylim = c(-3, 3))

plot - addElement(plot, lines(col = 'BLUE', x = c(0, 1, 2, 3), y =
c(3, 2, 1, 0)))

Hopefully this laid my problem out a little better.

Thanks in advance for any help you might be able to offer
-John Crepezzi

On Sep 19, 10:11 am, Duncan Murdoch [EMAIL PROTECTED] wrote:
 On 9/19/2008 9:32 AM, john crepezzi wrote:

  Is it possible to see if a plot is already open before I call lines()?

 I don't think so.  You can see if a graphics device is open by looking
 at dev.cur(), but I don't think there's a test for plot.new().  I'd just
 wrap the call in try() if you're not sure it will work.

 Duncan Murdoch

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

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


Re: [R] Coloring spaces between lines in xyplot

2008-09-19 Thread Seth W Bigelow

Ok, thanks to Carl Witthoft I now know that to color spaces between  and
below a pair of lines in xyplot, I will need to redefine the lines as
polygons, and use the lpolygon panel function, as in the following

library(lattice)
p - c(1,10,10,1)   #  vector of x values
q - c(4,29.2,16,2.5)  # vector of y values for upper polygon
r - c(2.5,16,0,0)# vector of y values for lower
polygon

xyplot(
  q + r ~ p,
  panel = lpolygon,
  col = c(red,green)
  )

But, having spent several hours arriving at this increment of knowlege, I
find myself stumped at how to assign different colors to the two polygons!
the above col line did not do the job.

--Seth



Dr. Seth  W. Bigelow
Biologist, Sierra Nevada Research Center
Pacific Southwest Research Station, USDA Forest Service. 1731 Research Park
Drive, Davis CA 95618
[EMAIL PROTECTED]
www.fs.fed.us/psw/programs/snrc/staff/bigelow
www.swbigelow.net

Phone: 530 759 1718
Fax: 530 747 0241

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

2008-09-19 Thread Yinghui Wang

Hi,

I am trying to fit a polytomous logistic regression with inverted sampling 
probabity as weight. I've tried multinom(nnet) function. While the results look 
not right. For example, the results were not the same for the following two 
model. Should I normalize the weights first? Or there were some other functions 
to use?

multinom(y~x,weights=rep(2,length(y))
vs.
multinom(y~x)

Thanks,
Yinghui

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

2008-09-19 Thread ermimi

Hello friends!!!

I´m spanish student, I am finishing the finish project in computer science.
I am creating a R package about CircularStatistics, In october i will upload
it to CRAN. I need to resolve one problem. 
I need to put a windows created with tktoplevel into screen center.
How I could put the windows created in the center of the screen?

I have created the windows with next sentences

tt - tktoplevel(width=2000,height=300)

Thank you very much,
A greetings, Luismi 
-- 
View this message in context: 
http://www.nabble.com/Position-WINDOWS-TKTOPLEVEL-tp19577290p19577290.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] Novice question about getting data into R

2008-09-19 Thread Tom Backer Johnsen

Silvia Lomascolo wrote:



refdata =
read.table(K:\\MerchantData\\RiskModel\\refund_distribution.csv, header
= TRUE)
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, 
: 
  line 1 did not have 42 elements

refdata =
read.table(K:\\MerchantData\\RiskModel\\refund_distribution.csv)
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, 
: 
  line 2 did not have 42 elements

R interprets that you have 42 columns from the variable names. Do you? See
if removing spaces between column names helps (e.g., week.1 instead of
week 1).  Also, because yours is a csv file, fields are separated by
comas.  You can either use the read.csv command instead of the
read.table (see ?read.table for details), or add the argument sep=, to
tell R that fields are separated by comas.  You might also need to specify,
if you have empty cells, what to do with them (e.g., na.strings=)


You are of course right about the NA's (missing values, empty cells) as 
well as the possible blanks in the column names.  It might nevertheless 
be a good idea for him to at least submit a few of the lines at the top 
of the file.  A .csv file as generated by Excel on Windows is not 
necessarily comma-separated.  That depends on the list separator 
setting under Regional Language Settings found in the Control Panel. 
On my machine, the list separator is a semicolon for a .csv file.  The 
reason is simple, in Norway, the standard decimal separator is a comma, 
and you do not want to confuse the system too much.  So, that particular 
point is dependent on the settisngs for his locale (language, country).


Tom








--
++
| Tom Backer Johnsen, Psychometrics Unit,  Faculty of Psychology |
| University of Bergen, Christies gt. 12, N-5015 Bergen,  NORWAY |
| Tel : +47-5558-9185Fax : +47-5558-9879 |
| Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ |
++

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Fwd: Lines between panels in lattice

2008-09-19 Thread Saptarshi Guha
Forgot to send to the list.


Begin forwarded message:

 From: Saptarshi Guha [EMAIL PROTECTED]
 Date: September 19, 2008 1:43:50 PM GMT-04:00
 To: Gabor Grothendieck [EMAIL PROTECTED]
 Subject: Re: [R] Lines between panels in lattice

 Certainly.

 x=cbind(runif(10),rnorm(10),c(rep(1,5),rep(2,5)))
 xyplot(x[,2]~x[,1]|x[,3],layout=c(1,2))
 x

 #x[,3]==2 is in the top panel and x[,3]==1 is in the bottom panel
 #so x[6:,] onwards is on the top panel and x[1:5,] is in the bottom
 #to find out the names of the viewports, use current.vpTree()

 seekViewport(plot1.panel.1.2.off.vp)
 grid.move.to(unit(x[10,1],native),unit(x[10,2],native))
 seekViewport(plot1.panel.1.1.off.vp)
 grid
 .line
 .to
 (unit
 (x[1,1],native),unit(x[1,2],native),gp=gpar(col='#aa',lty=3))

 Further details can be found in R Graphics, Paul Murrel, page 196  
 (ISBN 1-58488-486-X)
 Hope it helps.
 Regards
 Saptarshi



 On Sep 19, 2008, at 1:32 PM, Gabor Grothendieck wrote:

 Maybe you could post a working solution.

 On Fri, Sep 19, 2008 at 1:28 PM, Saptarshi Guha
 [EMAIL PROTECTED] wrote:
 Got it. It should be plot1.panel.1.2.off.vp and likewise.
 Thanks
 Saptarshi

 On Sep 19, 2008, at 12:08 PM, Saptarshi Guha wrote:

 Hello,
 I have a multi-page display each consisting of two-panels above  
 each
 other.
 I need to draw a line from the top panel to bottom panel. Using
 current.vpTree()
 i find that plot1.panel.1.2.vp and plot1.panel.1.1.vp are the
 top and bottom ones respectively.
 I am using the following code(inspired by Paul Murrell's R  
 Graphics)
 to draw a line.
 (All the co-ordinates lie well within the ranges of the respective
 panels)

 seekViewport(plot1.panel.1.2.vp)
 grid.move.to(unit(0.72,native),unit(3.8,native))
 seekViewport(plot1.panel.1.1.vp)
 grid.line.to(unit(1.2,native),unit(3.5,native))

 However, I can see the line in the bottom panel, but nothing in the
 top. Is there some
 clipping going on?

 Thanks
 Saptarshi

 Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha


 Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha
 After years of research, scientists recently reported that there is,
 indeed, arroz in Spanish Harlem.


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


 Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha
 The mome rath isn't born that could outgrabe me.
   -- Nicol Williamson


Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha
A fail-safe circuit will destroy others.
-- Klipstein


[[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] Plot availability

2008-09-19 Thread hadley wickham
On Fri, Sep 19, 2008 at 1:00 PM, john crepezzi [EMAIL PROTECTED] wrote:
 I'm not so sure the original way I stated my issue was clear enough,
 so I'll attempt to elaborate a little bit.

 I'd like to make a function that is passed the name of a plot object,
 and a lines/point specification, and graphs them all on the same plot.

 I don't want to redraw the plot each time, and I don't want the code
 to have any concept of a first entry instantiating the plot with
 plot() in place of lines().

 Ideally, I'd like something to the effect of:

 plot - createPlot(main = Hello World, sub = tiny, little world,
 xlim = c(-3, 3), ylim = c(-3, 3))

 plot - addElement(plot, lines(col = 'BLUE', x = c(0, 1, 2, 3), y =
 c(3, 2, 1, 0)))

 Hopefully this laid my problem out a little better.

Have a look at the ggplot2 package, which is based around this
concept:  http://had.co.nz/ggplot2.

Hadley


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

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


Re: [R] Novice question about getting data into R

2008-09-19 Thread Ted Byers

Thanks one and all.

Actually, I used OpenOffice's spreadsheet to creat the csv file, but I have
been using it long enough to know to specify how I wanted it, and sometimes,
when that proves annoying, I'll use Perl to finess it the way I want it.

It seems my principle error was to assume that it would ignore the character
strings within the double quotes and determine fields based on the commas. 
Silvia's remarks about empty cells and blanks in the middle of column names
were right on the mark.

Tom, I appreciate the caveats you mention.  I am aware of the complications
of i18n, but they don't affect me much as my stuff is run exclusively in
Canada (pretty much the same norms as the US).  They don't affect me (in a
sense because I have manipuated data around such issues using perl in order
to satisfy the peculiarities of the software used on one project or another
- I deal with it almost as a matter of course, as long as I already know the
peculiarities of the software I am working with), and I have plenty of
experience moving data between spreadsheets, RDBMS such as MS SQL,
PostgreSQl, MySQL, and XML files, and have had to resort to unusual
delimiters in the past because of peculiarities in the data feed.  While I
have tonnes of experience developing software (C++, Java, FORTRAN, perl) I
only started playing with R a few months ago, and this is the first I have
had to import real data into it.  While the tutorials I found were useful,
it seems there are key tidbits of information I need scattered through the
documentation and I am finding it challenging to find the peculiarities of
R.

Thanks again one and all.

Ted



Tom Backer Johnsen wrote:
 
 Silvia Lomascolo wrote:
 
 refdata =
 read.table(K:\\MerchantData\\RiskModel\\refund_distribution.csv,
 header
 = TRUE)
 Error in scan(file, what, nmax, sep, dec, quote, skip, nlines,
 na.strings, 
 : 
   line 1 did not have 42 elements
 refdata =
 read.table(K:\\MerchantData\\RiskModel\\refund_distribution.csv)
 Error in scan(file, what, nmax, sep, dec, quote, skip, nlines,
 na.strings, 
 : 
   line 2 did not have 42 elements
 R interprets that you have 42 columns from the variable names. Do you?
 See
 if removing spaces between column names helps (e.g., week.1 instead of
 week 1).  Also, because yours is a csv file, fields are separated by
 comas.  You can either use the read.csv command instead of the
 read.table (see ?read.table for details), or add the argument sep=,
 to
 tell R that fields are separated by comas.  You might also need to
 specify,
 if you have empty cells, what to do with them (e.g., na.strings=)
 
 You are of course right about the NA's (missing values, empty cells) as 
 well as the possible blanks in the column names.  It might nevertheless 
 be a good idea for him to at least submit a few of the lines at the top 
 of the file.  A .csv file as generated by Excel on Windows is not 
 necessarily comma-separated.  That depends on the list separator 
 setting under Regional Language Settings found in the Control Panel. 
 On my machine, the list separator is a semicolon for a .csv file.  The 
 reason is simple, in Norway, the standard decimal separator is a comma, 
 and you do not want to confuse the system too much.  So, that particular 
 point is dependent on the settisngs for his locale (language, country).
 
 Tom
 
 
 
 
 
 
 -- 
 ++
 | Tom Backer Johnsen, Psychometrics Unit,  Faculty of Psychology |
 | University of Bergen, Christies gt. 12, N-5015 Bergen,  NORWAY |
 | Tel : +47-5558-9185Fax : +47-5558-9879 |
 | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ |
 ++
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/Novice-question-about-getting-data-into-R-tp19576065p19577763.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] Plot availability

2008-09-19 Thread Gabor Grothendieck
On Fri, Sep 19, 2008 at 2:00 PM, john crepezzi [EMAIL PROTECTED] wrote:
 I'm not so sure the original way I stated my issue was clear enough,
 so I'll attempt to elaborate a little bit.

 I'd like to make a function that is passed the name of a plot object,
 and a lines/point specification, and graphs them all on the same plot.

 I don't want to redraw the plot each time, and I don't want the code
 to have any concept of a first entry instantiating the plot with
 plot() in place of lines().

 Ideally, I'd like something to the effect of:

 plot - createPlot(main = Hello World, sub = tiny, little world,
 xlim = c(-3, 3), ylim = c(-3, 3))

 plot - addElement(plot, lines(col = 'BLUE', x = c(0, 1, 2, 3), y =
 c(3, 2, 1, 0)))

 Hopefully this laid my problem out a little better.

 Thanks in advance for any help you might be able to offer
 -John Crepezzi

 On Sep 19, 10:11 am, Duncan Murdoch [EMAIL PROTECTED] wrote:
 On 9/19/2008 9:32 AM, john crepezzi wrote:

  Is it possible to see if a plot is already open before I call lines()?

 I don't think so.  You can see if a graphics device is open by looking
 at dev.cur(), but I don't think there's a test for plot.new().  I'd just
 wrap the call in try() if you're not sure it will work.



Using classic graphics try this:

# classic graphics
plot(BOD)
p - recordPlot()

# some times go by and other plots are made
plot(0)

# now go back to the original plot and add more
replayPlot(p)
points(5, 15, col = red)


In lattice graphics its like this:

# lattice graphics
library(lattice)
p - xyplot(demand ~ Time, BOD)

# some times go by and other plots are made
plot(0)

# now replot the original plot and add more
plot(p)
trellis.focus(panel, 1, 1)
panel.points(5, 15, col = red)
trellis.unfocus()

ggplot2 is also grid-based and should be amenable to
this sort of thing too.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] plot order in multi-panel figure

2008-09-19 Thread Greg Snow
You can reset the figure number with the 'mfg' parameter to 'par', but to do 
what you want you may be able to do using other tools.  Look at the examples 
for the cnvrt.coords function in the TeachingDemos package (you can do similar 
things with the grconvertX and grconvertY functions) or look at the subplot 
function in the TeachingDemos package for another possible approach.

Hope this helps,

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
801.408.8111


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 project.org] On Behalf Of Stephen Tucker
 Sent: Friday, September 19, 2008 8:37 AM
 To: R-help
 Subject: [R] plot order in multi-panel figure

 Hi,

 Does anyone know if there is a way to 'reset the plot number' on a
 traditional graphics device?

 For instance, I want to have two plots on stacked top of each other
 (mfrow=c(2,1)) but with underlying grid lines spanning both figures
 vertically. I can put the grid lines on top if I add them last:

 par(mfrow=c(2,1))
 plot.new()
 plot.window(c(0,1),c(0,1))
 for( i in 1:2) axis(i)
 box(bty=L)
 rect(0.2,0.2,0.5,0.5,col=8)

 plot.new()
 plot.window(c(0,1),c(0,1))
 for( i in 1:2) axis(i)
 box(bty=L)

 par(mfrow=c(1,1))
 plot.window(c(0,1),c(0,1))
 abline(v=seq(0,1,by=0.2),lty=3)

 But ideally I would like to draw the grid lines before drawing other
 objects on top of it, but something like

 par(mfrow=c(1,1))
 plot.new()
 plot.window(c(0,1),c(0,1))
 abline(v=seq(0,1,by=0.2),lty=3)

 par(mfrow=c(2,1))
 plot.window(c(0,1),c(0,1))
 for( i in 1:2) axis(i)
 box(bty=L)
 rect(0.2,0.2,0.5,0.5,col=8)

 plot.new()
 plot.window(c(0,1),c(0,1))
 for( i in 1:2) axis(i)
 box(bty=L)

 does not work because the first of the two plots appears in the bottom
 of the figure and not the top (as it is interpreted as the second of
 the mfrow=c(2,1) plots). I've also played around with layout() but I
 also get the same behavior.

 I suspect I can do this eventually with grid graphics but was wondering
 if it is also possible in traditional graphics. I would appreciate any
 help - thanks very much!
 Stephen

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] caret package: arguments passed to the classification or regression routine

2008-09-19 Thread Max Kuhn
Forgot to cc...

On Fri, Sep 19, 2008 at 3:22 PM, Max Kuhn [EMAIL PROTECTED] wrote:
 A new version 3.41 is on

   https://r-forge.r-project.org/projects/caret/

 Until later tonight, you will have to get it via

   svn checkout svn://svn.r-forge.r-project.org/svnroot/caret

 and build it yourself.

 Usage examples:

  library(caret)
  library(mlbench)
  data(BostonHousing)

  gbm1 - train(medv ~ .,
data = BostonHousing,
gbm,
distribution = laplace,
verbose = FALSE)

  gbm2 - train(medv ~ .,
data = BostonHousing,
gbm,
verbose = FALSE)

  gbm3 - train(medv ~ .,
data = BostonHousing,
gbm,
verbose = FALSE,
distribution = list(name=quantile,alpha=0.5))

 Max


 On Fri, Sep 19, 2008 at 2:49 PM, Max Kuhn [EMAIL PROTECTED] wrote:
 Peter,

 train looks at the class of the outcome variable to determine the type
 of model (regression or classification). Rather than making everyone
 specify the distribution in every case, it switches between
 bernoulli and gaussian.

 For other models, train looks at the parameters passed via ... and
 will let those over-ride the automatically generated values. I can do
 the same for gbm in this context (besides the tuning parameters, this
 is the only argument that is automatically set for gbm).

 I'll make the changes and upload a new version to

   https://r-forge.r-project.org/projects/caret/

 It will probably be version 3.41.

 One other thing - it is usually better to email the package
 maintainers off-list for questions like this before emailing the list.

 Max


 On Thu, Sep 18, 2008 at 2:22 PM, Peter Tait [EMAIL PROTECTED] wrote:
 Hi,
 I am having problems passing arguments to method=gbm using the train()
 function.

 I would like to train gbm using the laplace distribution or the quantile
 distribution.

 here is the code I used and the error:

 gbm.test - train(x.enet, y.matrix[,7],
  method=gbm,
  distribution=list(name=quantile,alpha=0.5), verbose=FALSE,
  trControl=trainControl(method=cv,number=5),
  tuneGrid=gbmGrid
 )
 Model 1: interaction.depth=1, shrinkage=0.1, n.trees=300
 collapsing over other values of n.trees
 Error in gbm.fit(trainX, modY, interaction.depth =
 tuneValue$.interaction.depth,  :
  formal argument distribution matched by multiple actual arguments

 The same error occured with distribution=laplace.

 I also tried the following without and success :

 gbm.test - train(x.enet, y.matrix[,7],
  method=gbm,
  list(distribution=laplace, verbose=FALSE),
  trControl=trainControl(method=cv,number=2),
  tuneGrid=gbmGrid
 )
 Model 1: interaction.depth=1, shrinkage=0.1, n.trees=300
 collapsing over other values of n.trees
 Error in if (is.null(offset) || (offset == 0)) { :
  missing value where TRUE/FALSE needed
 In addition: Warning message:
 In gbm.fit(trainX, modY, interaction.depth = tuneValue$.interaction.depth,
  :
  NAs introduced by coercion

 Any help would be appreciated.
 Cheers
 Peter

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




 --

 Max




 --

 Max




-- 

Max

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] migrating data from s-plus to R

2008-09-19 Thread Mike Prager
Patrizio Frederic [EMAIL PROTECTED] wrote:

 Dear all,
 is there any way to transform a .Data directory created in S-plus 6.1
 for windows in a .RData file?

You might try the functions dump or dput, which create text
representations readable by either S or R.  At least, they do so
for many common data objects -- I can't say whether they will do
so for specialized ones or not.


-- 
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.

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

2008-09-19 Thread john crepezzi
I believe I've found a way to wrap and use dev.cur()[[1]] to have the
desired effect.  I'm just leaving my terminal now, but I'll post these
results on monday so everyone can see how it turned out.

If you have any ideas or qualms with this method, please let me
know.

Thanks Duncan!
--john

On Sep 19, 2:00 pm, john crepezzi [EMAIL PROTECTED] wrote:
 I'm not so sure the original way I stated my issue was clear enough,
 so I'll attempt to elaborate a little bit.

 I'd like to make a function that is passed the name of a plot object,
 and a lines/point specification, and graphs them all on the same plot.

 I don't want to redraw the plot each time, and I don't want the code
 to have any concept of a first entry instantiating the plot with
 plot() in place of lines().

 Ideally, I'd like something to the effect of:

 plot - createPlot(main = Hello World, sub = tiny, little world,
 xlim = c(-3, 3), ylim = c(-3, 3))

 plot - addElement(plot, lines(col = 'BLUE', x = c(0, 1, 2, 3), y =
 c(3, 2, 1, 0)))

 Hopefully this laid my problem out a little better.

 Thanks in advance for any help you might be able to offer
 -John Crepezzi

 On Sep 19, 10:11 am, Duncan Murdoch [EMAIL PROTECTED] wrote:

  On 9/19/2008 9:32 AM, john crepezzi wrote:

   Is it possible to see if a plot is already open before I call lines()?

  I don't think so.  You can see if a graphics device is open by looking
  at dev.cur(), but I don't think there's a test for plot.new().  I'd just
  wrap the call in try() if you're not sure it will work.

  Duncan Murdoch

  __
  [EMAIL PROTECTED] mailing listhttps://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.

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

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


[R] lme: NaNs in hierarchical model

2008-09-19 Thread melanie.r

Dear R-users,
I'm somehow new to the topic of mixed models. I'd liked to simulate data
with a specific correlation-structure and analyze it with lme(). I have a
fixed effect (group) and a random effect (block):

ygroup   block
 -5.2158969-2 1
 -2.4174197-2 1
 -2.6731572-2 1
 -3.6310082-2 1
 -0.3888706 0 2
  1.3422255 0 2
  0.8303369 0 2
  1.0985184 0 2
  2.4403000 2 3
  2.0890006 2 3
  2.8849674 2 3
  3.1946739 2 3

This is just a short data.frame, to illustrate my model. My mentor called it
'hierarchical' model, because every group is in one block and only the
observations of one group are correlated. 

When I now try to analyze this using lme with the following model

fit-lme(y~group,random=~1|block)

there is an error message:
In pf(q, df1, df2, lower.tail, log.p) : NaNs produced

In fact I generate a certain number of that data and analyze it with 
anova(lme()) to get the p-values and then count them to get the power of the
test.
What I don't understand is, why are there NaNs? Or better: why is the
group-DF zero?
The output is the following:

fit
Linear mixed-effects model fit by REML
  Data: NULL 
  Log-restricted-likelihood: -13.90713
  Fixed: y ~ group 
(Intercept)  group0  group2 
  -3.4843704.2049236.136606 

Random effects:
 Formula: ~1 | block
(Intercept)  Residual
StdDev:1.200732 0.9005491

Number of Observations: 12
Number of Groups: 3 

 anova(fit)
numDF denDF  F-value p-value
(Intercept) 1 9 0.002524   0.961
group   2 0 5.986678 NaN
Warning message:
In pf(q, df1, df2, lower.tail, log.p) : NaNs produced


When I do the same with a sort of 'crossed' design

 y  group block
 -1.8892392-2 1
  0.4329959 0 1
  3.2474885 2 1
 -3.7710187-2 2
 -1.6624300 0 2
  1.2584779 2 2
 -1.6813929-2 3
  1.6828940 0 3
  2.2041250 2 3
 -1.2136863-2 4
  0.7032238 0 4
  0.9012617 2 4

the call to lme() works just fine:
lme(y~group,random=~1|block)
then anova() gives me the p-value and I'm happy=)

For my issue being to simulate the power I need to have the p-value. I tried
it with lmer():
anova(lmer(y~group+(1|block)))
which works, but with no degree of freedom I don't see myself getting a
critical F value that leads to my desired power. Or am I just wrong and
there's an easy way to compute it? Or is my model formula for the
hierarchical model wrong?
So that really confuses me and with all those things I read today concerning
this problem I'm not less confused.
The problem is: I need to get it solved very quickly. So, please, if there's
someone who can help me... I'd be so grateful.

mel
-- 
View this message in context: 
http://www.nabble.com/lme%3A-NaNs-in-hierarchical-model-tp19578256p19578256.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] gbm package on 64 bit machine

2008-09-19 Thread jtf2076

I'm having trouble getting the gbm package to load on my new 64 bit machine
running xp professional OS.  I installed version 2.72 and loaded the
package, although I got an error message:

The downloaded packages are in

C:\Documents and Settings\Administrator\Local
Settings\Temp\RtmpQbYngm\downloaded_packages

updating HTML package descriptions

 fin-read.csv(c:/documents and settings/administrator/my
 documents/R/fin_sb_mat.csv)

Error: unexpected '/' in fin-read.csv(c:/

 fin-read.csv(c:/documents and settings/administrator/my
 documents/R/fin_sb_mat.csv)

 fin.tc5.lr01 - gbm.step(data=fin, 

+ 

+ gbm.x = 7:14,

+ 

+ gbm.y = 24,

+ 

+ family = bernoulli,

+ 

+ tree.complexity = 5,

+ 

+ learning.rate = 0.01,

+ 

+ bag.fraction = 0.5)

Error: could not find function gbm.step

Any ideas on what could be wrong?

John
-- 
View this message in context: 
http://www.nabble.com/gbm-package-on-64-bit-machine-tp19577991p19577991.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] ggplot2 and lattice

2008-09-19 Thread stephen sefick
I am in the process of learning lattice graphics and have looked at
ggplot2 a little.  I would like to know if there is a tutorial that
shows how to convert lattice code into ggplot code and vise versa.  I
am finally discovering the power of these two packages and would like
suggestions to lessen my learning curve.  I could not find a straight
foward answer on the internet (I may have not looked far enough) to
what a parralelle plot is used for.
thanks

-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

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

-K. Mullis

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


[R] two questions on Sweave (help in the output + warnings in the output)

2008-09-19 Thread Domenico Vistocco

Dear All,
I am working on some slides using LaTeX/Beamer and R/Sweave.
I have the two questions below (sorry if they are stupid or already 
solved but I didn't find solutions on the web).


1) Using the following code:
\begin{frame}[containsverbatim]
echo=TRUE=
help('dim')
@
\end{frame}

I have only:
 help(dim)
on the slide. Is it possible to directly include in the slide the help 
of the function?


2) Using the following code:
\begin{frame}[containsverbatim]
echo=TRUE=
1:5 + 1:3
@ 


I have in the slide:
 1:5 + 1:3
[1] 2 4 6 5 7
How can I print also the related Warning message on the slide?

Thanks in advance for the help,
domenico

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

2008-09-19 Thread hadley wickham
On Fri, Sep 19, 2008 at 3:27 PM, stephen sefick [EMAIL PROTECTED] wrote:
 I am in the process of learning lattice graphics and have looked at
 ggplot2 a little.  I would like to know if there is a tutorial that
 shows how to convert lattice code into ggplot code and vise versa.  I
 am finally discovering the power of these two packages and would like
 suggestions to lessen my learning curve.

No, but it is on my to do list.  I have this page,
http://had.co.nz/ggplot/vs-lattice.html, from a previous version of
ggplot, but most of the code no longer works.  It would be helpful if
you would look at the lattice examples and let me know what is
missing.  It wouldn't be much work to update it for ggplot2.

 I could not find a straight
 foward answer on the internet (I may have not looked far enough) to
 what a parralelle plot is used for.

A parallel coordinates plot?

Hadley


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

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


Re: [R] [R-gui] Tinn-R/Latex output

2008-09-19 Thread Frank E Harrell Jr

Mike Prager wrote:

David Carslaw [EMAIL PROTECTED] wrote:


I find Tinn-R to be an excellent editor for R, but I have one question I
have not been able to answer.
 
I wish to include some R code in Latex.  Using the Edit/Copy formatted

(to export)/TeX does provide Latex-type output.  However, there are lots
of commands such as \RAIdentifier and \RAOperator etc. that would appear
to need either a Latex package to interpret or a list of new commands
that describe font attributes etc.

My question is whether such a package exists, or is the user expected to
define their own commands to interpret them?



David,

I also find Tinn-R an excellent editor for R.

When I include R code in Latex, I use the Latex listings
package. It has a wide variety of settings for pretty-printing R
code and can be customized by the user.  I think that would be
more satisfactory in the long run than inserting Latex codes (or
having an editor insert Latex codes) to mark R language
elements.

HTH

Mike P.



The following is how I set up the listings package usage for R.  If you 
have improvements to this please pass them along. -Frank


\usepackage{listings,relsize}
%Setup for listings package
\lstloadlanguages{R}
\lstset{language=R,basicstyle=\smaller[2],commentstyle=\rmfamily\smaller,
 showstringspaces=false,%
 xleftmargin=4ex,literate={-}{{$\leftarrow$}}1 {~}{{$\sim$}}1}
\lstset{escapeinside={(*}{*)}}   % for (*\ref{ }*) inside lstlistings (S 
code)


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

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


Re: [R] ggplot2 and lattice

2008-09-19 Thread stephen sefick
yes a parallel coordinates plot- I understand that it is for
multivariate data, but I am having a hard time figuring out what it is
telling me.  Thanks for your help.

On Fri, Sep 19, 2008 at 5:02 PM, hadley wickham [EMAIL PROTECTED] wrote:
 On Fri, Sep 19, 2008 at 3:27 PM, stephen sefick [EMAIL PROTECTED] wrote:
 I am in the process of learning lattice graphics and have looked at
 ggplot2 a little.  I would like to know if there is a tutorial that
 shows how to convert lattice code into ggplot code and vise versa.  I
 am finally discovering the power of these two packages and would like
 suggestions to lessen my learning curve.

 No, but it is on my to do list.  I have this page,
 http://had.co.nz/ggplot/vs-lattice.html, from a previous version of
 ggplot, but most of the code no longer works.  It would be helpful if
 you would look at the lattice examples and let me know what is
 missing.  It wouldn't be much work to update it for ggplot2.

 I could not find a straight
 foward answer on the internet (I may have not looked far enough) to
 what a parralelle plot is used for.

 A parallel coordinates plot?

 Hadley


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




-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

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

-K. Mullis

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


Re: [R] [R-gui] Tinn-R/Latex output

2008-09-19 Thread hadley wickham
On Fri, Sep 19, 2008 at 4:05 PM, Frank E Harrell Jr
[EMAIL PROTECTED] wrote:
 Mike Prager wrote:

 David Carslaw [EMAIL PROTECTED] wrote:

 I find Tinn-R to be an excellent editor for R, but I have one question I
 have not been able to answer.
  I wish to include some R code in Latex.  Using the Edit/Copy formatted
 (to export)/TeX does provide Latex-type output.  However, there are lots
 of commands such as \RAIdentifier and \RAOperator etc. that would appear
 to need either a Latex package to interpret or a list of new commands
 that describe font attributes etc.

 My question is whether such a package exists, or is the user expected to
 define their own commands to interpret them?


 David,

 I also find Tinn-R an excellent editor for R.

 When I include R code in Latex, I use the Latex listings
 package. It has a wide variety of settings for pretty-printing R
 code and can be customized by the user.  I think that would be
 more satisfactory in the long run than inserting Latex codes (or
 having an editor insert Latex codes) to mark R language
 elements.

 HTH

 Mike P.


 The following is how I set up the listings package usage for R.  If you have
 improvements to this please pass them along. -Frank

 \usepackage{listings,relsize}
 %Setup for listings package
 \lstloadlanguages{R}
 \lstset{language=R,basicstyle=\smaller[2],commentstyle=\rmfamily\smaller,
  showstringspaces=false,%
  xleftmargin=4ex,literate={-}{{$\leftarrow$}}1 {~}{{$\sim$}}1}
 \lstset{escapeinside={(*}{*)}}   % for (*\ref{ }*) inside lstlistings (S
 code)

I have played around with:

\definecolor{comment}{rgb}{0.60, 0.60, 0.53}
\definecolor{background}{rgb}{0.97, 0.97, 1.00}
\definecolor{string}{rgb}{0.863, 0.066, 0.266}
\definecolor{number}{rgb}{0.0, 0.6, 0.6}
\definecolor{variable}{rgb}{0.00, 0.52, 0.70}
\lstset{
  basicstyle=\ttfamily,
  keywordstyle=\bfseries,
  identifierstyle=,
  commentstyle=\color{comment} \itshape,
  stringstyle=, %\color{string}
  showstringspaces=false,
  columns = fullflexible,
  backgroundcolor=\color{background},
  mathescape = true,
  escapeinside=,
  fancyvrb
}

Hadley


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

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


Re: [R] [R-gui] Tinn-R/Latex output

2008-09-19 Thread Frank E Harrell Jr

hadley wickham wrote:

On Fri, Sep 19, 2008 at 4:05 PM, Frank E Harrell Jr
[EMAIL PROTECTED] wrote:

Mike Prager wrote:

David Carslaw [EMAIL PROTECTED] wrote:


I find Tinn-R to be an excellent editor for R, but I have one question I
have not been able to answer.
 I wish to include some R code in Latex.  Using the Edit/Copy formatted
(to export)/TeX does provide Latex-type output.  However, there are lots
of commands such as \RAIdentifier and \RAOperator etc. that would appear
to need either a Latex package to interpret or a list of new commands
that describe font attributes etc.

My question is whether such a package exists, or is the user expected to
define their own commands to interpret them?


David,

I also find Tinn-R an excellent editor for R.

When I include R code in Latex, I use the Latex listings
package. It has a wide variety of settings for pretty-printing R
code and can be customized by the user.  I think that would be
more satisfactory in the long run than inserting Latex codes (or
having an editor insert Latex codes) to mark R language
elements.

HTH

Mike P.


The following is how I set up the listings package usage for R.  If you have
improvements to this please pass them along. -Frank

\usepackage{listings,relsize}
%Setup for listings package
\lstloadlanguages{R}
\lstset{language=R,basicstyle=\smaller[2],commentstyle=\rmfamily\smaller,
 showstringspaces=false,%
 xleftmargin=4ex,literate={-}{{$\leftarrow$}}1 {~}{{$\sim$}}1}
\lstset{escapeinside={(*}{*)}}   % for (*\ref{ }*) inside lstlistings (S
code)


I have played around with:

\definecolor{comment}{rgb}{0.60, 0.60, 0.53}
\definecolor{background}{rgb}{0.97, 0.97, 1.00}
\definecolor{string}{rgb}{0.863, 0.066, 0.266}
\definecolor{number}{rgb}{0.0, 0.6, 0.6}
\definecolor{variable}{rgb}{0.00, 0.52, 0.70}
\lstset{
  basicstyle=\ttfamily,
  keywordstyle=\bfseries,
  identifierstyle=,
  commentstyle=\color{comment} \itshape,
  stringstyle=, %\color{string}
  showstringspaces=false,
  columns = fullflexible,
  backgroundcolor=\color{background},
  mathescape = true,
  escapeinside=,
  fancyvrb
}

Hadley




Thanks Hadley.  Your specificatins generated a couple of syntax errors 
for me and typeset the code too large but I'd like to play with it and 
I'm glad to have it.


Frank

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

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


Re: [R] Manual to learn TCL - TK

2008-09-19 Thread Duncan Murdoch

On 19/09/2008 6:25 PM, ermimi wrote:

Hello!
Anybody knows any manual to learn TCL - TK? I need it to finish my finsish
projet.


There are a lot of books available, and the docs are included with the 
Windows distribution of R, in R_HOME/Tcl/doc/tcltk85.chm.  Not sure 
about other platforms.


Duncan Murdoch

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


Re: [R] how to keep up with R?

2008-09-19 Thread Steven McKinney
One thing that R does very well that SAS does not is
graphics - graphical portrayal of data is important,
and you can keep up with R by supplementing your
SAS analyses with R graphics.

Steve McKinney



-Original Message-
From: [EMAIL PROTECTED] on behalf of Barry Rowlingson
Sent: Fri 9/19/2008 12:36 AM
To: Wensui Liu
Cc: r-help
Subject: Re: [R] how to keep up with R?
 
2008/9/19 Wensui Liu [EMAIL PROTECTED]:
 Dear Listers,

 I've been a big fan of R since graduate school. After working in the
 industry for years, I haven't had many opportunities to use R and am mainly
 using SAS. However, I am still forcing myself really hard to stay close to R
 by reading R-help and books and writing R code by myself for fun. But by and
 by, I start realizing I have hard time to keep up with R and am afraid that
 I would totally forget how to program in R.

 I really like it and am very unwilling to give it up. Is there any idea how
 I might keep touch with R without using it in work on daily basis? I really
 appreciate it.


 How about doing some kind of presentation on R at your work? It's
possible that some of the old fossils don't even know about it at all,
and use SAS because to them the alternative is SPSS. Do some R
evangelization. Find a task that R does better than SAS (not
difficult) and illustrate that to your superiors. Then when they ask
how much a corporate R license is, you tell them it's free, or say
it'll cost them a 2% raise in your salary, or say it will cost them
your resignation if you are feeling brave!

 Sure you may be tied to SAS for some other reasons, but there's no
reason why you can't use R for other things. Work out how to get it
into your corporate framework. Encourage your colleagues to look at it
for their tasks. Enthuse.

 The good thing about training and evangelization is that at first you
don't need mad skillz at R to do it. I have trouble understanding some
of the tips on R-help (especially when do.call() is used), but you can
teach new people with a good knowledge of the basics, which you should
still have. Eventually the hope is that enough people use R at your
workplace to develop a community where everyone keeps everyone else on
their toes with R questions!

 Good luck!

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-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] selecting dataframe values that are not nulls

2008-09-19 Thread Adaikalavan Ramasamy
Ramya, you sent four near identical emails with different subject lines. 
Since the list is run by unpaid volunteers, please avoid wasting 
people's time (and yours too) with such redundancies.


Please read http://www.r-project.org/posting-guide.html and search the 
mailing lists and documentations.


Did you receive the replies to your 1st request from miltinho and Moshe?

If not, have a look at help(merge) with the all.x, all.y and all 
argument. You might also be interested in unique, is.na, list.


Regards, Adai



Rajasekaramya wrote:

Hi,

I have a dataframe with 14319rows and 9 colums. for some rows there are null
values.I want a dataframe without these null values.I wanna select only
those that have values !=NA. 


kindly let me know how to do that.

Ramya



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

2008-09-19 Thread milton ruser
Dear all,



I have a probability of presence of distribution of a species of interest

(varying from 0 to 1 in continuous form) and I have a set of points

where I know that species really occurs. But I don´t have points of absence.



So, for each true presence I know the estimated presence.

I would like to know how can I compute AUC, taking account these

Available data.



Best wishes,



Miltinho autronauta

brazil

[[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] Design lrm function

2008-09-19 Thread Frank E Harrell Jr

milicic.marko wrote:

Hi,


Is it possible to get ROC and accuracy ratio/gini straight out of the
Design package?


Thanks



The print method for lrm prints the ROC area (labeled C).  lrm does 
not print the other 2 measures you listed.  It computes a generalized 
R^2 (much more powerful than all the other measures) and rank indexes 
other than C.


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

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