Re: [R] How to manipulate the time data without the date?

2008-11-06 Thread tedzzx

The problem is that: There is some rounding problems, for example
Library(chron)
any(times("4:00:01")==times("4:00:00")+times("00:00:01")))
False

But,it should be true

ggrothendieck-2 wrote:
> 
> On Thu, Nov 6, 2008 at 12:10 PM, tedzzx <[EMAIL PROTECTED]> wrote:
>>
>> Hi,all
>>
>> I only got the time data such as:
>> tms<-c("19:30:23","18:39:10".)
>>
>> I want to manipulate this time series data. For example, plus one
>> second(or
>> minute) or minus one second
>>
>> This data only has the time(h:m:s), without the date. I know that there
>> are
>> chron package, ISOPix class and the timeDate class, but all these class
>> need
>> the input of date.
> 
> The chron package's times class does not have that restriction:
> 
>> library(chron)
>> times("10:34:21")
> [1] 10:34:21
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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/How-to-manipulate-the-time-data-without-the-date--tp20365370p20374110.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] Encoding() and strsplit()

2008-11-06 Thread Heinz Tuechler

Dear All,

Encoding() goes beyond my understanding. See the 
example. I would expect from reading the help for 
Encoding() that strsplit preserves the encoding 
for each resulting element, but for simple letters it gets lost.
Also it seems that an Encoding() cannot be 
declared for simple letters. They remain in any 
case "unknown". In paste() "latin1" seems to dominate "unknown".
What kind of characteristic of an object is the 
encoding? It does not show up as attribute and 
also str() does not give me any hint.

Where can I find some explanation regarding encoding?

Thanks

Heinz

###   Encoding() and strsplit
u <- 'abcäöü'
Encoding(u)
[1] "latin1"
Encoding(u) <- 'latin1' # to be sure about encoding
us <- strsplit(u, '')[[1]] # split in single strings
Encoding(us)
[1] "unknown" "unknown" "unknown" "latin1"  "latin1"  "latin1"
Encoding(us) <- rep('latin1', length(us))
Encoding(us)
[1] "unknown" "unknown" "unknown" "latin1"  "latin1"  "latin1"
pus <- paste(us[1], us[5], sep='')
Encoding(pus)
[1] "latin1"

Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = Patched
 major = 2
 minor = 8.0
 year = 2008
 month = 11
 day = 04
 svn rev = 46830
 language = R
 version.string = R version 2.8.0 Patched (2008-11-04 r46830)

Windows XP (build 2600) Service Pack 2

Locale:
LC_COLLATE=German_Austria.1252;LC_CTYPE=German_Austria.1252;LC_MONETARY=German_Austria.1252;LC_NUMERIC=C;LC_TIME=German_Austria.1252

Search Path:
 .GlobalEnv, package:stats, package:graphics, 
package:grDevices, package:utils, 
package:datasets, package:methods, Autoloads, package:base


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

2008-11-06 Thread Duarte
Hi, before aplied, the function likfit, for one geodata class:
or.geo.lf<-likfit(or.geo,cov.model="matern",ini.cov.pars=c(2.5,1),kappa=3,fix.kappa=FALSE,nugget=1.2,lambda=0.019,fix.lambda=FALSE,hessian=TRUE)

got this with a summary
> summary(or.geo.lf)
Summary of the parameter estimation
---
Estimation method: maximum likelihood

Parameters of the mean component (trend):
  beta
5.0808

Parameters of the spatial component:
   correlation function: matern
  (estimated) variance parameter sigmasq (partial sill) =  0
  (estimated) cor. fct. parameter phi (range parameter)  =  0
  (estimated) extra parameter kappa = 2.422
   anisotropy parameters:
  (fixed) anisotropy angle = 0  ( 0 degrees )
  (fixed) anisotropy ratio = 1

Parameter of the error component:
  (estimated) nugget =  1.859

Transformation parameter:
  (estimated) Box-Cox parameter = -0.0473

Practical Range with cor=0.05 for asymptotic range: 0.339

Maximised Likelihood:
   log.L n.params  AIC  BIC
  "-900"  "6"   "1812"   "1829"

non spatial model:
   log.L n.params  AIC  BIC
  "-900"  "3"   "1806"   "1814"

Call:
likfit(geodata = or.geo, ini.cov.pars = c(2.5, 1), nugget = 1.2,
fix.kappa = FALSE, kappa = 3, fix.lambda = FALSE, lambda = 0.019,
cov.model = "matern", hessian = TRUE)



this two 0s is it ok or not?
(estimated) variance parameter sigmasq (partial sill) =  0
(estimated) cor. fct. parameter phi (range parameter)  =  0

Thnks

-- 
Freddy Duarte Muñoz
Licenciado en Ciencias
Biólogo Marino
Concepción
Chile
(56 - 82454357)
(56 - 41- 2738544)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Confidence limits for the parameter of the Poisson distribution

2008-11-06 Thread Hoang Trong Minh Tuan
Thank you two of you very much for your help,
  I found the way to solve my problem.

Best wishes,
Tuan.

On Thu, Nov 6, 2008 at 4:14 PM, Rolf Turner <[EMAIL PROTECTED]> wrote:

>
> On 7/11/2008, at 9:26 AM, Hoang Trong Minh Tuan wrote:
>
>  Hi all,
>>  So far I only know one way to get the confidence limit for the Poisson
>> distribution is to use the look-up table given by the 2 parameter (the
>> number of observation x and the confidence level, e.g. 95%) and the table
>> is
>> limit by the maximum number of observations (x <= 50).
>>  I know the formula to compute the CI, however, mathematically it is not
>> easy to do it. So, anyone know an R function to do this. Thanks
>>
>> Tuan.
>>
>
> You may find the URL
>
>http://www.math.mcmaster.ca/peter/s743/poissonalpha.html
>
> useful.
>
>cheers,
>
>Rolf Turner
>
> P.S.  The foregoing URL discusses the issues in terms of a *single*
> observation.  Note that if X_1, ..., X_n are i.i.d. Poisson(lambda)
> then Y = X_1 + ... + X_n is Poisson(n*lambda).
>
> Note that the ``exact'' confidence limits are very conservative.
>
>R. T.
>
> ##
> Attention:This e-mail message is privileged and confidential. If you are
> not theintended recipient please delete the message and notify the
> sender.Any views or opinions presented are solely those of the author.
>
> This e-mail has been scanned and cleared by MailMarshal
> www.marshalsoftware.com
> ##
>



-- 
Hoang Trong Minh Tuan
PhD Student - Bioinformatics&Computational Biology
George Mason University,Fairfax, VA, US
HP: 703-473-1395

[[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] kruskal test in R

2008-11-06 Thread C.H.
Are you dealing with some rainfall data for your schoolwork?
Few days ago, somebody asked exactly the same question.

read this one to know how to calculate the H value (An Alternative
Formula for the Calculation of H)
http://faculty.vassar.edu/lowry/ch14a.html

You can calculate the rank by rank()

> rain <- c(1,4,7,8,10,10,20,20,30,51)
> gp <- c(1,1,1,2,2,2,2,3,3,3)
> rain.rank <- rank(rain)

You can extract the rank of each gp by

> rain.rank[gp==1]

and the total rank for each gp (Tg) by

> sum(rain.rank[gp==1])

You can square it using the usual ^2

Once you can obtain the H value, you can calculate the p using pchisq command.
you can use ?pchisq to read the help file.

If you still don't know how to do it, please ask your tutor.

On Fri, Nov 7, 2008 at 8:53 AM, Pang Iverson <[EMAIL PROTECTED]> wrote:
>
> Hi,
> i have a question in R,
> How and what command you need to do to run a kruskal-wallis test without the 
> built in command 'kruskal.test'?
> many thanks.
> _
>
>
>[[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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] chi square table

2008-11-06 Thread Berwin A Turlach
G'day Cruz,

On Fri, 7 Nov 2008 09:47:47 +0800
cruz <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> How do we get the value of a chi square as we usually look up on the
> table on our text book?
> 
> i.e. Chi-square(0.01, df=8), the text book table gives 20.090
> 
> > dchisq(0.01, df=8)
> [1] 1.036471e-08
> > pchisq(0.01, df=8)
> [1] 2.593772e-11
> > qchisq(0.01, df=8)
> [1] 1.646497
> >
> 
> nono of them give me 20.090

The value that your textbook denotes, presumably, with chi^2_0.01 (or
some similar notatation) is in fact the 0.99 quantile of the chi-square
distribution; which R readily calculates:

R> qchisq(0.99, df=8)
[1] 20.09024


That's the problem with introductory textbook whose author think they
do the students a favour by using notation as z_alpha, z_0.01,
z_(alpha/2) instead of z_(1-alpha), z_0.99, z_(1-alpha/2),
respectively.  In my opinion this produces in the long run only
more confusion and does not help students at all.  It just panders to
intellectual laziness of (some) students and shows a great deal of
confusion on the side of the authors.
I would search another textbook


Cheers,

Berwin

=== Full address =
Berwin A TurlachTel.: +65 6516 4416 (secr)
Dept of Statistics and Applied Probability+65 6516 6650 (self)
Faculty of Science  FAX : +65 6872 3919   
National University of Singapore 
6 Science Drive 2, Blk S16, Level 7  e-mail: [EMAIL PROTECTED]
Singapore 117546http://www.stat.nus.edu.sg/~statba

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

2008-11-06 Thread Simon Blomberg
> qchisq(0.01, df=8, lower.tail=FALSE)
[1] 20.09024
> 

See ?dchisq


On Fri, 2008-11-07 at 09:47 +0800, cruz wrote:
> Hi,
> 
> How do we get the value of a chi square as we usually look up on the
> table on our text book?
> 
> i.e. Chi-square(0.01, df=8), the text book table gives 20.090
> 
> > dchisq(0.01, df=8)
> [1] 1.036471e-08
> > pchisq(0.01, df=8)
> [1] 2.593772e-11
> > qchisq(0.01, df=8)
> [1] 1.646497
> >
> 
> nono of them give me 20.090
> 
> Thanks,
> cruz
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
-- 
Simon Blomberg, BSc (Hons), PhD, MAppStat. 
Lecturer and Consultant Statistician 
Faculty of Biological and Chemical Sciences 
The University of Queensland 
St. Lucia Queensland 4072 
Australia
Room 320 Goddard Building (8)
T: +61 7 3365 2506
http://www.uq.edu.au/~uqsblomb
email: S.Blomberg1_at_uq.edu.au

Policies:
1.  I will NOT analyse your data for you.
2.  Your deadline is your problem.

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.

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

2008-11-06 Thread Erik Iverson

> qchisq(0.01, df = 8, lower.tail = FALSE)
[1] 20.09024


cruz wrote:

Hi,

How do we get the value of a chi square as we usually look up on the
table on our text book?

i.e. Chi-square(0.01, df=8), the text book table gives 20.090


dchisq(0.01, df=8)

[1] 1.036471e-08

pchisq(0.01, df=8)

[1] 2.593772e-11

qchisq(0.01, df=8)

[1] 1.646497

nono of them give me 20.090

Thanks,
cruz

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

2008-11-06 Thread David Scott

On Fri, 7 Nov 2008, cruz wrote:


Hi,

How do we get the value of a chi square as we usually look up on the
table on our text book?

i.e. Chi-square(0.01, df=8), the text book table gives 20.090


dchisq(0.01, df=8)

[1] 1.036471e-08

pchisq(0.01, df=8)

[1] 2.593772e-11

qchisq(0.01, df=8)

[1] 1.646497




nono of them give me 20.090

Thanks,
cruz





qchisq(0.99, df=8)

[1] 20.09024

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

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

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


[R] chi square table

2008-11-06 Thread cruz
Hi,

How do we get the value of a chi square as we usually look up on the
table on our text book?

i.e. Chi-square(0.01, df=8), the text book table gives 20.090

> dchisq(0.01, df=8)
[1] 1.036471e-08
> pchisq(0.01, df=8)
[1] 2.593772e-11
> qchisq(0.01, df=8)
[1] 1.646497
>

nono of them give me 20.090

Thanks,
cruz

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


[R] How to test for weak exogenity and specify long-run relation with r=2 from Bill

2008-11-06 Thread Xianchun Liao
I am an R beginner and trying to run a market model using supply and
demand in R framework.

 

First, I conducted cointegration test.  The results showed that there
were two ranks.

 

Now I need to test weak exogenity for each series of the seven
variables(my data have 7 variables).

 

Then I need to specify the two cointegration vectors: one for demand
where some variable will be zero; the other one for supply where some
variables will be zero.

 

SO, how to  write a R code to implement the procedure.

 

Thanks,

 

 

Bill

 


[[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] 2^2 factorial design question

2008-11-06 Thread Edna Bell
Dear R Gurus:

How do you put together a 2^2 (or even 2^k) factorial problem, please?

Since you have 2 levels for A and B, do you put in "A+" and "A-" as
factors, please?

Thanks,
Edna Bell

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


[R] kruskal test in R

2008-11-06 Thread Pang Iverson

Hi,
i have a question in R,
How and what command you need to do to run a kruskal-wallis test without the 
built in command 'kruskal.test'?
many thanks.
_


[[alternative HTML version deleted]]

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


Re: [R] replicate and as.matrix: different behaviour between batch and non-batch mode

2008-11-06 Thread Oliver Bandel
Hi,

Zitat von "Charles C. Berry" <[EMAIL PROTECTED]>:

> On Thu, 6 Nov 2008, Oliver Bandel wrote:
>
> > Hello Charles,
> >
>
> [snip]
>
> >> dim( as.matrix(replicate(10, sample(x, 3) )  ) )
> > [1]  3 10
> >> dim( as.matrix(replicate(10, sample(x, 2) )  ) )
> > [1]  2 10
> >> dim( as.matrix(replicate(10, sample(x, 1) )  ) )
> > [1] 10  1
> >>
> > =
> >
> >
> > So, the behaviour is the same...
> > ...but is not really that fine. :(
> >
> > ...how could I avoid the necessity of the transposition
> > of the matrix in the case of only one sample?
>
>
> use
>   matrix( your.result , nc = n.replicates )
>
> or
>
>   dim( your.result ) <- c( n.samples, n.replicates )
[...]

Aaaah, OK!

Yes, using dim() makes sense.

Good hint!

Thanks!


Ciao,
   Oliver

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

2008-11-06 Thread Heinz Tuechler

Dear Prof.Ripley!

Thank you very much for your attention. In the 
given example Encoding(), or the encoding 
parameter of read.csv solve the problem. I hope 
your patch will solve also the problem, when I 
read a spss file by spss.get(), since this 
function has no encoding parameter and my real problem originated there.


many thanks

Heinz Tüchler

At 23:51 06.11.2008, you wrote:
Look at Encoding() on your two strings.  The 
results are different, and this seems to be the 
root of the problem.  Adding encoding="latin1" 
to the read.csv call is a workaround.


It looks like there is a problem in the use of 
the CHARSXP cache: if I save the session then x0 
== x becomes true when I reload it, even though the encodings remain different.


I've found the immediate cause and will change this in R-patched shortly.

On Thu, 6 Nov 2008, Heinz Tuechler wrote:


Dear All!

Reading character strings containing an 
"umlaut" from a csv-file I find a (to me) 
surprising behaviour in R 2.8.0, that I did not notice in R 2.7.2.

A comparison by "==" results in FALSE, while grep does find the aggreement.
See the example below.
The crucial line is x=="div 1-2 Veränderungen", 
with the result [1] FALSE in R 2.8.0 but

[1] TRUE in R 2.7.2.

Thank you in advance for your help

Heinz Tüchler

# in R 2.8.0 patched

x0 <- "div 1-2 Veränderungen" # define a character string

write.csv(x0, 'chr.csv', row.names=FALSE) # write a csv-file with one line
rm(x0)

x <- read.csv('chr.csv', skip=0, header=TRUE, 
as.is=TRUE)$x # read in csv-file

x
x=="div 1-2 Veränderungen"

[1] FALSE

grep("div 1-2 Veränderungen", x)

[1] 1

grep("div 1-2 Veränderungen", x, value=TRUE)

[1] "div 1-2 Veränderungen"


unlink('chr.csv') # delete file

Version:
platform = i386-pc-mingw32
arch = i386
os = mingw32
system = i386, mingw32
status = Patched
major = 2
minor = 8.0
year = 2008
month = 11
day = 04
svn rev = 46830
language = R
version.string = R version 2.8.0 Patched (2008-11-04 r46830)

Windows XP (build 2600) Service Pack 2

Locale:
LC_COLLATE=German_Austria.1252;LC_CTYPE=German_Austria.1252;LC_MONETARY=German_Austria.1252;LC_NUMERIC=C;LC_TIME=German_Austria.1252

Search Path:
.GlobalEnv, package:stats, package:graphics, 
package:grDevices, package:utils, 
package:datasets, package:methods, Autoloads, package:base



# in R 2.7.2 patched


x0 <- "div 1-2 Veränderungen" # define a character string

write.csv(x0, 'chr.csv', row.names=FALSE) # write a csv-file with one line
rm(x0)

x <- read.csv('chr.csv', skip=0, header=TRUE, 
as.is=TRUE)$x # read in csv-file

x
x=="div 1-2 Veränderungen"

[1] TRUE

grep("div 1-2 Veränderungen", x)

[1] 1

grep("div 1-2 Veränderungen", x, value=TRUE)

[1] "div 1-2 Veränderungen"


unlink('chr.csv') # delete file

Version:
platform = i386-pc-mingw32
arch = i386
os = mingw32
system = i386, mingw32
status = Patched
major = 2
minor = 7.2
year = 2008
month = 09
day = 02
svn rev = 46486
language = R
version.string = R version 2.7.2 Patched (2008-09-02 r46486)

Windows XP (build 2600) Service Pack 2

Locale:
LC_COLLATE=German_Austria.1252;LC_CTYPE=German_Austria.1252;LC_MONETARY=German_Austria.1252;LC_NUMERIC=C;LC_TIME=German_Austria.1252

Search Path:
.GlobalEnv, package:stats, package:graphics, 
package:grDevices, package:utils, 
package:datasets, package:methods, Autoloads, package:base


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


--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595


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


Re: [R] replacing values in a vector

2008-11-06 Thread Rolf Turner


Boy are you confused.  This has nothing at all to do with substitution.

Instead do

test <- with(fc,ave.fc[match(diff_mirs_list,Probe)])

cheers,

Rolf Turner

On 7/11/2008, at 11:46 AM, Iain Gallagher wrote:


Hello list.

I have a vector of values:

eg


head(diff_mirs_list)
[1] "hsa-miR-26b" "hsa-miR-26b" "hsa-miR-23a" "hsa-miR-27b" "hsa- 
miR-29a"

[6] "hsa-miR-29b"

and I would like to conditionally replace each value in this vector  
with a number defined in a dataframe:



fc

 Probe ave.fc
1   hsa-let-7a   1.28
2  hsa-miR-100   1.47
3  hsa-miR-125a-5p   1.31
4   hsa-miR-140-3p   1.28
5  hsa-miR-143   1.98
6  hsa-miR-193a-3p   1.37
7 hsa-miR-193b   1.48
8  hsa-miR-195   1.16
9  hsa-miR-214   1.22
10 hsa-miR-23a   1.21
11 hsa-miR-26b   1.13
12 hsa-miR-27b   1.37
13 hsa-miR-29a   1.24
14 hsa-miR-29b   1.69
15 hsa-miR-30b   1.16
16 hsa-miR-424   1.42
17  hsa-miR-768-3p   1.48
18  hsa-miR-886-3p   1.43
19 hsa-miR-933   1.23

ie every hsa-let-7a in the diff_mirs_list is replaced by 1.28, hsa- 
miR-100 by 1.47 etc etc


I have tried to make a loop to use gsub eg


for (i in 1:nrow(fc)){

+ test<-gsub(fc[i,1], fc[i,2], diff_mirs_list)
}

but this obviously passes the unchanged vector to gsub each time  
and so I get back my 'test' vector with only hsa-miR-933 changed.  
Could someone help me out with this please.


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

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


Re: [R] PCA

2008-11-06 Thread Noela Sánchez
Thanks, I got to do it.,



2008/11/6 Pedro Mardones <[EMAIL PROTECTED]>

> try prcomp instead of princomp
>
> On Thu, Nov 6, 2008 at 3:20 PM, Lucke, Joseph F
> <[EMAIL PROTECTED]> wrote:
> > Neola
> > I'm a bit rusty on this, but I believe you can conduct on singular-value
> decomposition on the 436 by 518 matrix.  The squares of your singular values
> (max of 436, 518-436 will be zero) will be your eigenvalues, the same as in
> the PC analysis.  The post-eigenvectors will be your components.  As I have
> said, my knowledge is not completely trustworthy at this point, but SVD
> would be worth looking into.
> > Joe
> >
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On Behalf Of Noela Sánchez
> > Sent: Thursday, November 06, 2008 1:10 PM
> > To: stephen sefick
> > Cc: r-help@r-project.org
> > Subject: Re: [R] PCA
> >
> > My matrix have 436 registers and 518 variables. I need to do a PCA
> analyst.
> >
> > Usually I use princomp command to perform PCA analyst, but this time i
> can't because of my variables are more than my registers.
> >
> > 2008/11/6 stephen sefick <[EMAIL PROTECTED]>
> >
> >> would you please provide a dummy example that explains your problem.
> >> Then maybe I can help you.
> >> thanks
> >>
> >> Stephen
> >>
> >> On Thu, Nov 6, 2008 at 1:42 PM, Noela Sánchez <[EMAIL PROTECTED]>
> wrote:
> >> > I need perform PCA analyst with a matrix with more variables than
> units.
> >> >
> >> > The princomp command don't match with this matrix.
> >> >
> >> > Anybody knows a good command to do it?
> >> >
> >> > --
> >> > Noela
> >> >
> >> >[[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
>  >> osting-guide.html>
> >> > and provide commented, minimal, self-contained, reproducible code.
> >> >
> >>
> >>
> >>
> >> --
> >> Stephen Sefick
> >> Research Scientist
> >> Southeastern Natural Sciences Academy
> >>
> >> Let's not spend our time and resources thinking about things that are
> >> so little or so large that all they really do for us is puff us up and
> >> make us feel like gods.  We are mammals, and have not exhausted the
> >> annoying little problems of being mammals.
> >>
> >>-K.
> >> Mullis
> >>
> >
> >
> >
> > --
> > Noela
> > Grupo de Recursos Marinos y Pesquerías
> > Universidad de A Coruña
> >
> >[[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.
> >
>



-- 
Noela
Grupo de Recursos Marinos y Pesquerías
Universidad de A Coruña

[[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] Umlaut read from csv-file

2008-11-06 Thread Prof Brian Ripley
Look at Encoding() on your two strings.  The results are different, and 
this seems to be the root of the problem.  Adding encoding="latin1" to the 
read.csv call is a workaround.


It looks like there is a problem in the use of the CHARSXP cache: if I 
save the session then x0 == x becomes true when I reload it, even though 
the encodings remain different.


I've found the immediate cause and will change this in R-patched shortly.

On Thu, 6 Nov 2008, Heinz Tuechler wrote:


Dear All!

Reading character strings containing an "umlaut" from a csv-file I find a (to 
me) surprising behaviour in R 2.8.0, that I did not notice in R 2.7.2.

A comparison by "==" results in FALSE, while grep does find the aggreement.
See the example below.
The crucial line is x=="div 1-2 Veränderungen", with the result [1] FALSE in 
R 2.8.0 but

[1] TRUE in R 2.7.2.

Thank you in advance for your help

Heinz Tüchler

# in R 2.8.0 patched

x0 <- "div 1-2 Veränderungen" # define a character string

write.csv(x0, 'chr.csv', row.names=FALSE) # write a csv-file with one line
rm(x0)

x <- read.csv('chr.csv', skip=0, header=TRUE, as.is=TRUE)$x # read in 
csv-file

x
x=="div 1-2 Veränderungen"

[1] FALSE

grep("div 1-2 Veränderungen", x)

[1] 1

grep("div 1-2 Veränderungen", x, value=TRUE)

[1] "div 1-2 Veränderungen"


unlink('chr.csv') # delete file

Version:
platform = i386-pc-mingw32
arch = i386
os = mingw32
system = i386, mingw32
status = Patched
major = 2
minor = 8.0
year = 2008
month = 11
day = 04
svn rev = 46830
language = R
version.string = R version 2.8.0 Patched (2008-11-04 r46830)

Windows XP (build 2600) Service Pack 2

Locale:
LC_COLLATE=German_Austria.1252;LC_CTYPE=German_Austria.1252;LC_MONETARY=German_Austria.1252;LC_NUMERIC=C;LC_TIME=German_Austria.1252

Search Path:
.GlobalEnv, package:stats, package:graphics, package:grDevices, 
package:utils, package:datasets, package:methods, Autoloads, package:base



# in R 2.7.2 patched


x0 <- "div 1-2 Veränderungen" # define a character string

write.csv(x0, 'chr.csv', row.names=FALSE) # write a csv-file with one line
rm(x0)

x <- read.csv('chr.csv', skip=0, header=TRUE, as.is=TRUE)$x # read in 
csv-file

x
x=="div 1-2 Veränderungen"

[1] TRUE

grep("div 1-2 Veränderungen", x)

[1] 1

grep("div 1-2 Veränderungen", x, value=TRUE)

[1] "div 1-2 Veränderungen"


unlink('chr.csv') # delete file

Version:
platform = i386-pc-mingw32
arch = i386
os = mingw32
system = i386, mingw32
status = Patched
major = 2
minor = 7.2
year = 2008
month = 09
day = 02
svn rev = 46486
language = R
version.string = R version 2.7.2 Patched (2008-09-02 r46486)

Windows XP (build 2600) Service Pack 2

Locale:
LC_COLLATE=German_Austria.1252;LC_CTYPE=German_Austria.1252;LC_MONETARY=German_Austria.1252;LC_NUMERIC=C;LC_TIME=German_Austria.1252

Search Path:
.GlobalEnv, package:stats, package:graphics, package:grDevices, 
package:utils, package:datasets, package:methods, Autoloads, package:base


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



--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] replacing values in a vector

2008-11-06 Thread Iain Gallagher
Hello list.

I have a vector of values:

eg

> head(diff_mirs_list)
[1] "hsa-miR-26b" "hsa-miR-26b" "hsa-miR-23a" "hsa-miR-27b" "hsa-miR-29a"
[6] "hsa-miR-29b"

and I would like to conditionally replace each value in this vector with a 
number defined in a dataframe:

> fc
 Probe ave.fc
1   hsa-let-7a   1.28
2  hsa-miR-100   1.47
3  hsa-miR-125a-5p   1.31
4   hsa-miR-140-3p   1.28
5  hsa-miR-143   1.98
6  hsa-miR-193a-3p   1.37
7 hsa-miR-193b   1.48
8  hsa-miR-195   1.16
9  hsa-miR-214   1.22
10 hsa-miR-23a   1.21
11 hsa-miR-26b   1.13
12 hsa-miR-27b   1.37
13 hsa-miR-29a   1.24
14 hsa-miR-29b   1.69
15 hsa-miR-30b   1.16
16 hsa-miR-424   1.42
17  hsa-miR-768-3p   1.48
18  hsa-miR-886-3p   1.43
19 hsa-miR-933   1.23

ie every hsa-let-7a in the diff_mirs_list is replaced by 1.28, hsa-miR-100 by 
1.47 etc etc

I have tried to make a loop to use gsub eg

> for (i in 1:nrow(fc)){
+ test<-gsub(fc[i,1], fc[i,2], diff_mirs_list)
}

but this obviously passes the unchanged vector to gsub each time and so I get 
back my 'test' vector with only hsa-miR-933 changed. Could someone help me out 
with this please. 

Thanks

Iain

> sessionInfo()
R version 2.8.0 (2008-10-20) 
i486-pc-linux-gnu 

locale:
LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=C

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

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


Re: [R] PCA

2008-11-06 Thread Pedro Mardones
try prcomp instead of princomp

On Thu, Nov 6, 2008 at 3:20 PM, Lucke, Joseph F
<[EMAIL PROTECTED]> wrote:
> Neola
> I'm a bit rusty on this, but I believe you can conduct on singular-value 
> decomposition on the 436 by 518 matrix.  The squares of your singular values 
> (max of 436, 518-436 will be zero) will be your eigenvalues, the same as in 
> the PC analysis.  The post-eigenvectors will be your components.  As I have 
> said, my knowledge is not completely trustworthy at this point, but SVD would 
> be worth looking into.
> Joe
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Noela Sánchez
> Sent: Thursday, November 06, 2008 1:10 PM
> To: stephen sefick
> Cc: r-help@r-project.org
> Subject: Re: [R] PCA
>
> My matrix have 436 registers and 518 variables. I need to do a PCA analyst.
>
> Usually I use princomp command to perform PCA analyst, but this time i can't 
> because of my variables are more than my registers.
>
> 2008/11/6 stephen sefick <[EMAIL PROTECTED]>
>
>> would you please provide a dummy example that explains your problem.
>> Then maybe I can help you.
>> thanks
>>
>> Stephen
>>
>> On Thu, Nov 6, 2008 at 1:42 PM, Noela Sánchez <[EMAIL PROTECTED]> wrote:
>> > I need perform PCA analyst with a matrix with more variables than units.
>> >
>> > The princomp command don't match with this matrix.
>> >
>> > Anybody knows a good command to do it?
>> >
>> > --
>> > Noela
>> >
>> >[[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> osting-guide.html>
>> > and provide commented, minimal, self-contained, reproducible code.
>> >
>>
>>
>>
>> --
>> Stephen Sefick
>> Research Scientist
>> Southeastern Natural Sciences Academy
>>
>> Let's not spend our time and resources thinking about things that are
>> so little or so large that all they really do for us is puff us up and
>> make us feel like gods.  We are mammals, and have not exhausted the
>> annoying little problems of being mammals.
>>
>>-K.
>> Mullis
>>
>
>
>
> --
> Noela
> Grupo de Recursos Marinos y Pesquerías
> Universidad de A Coruña
>
>[[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Looking for suggestions on how to debug pvm/snow proc's

2008-11-06 Thread Peter Waltman
Hi All -

I'm running a faily long script that uses rpvm & snowFT to spawn off
multiple processes with the 'clusterApplyFT' function.

Specifically, what happens is that the head node generates a number of seed
clusters that are then spawned off to the pvm cluster (in this case, nodes
on a 4 dual-core machine) using clusterApplyFT to apply a function to each
seed cluster that optimizes each seed cluster and returns the new, optimized
clusters.

In some cases, however, clusterApplyFT will return try-error's for some of
the clusters.  Since it's a try-error, I know there's no way to get a
traceback (I've tried using clusterApplyFT to call traceback with no luck),
but even when I switch to snow instead of snowFT, I still can't figure out a
way to get a traceback for the failed clusters.

Any suggestions?

Thanks!

Peter

[[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] Estimating mean and standard deviation of lognormal distribution between two points

2008-11-06 Thread Jeremy Beaulieu
This is more of a statistical question.  Let's say I have two numbers.  One
is a lower bound and the other is a point estimate to the right of the lower
bound.  Now, let's say I want to be able to estimate the mean and standard
deviation of a lognormal distribution, where 95% of the density falls within
the range of the lower bound and the point estimate.  Concomitantly, can an
exponential distribution be described in the same fashion?

Any help would be greatly appreciated.

JB

[[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] Strang line while plotting failure curves

2008-11-06 Thread Frank E Harrell Jr

Lu, Jiang wrote:
Thank you very much, Frank. I installed Design package and tried 
survplot().
 
#R code

 
survplot(testfit,time.inc=365.25,xaxt='n',xlim=c(0,1826.25),ylim=c(0,1),conf='none',
  fun=function(y)1-y,label.curves=list(keys=c('Med','Rev')),
  abbrev.label=TRUE,n.risk=TRUE)
# End of R code
 
I have achieved my goal with the 'fun' argument you advised. But I have 
a difficult time to do the following fine tune.
 
1. The X axis scale was labeled as 'Days'. I would like something like 
'xscale=365.25' in plot.survfit to put time into Years and label the 
ticks from 0 to 5, instead of from 0 to 1826.25 by each 365.25 
increment. I tried xaxt='n' as you can see in the code above. Then I 
noticed that xaxt='n' only work for plot(survfit), not in survplot(). 
Any advice how to change the tick label using survplot()?


There are options to do all that, described in the documentation.

 
2. The n.risk was beautifully printed for each specified time point 
along the x axis. However, since I am plotting the failure rate, the 
n.risk looks busy with the failure rate curves. Is there a way to move 
the n.risk to the top of the plot where there are lots of space?


May be best to move it to the bottom margin.  See the help file.

 
3. I also tried label.curves=list(). It is very convenient. The curves 
are labeled and the legend is created as well. Could I only keep the 
curve label and get rid of the legend since the legend is not so 
necessary once the curve is labeled. How do you think?


Should be options for that too.

Frank

 
I really appreciate any help you give.
 
Best regards,
 
Jiang Lu
 
Statistician

Department of Epidemiology
University of Pittsburgh


 
On Thu, Nov 6, 2008 at 1:21 PM, Frank E Harrell Jr 
<[EMAIL PROTECTED] > wrote:


Lu, Jiang wrote:

Dear R helper,

I encountered a problem when I tried to plot the cumulative
failure rate
(i.e. 1 - survival probability). I have used the following code
to plot. The
scenario is that patients are randomized to different treatment
arm (rev in
the code), the PCI revascularization was monitored over 5 years.

#R code
 testfit <- survfit(Surv(pcifu,pci)~rev,data=subproc)
 testfit$surv <- 1 - testfit$surv
 testfail <- plot(testfit, mark.time=FALSE,col=1:2,
main='Failure Rate')
#End of R code

I arbitarily replaced testfit$surv by computing 1 minus the original
survival rate. So far so good. However, when I plot the manipulated
"testfit", there is a vertical line plotted at x=0, y=0:1. I checked
testfit$time and testfit$surv, nothing weird there. I am very
confused where
the vertical line at starting point of time 0 came from. How can
I get rid
of it?

Would you pleae help me with this? Thanks a lot!

Jiang


Also see the survplot.* functions in the Design package and their
fun argument, e.g., fun=function(y)1-y

Frank

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



-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine

Department of Biostatistics   Vanderbilt University





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


[R] nls: Fitting two models at once?

2008-11-06 Thread Martin Ballaschk
Hello,

I'm still a newbie user and struggling to automate some analyses from
SigmaPlot using R. R is a great help for me so far!

But the following problem makes me go nuts.

I have two spectra, both have to be fitted to reference data. Problem: the
both spectra are connected in some way: the stoichiometry of coefficients
"cytf.v"/"cytb.v" is 1/2.
{{In the SigmaPlot workflow one has to copy the two spectra into one column
beneath each other and the  two spectra are somehow treated as one curve -
like in http://home.arcor.de/ballaschk/cytbf-help/sigmaplot%20formula.png}}

Can anybody help? :(

I tried to condense everything to the "minimum" R script below to give an
impression of what I'm talking about.

Martin




# "Minimal" R script reading remote data for convenience

### READ IN DATA
# first spectrum
asfe <- read.table("http://home.arcor.de/ballaschk/cytbf-help/asfe.csv";)[, 1];
# second spectrum
dias <- read.table("http://home.arcor.de/ballaschk/cytbf-help/dias.csv";)[, 1];

# reference data for fit, wavelength = wl
ref <- read.table("http://home.arcor.de/ballaschk/cytbf-help/reference.csv";,
sep="\t", dec=".", header=T);
attach(ref);

### FITTING, problem: 2*cytf.v == cytb.v

# fit first spectrum to two reference spectra
asfe.fit <-
nls(
asfe ~ (cytf.v * 28) * CYTF + hp.v * B559HP,
start = list(cytf.v = 0.5, hp.v = 0.03) # arbitrary
);

# fit second spectrum to three reference spectra
dias.fit <-
nls(
dias ~ (cytb.v * 24.6 * 2) * CYTB6 + lp.v * B559LP + c550.v * C550,
start = list(cytb.v = 1, lp.v = 1, c550.v = 1) # arbitrary
);


# draw stuff
plot(
1, 2,
type="n",
xlim = c(540, 575),
ylim=c(-0.002, 0.008),
);

# first spectrum and fit
lines(wl, asfe, type="b", pch=19); # solid circles
lines(wl, fitted(asfe.fit), col = "red");

# second spectrum and fit
lines(wl, dias, type="b");
lines(wl, fitted(dias.fit), col = "blue");

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Confidence limits for the parameter of the Poisson distribution

2008-11-06 Thread Rolf Turner


On 7/11/2008, at 9:26 AM, Hoang Trong Minh Tuan wrote:


Hi all,
  So far I only know one way to get the confidence limit for the  
Poisson

distribution is to use the look-up table given by the 2 parameter (the
number of observation x and the confidence level, e.g. 95%) and the  
table is

limit by the maximum number of observations (x <= 50).
  I know the formula to compute the CI, however, mathematically it  
is not

easy to do it. So, anyone know an R function to do this. Thanks

Tuan.


You may find the URL

http://www.math.mcmaster.ca/peter/s743/poissonalpha.html

useful.

cheers,

Rolf Turner

P.S.  The foregoing URL discusses the issues in terms of a *single*
observation.  Note that if X_1, ..., X_n are i.i.d. Poisson(lambda)
then Y = X_1 + ... + X_n is Poisson(n*lambda).

Note that the ``exact'' confidence limits are very conservative.

R. T.

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

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


Re: [R] Confidence limits for the parameter of the Poisson distribution

2008-11-06 Thread Charles C. Berry

On Thu, 6 Nov 2008, Hoang Trong Minh Tuan wrote:


Hi all,
 So far I only know one way to get the confidence limit for the Poisson
distribution is to use the look-up table given by the 2 parameter (the
number of observation x and the confidence level, e.g. 95%) and the table is
limit by the maximum number of observations (x <= 50).
 I know the formula to compute the CI, however, mathematically it is not
easy to do it. So, anyone know an R function to do this. Thanks



A 'marriage-of-convenience' between uniroot() and ppois() should do it.

HTH,

Chuck




Tuan.

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



Charles C. Berry(858) 534-2098
Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]  UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

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

2008-11-06 Thread Heinz Tuechler

Dear All!

Reading character strings containing an "umlaut" 
from a csv-file I find a (to me) surprising 
behaviour in R 2.8.0, that I did not notice in R 2.7.2.

A comparison by "==" results in FALSE, while grep does find the aggreement.
See the example below.
The crucial line is x=="div 1-2 Veränderungen", 
with the result [1] FALSE in R 2.8.0 but

[1] TRUE in R 2.7.2.

Thank you in advance for your help

Heinz Tüchler

# in R 2.8.0 patched

x0 <- "div 1-2 Veränderungen" # define a character string

write.csv(x0, 'chr.csv', row.names=FALSE) # write a csv-file with one line
rm(x0)

x <- read.csv('chr.csv', skip=0, header=TRUE, as.is=TRUE)$x # read in csv-file
x
x=="div 1-2 Veränderungen"
> [1] FALSE
grep("div 1-2 Veränderungen", x)
> [1] 1
grep("div 1-2 Veränderungen", x, value=TRUE)
> [1] "div 1-2 Veränderungen"

unlink('chr.csv') # delete file

Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = Patched
 major = 2
 minor = 8.0
 year = 2008
 month = 11
 day = 04
 svn rev = 46830
 language = R
 version.string = R version 2.8.0 Patched (2008-11-04 r46830)

Windows XP (build 2600) Service Pack 2

Locale:
LC_COLLATE=German_Austria.1252;LC_CTYPE=German_Austria.1252;LC_MONETARY=German_Austria.1252;LC_NUMERIC=C;LC_TIME=German_Austria.1252

Search Path:
 .GlobalEnv, package:stats, package:graphics, 
package:grDevices, package:utils, 
package:datasets, package:methods, Autoloads, package:base



# in R 2.7.2 patched


x0 <- "div 1-2 Veränderungen" # define a character string

write.csv(x0, 'chr.csv', row.names=FALSE) # write a csv-file with one line
rm(x0)

x <- read.csv('chr.csv', skip=0, header=TRUE, as.is=TRUE)$x # read in csv-file
x
x=="div 1-2 Veränderungen"
> [1] TRUE
grep("div 1-2 Veränderungen", x)
> [1] 1
grep("div 1-2 Veränderungen", x, value=TRUE)
> [1] "div 1-2 Veränderungen"

unlink('chr.csv') # delete file

Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = Patched
 major = 2
 minor = 7.2
 year = 2008
 month = 09
 day = 02
 svn rev = 46486
 language = R
 version.string = R version 2.7.2 Patched (2008-09-02 r46486)

Windows XP (build 2600) Service Pack 2

Locale:
LC_COLLATE=German_Austria.1252;LC_CTYPE=German_Austria.1252;LC_MONETARY=German_Austria.1252;LC_NUMERIC=C;LC_TIME=German_Austria.1252

Search Path:
 .GlobalEnv, package:stats, package:graphics, 
package:grDevices, package:utils, 
package:datasets, package:methods, Autoloads, package:base


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Strang line while plotting failure curves

2008-11-06 Thread Lu, Jiang
Thank you very much, Frank. I installed Design package and tried survplot().


#R code
 
survplot(testfit,time.inc=365.25,xaxt='n',xlim=c(0,1826.25),ylim=c(0,1),conf='none',
  fun=function(y)1-y,label.curves=list(keys=c('Med','Rev')),
  abbrev.label=TRUE,n.risk=TRUE)
# End of R code

I have achieved my goal with the 'fun' argument you advised. But I have a
difficult time to do the following fine tune.

1. The X axis scale was labeled as 'Days'. I would like something like
'xscale=365.25' in plot.survfit to put time into Years and label the ticks
from 0 to 5, instead of from 0 to 1826.25 by each 365.25 increment. I tried
xaxt='n' as you can see in the code above. Then I noticed that xaxt='n' only
work for plot(survfit), not in survplot(). Any advice how to change the tick
label using survplot()?

2. The n.risk was beautifully printed for each specified time point along
the x axis. However, since I am plotting the failure rate, the n.risk looks
busy with the failure rate curves. Is there a way to move the n.risk to the
top of the plot where there are lots of space?

3. I also tried label.curves=list(). It is very convenient. The curves are
labeled and the legend is created as well. Could I only keep the curve label
and get rid of the legend since the legend is not so necessary once the
curve is labeled. How do you think?

I really appreciate any help you give.

Best regards,

Jiang Lu

Statistician
Department of Epidemiology
University of Pittsburgh



On Thu, Nov 6, 2008 at 1:21 PM, Frank E Harrell Jr <[EMAIL PROTECTED]
> wrote:

>  Lu, Jiang wrote:
>
>> Dear R helper,
>>
>> I encountered a problem when I tried to plot the cumulative failure rate
>> (i.e. 1 - survival probability). I have used the following code to plot.
>> The
>> scenario is that patients are randomized to different treatment arm (rev
>> in
>> the code), the PCI revascularization was monitored over 5 years.
>>
>> #R code
>>  testfit <- survfit(Surv(pcifu,pci)~rev,data=subproc)
>>  testfit$surv <- 1 - testfit$surv
>>  testfail <- plot(testfit, mark.time=FALSE,col=1:2, main='Failure Rate')
>> #End of R code
>>
>> I arbitarily replaced testfit$surv by computing 1 minus the original
>> survival rate. So far so good. However, when I plot the manipulated
>> "testfit", there is a vertical line plotted at x=0, y=0:1. I checked
>> testfit$time and testfit$surv, nothing weird there. I am very confused
>> where
>> the vertical line at starting point of time 0 came from. How can I get rid
>> of it?
>>
>> Would you pleae help me with this? Thanks a lot!
>>
>> Jiang
>>
>>
> Also see the survplot.* functions in the Design package and their fun
> argument, e.g., fun=function(y)1-y
>
> Frank
>
>[[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.
>>
>>
>
> --
> Frank E Harrell Jr   Professor and Chair   School of Medicine
> Department of Biostatistics   Vanderbilt University
>

[[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] replicate and as.matrix: different behaviour between batch and non-batch mode

2008-11-06 Thread Charles C. Berry

On Thu, 6 Nov 2008, Oliver Bandel wrote:


Hello Charles,



[snip]


dim( as.matrix(replicate(10, sample(x, 3) )  ) )

[1]  3 10

dim( as.matrix(replicate(10, sample(x, 2) )  ) )

[1]  2 10

dim( as.matrix(replicate(10, sample(x, 1) )  ) )

[1] 10  1



=


So, the behaviour is the same...
...but is not really that fine. :(

...how could I avoid the necessity of the transposition
of the matrix in the case of only one sample?



use
matrix( your.result , nc = n.replicates )

or

dim( your.result ) <- c( n.samples, n.replicates )

instead of as.matrix( your.result )

HTH,

Chuck



I mean, it's not extremely a problem,
because there are not many loops aroud it,
but it looks somehow ugly. :(

Ciao,
 Oliver

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



Charles C. Berry(858) 534-2098
Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]  UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Confidence limits for the parameter of the Poisson distribution

2008-11-06 Thread Hoang Trong Minh Tuan
Hi all,
  So far I only know one way to get the confidence limit for the Poisson
distribution is to use the look-up table given by the 2 parameter (the
number of observation x and the confidence level, e.g. 95%) and the table is
limit by the maximum number of observations (x <= 50).
  I know the formula to compute the CI, however, mathematically it is not
easy to do it. So, anyone know an R function to do this. Thanks

Tuan.

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

2008-11-06 Thread Lucke, Joseph F
Neola
I'm a bit rusty on this, but I believe you can conduct on singular-value 
decomposition on the 436 by 518 matrix.  The squares of your singular values 
(max of 436, 518-436 will be zero) will be your eigenvalues, the same as in the 
PC analysis.  The post-eigenvectors will be your components.  As I have said, 
my knowledge is not completely trustworthy at this point, but SVD would be 
worth looking into.
Joe 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Noela Sánchez
Sent: Thursday, November 06, 2008 1:10 PM
To: stephen sefick
Cc: r-help@r-project.org
Subject: Re: [R] PCA

My matrix have 436 registers and 518 variables. I need to do a PCA analyst.

Usually I use princomp command to perform PCA analyst, but this time i can't 
because of my variables are more than my registers.

2008/11/6 stephen sefick <[EMAIL PROTECTED]>

> would you please provide a dummy example that explains your problem.
> Then maybe I can help you.
> thanks
>
> Stephen
>
> On Thu, Nov 6, 2008 at 1:42 PM, Noela Sánchez <[EMAIL PROTECTED]> wrote:
> > I need perform PCA analyst with a matrix with more variables than units.
> >
> > The princomp command don't match with this matrix.
> >
> > Anybody knows a good command to do it?
> >
> > --
> > Noela
> >
> >[[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 osting-guide.html>
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
>
> --
> Stephen Sefick
> Research Scientist
> Southeastern Natural Sciences Academy
>
> Let's not spend our time and resources thinking about things that are 
> so little or so large that all they really do for us is puff us up and 
> make us feel like gods.  We are mammals, and have not exhausted the 
> annoying little problems of being mammals.
>
>-K. 
> Mullis
>



--
Noela
Grupo de Recursos Marinos y Pesquerías
Universidad de A Coruña

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

2008-11-06 Thread Greg Snow
Look at the rotate.wireframe function in the TeachingDemos package.

--
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 Bill Szkotnicki
> Sent: Thursday, November 06, 2008 8:39 AM
> To: r-help@r-project.org
> Subject: [R] wireframe
>
> I've been using lattice/wireframe succesfully to visualize some data.
> I have one question.
> I want to be able to change the viewpoint ( i.e. rotate the plotted
> figure a bit left or right or up and down )
> Is there a way to do that?
> Or is there some other package around that could help?
> Thanks.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] new plotrix and prettyR

2008-11-06 Thread Jim Lemon

Hi all,
I'm noting the appearance of new versions of plotrix and prettyR as I 
found a bug in the "brkdn" function that messed up the order of 
"value.labels" if they had been imported from an SPSS data file. For 
anyone using "brkdn", please upgrade to the new version of prettyR 
(1.3-5) if you are importing SPSS data files. If anyone discovers other 
problems, you know where to complain. Thanks.


Jim

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


Re: [R] How to avoid "$ operator is invalid for atomic vectors"

2008-11-06 Thread Patrick Burns

cruz wrote:

Thanks for all the responses, they are all very helpful:)

  

you don't need to assign dimension or classes to your objects.
It's easier if you  do like this



this is something that really bothers me, when I need to define an
object which i will later fill with data, the dimension of this object
should not be fixed because it will grow...

so in MATLAB, i.e. we define x = [ ],
what about in R?
  


It is generally best in R to create an object as the size
it will end up being and then make assignments into the
object.

But using the theory of giving you enough rope to hang
yourself, you can do things like:

x <- numeric(0)

or

x <- NULL


Patrick Burns
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")


Thanks,
cruz

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

2008-11-06 Thread Henrik Bengtsson
Hi,

On Thu, Nov 6, 2008 at 2:12 AM, Yuri Volchik <[EMAIL PROTECTED]> wrote:
>
> Thanks for reply Henrik, seems obvious now.
> Can child class (B) access argument of the parent class, i.e. can i rewrite
> definition of the class B as
>
> setConstructorS3("ClassB", function() {
>  extend(ClassA(), "ClassB",
>.size2 = A
>  );
> })
>
> it didn't work for me, so guess i'm doing smth wrong and i couldn't find any
> reference on inheritance in the help files.

Note that 'A' is only an argument (~= local variable) of the
constructor function ClassA().  There is no way the (constructor)
function ClassB() can know about that one; compare to:

foo <- function(A=1) {
}

bar <- function(B=2) {
  # Inside here you have no access to 'A' in foo(), regardless if you
call foo() or not.
}

So, I'm not sure what you are trying to do in reality.  Note, since
the value of 'A' is already assigned in ClassA() and part of its
returned object, then it will also be part of the returned object from
ClassB(), so you don't really have to assign 'A' again.

I think this is a better example.  See if you want to achive what
ClassB or ClassC do:

setConstructorS3("ClassA", function(A=0) {
 extend(Object(), "ClassA",
   A = A
 );
})

> objA <- ClassA();
> ll(objA)
  member data.class dimension objectSize
1  Anumeric 1 32
> objA$A
[1] 0


setConstructorS3("ClassB", function(A=0, B=1) {
 extend(ClassA(A=A), "ClassB",
   B = B
 );
})

> objB <- ClassB(A=1, B=2);
> ll(objB);
  member data.class dimension objectSize
1  Anumeric 1 32
2  Bnumeric 1 32
> objB$A
[1] 1
> objB$B
[1] 2


If you really want to access a field from a superclass inside the
constructor function, you have to first get the object returned by the
constructor of the superclass, and then from that object retrieve the
field:

setConstructorS3("ClassC", function(B=1) {
 this <- extend(ClassA(), "ClassC",
   B = B
 );
 this$copyOfA <- this$A;
 this;
})

> objC <- ClassC(B=3);
> ll(objC);
  member data.class dimension objectSize
1  Anumeric 1 32
2  Bnumeric 1 32
> objC$A
[1] 0
> objC$B
[1] 3


Note, there is nothing "magic" going on inside Object(), extend() or
any other R.oo methods.  Most of the things you can think of as
regular lists and functions.  The new think is that objects inheriting
from the Object class store their values inside an environment, which
is why the object behaves as it is passed by reference.

Hope this helps

/Henrik

>
> --
> View this message in context: 
> http://www.nabble.com/Methods-dispatch-and-inheritance-R.oo-tp20339090p20358341.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] PCA

2008-11-06 Thread Noela Sánchez
My matrix have 436 registers and 518 variables. I need to do a PCA analyst.

Usually I use princomp command to perform PCA analyst, but this time i can't
because of my variables are more than my registers.

2008/11/6 stephen sefick <[EMAIL PROTECTED]>

> would you please provide a dummy example that explains your problem.
> Then maybe I can help you.
> thanks
>
> Stephen
>
> On Thu, Nov 6, 2008 at 1:42 PM, Noela Sánchez <[EMAIL PROTECTED]> wrote:
> > I need perform PCA analyst with a matrix with more variables than units.
> >
> > The princomp command don't match with this matrix.
> >
> > Anybody knows a good command to do it?
> >
> > --
> > Noela
> >
> >[[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.
> >
>
>
>
> --
> 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
>



-- 
Noela
Grupo de Recursos Marinos y Pesquerías
Universidad de A Coruña

[[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] mean computation for external data

2008-11-06 Thread Jorge Ivan Velez
Hi Christabel,
Take a look at the function basicStats in the fBasics package. Here is an
example:

library(fBasics)
set.seed(123)
x=rnorm(20,24,2)
basicStats(x)
#x
#nobs 20.00
#NAs   0.00
#Minimum  20.066766
#Maximum  27.573826
#1. Quartile  23.012892
#3. Quartile  25.097454
#Mean 24.283248
#Median   24.239970
#Sum 485.664952
#SE Mean   0.434989
#LCL Mean 23.372805
#UCL Mean 25.193690
#Variance  3.784311
#Stdev 1.945331
#Skewness -0.062495
#Kurtosis -0.547891


HTH,

Jorge



On Thu, Nov 6, 2008 at 6:07 AM, christabel_jane prudencio <
[EMAIL PROTECTED]> wrote:

>
>
>
> I have an external data (.txt) for
> annual peak flood. The first column is the year, second column is the
> observation date, and the last is the observed discharge. My task is to
> calculate the mean, skewness and kurtosis of the said data. I was advised
> to use
> read.table() to read the entire data. Please help me on how to perform the
> required computation. I am obviously a new user of this statistical
> software.
> Thank you so much for helping.
>
> Christabel Jane P. Rubio
> M.S. Student
> Water Resources Engineering
> Dept. of Construction & Environmental Engineering
> Kongju National University (Cheonan Campus)
> 102th Office,The 5th Engineering Building,
> 275, Budae-dong, Cheonan-si, Chungnam-do, 330-717, Korea
> TEL : +82-41-521-9316
> FAX : +82-41-568-0287
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] PCA

2008-11-06 Thread Jorge Ivan Velez
Hi Noela,

Take a loot at ?prcomp

HTH,

Jorge



On Thu, Nov 6, 2008 at 1:42 PM, Noela Sánchez <[EMAIL PROTECTED]> wrote:

> I need perform PCA analyst with a matrix with more variables than units.
>
> The princomp command don't match with this matrix.
>
> Anybody knows a good command to do it?
>
> --
> Noela
>
>[[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


Re: [R] PCA

2008-11-06 Thread Prof Brian Ripley

?princomp refers you to prcomp for that case:

 'princomp' only handles so-called R-mode PCA, that is feature
 extraction of variables.  If a data matrix is supplied (possibly
 via a formula) it is required that there are at least as many
 units as variables.  For Q-mode PCA use 'prcomp'.


On Thu, 6 Nov 2008, Noela Sánchez wrote:


I need perform PCA analyst with a matrix with more variables than units.

The princomp command don't match with this matrix.

Anybody knows a good command to do it?

--
Noela


--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] PCA

2008-11-06 Thread stephen sefick
would you please provide a dummy example that explains your problem.
Then maybe I can help you.
thanks

Stephen

On Thu, Nov 6, 2008 at 1:42 PM, Noela Sánchez <[EMAIL PROTECTED]> wrote:
> I need perform PCA analyst with a matrix with more variables than units.
>
> The princomp command don't match with this matrix.
>
> Anybody knows a good command to do it?
>
> --
> Noela
>
>[[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.
>



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

2008-11-06 Thread Noela Sánchez
I need perform PCA analyst with a matrix with more variables than units.

The princomp command don't match with this matrix.

Anybody knows a good command to do it?

-- 
Noela

[[alternative HTML version deleted]]

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


Re: [R] How to avoid "$ operator is invalid for atomic vectors"

2008-11-06 Thread John Kane

Does this help
(mylist <- list(NULL))


(mylist[[3]] <- data.frame(a=1:4, b=letters[1:4]))
mylist

(mylist[[2]] <- matrix(1:12, nrow=4))

mylist


--- On Thu, 11/6/08, cruz <[EMAIL PROTECTED]> wrote:

> From: cruz <[EMAIL PROTECTED]>
> Subject: Re: [R] How to avoid "$ operator is invalid for atomic vectors"
> To: r-help@r-project.org
> Received: Thursday, November 6, 2008, 1:16 PM
> Thanks for all the responses, they are all very helpful:)
> 
> > you don't need to assign dimension or classes to
> your objects.
> > It's easier if you  do like this
> 
> this is something that really bothers me, when I need to
> define an
> object which i will later fill with data, the dimension of
> this object
> should not be fixed because it will grow...
> 
> so in MATLAB, i.e. we define x = [ ],
> what about in R?
> 
> Thanks,
> cruz
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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 avoid "$ operator is invalid for atomic vectors"

2008-11-06 Thread Jeffrey Horner

cruz wrote on 11/06/2008 12:16 PM:

Thanks for all the responses, they are all very helpful:)


you don't need to assign dimension or classes to your objects.
It's easier if you  do like this


this is something that really bothers me, when I need to define an
object which i will later fill with data, the dimension of this object
should not be fixed because it will grow...

so in MATLAB, i.e. we define x = [ ],
what about in R?


?numeric, ?character, others probably...

x <- numeric()

x[10] <- 42
print(x)
 [1] NA NA NA NA NA NA NA NA NA 42

Does that answer your question?

Jeff



Thanks,
cruz

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 avoid "$ operator is invalid for atomic vectors"

2008-11-06 Thread cruz
>
> Does that answer your question?
>

Thanks:)

I received one from Erin:

x <- NULL

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Strang line while plotting failure curves

2008-11-06 Thread Frank E Harrell Jr

Lu, Jiang wrote:

Dear R helper,

I encountered a problem when I tried to plot the cumulative failure rate
(i.e. 1 - survival probability). I have used the following code to plot. The
scenario is that patients are randomized to different treatment arm (rev in
the code), the PCI revascularization was monitored over 5 years.

#R code
 testfit <- survfit(Surv(pcifu,pci)~rev,data=subproc)
 testfit$surv <- 1 - testfit$surv
 testfail <- plot(testfit, mark.time=FALSE,col=1:2, main='Failure Rate')
#End of R code

I arbitarily replaced testfit$surv by computing 1 minus the original
survival rate. So far so good. However, when I plot the manipulated
"testfit", there is a vertical line plotted at x=0, y=0:1. I checked
testfit$time and testfit$surv, nothing weird there. I am very confused where
the vertical line at starting point of time 0 came from. How can I get rid
of it?

Would you pleae help me with this? Thanks a lot!

Jiang



Also see the survplot.* functions in the Design package and their fun 
argument, e.g., fun=function(y)1-y


Frank


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




--
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] mean computation for external data

2008-11-06 Thread John Kane
?mean

kurtosis
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/110186.html
 


--- On Thu, 11/6/08, christabel_jane prudencio <[EMAIL PROTECTED]> wrote:

> From: christabel_jane prudencio <[EMAIL PROTECTED]>
> Subject: [R] mean computation for external data
> To: r-help@r-project.org
> Received: Thursday, November 6, 2008, 6:07 AM
> I have an external data (.txt) for
> annual peak flood. The first column is the year, second
> column is the
> observation date, and the last is the observed discharge.
> My task is to
> calculate the mean, skewness and kurtosis of the said data.
> I was advised to use
> read.table() to read the entire data. Please help me on how
> to perform the
> required computation. I am obviously a new user of this
> statistical software.
> Thank you so much for helping.
> 
> Christabel Jane P. Rubio
> M.S. Student
> Water Resources Engineering
> Dept. of Construction & Environmental Engineering 
> Kongju National University (Cheonan Campus)
> 102th Office,The 5th Engineering Building,
> 275, Budae-dong, Cheonan-si, Chungnam-do, 330-717, Korea
> TEL : +82-41-521-9316 
> FAX : +82-41-568-0287
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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 avoid "$ operator is invalid for atomic vectors"

2008-11-06 Thread cruz
Thanks for all the responses, they are all very helpful:)

> you don't need to assign dimension or classes to your objects.
> It's easier if you  do like this

this is something that really bothers me, when I need to define an
object which i will later fill with data, the dimension of this object
should not be fixed because it will grow...

so in MATLAB, i.e. we define x = [ ],
what about in R?

Thanks,
cruz

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


Re: [R] Simple rep() question duplicating times and dates.

2008-11-06 Thread John Kane

Hi Solveig, 
Thanks very much, it's a nice solution and one I had not even begun to think 
about.  I MUST learn more about dates!


--- On Thu, 11/6/08, Solveig Mimler <[EMAIL PROTECTED]> wrote:

> From: Solveig Mimler <[EMAIL PROTECTED]>
> Subject: Re: Simple rep() question duplicating times and dates.
> To: [EMAIL PROTECTED]
> Cc: r-help@r-project.org
> Received: Thursday, November 6, 2008, 7:06 AM
> Hi John,
> 
> I had the same problem yesterday and solved it like
> following:
> 
> seq(ISOdate(Year,Month,Day,Hour), by="hour",
> length=24*365)
> 
> for example: seq(ISOdate(2005,1,1,0), by="hour",
> length=8760)
> 
> Regards,
> Solveig 
> 
> 
> EIFER
> Europäisches Institut für Energieforschung
> Institut européen de recherche sur l'énergie
> European Institute for Energy Research
> 
> Solveig Mimler 
> Sociologist M.A.
> Emmy-Noether-Straße 11
> 76131 Karlsruhe
> Tel: +49 721 6105 1351
> Fax: +49 721 6105 1332
> mailto: [EMAIL PROTECTED]
> _
> 
> EIFER
> Europäisches Institut für Energieforschung, 
> Electricité de France / Universität Karlsruhe (TH) EWIV 
> Sitz der europäischen wirtschaftlichen
> Interessenvereinigung: Karlsruhe
> Handelsregister: Amtsgericht Karlsruhe HRA 4823 
> Vorsitzender des Aufsichtsrats: Prof. Dr.-Ing. RAINER
> REIMERT
> Geschäftsführer: Dr. FREDERIC BARON (Institutsleiter) 
> _
> 
> This e-mail and any attachment is for authorized use by the
> intended
> recipient(s) only. It may contain proprietary material,
> confidential
> information and/or be subject to legal privilege. It should
> not be copied,
> disclosed to, retained or used by any other party.
> If you are not an intended recipient then please promptly
> delete this 
> e-mail and any attachment and all copies and inform the
> sender.
> _
> 
> Message: 27
> Date: Wed, 5 Nov 2008 16:14:19 +0100
> From: "Gustaf Rydevik"
> <[EMAIL PROTECTED]>
> Subject: Re: [R] Simple rep() question duplicating times
> and dates.
> To: [EMAIL PROTECTED]
> Cc: R R-help <[EMAIL PROTECTED]>
> Message-ID:
> 
> <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=ISO-8859-1
> 
> On Wed, Nov 5, 2008 at 4:02 PM, John Kane
> <[EMAIL PROTECTED]> wrote:
> >
> > I want to create a data.frame of time and date for a
> year.  I started 
> with the idea of simply producing two vectors (time and
> date)
> >
> > The first part ( time) is easy.
> >  rep(1:24, 365)
> >
> > But how do I get a series of 24 dates for O1 January
> 2005 and repeat 
> this to 31 December 2005.
> >
> > It should be easy but I don't see it.
> >
> > Thanks
> 
> 
> Hi John,
> 
> ?Date leads you to (among other things) ?seq.Date.
> 
> Something like this should work:
> 
> time<-rep(1:24, 365)
> dates<-seq(as.Date("01012005",format="%d%m%Y"),as.Date("31122005",format="%d%m%Y"),by=1)
> TimeFrame<-data.frame(time)
> TimeFrame$dates<-rep(dates,each=24)
> 
> 
> Regards,
> Gustaf
> -- 
> Gustaf Rydevik, M.Sci.
> tel: +46(0)703 051 451
> address:Essingetorget 40,112 66 Stockholm, SE
> skype:gustaf_rydevik
> 
> 
> 
> --
> 
> Message: 28
> Date: Wed, 5 Nov 2008 07:30:31 -0800 (PST)
> From: John Kane <[EMAIL PROTECTED]>
> Subject: Re: [R] Simple rep() question duplicating times
> and dates.
> To: Gustaf Rydevik <[EMAIL PROTECTED]>
> Cc: R R-help <[EMAIL PROTECTED]>
> Message-ID:
> <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=us-ascii
> 
> I don't have R on this machine to try it but it looks
> good to me.  I had 
> even got as far as seq() but completely missed the use of
> "each". 
> 
> Thanks very much.
> 
> --- On Wed, 11/5/08, Gustaf Rydevik
> <[EMAIL PROTECTED]> wrote:
> 
> > From: Gustaf Rydevik <[EMAIL PROTECTED]>
> > Subject: Re: [R] Simple rep() question duplicating
> times and dates.
> > To: [EMAIL PROTECTED]
> > Cc: "R R-help"
> <[EMAIL PROTECTED]>
> > Received: Wednesday, November 5, 2008, 10:14 AM
> > On Wed, Nov 5, 2008 at 4:02 PM, John Kane
> > <[EMAIL PROTECTED]> wrote:
> > >
> > > I want to create a data.frame of time and date
> for a
> > year.  I started with the idea of simply producing two
> > vectors (time and date)
> > >
> > > The first part ( time) is easy.
> > >  rep(1:24, 365)
> > >
> > > But how do I get a series of 24 dates for O1
> January
> > 2005 and repeat this to 31 December 2005.
> > >
> > > It should be easy but I don't see it.
> > >
> > > Thanks
> > 
> > 
> > Hi John,
> > 
> > ?Date leads you to (among other things) ?seq.Date.
> > 
> > Something like this should work:
> > 
> > time<-rep(1:24, 365)
> > 
> dates<-seq(as.Date("01012005",format="%d%m%Y"),as.Date("31122005",format="%d%m%Y"),by=1)
> > TimeFrame<-data.frame(time)
> > TimeFrame$dates<-rep(dates,each=24)
> > 
> > 
> > Regards,
> > Gustaf
> > -- 
> > Gustaf Rydevik, M.Sci.
> > tel: +46(0)703 051 451
> > address:Essingetorget 40,112 66 Stockholm, SE
> > skype:gustaf_rydevik


  __

Re: [R] How to manipulate the time data without the date?

2008-11-06 Thread John Kane
Does this help?

library(chron)
tms<-c("19:30:23","18:39:10")
mytimes <- times(tms)
mytimes[1]-mytimes[2]


--- On Thu, 11/6/08, tedzzx <[EMAIL PROTECTED]> wrote:

> From: tedzzx <[EMAIL PROTECTED]>
> Subject: [R]  How to manipulate the time data without the date?
> To: r-help@r-project.org
> Received: Thursday, November 6, 2008, 12:10 PM
> Hi,all
> 
> I only got the time data such as:
> tms<-c("19:30:23","18:39:10".)
> 
> I want to manipulate this time series data. For example,
> plus one second(or
> minute) or minus one second
> 
> This data only has the time(h:m:s), without the date. I
> know that there are
> chron package, ISOPix class and the timeDate class, but all
> these class need
> the input of date. 
> 
> How can we manipulate the time data without the date?
> 
> Thanks advance
> 
> Ted
> -- 



  __
[[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 avoid "$ operator is invalid for atomic vectors"

2008-11-06 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of anna freni 
> sterrantino
> Sent: Thursday, November 06, 2008 10:00 AM
> To: cruz; r-help@r-project.org
> Subject: Re: [R] How to avoid "$ operator is invalid for 
> atomic vectors"
> 
> Hi Cruz
> you don't need to assign dimension or classes to your objects.
> It's easier if you  do like this
> 
> 
> > a=c(0,1,2,4,1,1)
> > length(a)
> [1] 6
> > b=matrix(a,3,2,byrow=T)
> > b
>  [,1] [,2]
> [1,]01
> [2,]24
> [3,]11
> of course you can change the colnames and assign what 
> you prefer
> 
> > colnames(b)=c("x","y")
> 
> but if you try to recall "x" with
> b$x 
> is not going to work
> like that, 
> you have two option:
> 
> 1. switch  form matrix to a dataframe:
> > c=as.data.frame(b)
> > c
>   x y
> 1 0 1
> 2 2 4
> 3 1 1
> > c$x
> [1] 0 2 1
> 
> no problems.
> 
> 2. Can get the column  "x"
> on the matrix b as
> b[,1]
> [1] 0 2 1
> 
> just giving the  position.
> 
> 
> Hope that this helps.
> 
> Best Regards
> Anna
> 
> 
> 
>  Anna Freni Sterrantino
> Ph.D Student 
> Department of Statistics
> University of Bologna, Italy
> via Belle Arti 41, 40124 BO.
> 
> 
> 
> 
> 
> Da: cruz <[EMAIL PROTECTED]>
> A: r-help@r-project.org
> Inviato: Giovedì 6 novembre 2008, 17:22:42
> Oggetto: [R] How to avoid "$ operator is invalid for atomic vectors"
> 
> Hi,
> 
> I am writing this in a wrong way, can someone please correct me?
> 
> > A <- matrix()
> > length(A) <- 6
> > dim(A) <- c(3,2)
> > colnames(A) <- c("X","Y")
> > A
>   X  Y
> [1,] NA NA
> [2,] NA NA
> [3,] NA NA
> > A$X
> Error in A$X : $ operator is invalid for atomic vectors
> >
> 
> Thanks,
> cruz
> 

You can also use the column name with the matrix

A[,'X']

Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA  98504-5204
 
 

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Strang line while plotting failure curves

2008-11-06 Thread Lu, Jiang
Dear R helper,

I encountered a problem when I tried to plot the cumulative failure rate
(i.e. 1 - survival probability). I have used the following code to plot. The
scenario is that patients are randomized to different treatment arm (rev in
the code), the PCI revascularization was monitored over 5 years.

#R code
 testfit <- survfit(Surv(pcifu,pci)~rev,data=subproc)
 testfit$surv <- 1 - testfit$surv
 testfail <- plot(testfit, mark.time=FALSE,col=1:2, main='Failure Rate')
#End of R code

I arbitarily replaced testfit$surv by computing 1 minus the original
survival rate. So far so good. However, when I plot the manipulated
"testfit", there is a vertical line plotted at x=0, y=0:1. I checked
testfit$time and testfit$surv, nothing weird there. I am very confused where
the vertical line at starting point of time 0 came from. How can I get rid
of it?

Would you pleae help me with this? Thanks a lot!

Jiang

[[alternative HTML version deleted]]

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


Re: [R] How to avoid "$ operator is invalid for atomic vectors"

2008-11-06 Thread anna freni sterrantino
Hi Cruz
you don't need to assign dimension or classes to your objects.
It's easier if you  do like this


> a=c(0,1,2,4,1,1)
> length(a)
[1] 6
> b=matrix(a,3,2,byrow=T)
> b
 [,1] [,2]
[1,]01
[2,]24
[3,]11
of course you can change the colnames and assign what 
you prefer

> colnames(b)=c("x","y")

but if you try to recall "x" with
b$x 
is not going to work
like that, 
you have two option:

1. switch  form matrix to a dataframe:
> c=as.data.frame(b)
> c
  x y
1 0 1
2 2 4
3 1 1
> c$x
[1] 0 2 1

no problems.

2. Can get the column  "x"
on the matrix b as
b[,1]
[1] 0 2 1

just giving the  position.


Hope that this helps.

Best Regards
Anna



 Anna Freni Sterrantino
Ph.D Student 
Department of Statistics
University of Bologna, Italy
via Belle Arti 41, 40124 BO.





Da: cruz <[EMAIL PROTECTED]>
A: r-help@r-project.org
Inviato: Giovedì 6 novembre 2008, 17:22:42
Oggetto: [R] How to avoid "$ operator is invalid for atomic vectors"

Hi,

I am writing this in a wrong way, can someone please correct me?

> A <- matrix()
> length(A) <- 6
> dim(A) <- c(3,2)
> colnames(A) <- c("X","Y")
> A
  X  Y
[1,] NA NA
[2,] NA NA
[3,] NA NA
> A$X
Error in A$X : $ operator is invalid for atomic vectors
>

Thanks,
cruz

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



  Unisciti alla community di Io fotografo e video, il nuovo corso di 
fotografia di Gazzetta dello sport:

[[alternative HTML version deleted]]

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


Re: [R] How to manipulate the time data without the date?

2008-11-06 Thread Gabor Grothendieck
On Thu, Nov 6, 2008 at 12:10 PM, tedzzx <[EMAIL PROTECTED]> wrote:
>
> Hi,all
>
> I only got the time data such as:
> tms<-c("19:30:23","18:39:10".)
>
> I want to manipulate this time series data. For example, plus one second(or
> minute) or minus one second
>
> This data only has the time(h:m:s), without the date. I know that there are
> chron package, ISOPix class and the timeDate class, but all these class need
> the input of date.

The chron package's times class does not have that restriction:

> library(chron)
> times("10:34:21")
[1] 10:34:21

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 manipulate the time data without the date?

2008-11-06 Thread Prof Brian Ripley

Why not give it an arbitrary date such 2008-01-01?

On Thu, 6 Nov 2008, tedzzx wrote:



Hi,all

I only got the time data such as:
tms<-c("19:30:23","18:39:10".)

I want to manipulate this time series data. For example, plus one second(or
minute) or minus one second

This data only has the time(h:m:s), without the date. I know that there are
chron package, ISOPix class and the timeDate class, but all these class need
the input of date.


And in base R there is POSIXct.


How can we manipulate the time data without the date?


Not really, as DST changes mean which day does matter.  But all other days 
will be the same.


--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


[R] FW: [rkward-devel] questions on RKWard

2008-11-06 Thread Horace Tso
Thought I should copy the list with Matthieu's response.

H

-Original Message-
From: Matthieu Stigler [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 05, 2008 8:29 PM
To: Horace Tso; [EMAIL PROTECTED]
Subject: Re: [rkward-devel] questions on RKWard


some answer only for the third question: do you have the package
r-doc-html installed? (on ubuntu check with dpkg -l r-*) this is maybe
the solution

Horace Tso a écrit :
> Folks,
>
> I'm making progress moving from Windows to Linux and have RKward up
> and running. I read somewhere that Rkward's supposed to be the Tinn-R
> for linux and Tinn-R has worked out great for me. So naturally I'd
> like to do the following, if possible,
>
> 1. How to ask Rkward not to load the last saved image. Right now
> whenever it starts, it loads an image from some obscure corner of my
> directory. I can't quite figure out where it gets that image from. On
> the command line, I can do --no-restore. But there seems to be no
> place to sneak in these command line options under Rkward.  A startup
> config file hidden somewhere?
>
> 2. Customize CTRL-keys. Just out of the box, many menu options do not
> have a control key associated with them. Any way to pick my favorite key?
>
> 3. I'm used to typing ?command on the R-console and get a HTML help
> page pops up. But when I do that, a shockingly large window comes up
> and complains in many words about some error which I can't quite
> figure out what it's saying (sorry don't have linux in front of me
> right now).
>
> 4. I see there is an 'Output' tab by default. But command results are
> sent to R-console, and nothing seems to happen in 'Output'.
>
> I have R 2.7.1 running under KDE on openSUSE 10.3.
>
> TIA.
>
> Horace
> 
>
> -
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> 
>
> ___
> RKWard-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/rkward-devel
>

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


[R] How to manipulate the time data without the date?

2008-11-06 Thread tedzzx

Hi,all

I only got the time data such as:
tms<-c("19:30:23","18:39:10".)

I want to manipulate this time series data. For example, plus one second(or
minute) or minus one second

This data only has the time(h:m:s), without the date. I know that there are
chron package, ISOPix class and the timeDate class, but all these class need
the input of date. 

How can we manipulate the time data without the date?

Thanks advance

Ted
-- 
View this message in context: 
http://www.nabble.com/How-to-manipulate-the-time-data-without-the-date--tp20365370p20365370.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] replacing characters in formulae / models

2008-11-06 Thread Gabor Grothendieck
Try this:

library(alr3)
library(gsubfn)
example(delta.method) # defines m1
num <- 2
fn$delta.method(m1, "-b1/($num*b2)")

See gsubfn home page at:
http://gsubfn.googlecode.com



On Thu, Nov 6, 2008 at 12:13 PM, Christoph Scherber
<[EMAIL PROTECTED]> wrote:
> Dear all, Dear Keith,
>
> Well, of course in fact the problem is more complicated than that. The
> example was just for illustration.
>
> I have several statistical models for which I want to retrieve predictions
> using delta.method (from library(alr3)).
>
> Now for this I need a character string such as e.g.
> delta.method(model, "a + exp(c * x)") # model could for example be an
> exponential nls fit
>
> where the "x" shall be replaced by a numeric value at which the predictions
> plus s.e. shall be returned:
>
> delta.method(model, "a + exp(c * 10)")
>
> ##
>
> Because there are many models for which this shall be done, I would like to
> have a function that does something like the following:
>
> extract.estimates=function(model.list,xval)
> for (i in 1:length(model.list)){
> mod=model.list[i]
>
> - extract the model formula using formula(mod)
> - every time the variable "x" is present, it shall be replaced by xval
> - create a pasted character string "pastestring" to be used by delta.method
>
> result=list(delta.method(mod,pastestring))
> return(result)
> }
>
> I hope this has helped illustrating my point.
>
> All the best
> Christoph
>
>
>
>
> Keith Jewell schrieb:
>>
>> Hi,
>>
>> Firstly,  I'd recommend using '<-' for assignment, rather than '='; it
>> saves confusion
>> Secondly, I don't think you want 'a*x+b' as a formula, I think you want an
>> expression.
>> Thirdly, your 'y' has only one term, a 9 character constant = "a * x + b"
>>
>> Consider instead,
>> y <- expression(a*x+b)
>> a <- 2
>> b <- 3
>> x <- 1:10
>> y
>> eval(y)
>>
>> Now, how to replace 'x' by 'w'?
>> I'm not an expert, but this is the kind of thing I need to do, so I'd
>> welcome criticism of my approach.
>> I would view the expression as a list:
>> as.list(y)
>> as.list(y[[1]])
>>
>> So y is an expression containing a sub-expression; that is y is  '(a*x) +
>> b'
>> You want to access the sub-expression 'a*x'
>> y[[1]][[2]]
>> as.list(y[[1]][[2]])
>>
>> Now you want to replace the third item in that sub-expression with the
>> name (not the character) w
>> y[[1]][[2]][[3]] <- as.name("w")
>> w <- 11:20
>> y
>> eval(y)
>>
>> hth
>>
>> Keith J
>>
>> P.S. Perhaps you really do want a formula; y ~ a*x+b ??
>> In that case I'd still probably manipulate it as a list.
>> ---
>> "Christoph Scherber" <[EMAIL PROTECTED]> wrote in
>> message news:[EMAIL PROTECTED]
>>>
>>> Dear all,
>>>
>>> How can I replace text in objects that are of class "formula"?
>>>
>>> y="a * x + b"
>>> class(y)="formula"
>>> grep("x",y)
>>> y[1]
>>>
>>> Suppose I would like to replace the "x" by "w" in the formula object "y".
>>>
>>> How can this be done? Somehow, the methods that can be used in character
>>> objects do not work 1:1 in formula objects...
>>>
>>> Many thanks and best wishes
>>> Christoph
>>>
>>>
>>>
>>> --
>>> Dr. rer.nat. Christoph Scherber
>>> University of Goettingen
>>> DNPW, Agroecology
>>> Waldweg 26
>>> D-37073 Goettingen
>>> Germany
>>>
>>> phone +49 (0)551 39 8807
>>> fax   +49 (0)551 39 8806
>>>
>>> Homepage http://www.gwdg.de/~cscherb1
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>> .
>>
>
> --
> Dr. rer.nat. Christoph Scherber
> University of Goettingen
> DNPW, Agroecology
> Waldweg 26
> D-37073 Goettingen
> Germany
>
> phone +49 (0)551 39 8807
> fax   +49 (0)551 39 8806
>
> Homepage http://www.gwdg.de/~cscherb1
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] need help with SIGNAL module

2008-11-06 Thread Michael Tiemann
I sent this message to the maintainer's email address listed on the 
signal package, but it bounced.  Perhaps somebody on this list has more 
insight into the signal package than I do (or knows the maintainer's new 
address):


Subject:
question about buttord function in R signal module
From:
Michael Tiemann <[EMAIL PROTECTED]>
Date:
Thu, 06 Nov 2008 07:18:58 -0500

To:
[EMAIL PROTECTED]


Tom,

I was trying to compare lowpass and highpass filters and found that the 
buttord example in the manual worked as expected, namely the $type was 
"low".  But when I reversed the Wp and Ws parameters, it resulted in an 
object with an empty $type instead of $type being "high".  I looked at 
the source code and found an obvious reason why:


   if (length(Wp) == 2) {
   warning("buttord seems to overdesign bandpass and bandreject
   filters")
   if (any(stop))
   type = "stop"
   else type = "pass"
   }
   else {
   ## here we set to "high" or "low", as expected
   if (any(stop))
   type = "high"
   else type = "low"
   }
   ## here we arbitrarily override the type if there is a stop band
   defined...why?
   if (any(stop))
   type = ""

Thank you for any explanation you can provide.

M

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Using a background photo in lattice--title and axes missing

2008-11-06 Thread Waichler, Scott R
> I am trying to use a background photo in a lattice plot.  I 
> am using the rimage and TeachingDemos packages to plot the 
> photo and translate from the photo coordinates in pixels to 
> geographic coordinates, which is what I want to use for 
> plotting contours, lines, etc.  The (unrunable) code below 
> does give me a plot showing the photo, color contours, 
> contour lines, and colorkey, but not the plot title or axes.  
> How can I get the title and axes to appear?

Nevermind, I figured out that all I needed was to add the statement
par(new=T) before plot(photo).

Regards,
Scott Waichler

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

2008-11-06 Thread Christoph Scherber

Dear all, Dear Keith,

Well, of course in fact the problem is more complicated than that. The example was just for 
illustration.


I have several statistical models for which I want to retrieve predictions using delta.method (from 
library(alr3)).


Now for this I need a character string such as e.g.
delta.method(model, "a + exp(c * x)") # model could for example be an 
exponential nls fit

where the "x" shall be replaced by a numeric value at which the predictions 
plus s.e. shall be returned:

delta.method(model, "a + exp(c * 10)")

##

Because there are many models for which this shall be done, I would like to have a function that 
does something like the following:


extract.estimates=function(model.list,xval)
for (i in 1:length(model.list)){
mod=model.list[i]

- extract the model formula using formula(mod)
- every time the variable "x" is present, it shall be replaced by xval
- create a pasted character string "pastestring" to be used by delta.method

result=list(delta.method(mod,pastestring))
return(result)
}

I hope this has helped illustrating my point.

All the best
Christoph




Keith Jewell schrieb:

Hi,

Firstly,  I'd recommend using '<-' for assignment, rather than '='; it saves 
confusion
Secondly, I don't think you want 'a*x+b' as a formula, I think you want an 
expression.

Thirdly, your 'y' has only one term, a 9 character constant = "a * x + b"

Consider instead,
y <- expression(a*x+b)
a <- 2
b <- 3
x <- 1:10
y
eval(y)

Now, how to replace 'x' by 'w'?
I'm not an expert, but this is the kind of thing I need to do, so I'd 
welcome criticism of my approach.

I would view the expression as a list:
as.list(y)
as.list(y[[1]])

So y is an expression containing a sub-expression; that is y is  '(a*x) + b'
You want to access the sub-expression 'a*x'
y[[1]][[2]]
as.list(y[[1]][[2]])

Now you want to replace the third item in that sub-expression with the name 
(not the character) w

y[[1]][[2]][[3]] <- as.name("w")
w <- 11:20
y
eval(y)

hth

Keith J

P.S. Perhaps you really do want a formula; y ~ a*x+b ??
In that case I'd still probably manipulate it as a list.
---
"Christoph Scherber" <[EMAIL PROTECTED]> wrote in 
message news:[EMAIL PROTECTED]

Dear all,

How can I replace text in objects that are of class "formula"?

y="a * x + b"
class(y)="formula"
grep("x",y)
y[1]

Suppose I would like to replace the "x" by "w" in the formula object "y".

How can this be done? Somehow, the methods that can be used in character 
objects do not work 1:1 in formula objects...


Many thanks and best wishes
Christoph



--
Dr. rer.nat. Christoph Scherber
University of Goettingen
DNPW, Agroecology
Waldweg 26
D-37073 Goettingen
Germany

phone +49 (0)551 39 8807
fax   +49 (0)551 39 8806

Homepage http://www.gwdg.de/~cscherb1


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

.



--
Dr. rer.nat. Christoph Scherber
University of Goettingen
DNPW, Agroecology
Waldweg 26
D-37073 Goettingen
Germany

phone +49 (0)551 39 8807
fax   +49 (0)551 39 8806

Homepage http://www.gwdg.de/~cscherb1

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] replicate and as.matrix: different behaviour between batch and non-batch mode

2008-11-06 Thread Oliver Bandel
Hello Charles,

thank you for the hint.


Zitat von "Charles C. Berry" <[EMAIL PROTECTED]>:

[...]
> > This looks good (and correct to me).
>
> Look again .
>
> It is not the same as what you have above.
[...]


OK, yes, you are right!

I mixed the two parameters...


Now I get the same problem also at the shell directly typed in:


=
> as.matrix(replicate(10, sample(x, 3) )  )
 [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]   12   153   12744   14620
[2,]6   11146   19   17   11   1911
[3,]   20   17683   14   19   10214
>
> as.matrix(replicate(10, sample(x, 2) )  )
 [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]4   17   18   146   115   17   1313
[2,]   143   16   12   177   20   16217
>
> as.matrix(replicate(10, sample(x, 1) )  )
  [,1]
 [1,]   19
 [2,]   17
 [3,]   12
 [4,]   14
 [5,]   12
 [6,]   13
 [7,]   18
 [8,]   12
 [9,]5
[10,]   20
> dim( as.matrix(replicate(10, sample(x, 3) )  ) )
[1]  3 10
> dim( as.matrix(replicate(10, sample(x, 2) )  ) )
[1]  2 10
> dim( as.matrix(replicate(10, sample(x, 1) )  ) )
[1] 10  1
>
=


So, the behaviour is the same...
...but is not really that fine. :(

...how could I avoid the necessity of the transposition
of the matrix in the case of only one sample?

I mean, it's not extremely a problem,
because there are not many loops aroud it,
but it looks somehow ugly. :(

Ciao,
  Oliver

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 avoid "$ operator is invalid for atomic vectors"

2008-11-06 Thread Erik Iverson

Hello -

cruz wrote:

Hi,

I am writing this in a wrong way, can someone please correct me?


A <- matrix()
length(A) <- 6
dim(A) <- c(3,2)
colnames(A) <- c("X","Y")
A

  X  Y
[1,] NA NA
[2,] NA NA
[3,] NA NA

A$X

Error in A$X : $ operator is invalid for atomic vectors


A[, "X"] may be what you want?

See the details of ?Extract about how '$' only works on recursive 
(list-like) objects, of which your matrix A is not one of.




Thanks,
cruz

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

2008-11-06 Thread Duncan Murdoch

On 06/11/2008 11:18 AM, BKMooney wrote:
I am new to R and am running into trouble with the function plot.  

When I enter in the simple code: 
x<-1:4

y<-5:8
plot(x,y)

I get a scatter plot with 4 points as expected.  


However, with my own data, A and B are both vectors of length ~85, each
entry a decimal in [0,1].  


Using the same plot(A,B) with this data, the plot function no longer gives
me a simple plot with 85 points.  Instead there are many points, and what
looks to be several box&whisker plots also included on the plot.  

This is a link to the actual output.  
http://www.nabble.com/file/p20364310/plotAB.bmp plotAB.bmp 


Why is the plot function doing this?  How can I get it to simply give me a
scatterplot?  (From there I want to do a lsline, etc..)

Any help is greatly appreciated...


Most likely your A vector is not numeric:  it's being read as strings 
like "0.4688", etc.  Take a look at str(A) and str(B) to see their 
structure.  (I can't tell from the plot, but I'd guess it's being read 
as a factor, because some of the values are not recognized as numeric.)


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] replacing characters in formulae / models

2008-11-06 Thread Keith Jewell
Hi,

Firstly,  I'd recommend using '<-' for assignment, rather than '='; it saves 
confusion
Secondly, I don't think you want 'a*x+b' as a formula, I think you want an 
expression.
Thirdly, your 'y' has only one term, a 9 character constant = "a * x + b"

Consider instead,
y <- expression(a*x+b)
a <- 2
b <- 3
x <- 1:10
y
eval(y)

Now, how to replace 'x' by 'w'?
I'm not an expert, but this is the kind of thing I need to do, so I'd 
welcome criticism of my approach.
I would view the expression as a list:
as.list(y)
as.list(y[[1]])

So y is an expression containing a sub-expression; that is y is  '(a*x) + b'
You want to access the sub-expression 'a*x'
y[[1]][[2]]
as.list(y[[1]][[2]])

Now you want to replace the third item in that sub-expression with the name 
(not the character) w
y[[1]][[2]][[3]] <- as.name("w")
w <- 11:20
y
eval(y)

hth

Keith J

P.S. Perhaps you really do want a formula; y ~ a*x+b ??
In that case I'd still probably manipulate it as a list.
---
"Christoph Scherber" <[EMAIL PROTECTED]> wrote in 
message news:[EMAIL PROTECTED]
> Dear all,
>
> How can I replace text in objects that are of class "formula"?
>
> y="a * x + b"
> class(y)="formula"
> grep("x",y)
> y[1]
>
> Suppose I would like to replace the "x" by "w" in the formula object "y".
>
> How can this be done? Somehow, the methods that can be used in character 
> objects do not work 1:1 in formula objects...
>
> Many thanks and best wishes
> Christoph
>
>
>
> -- 
> Dr. rer.nat. Christoph Scherber
> University of Goettingen
> DNPW, Agroecology
> Waldweg 26
> D-37073 Goettingen
> Germany
>
> phone +49 (0)551 39 8807
> fax   +49 (0)551 39 8806
>
> Homepage http://www.gwdg.de/~cscherb1

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

2008-11-06 Thread Erik Iverson

Hello -

In you example, what are the classes of x and y?

 x<-1:4
 y<-5:8
 plot(x,y)

class(x)
class(y)

In your 'real' data, what are the classes of A and B

class(A)
class(B)

One may be a factor?

How are you reading your data into R, read.table?  Make sure your data 
are numeric, then plot them, and it should do what you'd like.


Since you're new to R, one of my tips would be to learn the class() and 
str() functions.  Many functions, such as plot, operate differently 
depending on the class of data given to them, therefore it's very 
important to know the classes of your data objects.



BKMooney wrote:
I am new to R and am running into trouble with the function plot.  

When I enter in the simple code: 
x<-1:4

y<-5:8
plot(x,y)

I get a scatter plot with 4 points as expected.  


However, with my own data, A and B are both vectors of length ~85, each
entry a decimal in [0,1].  


Using the same plot(A,B) with this data, the plot function no longer gives
me a simple plot with 85 points.  Instead there are many points, and what
looks to be several box&whisker plots also included on the plot.  

This is a link to the actual output.  
http://www.nabble.com/file/p20364310/plotAB.bmp plotAB.bmp 


Why is the plot function doing this?  How can I get it to simply give me a
scatterplot?  (From there I want to do a lsline, etc..)

Any help is greatly appreciated...

Thanks!


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

2008-11-06 Thread Charles C. Berry

On Thu, 6 Nov 2008, Christoph Scherber wrote:


Dear all,

How can I replace text in objects that are of class "formula"?

y="a * x + b"
class(y)="formula"
grep("x",y)
y[1]



What exactly are you trying to accomplish??

And why did you assign 'formula' as the class of a character string?

'y' is not a valid formula object:


lm(y)

Error in terms.formula(formula, data = data) :
  argument is not a valid model

=

Perhaps, you need to review

?formula

and
11 Statistical models in R

from Introduction to R.

Oh, yes. There is the matter of reviewing the _posting guide_ before 
posting, too.


HTH,

Chuck




Suppose I would like to replace the "x" by "w" in the formula object "y".

How can this be done? Somehow, the methods that can be used in character 
objects do not work 1:1 in formula objects...


Many thanks and best wishes
Christoph



--
Dr. rer.nat. Christoph Scherber
University of Goettingen
DNPW, Agroecology
Waldweg 26
D-37073 Goettingen
Germany

phone +49 (0)551 39 8807
fax   +49 (0)551 39 8806

Homepage http://www.gwdg.de/~cscherb1

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



Charles C. Berry(858) 534-2098
Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]  UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

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

2008-11-06 Thread jim holtman
You need to provide more information. PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Show at least an 'str' of your data if you can not include it and the
commands that you were using.

On Thu, Nov 6, 2008 at 11:18 AM, BKMooney <[EMAIL PROTECTED]> wrote:
>
> I am new to R and am running into trouble with the function plot.
>
> When I enter in the simple code:
> x<-1:4
> y<-5:8
> plot(x,y)
>
> I get a scatter plot with 4 points as expected.
>
> However, with my own data, A and B are both vectors of length ~85, each
> entry a decimal in [0,1].
>
> Using the same plot(A,B) with this data, the plot function no longer gives
> me a simple plot with 85 points.  Instead there are many points, and what
> looks to be several box&whisker plots also included on the plot.
>
> This is a link to the actual output.
> http://www.nabble.com/file/p20364310/plotAB.bmp plotAB.bmp
>
> Why is the plot function doing this?  How can I get it to simply give me a
> scatterplot?  (From there I want to do a lsline, etc..)
>
> Any help is greatly appreciated...
>
> Thanks!
> --
> View this message in context: 
> http://www.nabble.com/New-to-R---Errors-in-plotting-tp20364310p20364310.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.
>



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

What is the problem that you are trying to solve?

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


[R] How to avoid "$ operator is invalid for atomic vectors"

2008-11-06 Thread cruz
Hi,

I am writing this in a wrong way, can someone please correct me?

> A <- matrix()
> length(A) <- 6
> dim(A) <- c(3,2)
> colnames(A) <- c("X","Y")
> A
  X  Y
[1,] NA NA
[2,] NA NA
[3,] NA NA
> A$X
Error in A$X : $ operator is invalid for atomic vectors
>

Thanks,
cruz

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

2008-11-06 Thread Gabor Grothendieck
Assuming you mean data frame and not matrix and
depending on whether the empty spaces are intended
to represent NA or 0 we have:

> DF <- data.frame(V1 = LETTERS[1:3], V2 = LETTERS[24:26], V3 = 1:3)
> tapply(DF[[3]], DF[1:2], c)
   V2
V1   X  Y  Z
  A  1 NA NA
  B NA  2 NA
  C NA NA  3
> xtabs(V3 ~ V1 + V2, DF)
   V2
V1  X Y Z
  A 1 0 0
  B 0 2 0
  C 0 0 3


On Wed, Nov 5, 2008 at 7:53 PM, dinesh kumar <[EMAIL PROTECTED]> wrote:
> Dear R users,
>
> I have a matrix like
>
> A  X1
> B  Y2
> C  Z3
>
> I want to reshape this matrix into this format
>
>X  Y  Z
> A  1
> B 2
> C 3
>
>
>
> Thanks in advance for your help.
>
>
> Dinesh
>
> --
> Dinesh Kumar Barupal
> Junior Specialist
> Metabolomics Fiehn Lab
> UCD Genome Center
> 451 East Health Science Drive
> GBSF Builidng
> University of California
> DAVIS
> 95616
> http://fiehnlab.ucdavis.edu/staff/kumar
>
>[[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Including graphics files in MS office / open office

2008-11-06 Thread hadley wickham
Hi Phillippe,

Thanks for the pointer.  It looks like a nice resource.

Hadley

On Thu, Nov 6, 2008 at 9:34 AM, Philippe Grosjean
<[EMAIL PROTECTED]> wrote:
> Hello Hadley,
>
> I have started this:
> http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:export.
>
> One solution that works not too bad in OpenOffice is to output the graph in
> XFig format, and then use fig2dev from transfig to get an EMF file. That one
> is rather well readable by OpenOffice. There are some limitations of XFig
> with R graphs, see ?xfig.
>
> Best,
>
> Philippe
> ..<°}))><
>  ) ) ) ) )
> ( ( ( ( (Prof. Philippe Grosjean
>  ) ) ) ) )
> ( ( ( ( (Numerical Ecology of Aquatic Systems
>  ) ) ) ) )   Mons-Hainaut University, Belgium
> ( ( ( ( (
> ..
>
> hadley wickham wrote:
>>
>> Hi all,
>>
>> I'm trying to write up some recommendations for what graphics formats
>> are most useful for inclusion into ms office and openoffice.  There
>> have been a few discussions on the list in the past, but I haven't
>> seen a summary.  These are the options I've seen so far, along with
>> there costs and benefits:
>>
>>  * high-resolution (600-dpi) png output (or tiff or jpg or other
>> raster format).  The main disadvantage is that it's a raster format,
>> so you need to know the eventual output size.
>>
>>  * windows metafile: works well in MS office, but does not support
>> transparency.  Can only be produced on windows, and openoffice support
>> isn't great
>>
>>  * encapsulated postscript: supported by both MS office and open
>> office, but won't display a preview image unless you add one with an
>> external program.  Prints fine.
>>
>>  * svg: R output devices still experimental and open office import
>> still experimental.  No support in ms office.
>>
>> Have I missed anything?  Is the information correct?
>>
>> Hadley
>>
>



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

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


[R] New to R - Errors in plotting

2008-11-06 Thread BKMooney

I am new to R and am running into trouble with the function plot.  

When I enter in the simple code: 
x<-1:4
y<-5:8
plot(x,y)

I get a scatter plot with 4 points as expected.  

However, with my own data, A and B are both vectors of length ~85, each
entry a decimal in [0,1].  

Using the same plot(A,B) with this data, the plot function no longer gives
me a simple plot with 85 points.  Instead there are many points, and what
looks to be several box&whisker plots also included on the plot.  

This is a link to the actual output.  
http://www.nabble.com/file/p20364310/plotAB.bmp plotAB.bmp 

Why is the plot function doing this?  How can I get it to simply give me a
scatterplot?  (From there I want to do a lsline, etc..)

Any help is greatly appreciated...

Thanks!
-- 
View this message in context: 
http://www.nabble.com/New-to-R---Errors-in-plotting-tp20364310p20364310.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] Including graphics files in MS office / open office

2008-11-06 Thread hadley wickham
On Thu, Nov 6, 2008 at 10:05 AM, Max Kuhn <[EMAIL PROTECTED]> wrote:
>>  * svg: R output devices still experimental
>
> I've been using the svg device in the Cairo package for a while now.
> I've never had any issues with it and wouldn't characterize it as
> experimental (of course, others may have had issues).

Ah, ok.  There's a bewildering array of options for producing svg
(rsvgdevice, svg with grDevices, svg with Cairo, svg with cairoDevice,
gridSVG) and it's hard to figure out which is the most mature.  Thanks
for the info.

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] replicate and as.matrix: different behaviour between batch and non-batch mode

2008-11-06 Thread Charles C. Berry

On Thu, 6 Nov 2008, Oliver Bandel wrote:


Hello,


for a simulation  I tried the following:

=
sampmeanvec <- function (from, n, repititions)
{
 print( paste("samplesize n:", n, "repititions:", repititions) )
 samples.mat <- as.matrix( replicate( repititions, sample(from, n) ) )

 # would that case-check be necessary?
 #if( n == 1 )
 #{
 #  samples.mat <- t (samples.mat)
 #}

 print( "Dim of matrix:")
 print( dim(samples.mat) )

 meanvec <- apply(samples.mat, 2, mean)
 return(meanvec)
}


gleichsamp <- runif(1)

for( sampsize in c(1,2,4,8,16,32,64,128) )
{
 sampmeanvec(gleichsamp, sampsize, 20)
}

=

The following result:
--

source("central_limit_theorem.R")

[1] "samplesize n: 1 repititions: 20"
[1] "Dim of matrix:"
[1] 20  1
[1] "samplesize n: 2 repititions: 20"
[1] "Dim of matrix:"
[1]  2 20
[1] "samplesize n: 4 repititions: 20"
[1] "Dim of matrix:"
[1]  4 20
[1] "samplesize n: 8 repititions: 20"
[1] "Dim of matrix:"
[1]  8 20
[1] "samplesize n: 16 repititions: 20"
[1] "Dim of matrix:"
[1] 16 20
[1] "samplesize n: 32 repititions: 20"
[1] "Dim of matrix:"
[1] 32 20
[1] "samplesize n: 64 repititions: 20"
[1] "Dim of matrix:"
[1] 64 20
[1] "samplesize n: 128 repititions: 20"
[1] "Dim of matrix:"
[1] 128  20




Look at the first dimension: there the cols and rows are
changed.

I tried directly in the R-shell:



x <- 1:20
dim( as.matrix(replicate(1, sample(x, length(x)) )  ))

[1] 20  1

dim( as.matrix(replicate(2, sample(x, length(x)) )  ))

[1] 20  2

dim( as.matrix(replicate(3, sample(x, length(x)) )  ))

[1] 20  3

dim( as.matrix(replicate(4, sample(x, length(x)) )  ))

[1] 20  4


This looks good (and correct to me).


Look again .

It is not the same as what you have above.

If studying your code does not reveal your error, you might put a 
browser() call in your function after the samples.mat <- ... line to

get a sense of what is happening. See

?browser






Can you locate my problem here?

Why is the cols and rows dimensions be changed?

Without using as.matrix the result of replicte is just a vector.




Not!


is.matrix( replicate(4, sample(x, length(x)) )  )

[1] TRUE

 So I have to use it.

But only in the script/batch-mode.

Typed in directly (see above), it works as expected.

Any ideas on this behaviour?



Get some rest. Then make a big pot of coffee. Stuff like this happens to 
many of us. You need to slow down and work thru your code before 
jumping to conclusions about odd behavior of well tested, well documented 
functions.



HTH,

Chuck




Ciao,
  Oliver

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



Charles C. Berry(858) 534-2098
Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]  UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Including graphics files in MS office / open office

2008-11-06 Thread Max Kuhn
>  * svg: R output devices still experimental

I've been using the svg device in the Cairo package for a while now.
I've never had any issues with it and wouldn't characterize it as
experimental (of course, others may have had issues).

I have had problems generating svg using some of the non-Cairo
packages, but this was some time ago.

Until OO can import them without going to great lengths, I guess it is
a moot point.

-- 

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] Sort help

2008-11-06 Thread Kevin Wright
The R wiki also discusses this:
http://wiki.r-project.org/rwiki/doku.php?id=tips:data-frames:sort&s=sort


On Wed, Nov 5, 2008 at 1:24 PM, Richardson, Patrick
<[EMAIL PROTECTED]> wrote:
> http://www.ats.ucla.edu/stat/R/faq/sort.htm
>
> A great tutorial about sorting data in R.
>
> HTH,
>
> _
> Patrick Richardson
> Biostatistician - Program of Translational Medicine
> Van Andel Research Institute - Webb Lab
> Grand Rapids, MI  49503
>
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rajasekaramya
> Sent: Wednesday, November 05, 2008 2:03 PM
> To: r-help@r-project.org
> Subject: [R] Sort help
>
>
>  Geneset_name  #Chromosome  #Hit_in_Biomart
> original_geneset_len  Missing.genes
>  [1,] "AGUIRRE_PANCREAS_CHR12"  "1" "51"
> "59" "8"
>  [3,] "AGUIRRE_PANCREAS_CHR9"   "1" "24"
> "24" "0"
>  [4,] "AGUIRRE_PANCREAS_CHR1""1" "30"
> "31" "1"
>  [5,] "AGUIRRE_PANCREAS_CHR18"  "1" "17"
> "17" "0"
>  [6,] "AGUIRRE_PANCREAS_CHR7"   "1" "35"
> "48" "13"
>  [7,] "AGUIRRE_PANCREAS_CHR8"   "1" "55"
> "61" "6"
>
> Above is a dataframe information.
>
> i need to sort the entire dataframe based on the  3rd colum. in decending
> order.
>
> I tried using order
>
> information[order(information[,3])] but it gives me only the ordered first
> coulmn that too i am not sure that it really works.
>
> Kindly let me know with any suggestions.
>
> Regards
> Ramya
>
>
> --
> View this message in context: 
> http://www.nabble.com/Sort-help-tp20346314p20346314.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.
> This email message, including any attachments, is for th...{{dropped:6}}
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] wireframe

2008-11-06 Thread jim holtman
Try the 'rgl' package.

On Thu, Nov 6, 2008 at 10:38 AM, Bill Szkotnicki <[EMAIL PROTECTED]> wrote:
> I've been using lattice/wireframe succesfully to visualize some data.
> I have one question.
> I want to be able to change the viewpoint ( i.e. rotate the plotted figure a
> bit left or right or up and down )
> Is there a way to do that?
> Or is there some other package around that could help?
> Thanks.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

What is the problem that you are trying to solve?

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


Re: [R] wireframe

2008-11-06 Thread Kornelius Rohmeyer
Am Donnerstag, den 06.11.2008, 10:38 -0500 schrieb Bill Szkotnicki:
> I've been using lattice/wireframe succesfully to visualize some data.
> I have one question.
> I want to be able to change the viewpoint ( i.e. rotate the plotted 
> figure a bit left or right or up and down )
> Is there a way to do that?

Take a look at the parameter screen in ?wireframe:

"The viewing direction is given by a sequence of rotations specified by
the 'screen' argument, starting from the positive Z-axis."

e.g. screen = list(z = 20, x = -70, y = 3) from the example section.

Kornelius.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] comparing matrices using max or min

2008-11-06 Thread Dimitris Rizopoulos

you just need pmax() or pmin(), e.g., check this:

set.seed(123)
M1 <- matrix(rnorm(20), 4, 5)
M2 <- matrix(rnorm(20), 4, 5)
M3 <- matrix(rnorm(20), 4, 5)

M1; M2; M3
pmax(M1, M2, M3)
pmin(M1, M2, M3)


I hope it helps.

Best,
Dimitris


Diogo André Alagador wrote:

Dear all,
 
I have 3 matrices with the same dimension, A,B,C and I would like to produce

a matrix D where in each position would retrieve the max(or min) value along
A,B,C taken from the same position.
I guess that apply functions should fit, but for matrices objects I am not
getting it.
 
thanks in advance,
 
Diogo André Alagador


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


--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] comparing matrices using max or min

2008-11-06 Thread stephen sefick
#how about this
A <- rnorm(10)
B <- rnorm(10)
C <- rnorm(10)

D <- data.frame(A,B,C)

apply(D, MARGIN=1, FUN=min)

On Thu, Nov 6, 2008 at 10:00 AM, Diogo André Alagador
<[EMAIL PROTECTED]> wrote:
> Dear all,
>
> I have 3 matrices with the same dimension, A,B,C and I would like to produce
> a matrix D where in each position would retrieve the max(or min) value along
> A,B,C taken from the same position.
> I guess that apply functions should fit, but for matrices objects I am not
> getting it.
>
> thanks in advance,
>
> Diogo André Alagador
>
>[[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.
>
>



-- 
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] comparing matrices using max or min

2008-11-06 Thread Diogo André Alagador
Dear all,
 
I have 3 matrices with the same dimension, A,B,C and I would like to produce
a matrix D where in each position would retrieve the max(or min) value along
A,B,C taken from the same position.
I guess that apply functions should fit, but for matrices objects I am not
getting it.
 
thanks in advance,
 
Diogo André Alagador

[[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] replacing characters in formulae / models

2008-11-06 Thread Christoph Scherber

Dear all,

How can I replace text in objects that are of class "formula"?

y="a * x + b"
class(y)="formula"
grep("x",y)
y[1]

Suppose I would like to replace the "x" by "w" in the formula object "y".

How can this be done? Somehow, the methods that can be used in character objects do not work 1:1 in 
formula objects...


Many thanks and best wishes
Christoph



--
Dr. rer.nat. Christoph Scherber
University of Goettingen
DNPW, Agroecology
Waldweg 26
D-37073 Goettingen
Germany

phone +49 (0)551 39 8807
fax   +49 (0)551 39 8806

Homepage http://www.gwdg.de/~cscherb1

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

2008-11-06 Thread Olivier ETERRADOSSI

Hi Ramya,
Sorry if I missed something, but unless I have problems reading your 
message it seems that there is no line in your example matching both 
your test conditions...

Hope this helps. Olivier



Hi there,

I have a dataframe length.unique.info
  

> length.unique.info


abc 12  345
def  16  550
lmn  6   600
I want those names that fall under the condition (length.unique.info[,2][i]
<=5 && length.unique.info[,3][i] >=500)

abcder<-length.unique.info[which(length.unique.info[,2][i] <=5 &&
length.unique.info[,3][i] >= 500),1]

will "&&" look for both the condition.It isnt returning names is there
anything i am missing.Kindly suggest me the way to do it.

Regards
Ramya


--
Olivier ETERRADOSSI
Maître-Assistant
CMGD / Equipe "Propriétés Psycho-Sensorielles des Matériaux"
Ecole des Mines d'Alès
Hélioparc, 2 av. P. Angot, F-64053 PAU CEDEX 9
tel std: +33 (0)5.59.30.54.25
tel direct: +33 (0)5.59.30.90.35 
fax: +33 (0)5.59.30.63.68

http://www.ema.fr

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


[R] wireframe

2008-11-06 Thread Bill Szkotnicki

I've been using lattice/wireframe succesfully to visualize some data.
I have one question.
I want to be able to change the viewpoint ( i.e. rotate the plotted 
figure a bit left or right or up and down )

Is there a way to do that?
Or is there some other package around that could help?
Thanks.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Including graphics files in MS office / open office

2008-11-06 Thread Philippe Grosjean

Hello Hadley,

I have started this: 
http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:export.


One solution that works not too bad in OpenOffice is to output the graph 
in XFig format, and then use fig2dev from transfig to get an EMF file. 
That one is rather well readable by OpenOffice. There are some 
limitations of XFig with R graphs, see ?xfig.


Best,

Philippe
..<°}))><
 ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
 ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
 ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

hadley wickham wrote:

Hi all,

I'm trying to write up some recommendations for what graphics formats
are most useful for inclusion into ms office and openoffice.  There
have been a few discussions on the list in the past, but I haven't
seen a summary.  These are the options I've seen so far, along with
there costs and benefits:

 * high-resolution (600-dpi) png output (or tiff or jpg or other
raster format).  The main disadvantage is that it's a raster format,
so you need to know the eventual output size.

 * windows metafile: works well in MS office, but does not support
transparency.  Can only be produced on windows, and openoffice support
isn't great

 * encapsulated postscript: supported by both MS office and open
office, but won't display a preview image unless you add one with an
external program.  Prints fine.

 * svg: R output devices still experimental and open office import
still experimental.  No support in ms office.

Have I missed anything?  Is the information correct?

Hadley



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Including graphics files in MS office / open office

2008-11-06 Thread hadley wickham
Hi all,

I'm trying to write up some recommendations for what graphics formats
are most useful for inclusion into ms office and openoffice.  There
have been a few discussions on the list in the past, but I haven't
seen a summary.  These are the options I've seen so far, along with
there costs and benefits:

 * high-resolution (600-dpi) png output (or tiff or jpg or other
raster format).  The main disadvantage is that it's a raster format,
so you need to know the eventual output size.

 * windows metafile: works well in MS office, but does not support
transparency.  Can only be produced on windows, and openoffice support
isn't great

 * encapsulated postscript: supported by both MS office and open
office, but won't display a preview image unless you add one with an
external program.  Prints fine.

 * svg: R output devices still experimental and open office import
still experimental.  No support in ms office.

Have I missed anything?  Is the information correct?

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] standard errors for predict.nls?

2008-11-06 Thread Christoph Scherber

Dear Prof Ripley,

Am I correct if I use the following code to get c.i.´s for predicted values of 
the nls fit:

puro1<-nls(rate~a*conc/(b+conc), data=Puromycin[1:12,], start=list(a=200, b=1)) 
 #set up nls model

# assume only one predicted value is obtained using 
predict(puro1,list(conc=0.02)):

st=cbind(Puromycin[1:12,],fit=predict(puro1,list(conc=0.02)))

puro.bf=function(rs,i){
st$rate=st$fit+rs[i]
coef(nls(rate~a*conc/(b+conc), st, start=coef(puro1)))
}

rs=scale(resid(puro1),scale=F)
(puro.boot=boot(rs,puro.bf,R=100))

boot.ci(puro.boot,index=1,type=c("norm"))

###



Best wishes
Christoph




Prof Brian Ripley schrieb:

On Mon, 3 Nov 2008, Ben Bolker wrote:


Prof Brian Ripley wrote:

Christoph Scherber  agr.uni-goettingen.de>
writes:



Dear all,

Is there a way to retrieve standard errors from nls models?
The help page tells me that arguments
such as se.fit are ignored...

Many thanks and best wishes
Christoph



In general using the delta method (which is I guess what you mean, local
linearization via derivatives) is nowhere near accurate enough to be
useful.  That's why it has not been done on several occasions in the 
past.

If you think it might be, see ?delta.method in package alr3.

I would suggest using simulation/bootsrapping to explore the 
uncertainty.

There is an example in MASS of doing so (and that illustrates some of
the pitfalls).


 Hmmm.  By an example, do you mean an example of using bootstrapping to
explore uncertainty in general, or of using bootstrapping to get
standard errors of predictions from nonlinear regressions?  I looked
through my copy of MASS (4th ed.) and found only section 5.7
(bootstrapping in general) and chapter 8 (nonlinear and smooth
regression, esp. p. 225 "bootstrapping" for getting bootstrap c.i.'s on
parameter estimates).  I didn't find anything *specifically* covering
s.e./c.i. for nls predictions, but maybe that's not what you meant.


I meant the example on p.225 on bootstrapping a nls fit (and that you 
needed to bootstrap residuals in some cases).  You can use almost 
identical code to set s.e./c.i. for nls predictions.



 And yes, I meant "delta method" rather than "delta function" in my
original post.  Oops.

 I might add something quick/dirty/naive to the wiki giving
some examples of delta method/bootstrap approaches ...

 If there is no intention to add confidence interval calculation
to predict.se in the foreseeable future might I suggest that the details
under "Value" as to what "se.fit" will do when it is implemented be
removed? (And perhaps even a statement to the effect [as you say
above] that delta method is considered unreliable?)  As written it's a
bit of a tease ...


I didn't write that ... and its author might have other opinions.


 cheers
   Ben Bolker





--
Dr. rer.nat. Christoph Scherber
University of Goettingen
DNPW, Agroecology
Waldweg 26
D-37073 Goettingen
Germany

phone +49 (0)551 39 8807
fax   +49 (0)551 39 8806

Homepage http://www.gwdg.de/~cscherb1

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Bio7 1.3 for Linux released!

2008-11-06 Thread Bio7

Release notes:

http://www.nabble.com/Bio7-1.3-Linux-released!-td20360723.html#a20360723
http://www.nabble.com/Bio7-1.3-Linux-released!-td20360723.html#a20360723 

With kind regards

M.Austenfeld 
-- 
View this message in context: 
http://www.nabble.com/New-version-of-ecological-modeling-software-using-R-tp20318525p20362952.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] replicate and as.matrix: different behaviour between batch and non-batch mode

2008-11-06 Thread Oliver Bandel
Hello,


for a simulation  I tried the following:

=
sampmeanvec <- function (from, n, repititions)
{
  print( paste("samplesize n:", n, "repititions:", repititions) )
  samples.mat <- as.matrix( replicate( repititions, sample(from, n) ) )

  # would that case-check be necessary?
  #if( n == 1 )
  #{
  #  samples.mat <- t (samples.mat)
  #}

  print( "Dim of matrix:")
  print( dim(samples.mat) )

  meanvec <- apply(samples.mat, 2, mean)
  return(meanvec)
}


gleichsamp <- runif(1)

for( sampsize in c(1,2,4,8,16,32,64,128) )
{
  sampmeanvec(gleichsamp, sampsize, 20)
}

=

The following result:
--
> source("central_limit_theorem.R")
[1] "samplesize n: 1 repititions: 20"
[1] "Dim of matrix:"
[1] 20  1
[1] "samplesize n: 2 repititions: 20"
[1] "Dim of matrix:"
[1]  2 20
[1] "samplesize n: 4 repititions: 20"
[1] "Dim of matrix:"
[1]  4 20
[1] "samplesize n: 8 repititions: 20"
[1] "Dim of matrix:"
[1]  8 20
[1] "samplesize n: 16 repititions: 20"
[1] "Dim of matrix:"
[1] 16 20
[1] "samplesize n: 32 repititions: 20"
[1] "Dim of matrix:"
[1] 32 20
[1] "samplesize n: 64 repititions: 20"
[1] "Dim of matrix:"
[1] 64 20
[1] "samplesize n: 128 repititions: 20"
[1] "Dim of matrix:"
[1] 128  20
>

Look at the first dimension: there the cols and rows are
changed.

I tried directly in the R-shell:


> x <- 1:20
> dim( as.matrix(replicate(1, sample(x, length(x)) )  ))
[1] 20  1
> dim( as.matrix(replicate(2, sample(x, length(x)) )  ))
[1] 20  2
> dim( as.matrix(replicate(3, sample(x, length(x)) )  ))
[1] 20  3
> dim( as.matrix(replicate(4, sample(x, length(x)) )  ))
[1] 20  4


This looks good (and correct to me).


Can you locate my problem here?

Why is the cols and rows dimensions be changed?

Without using as.matrix the result of replicte is just a vector.
So I have to use it.
But only in the script/batch-mode.

Typed in directly (see above), it works as expected.

Any ideas on this behaviour?

Ciao,
   Oliver

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

2008-11-06 Thread Rodrigo Aluizio
Thanks Mark, it was exactly what I was looking for.

-Mensagem original-
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Em nome de Mark Difford
Enviada em: quinta-feira, 6 de novembro de 2008 09:22
Para: r-help@r-project.org
Assunto: Re: [R] R Mixed Anova


Hi Rodrigo,

Here are two options; for each type, the second version gives 2nd order
interactions

## aov
T.aovmod <- aov(response ~ Season + Beach + Line + Error(Block/Strata))
T.aovmod <- aov(response ~ (Season + Beach + Line)^2 + Error(Block/Strata))

## lme
library(nlme)
T.lmemod <- lme(response ~ Season + Beach + Line, random = ~ 1 |
Block/Strata)
T.lmemod <- lme(response ~ (Season + Beach + Line)^2, random = ~ 1 |
Block/Strata)
anova(T.lmemod)
?anova.lme

## Use package multcomp for doing post-hoc analysis.

Regards, Mark.


Rodrigo Aluizio wrote:
> 
> Hi list, I was searching how to properly write a command line for a mixed
> ANOVA. Well honestly, there are so many material on the older post of the
> list that just confused me.
> 
> I have five factors.
> 
>  
> 
> Season (fixed)
> 
> Beach (fixed)
> 
> Line (fixed)
> 
> Block (random)
> 
> Strata (random) nested in Block
> 
>  
> 
> And for each of the tree strata per block I got 3 replicates. 
> 
>  
> 
> I saw lots of things about “different” linear models commands… lm, lme… On
> R
> help I found aov and anova…
> 
>  
> 
> Any one knows what should be more adequate and how I write and appropriate
> command line? I need an ANOVA table, a p value, and be able to run post
> hoc
> tests.
> 
>  
> 
> Thanks for your attention and patience.
> 
>  
> 
> ___
> MSc.   Rodrigo Aluizio
> Centro de Estudos do Mar/UFPR
> Laboratório de Micropaleontologia
> Avenida Beira Mar s/n - CEP 83255-000
> Pontal do Paraná - PR - BRASIL
> Fone: (0**41) 3455-1496 ramal 217
> Fax: (0**41) 3455-1105
> 
> 
> 
> 
>   [[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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/R-Mixed-Anova-tp20358811p20359309.html
Sent from the R help mailing list archive at Nabble.com.

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

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


[R] Queries about step() and stepAIC()

2008-11-06 Thread Philip Whittall
I have been learning how to use these functions and would like to know
the following as
I have so far been unable to find the answers in the documentation.

1) What stopping rules are used ?

2) Can the stopping rules be changed?

3) Can the results of each step be stored as objects in R and if so how
?

4) Is there a worked example somewhere of using the keep= argument ?

Many thanks in anticipation,

Philip
 



This message should be regarded as confidential. If you have received this 
email in error please notify the sender and destroy it immediately.
Statements of intent shall only become binding when confirmed in hard copy by 
an authorised signatory.  The contents of this email may relate to dealings 
with other companies within the Detica Group plc group of companies.

Detica Limited is registered in England under No: 1337451.

Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, England.



[[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] Data manipulation question

2008-11-06 Thread Peter Jepsen
Thank you for your prompt assistance, cruz and Bart. 

Bart set me on the right track, and I modified his proposal to this:

f <- function(data){
m <- match(data$stop,data$start) 
n <- min(length(m),which(is.na(m)))
data$stop[n]
}
by(data,data$id,f)

It also handles some special cases outside my small example dataset.

Thank you again!
Peter.


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of bartjoosen
Sent: 6. november 2008 11:31
To: r-help@r-project.org
Subject: Re: [R] Data manipulation question


How about: 

id <- c(rep("a",4),rep("b",2), rep("c",5), rep("d",1)) 
start <- c(c(0,6,17,20),c(0,1),c(0,5,10,11,50),c(0)) 
stop <- c(c(6,12,20,30),c(1,10),c(3,10,11,30,55),c(6)) 
data <- data.frame(id,start,stop)

f <- function(data){
m <- match(data$start,data$stop) + 1
if (length(m)==1 && is.na(m)) m <- 1 
if (length(m) > 1 && is.na(m[2])) m <- 1
data$stop[min(m,na.rm=T)]
}

by(data,data$id,f)

The if statements in the function are for some special cases, in all the
other cases the firs line will do the trick.
I would like to add that using data is a somewhat bad behavior, as this
overwrites the build in data function of R.
And I changed the way you made up the data.frame, as your method would
convert everything to factors.

Good luck

Bart



Peter Jepsen wrote:
> 
> Dear R-listers,
> 
> I am a relatively inexperienced R-user currently migrating from Stata.
I
> am deeply frustrated by this data manipulation question: I know how I
> could do it in Stata, but I cannot make it work in R.
> 
> I have a data frame of hospitalization data where each row represents
an
> admission. I need to know when patients were first discharged, but the
> problem is that patients were sometimes transferred between hospital
> departments. In my data a transfer looks like a new admission, except
> that it has a 'start' date equal to the previous admission's 'stop'
> date.
> 
> Here is an example:
> 
> id <- c(rep("a",4),rep("b",2), rep("c",5), rep("d",1))
> start <- c(c(0,6,17,20),c(0,1),c(0,5,10,11,50),c(0))
> stop <- c(c(6,12,20,30),c(1,10),c(3,10,11,30,55),c(6))
> data <- as.data.frame(cbind(id,start,stop))
> data
> #id start stop
> # 1   a 06
> # 2   a 6   12
> # 3   a17   20
> # 4   a20   30
> # 5   b 01
> # 6   b 1   10
> # 7   c 03
> # 8   c 5   10
> # 9   c10   11
> # 10  c11   30
> # 11  c50   55
> # 12  d 06
> 
> So, what I want to end up with is this:
> 
> id start stop
> a  0 12   # This patient was transferred at time 6 and discharged
at
> time 12. The admission starting at time 17 is therefore irrelevant.
> b  0 10   
> c  0 3
> d  0 6
> 
> I have tried tons of variations over lapply, sapply, split, for etc.,
> all to no avail. 
> 
> Thank you in advance for any assistance.
> 
> Best regards,
> Peter Jepsen, MD.
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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/Data-manipulation-question-tp20356835p20358624.htm
l
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] Simple rep() question duplicating times and dates.

2008-11-06 Thread Solveig Mimler
Hi John,

I had the same problem yesterday and solved it like following:

seq(ISOdate(Year,Month,Day,Hour), by="hour", length=24*365)

for example: seq(ISOdate(2005,1,1,0), by="hour", length=8760)

Regards,
Solveig 


EIFER
Europäisches Institut für Energieforschung
Institut européen de recherche sur l'énergie
European Institute for Energy Research

Solveig Mimler 
Sociologist M.A.
Emmy-Noether-Straße 11
76131 Karlsruhe
Tel: +49 721 6105 1351
Fax: +49 721 6105 1332
mailto: [EMAIL PROTECTED]
_

EIFER
Europäisches Institut für Energieforschung, 
Electricité de France / Universität Karlsruhe (TH) EWIV 
Sitz der europäischen wirtschaftlichen Interessenvereinigung: Karlsruhe
Handelsregister: Amtsgericht Karlsruhe HRA 4823 
Vorsitzender des Aufsichtsrats: Prof. Dr.-Ing. RAINER REIMERT
Geschäftsführer: Dr. FREDERIC BARON (Institutsleiter) 
_

This e-mail and any attachment is for authorized use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by any other party.
If you are not an intended recipient then please promptly delete this 
e-mail and any attachment and all copies and inform the sender.
_

Message: 27
Date: Wed, 5 Nov 2008 16:14:19 +0100
From: "Gustaf Rydevik" <[EMAIL PROTECTED]>
Subject: Re: [R] Simple rep() question duplicating times and dates.
To: [EMAIL PROTECTED]
Cc: R R-help <[EMAIL PROTECTED]>
Message-ID:
 <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1

On Wed, Nov 5, 2008 at 4:02 PM, John Kane <[EMAIL PROTECTED]> wrote:
>
> I want to create a data.frame of time and date for a year.  I started 
with the idea of simply producing two vectors (time and date)
>
> The first part ( time) is easy.
>  rep(1:24, 365)
>
> But how do I get a series of 24 dates for O1 January 2005 and repeat 
this to 31 December 2005.
>
> It should be easy but I don't see it.
>
> Thanks


Hi John,

?Date leads you to (among other things) ?seq.Date.

Something like this should work:

time<-rep(1:24, 365)
dates<-seq(as.Date("01012005",format="%d%m%Y"),as.Date("31122005",format="%d%m%Y"),by=1)
TimeFrame<-data.frame(time)
TimeFrame$dates<-rep(dates,each=24)


Regards,
Gustaf
-- 
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik



--

Message: 28
Date: Wed, 5 Nov 2008 07:30:31 -0800 (PST)
From: John Kane <[EMAIL PROTECTED]>
Subject: Re: [R] Simple rep() question duplicating times and dates.
To: Gustaf Rydevik <[EMAIL PROTECTED]>
Cc: R R-help <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii

I don't have R on this machine to try it but it looks good to me.  I had 
even got as far as seq() but completely missed the use of "each". 

Thanks very much.

--- On Wed, 11/5/08, Gustaf Rydevik <[EMAIL PROTECTED]> wrote:

> From: Gustaf Rydevik <[EMAIL PROTECTED]>
> Subject: Re: [R] Simple rep() question duplicating times and dates.

> Cc: "R R-help" <[EMAIL PROTECTED]>
> Received: Wednesday, November 5, 2008, 10:14 AM
> On Wed, Nov 5, 2008 at 4:02 PM, John Kane

> >
> > I want to create a data.frame of time and date for a
> year.  I started with the idea of simply producing two
> vectors (time and date)
> >
> > The first part ( time) is easy.
> >  rep(1:24, 365)
> >
> > But how do I get a series of 24 dates for O1 January
> 2005 and repeat this to 31 December 2005.
> >
> > It should be easy but I don't see it.
> >
> > Thanks
> 
> 
> Hi John,
> 
> ?Date leads you to (among other things) ?seq.Date.
> 
> Something like this should work:
> 
> time<-rep(1:24, 365)
> 
dates<-seq(as.Date("01012005",format="%d%m%Y"),as.Date("31122005",format="%d%m%Y"),by=1)
> TimeFrame<-data.frame(time)
> TimeFrame$dates<-rep(dates,each=24)
> 
> 
> Regards,
> Gustaf
> -- 
> Gustaf Rydevik, M.Sci.
> tel: +46(0)703 051 451
> address:Essingetorget 40,112 66 Stockholm, SE
> skype:gustaf_rydevik


[[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] mean computation for external data

2008-11-06 Thread christabel_jane prudencio


 
I have an external data (.txt) for
annual peak flood. The first column is the year, second column is the
observation date, and the last is the observed discharge. My task is to
calculate the mean, skewness and kurtosis of the said data. I was advised to use
read.table() to read the entire data. Please help me on how to perform the
required computation. I am obviously a new user of this statistical software.
Thank you so much for helping.

Christabel Jane P. Rubio
M.S. Student
Water Resources Engineering
Dept. of Construction & Environmental Engineering 
Kongju National University (Cheonan Campus)
102th Office,The 5th Engineering Building,
275, Budae-dong, Cheonan-si, Chungnam-do, 330-717, Korea
TEL : +82-41-521-9316 
FAX : +82-41-568-0287

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

2008-11-06 Thread Uwe Ligges



christabel_jane prudencio wrote:


 
I have an external data (.txt) for

annual peak flood. The first column is the year, second column is the
observation date, and the last is the observed discharge. My task is to
calculate the mean, skewness and kurtosis of the said data. I was advised to use
read.table() to read the entire data. Please help me on how to perform the
required computation. I am obviously a new user of this statistical software.
Thank you so much for helping.


Then please read the posting guide of this list and learn that we will 
not solve your homeworks.


Uwe Ligges




Christabel Jane P. Rubio
M.S. Student
Water Resources Engineering
Dept. of Construction & Environmental Engineering 
Kongju National University (Cheonan Campus)

102th Office,The 5th Engineering Building,
275, Budae-dong, Cheonan-si, Chungnam-do, 330-717, Korea
TEL : +82-41-521-9316 
FAX : +82-41-568-0287


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] RE : "Text" function in 3D graph

2008-11-06 Thread EVANS David-William
I produced the 3D plot with "cloud" function (lattice package), but rgl package 
works well: I can easily plot in 3D and annotate.

Thank you very much for your help.

Sebastian.

-
Merci de répondre à cette adresse e-mail et à [EMAIL PROTECTED]  
Please reply both to this email address and to [EMAIL PROTECTED] 
 

-Message d'origine-
De : Duncan Murdoch [mailto:[EMAIL PROTECTED] 
Envoyé : mercredi 5 novembre 2008 19:02
À : EVANS David-William
Cc : r-help@r-project.org
Objet : Re: [R] "Text" function in 3D graph

On 11/5/2008 10:59 AM, EVANS David-William wrote:
> Fellow R users,
> 
>  
> 
> I often use « text » to annotate plots in 2 dimensions.  Having grown up to 3 
> dimensions recently, I am looking for a similar function.  Could anyone 
> provide code for how to annotate points in a 3-d plot?

You need to describe how you are producing the 3d plot.  The rgl package 
has text3d, but it's different in the scatterplot3d package or lattice.

Duncan Murdoch

>  
> 
> Your help is greatly appreciated.
> 
>  
> 
> For Sébastien Velazquez.
> 
>  
> 
> -
> 
> Merci de répondre à cette adresse e-mail et à [EMAIL PROTECTED] 
>  .  
> 
> Please reply both to this email address and to [EMAIL PROTECTED] 
>  . 
> 
>  
> 
>  
> 
> 
>   [[alternative HTML version deleted]]
> 
> 
> 
> 
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] How to get the length of an UTF-8 string

2008-11-06 Thread Prof Brian Ripley

On Thu, 6 Nov 2008, Fán Lóng wrote:


Hi there,

I am intending to get the length of an UTF-8 string which contains
some Japanese characters (let's say, rstr) in R language.
I try to use the nchar(rstr) to get its length, however, it returns
the "NA" for it contains some multi-byte characters.

Is there any alternatives to return the length of this rstr?


Use a UTF-8 locale, then nchar() will get it right.

Or convert it to the Japanese locale on your system, and use nchar in that 
locale.




Any suggestion is  appreciated.

Long

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


Please do: we are missing the 'at a minimum' information needed to answer 
this question.  Locales do matter.



--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Inference and confidence interval for a restricted cubic spline function in a hurdle model

2008-11-06 Thread Erik Lampa
Dear list,

I'm currently analyzing some count data using a hurdle model. I've used 
the rcspline.eval function in the Hmisc-library to contruct the spline 
terms for the regression model, and what I want in the end is the ability 
to compute coefficients and confidence intervals for different changes in 
the smooth function as well as plotting the smooth function along with the 
confidence interval at the values of the x-variable.

An example using the "zero"-part of the hurdle model:

library(Hmisc)
library(pscl)

# Simulate some data

set.seed(1)
y<-c(rep(0,50),rnbinom(50,0.9,0.2))
x<-sin(y)+rnorm(100)

# Set up the spline terms
ssp<-rcspline.eval(x,inclx=T)

# Fit the model and construct the smooth function
f<-hurdle(y~ssp)
knots<-attr(ssp,"knots")
coef<-f$coefficients$zero
w<-rcspline.restate(knots,coef)
fun<-eval(attr(w,"function"))

The coefficient for a change in x from -0.1 to 0.1 is fun(0.1)-fun(-0.1). 
My question is therefore how do I compute the confidence interval for this 
change?

This is easy to do with the Design-library for the "zero"-part but as far 
as I know, zero-truncated negative binomial data can't be fitted using 
Design's functions as they are. Does someone know any neat tricks that 
would make this possible?

Any help on this would be greatly appreciated. Thanks for your time.

/Erik Lampa, Statistician, Uppsala University Hospital, Sweden

[[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] read Idrisi file

2008-11-06 Thread Roger Bivand
Abdou Ali  agrhymet.ne> writes:

> 
> Dear Sirs,
> 
> Is there a R function to read an Idrisi image (*.rdc & *.rst)

Yes, please see the rgdal package, which can read this format. The "Spatial" 
Task View (CRAN) might have got you the information you need without posting. 
Depending on the size of your data, used the GDAL bindings directly, or use 
sp classes if the raster isn't huge.

Roger Bivand

> 
> Thanks
>

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

2008-11-06 Thread Michael Kubovy
Hi,

I'm not sure how use curve(dexGAUS(…

None of the following four works:

rt<- rexGAUS(100, mu=300, nu=100, sigma=35)
m1<-gamlss(rt~1, family=exGAUS)
curve(dexGAUS(rt=x, mu=300 ,sigma=35,nu=100), 100, 600, main = "The ex- 
GAUS  density mu=300 ,sigma=35,nu=100")
curve(dexGAUS(x=rt, mu=300 ,sigma=35,nu=100), 100, 600, main = "The ex- 
GAUS  density mu=300 ,sigma=35,nu=100")
curve(dexGAUS(y=rt, mu=300 ,sigma=35,nu=100), 100, 600, main = "The ex- 
GAUS  density mu=300 ,sigma=35,nu=100")
curve(dexGAUS(rt=y, mu=300 ,sigma=35,nu=100), 100, 600, main = "The ex- 
GAUS  density mu=300 ,sigma=35,nu=100")
But this does:

y<- rexGAUS(100, mu=300, nu=100, sigma=35)
m1<-gamlss(y~1, family=exGAUS)
curve(dexGAUS(y=x, mu=300 ,sigma=35,nu=100), 100, 600, main = "The ex- 
GAUS  density mu=300 ,sigma=35,nu=100")



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




[[alternative HTML version deleted]]

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


[R] mean computation for external data

2008-11-06 Thread christabel jane

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


  1   2   >