[R] Most used R editors

2009-06-02 Thread Martial Sankar

Hi,

I am a little lonely as R users in my group. So, I would like to know which 
editor is the most used in the R community.
This post is some kind of survey.

Personally, I use  Emacs with ESS, It permits to :

- open more than one R session 
- split the emacs editor as many part as you want.
- use a lot of keybindings.
...

I also tried Rkwards, Scilab (windows), JGR etc... but they are not suitable 
for what I do.

Best,

- Martial


_
Découvrez toutes les possibilités de communication avec vos proches

[[alternative HTML version deleted]]

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


Re: [R] creating list with 200 identical objects

2009-06-02 Thread Rainer M Krug
Thanks a lot Wacek for this clear description of the problem - I was
not aware, that it is that complex.
I definitely did not consider the initialize() function in writing my code.

But as I only want to allocate the space for the objects, it does not
matter here. But when I write a simulation and want to initialize it
with two hundred different individuals, this definitely becomes
crucial - thanks again for this clarification and the very useful
references (especially [2] for the moment).

Am I right that all assignments of classes via <- or -> are by value
and NOT by reference? So when

setClass('foo',
   representation=representation(content='character'),
   prototype=list(content='foo'))

A <- new("foo")
B <- A

B is a different object then A, i.e. changes in B are not reflected in
A and vice versa, but they have the same content.

It seems that if foo has a slot O containing an object of class
"fooInFoo", this object O also copied by value. I.e. when, following
above,

setClass('foo2',
   representation=representation(content='character'),
   prototype=list(content='fooInFoo'))
setClass('foo',
   representation=representation(content='character', O='foo2'),
   prototype=list(content='foo', O=new('foo2')))
A <- new("foo")
B <- A

a...@o@content <- "AA"
a...@o@content
  [1] "AA"
b...@o@content
  [1] "fooInFoo"

Is this always the case? and is there a way of copying by reference
(or passing an object to a function by reference)?

Rainer
Cheers

Rainer

On Mon, Jun 1, 2009 at 11:36 PM, Wacek Kusnierczyk
 wrote:
> Wacek Kusnierczyk wrote:
>>
>> consider:
>>
>>     setClass('foo',
>>        representation=representation(content='environment'))
>>     setMethod('initialize', 'foo', function(.Object) {
>>         .obj...@content = new.env()
>>         .obj...@content$name = 'foo'
>>         .Object })
>>
>>     foos = rep(list(new('foo')), 2)
>>     foos[[...@content$name = 'bar'
>>     foos[[...@content$name
>>     # 'bar'
>>
>> of course, because you have just one object twice on the list, its
>> content is an environment, and with environments r does not pretend to
>> be functional.  but:
>>
>>     foos = lapply(1:2, function(x) new('foo'))
>>     foos[[...@content$name = 'bar'
>>     foos[[...@content$name
>>     # 'foo'
>>
>> of course, because you have two distinct objects, and assignment to one
>> of them has no effect on the other.  similarly if 'foo' is defined as
>> follows:
>>
>>     setClass('foo',
>>        representation=representation(content='environment'))
>>     setMethod('initialize', 'foo', function(.Object) {
>>        .obj...@content$name = 'foo'
>>        .Object })
>>
>> or as follows:
>>
>>     setClass('foo',
>>        representation=representation(content='environment'),
>>        prototype=list(content={
>>            e=new.env()
>>            e$name='foo'
>>            e }))
>>
>>
>
> actually, not the last one;  i got caught by that redefining 'foo' with
> setClass does not remove the initializer.  so here's another situation
> (best to execute in a fresh session) you should beware:
>
>    setClass('foo',
>        representation=representation(content='environment'),
>        prototype=list(content={
>            e=new.env()
>            e$name='foo'
>            e }))
>
>    foos = lapply(1:2, function(x) new('foo'))
>    foos[[...@content$name = 'bar'
>    foos[[...@content$name
>    # "bar"
>
> in this case, even if you're careful enough to create two objects, they
> share the representation because they both get it from the same prototype.
>
> vQ
>
>
>



-- 
Rainer M. Krug, Centre of Excellence for Invasion Biology,
Stellenbosch University, South Africa

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


Re: [R] R Solves Shakespeare Authorship Question

2009-06-02 Thread Wacek Kusnierczyk
Stavros Macrakis wrote:
> I don't know why this paper is getting our attention here -- it is just an
> undergraduate student term paper for a computer science course on statistics
> and data mining.
>   

"Those of you who track applications of R may be interested"

vQ

>  -s
>
> On Mon, Jun 1, 2009 at 5:48 PM,  wrote:
>
>   
>> On Sat, 30-May-2009 at 07:42PM -0700, Arthur Burke wrote:
>>
>> |> Those of you who track applications of R may be interested in the
>> following:
>> |>
>> |> "The purpose of this paper is then to apply modern
>> |> text analysis techniques using the R statistical packege [sic]
>>
>> That's not the only such typo.  I had a very quick skim through the PDF
>> file and spotted half a dozen of them.  Kind of calls into question
>> how reliable the list of words they used was, and thereby the
>> reliability of any conclusion.
>>
>> Either that, or my sense of humour is failing me.
>>
>>
>>
>> |> to compare the works attributed to Shakespeare
>> |> to those of leading alternate candidates such as Sir
>> |> Frances Bacon, Christopher Marlow, and Edward de
>> |> Vere...".
>> |>
>> |> 
>> http://www.cs.dartmouth.edu/~datamining/Final.pdf
>> |>
>>
>> |> I await the creative use of R to solve other vexing problems in the
>> |> dramatic and performing arts such as the "Third Stooge Problem" and
>> |> whether there is any naughtiness in the Britney Spears song title,
>> |> "If You Seek Amy."
>> --
>>
>> Patrick Connolly
>>
>> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
>> I have the world`s largest collection of seashells. I keep it on all
>> the beaches of the world ... Perhaps you`ve seen it.  ---Steven Wright
>> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/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] Most used R editors

2009-06-02 Thread Ronggui Huang
I personally use ESS now. I think it is great for programming. I used
kate under KDE once, and it worked fine. I quite like kate though I am
not a fan of KDE.

Ronggui

2009/6/2 Martial Sankar :
>
> Hi,
>
> I am a little lonely as R users in my group. So, I would like to know which 
> editor is the most used in the R community.
> This post is some kind of survey.
>
> Personally, I use  Emacs with ESS, It permits to :
>
> - open more than one R session
> - split the emacs editor as many part as you want.
> - use a lot of keybindings.
> ...
>
> I also tried Rkwards, Scilab (windows), JGR etc... but they are not suitable 
> for what I do.
>
> Best,
>
> - Martial
>
>
> _
> Découvrez toutes les possibilités de communication avec vos proches
>
>        [[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.
>
>



-- 
HUANG Ronggui, Wincent
PhD Candidate
Dept of Public and Social Administration
City University of Hong Kong
Home page: http://asrr.r-forge.r-project.org/rghuang.html

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


Re: [R] Bug in hist() when working with Dates ?

2009-06-02 Thread Martin Maechler
> "SN" == S Nunes 
> on Mon, 1 Jun 2009 16:45:54 +0100 writes:

SN> Hi, It seems that hist() has a buggy behavior when
SN> breaking over "days".  The bug can be reproduced in a
SN> few steps:

>> d=data.frame(date=c("2009-01-01", "2009-01-02",
>> "2009-01-02")) d$date=as.Date(d$date) d$date
SN> [1] "2009-01-01" "2009-01-02" "2009-01-02"

>> h=hist(d$date, "days") h$count
SN> [1] 3

much simpler and less confusing is not going via data frame
(and 'plot=FALSE' suppresses the plot which is not the issue here) :

d. <- as.Date(c("2009-01-01", "2009-01-02", "2009-01-02"))
str(h <- hist(d., "days", plot=FALSE))

This does give what you observe.
It is not a bug as it is consistent with the default histogram
behavior:

> str(hist(c(1,2,2), breaks=1:2, plot=FALSE))
List of 7
 $ breaks : int [1:2] 1 2
 $ counts : int 3
 $ intensities: num 1
 $ density: num 1
 $ mids   : num 1.5
 $ xname  : chr "c(1, 2, 2)"
 $ equidist   : logi TRUE
 - attr(*, "class")= chr "histogram"

SN> Despite the fact that the original data contains 2
SN> distinct days. The call hist() only returns one "break",
SN> adding the occurrences of both days. I would expect the
SN> last output to be: [1] 1 2.

as you see, your expectation is wrong.
It may help if you  also use  cut() (and read its help page)
and study the behavior of 
'include.lowest' and 'right' arguments to both cut and hist.

SN> I am using R version 2.9.0.

SN> I would like to know if this behavior is correct or a
SN> bug?
"correct", as said above.

SN> Thanks in advance for your comments on this issue,

I agree that it may be useful if hist.Date(), the method used here,
would allow to easily produce what you expected,
when you'd use

  str(h <- hist(d., "days", include.lowest=FALSE))

{which gives an error now},
namely to effectively use what you now can get via

  str(hist(d., breaks= seq(min(d.)-1, max(d.), "days")))

{hint: the above is the solution for your problem}

(make check-devel) tested patches to hist.Date()
[in src/library/graphics/R/datetime.R] are welcome.

Martin Maechler, ETH Zurich

SN> -- Sergio Nunes

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


Re: [R] Error:non-numeric argument in my function

2009-06-02 Thread Wacek Kusnierczyk
Stavros Macrakis wrote:
> On Mon, Jun 1, 2009 at 11:33 AM, Wacek Kusnierczyk <
> waclaw.marcin.kusnierc...@idi.ntnu.no> wrote:
>
>   
>> ...  there is an ugly lack of consistency here:...
>>
>> 
>
> I agree that it's inconsistent that
>
>   1:'2'   --> 1:2  # this doesn't seem to be documented in ? seq
>   1+ '2'  --> error
>   1+factor(2)  --> NA (with a warning)
>   1 : factor(4)  --> 1  (uses as.numeric/unclass of factor)
>
>
>   
>> ...i'd expect ...a successful computation (with a character -> numeric
>> coercion of '2' to 2)...
>>
>> 
>
> But I disagree that the best thing to do here is to have them all coerce to
> numerics.  In scripting languages like Perl which are constantly going back
> and forth between internal and external representations, it makes some sense
> to auto-convert numeric strings to numerics and vice versa, but I don't
> think it makes sense in a statistical language.
>
> I would rather see them all give errors.
>   

i think either approach is correct in the scripting language r, provided
the users do not have to navigate between exceptions and errors due to
the inconsistent design.

i agree that having 1:'2' result in an error might be better than what i
suggested above.  i said "i'd expect a successful computation" wrt. 1 *
'2' not because i think it is the best r could do, but because r already
messes with implicit coercions (as in 1:'2' and 1 + 0i, but not 1*'2'
and sqrt(0i)), and it would be easier to learn if you could always
expect a string to be (attempted to be) coerced to numeric in an
arithmetic context.


vQ

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

2009-06-02 Thread yongkook Kwon
Hi..

I want to conduct data rank regression.

The some value in my data has 5 levels( 0,1,2,3,4).

I don't know exactly value, just know levels.

How can I use fuction ??

[[alternative HTML version deleted]]

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


Re: [R] creating list with 200 identical objects

2009-06-02 Thread Wacek Kusnierczyk
Rainer M Krug wrote:
> Thanks a lot Wacek for this clear description of the problem - I was
> not aware, that it is that complex.
> I definitely did not consider the initialize() function in writing my code.
>
> But as I only want to allocate the space for the objects, it does not
> matter here. But when I write a simulation and want to initialize it
> with two hundred different individuals, this definitely becomes
> crucial - thanks again for this clarification and the very useful
> references (especially [2] for the moment).
>
> Am I right that all assignments of classes via <- or -> are by value
> and NOT by reference? So when
>
> setClass('foo',
>representation=representation(content='character'),
>prototype=list(content='foo'))
>
> A <- new("foo")
> B <- A
>   

i guess [sic] that what happens at this point is the usual thing:  B
refers to the *same* object, which now has an increased accession counter.

> B is a different object then A, i.e. changes in B are not reflected in
> A and vice versa, but they have the same content.
>   

well.  i guess [sic] that when you assign to a slot of b, it is that
object that is reproduced, which also triggers a reproduction of the
instance object itself (note:  without 'new' and any initializer being
called).  however, this does not happen if the slot is an environment,
because r won't reproduce an environment on assignment.  in this case,
you still have A and B being the same object, with modified content:

setClass('foo',
representation=representation(foo='environment'),
prototype=list(foo=new.env()))

a = new('foo')
b = a
a...@foo$bar = 'bar'
b...@foo$bar
# "bar"


to be sure, you may want to check with the sources -- i haven't done it
yet, hence the guesswork.


> It seems that if foo has a slot O containing an object of class
> "fooInFoo", this object O also copied by value. I.e. when, following
> above,
>
> setClass('foo2',
>representation=representation(content='character'),
>prototype=list(content='fooInFoo'))
> setClass('foo',
>representation=representation(content='character', O='foo2'),
>prototype=list(content='foo', O=new('foo2')))
> A <- new("foo")
> B <- A
>
> a...@o@content <- "AA"
> a...@o@content
>   [1] "AA"
> b...@o@content
>   [1] "fooInFoo"
>
> Is this always the case? and is there a way of copying by reference
> (or passing an object to a function by reference)?
>   

using environments provides a straightforward way to pass by reference,
because that's how they are passed.  (the claim that r passes by value,
made here and there, is incorrect and misleading, for this and other
reasons.)

otherwise, r's object systems -- s3 and s4 -- are so good that people
have been inventing their own ways to deal with the trouble.  For
example, R.oo, available from cran, is a package with

"Methods and classes for object-oriented programming in R with or
without references. [...] This is a cross-platform package implemented
in pure R that defines standard S3 classes without any tricks."

vQ

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


Re: [R] grid.edit() for ggplot2

2009-06-02 Thread baptiste auguie

Perfect, thank you!

Thanks also to Gabor G. for the links.

baptiste

On 2 Jun 2009, at 01:30, Paul Murrell wrote:


Hi


baptiste auguie wrote:

Dear all,


I'm trying to access and modify grobs in a ggplot2 plot. The basic  
idea
for raw Grid objects I understand from Paul Murrell's R graphics  
book,

or this page of examples,

http://www.stat.auckland.ac.nz/~paul/grid/copygrob/copygrobs.R

However I can't figure out how to apply this to a ggplot (basically I
don't know how to write a syntactically correct gPath),


p <- # minimal example
qplot(0,0)+ annotate("text",0,0,label="test")

g <- # store the plot as a grob
ggplotGrob(p)

# structure of the grob
grid.ls(g) # rather large!

# find a particular grob in the gTree
getGrob(g,"texts", grep = T)


# next step, modify, say, the colour of these grobs
grid.edit() # what do I put in here?



(Ignoring whether this is the most ggplot-ish way to achieve the end
result ...)

Let's take a closer look at the part of the grob (gTree) that you have
selected ...


grid.ls(getGrob(g,"texts", grep = T))

texts.gTree.5
  GRID.text.3

... (the "5" and the "3" in those names are likely to be different for
you).  This is a gTree with one child, which is a text grob.  I don't
know much about how the "texts" gTree works, so it's not clear how I
should modify that to influence the text grob, but I do know that I  
can

modify the 'gp' component of the text grob.  For example ...


grid.edit("GRID.text.3", gp=gpar(col="red"))


... and if I wanted to be SURE that I was getting the text grob  
beneath

that "texts" gTree, then I could use a gPath like this ...


grid.edit(gPath("texts.gTree.5", "GRID.text.3"), gp=gpar(col="blue"))


... and if I wanted to use code that had a better chance of working in
another session (when the "5" and "3" name suffixes are likely to be
different), I could use something like ...


grid.edit(gPath("texts.gTree", "GRID.text"), grep=TRUE,

gp=gpar(col="pink"))

... does that give you what you were looking for ?

Paul



Thanks for any piece of advice,

baptiste

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
p...@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/


_

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag

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


Re: [R] compatibility between R 2.7.0 and 2.8.1

2009-06-02 Thread Uwe Ligges
Perhaps the real solution is to upgrade to R-2.9.0 and patch RPy so that 
it works with recent versions of R. The maintainer of RPy might be happy 
about patches.


Best,
Uwe Ligges




Rheannon wrote:

Hello,

I have some R code that I wrote with version 2.8.1 and have since needed to
revert back to version 2.7.0 in order to run my R code with RPy for Python.
R version 2.7.1 is the latest version RPy supports. My issue is my code is
no longer running properly and I was hoping someone might be able to help
me. I am wondering if there are certain functions that I am using that are
not supported in the older version of R.

I have uploaded the R file I am running and the error message I am receiving
after this section of code is as follows:
 #sum AFDD between FN and LN, excluding positive values

for(i in 1:R){

+ for(j in FN[i]:LN[i]){
+ if(Growth_period[i,j]<0)
+ AFDD[i] <- AFDD[i] + sum(Growth_period[i,j])}}
Error in if (Growth_period[i, j] < 0) AFDD[i] <- AFDD[i] +
sum(Growth_period[i,  : 
  argument is of length zero


When I run the same code in 2.8.0 there does not seem to be a problem. More
interestingly, in version 2.7.1 when I keep the input files the same, the
outputs do not match!? Which makes it harder to locate the exact cause of
the issue..

If anyone can see a particular function I am using that does not well in the
older vresion or has any suggestions that would be very helpful.

Cheers,
R

http://www.nabble.com/file/p23820222/Validation_Hydro_year_post.txt
Validation_Hydro_year_post.txt 





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


[R] R: subset dataframe/list

2009-06-02 Thread Cecilia Carmo

Thank you all!!!

The problem was the decimal symbol! My data was saved in a 
txt file, so I’ve introduced the dec="," in «read.table» 
and it worked. What I’ve done was

coeficientes<-read.table("coeficientes.txt",sep="\t",header=T,dec=",")

Then, subset worked fine
coeficientesWanted<-subset(coeficientes,b1>0)

Thanks again,
Cecília Carmo (Universidade de Aveiro – Portugal)






  --- the forwarded message follows ---
--- Begin Message ---






  --- the forwarded message follows ---
--- Begin Message ---

Doesn´t work neither!


head(coeficientes)

   caedois   b1   b2   b3
11   0,033120395 -20,29478338 -0,274638864
22 -0,040629634  74,54239889 -0,069958424
35-0,001116816   35,2398622  0,214327185
4   10 0,171875
5   140,007288399  40,06560548 -0,081828338
6   150,027530346  0,969969409  0,10277

I’ve done
coeficientes$b1<-as.numeric(as.character(coeficientes$b1))
And b1 was substituted by NA’s

Then I’ve done
coeficientes$b1<-as.numeric(coeficientes$b1)
And b1 was transformed in other numbers
 caedois   b1   b2   b3
1138-20,29478338 -0,274638864
22 7 74,54239889 -0,069958424
35 2 35,2398622  0,214327185
4   1048
5   1415  40,06560548 -0,081828338
6   1531  0,969969409  0,10277

Thanks anyway,
Cecília


Em Mon, 01 Jun 2009 13:11:48 -0500 (CDT)
 markle...@verizon.net escreveu:
hi: when I sent you my solution,  I didn't realize that 
you had factors. if you change the
factors  to characters as described in that email, and 
then use my approach , i think it should still work.







On Jun 1, 2009, markle...@verizon.net wrote: Hi: 


coeficientes[,(coeficientes[,"b1"] > 0)]

will i think give you all the rows of the object where 
b1 is greater than zero.


I can't tell if coeficients is a data frame or a matrix 
but the above should work in either case.






On Jun 1, 2009, Cecilia Carmo  
wrote: Hi R-helpers!


I have the following object:

head(coeficientes)

caedois   b1   b2   b3
1   10,033120395 -20,29478338 -0,274638864
2   2   -0,040629634  74,54239889 -0,069958424
3   5   -0,001116816   35,2398622  0,214327185
4  10 0,171875
5  14   0,007288399  40,06560548 -0,081828338
6  15   0,027530346  0,969969409  0,10277

I´ve tried to subset it like this:
coefSelected<-subset(coeficientes,"b1">0) 

but it does nothing

Then I’ve tried:

coefSelected<-subset(coeficientes,b1>0)

But I´ve got the following
Warning message:
In Ops.factor(b1, 0) : > not meaningful for factors

So I’ve tried:

coefSelected<-subset(coeficientes,coeficientes$b1>0)

Warning message:
In Ops.factor(coeficientes$b1, 0) : > not meaningful for 
factors


 I´ve done

mode(coeficientes)

[1] "list"

But I don´t know how to handle it!
Coul anyone help me?
Thanks,

Cecília Carmo (Universidade de Aveiro – Portugal

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





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


Re: [R] problem with package creation under Windows and R 2.9.0

2009-06-02 Thread Uwe Ligges



antonio.gasparr...@lshtm.ac.uk wrote:

Dear R users,
 
I found a small problem with the package creation procedure in R 2.9.0 under Windows.

Basically, I input in the command prompt;
 
Rcmd BUILD --binary --use-zip namepackage
 
The procedure works, but the titles in the help pages of the created package lose the usual colours and font.


Which help pages? Formatted text, html, compiled html, pdf
Can you provide us an example for a corresponding Rd file?

Best,
Uwe Ligges



Conversely, the result is perfect using R 2.8.1 (changing the path) and the 
same version of Rtools (.29).
 
Not a big issue, but maybe it's worth considering it.

Regards,
 
Antonio Gasparrini

Public and Environmental Health Research Unit (PEHRU)
London School of Hygiene & Tropical Medicine
Keppel Street, London WC1E 7HT, UK
Office: 0044 (0)20 79272406 - Mobile: 0044 (0)79 64925523
Skype contact: a.gasparrini

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 add value on the bar ploted by barplot()

2009-06-02 Thread Jim Lemon

Xiaogang Yang wrote:

how to add value on the bar ploted by barplot()?

and the axis label is too big, anyone know how to change their font , thanks

  

Hi Xiaogang,
Have a look at the second example for the "boxed.labels" function in the 
plotrix package.

For the second question, look at par(cex.axis =)

Jim

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


[R] newbie help: simple operations in R

2009-06-02 Thread Carletto Rossi
Hi, i' d like to use R for simple calculations. I show you an examples to
make clear my help request

I' ve a file .csv like this (my real file is composed by 10.000 lines and 8
columns)

x y
3 4
1 7

I' ve imported in R correctly. Now i want create a new variable named "t"
and t is defined throught this relation:

t = 4 (second element on x column) * 4 (first element on y column)

in what way can i calculate t and print its value on an external file or,
better, append t values as a column on my original csv???

Thanks

Emanuele

[[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] newbie help: simple operations in R

2009-06-02 Thread Simon Pickett

you could use a loop but maybe easier would be
x<-c(NA,x)
y<-c(y,NA)
t<-x*y

use write.table() to write the table to your hard drive

e.g.

write.table(t, file="C:/Documents and Settings/simonp/My Documents/RELU/GIS 
data/Land Cover Map working/squares plus adjoining parcels/Scotland/scotland 
adj squares.csv", sep = ",",row.names = F)


HTH, Si.

- Original Message - 
From: "Carletto Rossi" 

To: 
Sent: Tuesday, June 02, 2009 11:22 AM
Subject: [R] newbie help: simple operations in R



Hi, i' d like to use R for simple calculations. I show you an examples to
make clear my help request

I' ve a file .csv like this (my real file is composed by 10.000 lines and 
8

columns)

x y
3 4
1 7

I' ve imported in R correctly. Now i want create a new variable named "t"
and t is defined throught this relation:

t = 4 (second element on x column) * 4 (first element on y column)

in what way can i calculate t and print its value on an external file or,
better, append t values as a column on my original csv???

Thanks

Emanuele

[[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] Neural Network resource

2009-06-02 Thread Indrajit Sengupta
Thanks to all those who have replied to my query. I have decided do a thorough 
reading on this subject and try to seek out a proper solution. I will stick to 
the nnet package as mentioned by Jude and try and compare results with other 
neural network software if possible.

Regards,
Indrajit
 





From: "jude.r...@ubs.com" 

Sent: Thursday, May 28, 2009 10:49:36 PM
Subject: Re: [R] Neural Network resource


The package AMORE appears to be more flexible, but I got very poor results 
using it when I tried to improve the predictive accuracy of a regression model. 
I don't understand all the options well enough to be able to fine tune it to 
get better predictions. However, using the nnet() function in package VR gave 
me decent results and is pretty easy to use (see the Venables and Ripley book, 
Modern Applied Statistics with S, pages 243 to 249, for more details). I tried 
using package neuralnet as well but the neural net failed to converge. I could 
not figure out how to set the threshold option (or other options) to get the 
neural net to converge. I explored package neural as well. Of all these 4 
packages, the nnet() function in package VR worked the best for me.
 
As another R user commented as well, you have too many hidden layers and too 
many neurons. In general you do not need more than 1 hidden layer. One hidden 
layer is sufficient for the "universal approximator" property of neural 
networks to hold true. As you keep adding neurons to the one hidden layer, the 
problem becomes more and more non-linear. If you add too many neurons you will 
overfit. In general, you do not need to add more than 10 neurons. The 
activation function in the hidden layer of Venables and Ripley's nnet() 
function is logistic, and you can specify the activation function in the output 
layer to be linear using linout = T in nnet(). Using one hidden layer, and 
starting with one hidden neuron and working up to 10 hidden neurons, I built 
several neural nets (4,000 records) and computed the training MSE. I also 
computed the validation MSE on a holdout sample of over 1,000 records. I also 
started with 2 variables and worked up to 15 variables in
 a "for" loop, so in all, I built 140 neural nets using 2 "for" loops, and 
stored the results in lists. I arranged my variables in the data frame based on 
correlations and partial correlations so that I could easily add variables in a 
"for" loop. This was my "crude" attempt to simulate variable selection since, 
from what I have seen, neural networks do not have variable selection methods. 
In my particular case, neural networks gave me marginally better results than 
regression. It all depends on the problem. If the data has non-linear patterns, 
neural networks will be better than linear regression.
 
My code is below. You can modify it to suit your needs if you find it useful. 
There are probably lines in the code that are redundant which can be deleted.
 
HTH.
 
Jude Ryan
 
My code:
 
# set order in data frame train2 based on correlations and partial correlations
train2 <- train[, c(5,27,19,20,25,26,4,9,3,10,16,6,2,14,21,28)]
dim(train2)
names(train2)
library(nnet)
# skip = T
# train 10 neural networks in a loop and find the one with the minimum test and 
validation error
# create various lists to store the results of the neural network running in 
two for loops
# The Column List is for the outer for loop, which loops over variables
# The Row List is for the inner for loop, which loops over number of neurons in 
the hidden layer
col_nn <- list()  # stores the results of nnet() over variables - outer loop
row_nn <- list()  # stores the results of nnet() over neurons - inner loop
col_mse <- list()
# row_mse <- list() # not needed because nn.mse is a data frame with rows
col_sum <- list()
row_sum <- list()
col_vars <- list()
row_vars <- list()
col_wts <- list()
row_wts <- list()
df_dim <- dim(train2)
df_dim[2]  # number of variables
df_dim[2] - 1
num_of_neurons <- 10
# build data frame to store results of neural net for each run
nn.mse <- data.frame(Train_MSE=seq(1:num_of_neurons), 
Valid_MSE=seq(1:num_of_neurons))
# open log file and redirect output to log file
sink("D:\\XXX\\YYY\\ Programs\\Neural_Network_v8_VR_log.txt")
# outer loop - loop over variables
for (i in 3:df_dim[2]) {  # df_dim[2]
  # inner loop - loop over number of hidden neurons
  for (j in 1:num_of_neurons) { # upto 10 neurons in the hidden layer
    # need to create a new data frame with just the predictor/input variables 
needed
    train3 <- train2[,c(1:i)]
    coreaff.nn <- nnet(dep_var ~ ., train3, size = j, decay = 1e-3, linout = T, 
skip = T, maxit = 1000, Hess = T)
    # row_vars[[j]] <- coreaff.nn$call # not what we want
    # row_vars[[j]] <- names(train3)[c(2:i)] # not needed in inner loop - same 
number of variables for all neurons
    row_sum[[j]] <- summary(coreaff.nn)
    row_wts[[j]] <- coreaff.nn$wts
    rownames(nn.mse)[j] <- paste("H", j, sep="")
    nn.ms

Re: [R] Editor R

2009-06-02 Thread Paul Hiemstra

Hi,

I'm taking the liberty to answer your question. In most Kate versions I 
worked with you need to select the part of the code you wish to run and 
then go to Tools > Pipe to console. The selected part will then be 
executed. To make life a little easier you can assign a hotkey to "Pipe 
to console" (e.g. Shift + F5) in Settings > Configure shortcuts.


Another good option if you want to run the whole script is to use the 
source() command. And what do you mean by "Do the graphics work"? The 
editor is just a means of writing the code, all the processing is done 
by R. So graphics should work.


hth and cheers,
Paul

Kenneth Roy Cabrera Torres wrote:

Dr Krzysztof:

Can you help me how can you configure kate 
so you can send selected parts

to an R console, or the whole script?
Does the graphics works fine in this editor?

Thank you for your help.

Kenneth

El lun, 01-06-2009 a las 20:04 -0400, Krzysztof Sakrejda-Leavitt
escribió:
  

Under linux, Kate with its built-in console is very good.  You can
easily set up a command to let you pipe highlighted parts of your script
to that console.  The default highlighting is very good, it points out
unfinished brackets and such, and the session support lets you switch
between projects very quickly without scattering project files all over
your tree.

Krzysztof


Grzes' wrote:

Do you know any good editor  R?   
  


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



--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul

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


[R] plot 4th variable contour lines on filled.contour

2009-06-02 Thread AnaFilipaDeMouraQueiros

Hello,
I have a dataset with 4 variables, each consisting of a vector, all with 
the same length. I start by interpolating the first three variables 
using the function "interp", and plot the interpolation successfully 
using "filled.contour". I then interpolate the first two variables and a 
fourth using "interp" again, but when I try to overlay the  contour 
lines of this second interpolation on the first filled.contour plot, the 
lines appear to be located wrongly on the plot, overlapping the colour bar!

Any light shed on this matter would be most appreciated..
Kind regards
Ana
de Moura Queiros,Ana Filipa osp...@bangor.ac.uk

--
Gall y neges e-bost hon, ac unrhyw atodiadau a anfonwyd gyda hi,
gynnwys deunydd cyfrinachol ac wedi eu bwriadu i'w defnyddio'n unig
gan y sawl y cawsant eu cyfeirio ato (atynt). Os ydych wedi derbyn y
neges e-bost hon trwy gamgymeriad, rhowch wybod i'r anfonwr ar
unwaith a dilëwch y neges. Os na fwriadwyd anfon y neges atoch chi,
rhaid i chi beidio â defnyddio, cadw neu ddatgelu unrhyw wybodaeth a
gynhwysir ynddi. Mae unrhyw farn neu safbwynt yn eiddo i'r sawl a'i
hanfonodd yn unig  ac nid yw o anghenraid yn cynrychioli barn
Prifysgol Bangor. Nid yw Prifysgol Bangor yn gwarantu
bod y neges e-bost hon neu unrhyw atodiadau yn rhydd rhag firysau neu
100% yn ddiogel. Oni bai fod hyn wedi ei ddatgan yn uniongyrchol yn
nhestun yr e-bost, nid bwriad y neges e-bost hon yw ffurfio contract
rhwymol - mae rhestr o lofnodwyr awdurdodedig ar gael o Swyddfa
Cyllid Prifysgol Bangor.  www.bangor.ac.uk

This email and any attachments may contain confidential material and
is solely for the use of the intended recipient(s).  If you have
received this email in error, please notify the sender immediately
and delete this email.  If you are not the intended recipient(s), you
must not use, retain or disclose any information contained in this
email.  Any views or opinions are solely those of the sender and do
not necessarily represent those of the Bangor University.
Bangor University does not guarantee that this email or
any attachments are free from viruses or 100% secure.  Unless
expressly stated in the body of the text of the email, this email is
not intended to form a binding contract - a list of authorised
signatories is available from the Bangor University Finance
Office.  www.bangor.ac.uk

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


Re: [R] newbie help: simple operations in R

2009-06-02 Thread Carletto Rossi
I' ve tried your suggestions but the results are wrong.I don't
understand...i explain my request in a new way.
I have this table named data-4-bk.csv

"Y/h","u/U_b","v/U_b","uu/U_b^2","vv/U_b^2","uv/U_b^2","k/U_b^2"
0.16067E-02,-0.11652E-01,0.30712E-04,0.11377E-02,0.37886E-06,-0.12657E-05,0.13570E-02
0.48616E-02,-0.28583E-01,-0.10085E-03,0.72322E-02,0.44299E-04,-0.17874E-04,0.78991E-02
0.82005E-02,-0.40079E-01,-0.25124E-03,0.14272E-01,0.2E-03,-0.75078E-04,0.15054E-01
0.11625E-01,-0.47481E-01,-0.50081E-03,0.19783E-01,0.60134E-03,-0.17623E-03,0.20764E-01
0.15139E-01,-0.52047E-01,-0.78504E-03,0.23607E-01,0.11297E-02,-0.31123E-03,0.25042E-01
0.18743E-01,-0.54658E-01,-0.11273E-02,0.26189E-01,0.17884E-02,-0.46941E-03,0.28287E-01
0.22439E-01,-0.55902E-01,-0.15016E-02,0.27935E-01,0.25450E-02,-0.64447E-03,0.30825E-01
0.26231E-01,-0.56181E-01,-0.19149E-02,0.29136E-01,0.33728E-02,-0.83204E-03,0.32881E-01
0.30121E-01,-0.55777E-01,-0.23570E-02,0.29974E-01,0.42480E-02,-0.10299E-02,0.34591E-01
0.34111E-01,-0.54897E-01,-0.28303E-02,0.30577E-01,0.51528E-02,-0.12376E-02,0.36045E-01
0.38204E-01,-0.53696E-01,-0.33293E-02,0.31034E-01,0.60717E-02,-0.14533E-02,0.37305E-01
0.42403E-01,-0.52267E-01,-0.38533E-02,0.31403E-01,0.69931E-02,-0.16763E-02,0.38415E-01
0.46709E-01,-0.50663E-01,-0.43996E-02,0.31712E-01,0.79083E-02,-0.19064E-02,0.39403E-01

I give these R commands to import the file

quattro <- read.csv('data-4-bk.csv', header=TRUE)
attach(quattro)
names(quattro)

Then i'd like to calculate the new variable "t" defined as:

First element of u/U_b column * Second element of Y/h column
Second element of u/U_b column * Third element of Y/h column
etc.. etc..

Now i' d like to print the values of t as a new column on the original
data-4-bk.csv

Thanks and sorry for my newbie request.





2009/6/2 Simon Pickett 

> you could use a loop but maybe easier would be
> x<-c(NA,x)
> y<-c(y,NA)
> t<-x*y
>
> use write.table() to write the table to your hard drive
>
> e.g.
>
> write.table(t, file="C:/Documents and Settings/simonp/My Documents/RELU/GIS
> data/Land Cover Map working/squares plus adjoining parcels/Scotland/scotland
> adj squares.csv", sep = ",",row.names = F)
>
> HTH, Si.
>
> - Original Message - From: "Carletto Rossi" 
> To: 
> Sent: Tuesday, June 02, 2009 11:22 AM
> Subject: [R] newbie help: simple operations in R
>
>
>  Hi, i' d like to use R for simple calculations. I show you an examples to
>> make clear my help request
>>
>> I' ve a file .csv like this (my real file is composed by 10.000 lines and
>> 8
>> columns)
>>
>> x y
>> 3 4
>> 1 7
>>
>> I' ve imported in R correctly. Now i want create a new variable named "t"
>> and t is defined throught this relation:
>>
>> t = 4 (second element on x column) * 4 (first element on y column)
>>
>> in what way can i calculate t and print its value on an external file or,
>> better, append t values as a column on my original csv???
>>
>> Thanks
>>
>> Emanuele
>>
>> [[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.


[R] Odp: newbie help: simple operations in R

2009-06-02 Thread Petr PIKAL
Hi

r-help-boun...@r-project.org napsal dne 02.06.2009 12:22:49:

> Hi, i' d like to use R for simple calculations. I show you an examples 
to
> make clear my help request
> 
> I' ve a file .csv like this (my real file is composed by 10.000 lines 
and 8
> columns)
> 
> x y
> 3 4
> 1 7
> 
> I' ve imported in R correctly. Now i want create a new variable named 
"t"
> and t is defined throught this relation:
> 
> t = 4 (second element on x column) * 4 (first element on y column)
> 
> in what way can i calculate t and print its value on an external file 
or,
> better, append t values as a column on my original csv???

It is rather difficult to evaluate what you really want to do. You say you 
have 1 rows and 8 columns and your small example has only 2 columns 
and 2 rows.  Do you want to use third and subsequent row, or third and 
further columns? If yes how?

If you want to multiply second with first and third with second and ... 
than

DF <- data.frame(x=c(5,3,7), y=c(1,4,2))

drop the first item from x and last item from y and multiply

DF[-1,1]*DF[-3,2]

Regards
Petr

> 
> Thanks
> 
> Emanuele
> 
>[[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] newbie help: simple operations in R

2009-06-02 Thread Simon Pickett
The solution I provided should work

First off all give your data frame shorter and easier names e.g.

names(quatrro)<-c("x","y",etc)

since you want y(n)*x(n+1) an easy way to code this is to add on an "NA" to the 
start of x so everything shifts down a row and add an NA on the end of Y so 
that X and Y are the same length. look up the concatentae function ?c to 
understand this.

Data frame is not a problem. In that case its...

x<-c(NA,quattro$x)
y<-c(quattro$y,NA)
quattro$t<-quattro$x*quatrro$y

then

write.table(quattro,file="where you want the table to go.csv",sep="")

HTH, Si.



  - Original Message - 
  From: Carletto Rossi 
  To: Simon Pickett ; r-help@r-project.org 
  Sent: Tuesday, June 02, 2009 12:03 PM
  Subject: Re: [R] newbie help: simple operations in R


  I' ve tried your suggestions but the results are wrong.I don't understand...i 
explain my request in a new way.
  I have this table named data-4-bk.csv

  "Y/h","u/U_b","v/U_b","uu/U_b^2","vv/U_b^2","uv/U_b^2","k/U_b^2"
  
0.16067E-02,-0.11652E-01,0.30712E-04,0.11377E-02,0.37886E-06,-0.12657E-05,0.13570E-02
  
0.48616E-02,-0.28583E-01,-0.10085E-03,0.72322E-02,0.44299E-04,-0.17874E-04,0.78991E-02
  
0.82005E-02,-0.40079E-01,-0.25124E-03,0.14272E-01,0.2E-03,-0.75078E-04,0.15054E-01
  
0.11625E-01,-0.47481E-01,-0.50081E-03,0.19783E-01,0.60134E-03,-0.17623E-03,0.20764E-01
  
0.15139E-01,-0.52047E-01,-0.78504E-03,0.23607E-01,0.11297E-02,-0.31123E-03,0.25042E-01
  
0.18743E-01,-0.54658E-01,-0.11273E-02,0.26189E-01,0.17884E-02,-0.46941E-03,0.28287E-01
  
0.22439E-01,-0.55902E-01,-0.15016E-02,0.27935E-01,0.25450E-02,-0.64447E-03,0.30825E-01
  
0.26231E-01,-0.56181E-01,-0.19149E-02,0.29136E-01,0.33728E-02,-0.83204E-03,0.32881E-01
  
0.30121E-01,-0.55777E-01,-0.23570E-02,0.29974E-01,0.42480E-02,-0.10299E-02,0.34591E-01
  
0.34111E-01,-0.54897E-01,-0.28303E-02,0.30577E-01,0.51528E-02,-0.12376E-02,0.36045E-01
  
0.38204E-01,-0.53696E-01,-0.33293E-02,0.31034E-01,0.60717E-02,-0.14533E-02,0.37305E-01
  
0.42403E-01,-0.52267E-01,-0.38533E-02,0.31403E-01,0.69931E-02,-0.16763E-02,0.38415E-01
  
0.46709E-01,-0.50663E-01,-0.43996E-02,0.31712E-01,0.79083E-02,-0.19064E-02,0.39403E-01

  I give these R commands to import the file

  quattro <- read.csv('data-4-bk.csv', header=TRUE)
  attach(quattro)
  names(quattro)

  Then i'd like to calculate the new variable "t" defined as:

  First element of u/U_b column * Second element of Y/h column
  Second element of u/U_b column * Third element of Y/h column
  etc.. etc..

  Now i' d like to print the values of t as a new column on the original 
data-4-bk.csv

  Thanks and sorry for my newbie request.






  2009/6/2 Simon Pickett 

you could use a loop but maybe easier would be
x<-c(NA,x)
y<-c(y,NA)
t<-x*y

use write.table() to write the table to your hard drive

e.g.

write.table(t, file="C:/Documents and Settings/simonp/My Documents/RELU/GIS 
data/Land Cover Map working/squares plus adjoining parcels/Scotland/scotland 
adj squares.csv", sep = ",",row.names = F)

HTH, Si.

- Original Message - From: "Carletto Rossi" 
To: 
Sent: Tuesday, June 02, 2009 11:22 AM
Subject: [R] newbie help: simple operations in R



  Hi, i' d like to use R for simple calculations. I show you an examples to
  make clear my help request

  I' ve a file .csv like this (my real file is composed by 10.000 lines and 
8
  columns)

  x y
  3 4
  1 7

  I' ve imported in R correctly. Now i want create a new variable named "t"
  and t is defined throught this relation:

  t = 4 (second element on x column) * 4 (first element on y column)

  in what way can i calculate t and print its value on an external file or,
  better, append t values as a column on my original csv???

  Thanks

  Emanuele


  [[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] newbie help: simple operations in R

2009-06-02 Thread Petr PIKAL
Hi

r-help-boun...@r-project.org napsal dne 02.06.2009 13:03:39:

> I' ve tried your suggestions but the results are wrong.I don't
> understand...i explain my request in a new way.
> I have this table named data-4-bk.csv
> 
> "Y/h","u/U_b","v/U_b","uu/U_b^2","vv/U_b^2","uv/U_b^2","k/U_b^2"
> 
0.16067E-02,-0.11652E-01,0.30712E-04,0.11377E-02,0.37886E-06,-0.12657E-05,0.13570E-02
> 
0.48616E-02,-0.28583E-01,-0.10085E-03,0.72322E-02,0.44299E-04,-0.17874E-04,0.78991E-02
> 
0.82005E-02,-0.40079E-01,-0.25124E-03,0.14272E-01,0.2E-03,-0.75078E-04,0.15054E-01
> 
0.11625E-01,-0.47481E-01,-0.50081E-03,0.19783E-01,0.60134E-03,-0.17623E-03,0.20764E-01
> 
0.15139E-01,-0.52047E-01,-0.78504E-03,0.23607E-01,0.11297E-02,-0.31123E-03,0.25042E-01
> 
0.18743E-01,-0.54658E-01,-0.11273E-02,0.26189E-01,0.17884E-02,-0.46941E-03,0.28287E-01
> 
0.22439E-01,-0.55902E-01,-0.15016E-02,0.27935E-01,0.25450E-02,-0.64447E-03,0.30825E-01
> 
0.26231E-01,-0.56181E-01,-0.19149E-02,0.29136E-01,0.33728E-02,-0.83204E-03,0.32881E-01
> 
0.30121E-01,-0.55777E-01,-0.23570E-02,0.29974E-01,0.42480E-02,-0.10299E-02,0.34591E-01
> 
0.34111E-01,-0.54897E-01,-0.28303E-02,0.30577E-01,0.51528E-02,-0.12376E-02,0.36045E-01
> 
0.38204E-01,-0.53696E-01,-0.33293E-02,0.31034E-01,0.60717E-02,-0.14533E-02,0.37305E-01
> 
0.42403E-01,-0.52267E-01,-0.38533E-02,0.31403E-01,0.69931E-02,-0.16763E-02,0.38415E-01
> 
0.46709E-01,-0.50663E-01,-0.43996E-02,0.31712E-01,0.79083E-02,-0.19064E-02,0.39403E-01
> 
> I give these R commands to import the file
> 
> quattro <- read.csv('data-4-bk.csv', header=TRUE)
> attach(quattro)
> names(quattro)
> 
> Then i'd like to calculate the new variable "t" defined as:
> 
> First element of u/U_b column * Second element of Y/h column
> Second element of u/U_b column * Third element of Y/h column
> etc.. etc..
> 
> Now i' d like to print the values of t as a new column on the original
> data-4-bk.csv
> 
> Thanks and sorry for my newbie request.

My previous solution will work but you need to drop last element from u/U 
column.

so do not attach and use

quattro[-nrow(quattro),"u/U"] * quattro[-1,"Y/h"]

then you will get one item less and you need to decide if NA value will be 
at the beginning or at the end.

Regards
Petr




> 
> 
> 
> 
> 
> 2009/6/2 Simon Pickett 
> 
> > you could use a loop but maybe easier would be
> > x<-c(NA,x)
> > y<-c(y,NA)
> > t<-x*y
> >
> > use write.table() to write the table to your hard drive
> >
> > e.g.
> >
> > write.table(t, file="C:/Documents and Settings/simonp/My 
Documents/RELU/GIS
> > data/Land Cover Map working/squares plus adjoining 
parcels/Scotland/scotland
> > adj squares.csv", sep = ",",row.names = F)
> >
> > HTH, Si.
> >
> > - Original Message - From: "Carletto Rossi" 

> > To: 
> > Sent: Tuesday, June 02, 2009 11:22 AM
> > Subject: [R] newbie help: simple operations in R
> >
> >
> >  Hi, i' d like to use R for simple calculations. I show you an 
examples to
> >> make clear my help request
> >>
> >> I' ve a file .csv like this (my real file is composed by 10.000 lines 
and
> >> 8
> >> columns)
> >>
> >> x y
> >> 3 4
> >> 1 7
> >>
> >> I' ve imported in R correctly. Now i want create a new variable named 
"t"
> >> and t is defined throught this relation:
> >>
> >> t = 4 (second element on x column) * 4 (first element on y column)
> >>
> >> in what way can i calculate t and print its value on an external file 
or,
> >> better, append t values as a column on my original csv???
> >>
> >> Thanks
> >>
> >> Emanuele
> >>
> >> [[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.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Odp: plot 4th variable contour lines on filled.contour

2009-06-02 Thread Petr PIKAL
Hi

r-help-boun...@r-project.org napsal dne 02.06.2009 12:50:50:

> Hello,
> I have a dataset with 4 variables, each consisting of a vector, all with 

> the same length. I start by interpolating the first three variables 
> using the function "interp", and plot the interpolation successfully 
> using "filled.contour". I then interpolate the first two variables and a 

> fourth using "interp" again, but when I try to overlay the  contour 
> lines of this second interpolation on the first filled.contour plot, the 

> lines appear to be located wrongly on the plot, overlapping the colour 
bar!

Either use combination of image and contour or you need to get correct 
plotting area from filled.contour as it consist from 2 plots, see 
?filled.contour.

I remember this question was raised before and from search

"filled.contour overplot"

you can quickly get this answer

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

Regards
Petr


> Any light shed on this matter would be most appreciated..
> Kind regards
> Ana
> de Moura Queiros,Ana Filipa osp...@bangor.ac.uk
> 
> -- 
> Gall y neges e-bost hon, ac unrhyw atodiadau a anfonwyd gyda hi,
> gynnwys deunydd cyfrinachol ac wedi eu bwriadu i'w defnyddio'n unig
> gan y sawl y cawsant eu cyfeirio ato (atynt). Os ydych wedi derbyn y
> neges e-bost hon trwy gamgymeriad, rhowch wybod i'r anfonwr ar
> unwaith a dilëwch y neges. Os na fwriadwyd anfon y neges atoch chi,
> rhaid i chi beidio â defnyddio, cadw neu ddatgelu unrhyw wybodaeth a
> gynhwysir ynddi. Mae unrhyw farn neu safbwynt yn eiddo i'r sawl a'i
> hanfonodd yn unig  ac nid yw o anghenraid yn cynrychioli barn
> Prifysgol Bangor. Nid yw Prifysgol Bangor yn gwarantu
> bod y neges e-bost hon neu unrhyw atodiadau yn rhydd rhag firysau neu
> 100% yn ddiogel. Oni bai fod hyn wedi ei ddatgan yn uniongyrchol yn
> nhestun yr e-bost, nid bwriad y neges e-bost hon yw ffurfio contract
> rhwymol - mae rhestr o lofnodwyr awdurdodedig ar gael o Swyddfa
> Cyllid Prifysgol Bangor.  www.bangor.ac.uk
> 
> This email and any attachments may contain confidential material and
> is solely for the use of the intended recipient(s).  If you have
> received this email in error, please notify the sender immediately
> and delete this email.  If you are not the intended recipient(s), you
> must not use, retain or disclose any information contained in this
> email.  Any views or opinions are solely those of the sender and do
> not necessarily represent those of the Bangor University.
> Bangor University does not guarantee that this email or
> any attachments are free from viruses or 100% secure.  Unless
> expressly stated in the body of the text of the email, this email is
> not intended to form a binding contract - a list of authorised
> signatories is available from the Bangor University Finance
> Office.  www.bangor.ac.uk
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] newbie help: simple operations in R

2009-06-02 Thread Carletto Rossi
Thanks the Simon way works well!!

2009/6/2 Petr PIKAL 

> Hi
>
> r-help-boun...@r-project.org napsal dne 02.06.2009 13:03:39:
>
> > I' ve tried your suggestions but the results are wrong.I don't
> > understand...i explain my request in a new way.
> > I have this table named data-4-bk.csv
> >
> > "Y/h","u/U_b","v/U_b","uu/U_b^2","vv/U_b^2","uv/U_b^2","k/U_b^2"
> >
>
> 0.16067E-02,-0.11652E-01,0.30712E-04,0.11377E-02,0.37886E-06,-0.12657E-05,0.13570E-02
> >
>
> 0.48616E-02,-0.28583E-01,-0.10085E-03,0.72322E-02,0.44299E-04,-0.17874E-04,0.78991E-02
> >
>
> 0.82005E-02,-0.40079E-01,-0.25124E-03,0.14272E-01,0.2E-03,-0.75078E-04,0.15054E-01
> >
>
> 0.11625E-01,-0.47481E-01,-0.50081E-03,0.19783E-01,0.60134E-03,-0.17623E-03,0.20764E-01
> >
>
> 0.15139E-01,-0.52047E-01,-0.78504E-03,0.23607E-01,0.11297E-02,-0.31123E-03,0.25042E-01
> >
>
> 0.18743E-01,-0.54658E-01,-0.11273E-02,0.26189E-01,0.17884E-02,-0.46941E-03,0.28287E-01
> >
>
> 0.22439E-01,-0.55902E-01,-0.15016E-02,0.27935E-01,0.25450E-02,-0.64447E-03,0.30825E-01
> >
>
> 0.26231E-01,-0.56181E-01,-0.19149E-02,0.29136E-01,0.33728E-02,-0.83204E-03,0.32881E-01
> >
>
> 0.30121E-01,-0.55777E-01,-0.23570E-02,0.29974E-01,0.42480E-02,-0.10299E-02,0.34591E-01
> >
>
> 0.34111E-01,-0.54897E-01,-0.28303E-02,0.30577E-01,0.51528E-02,-0.12376E-02,0.36045E-01
> >
>
> 0.38204E-01,-0.53696E-01,-0.33293E-02,0.31034E-01,0.60717E-02,-0.14533E-02,0.37305E-01
> >
>
> 0.42403E-01,-0.52267E-01,-0.38533E-02,0.31403E-01,0.69931E-02,-0.16763E-02,0.38415E-01
> >
>
> 0.46709E-01,-0.50663E-01,-0.43996E-02,0.31712E-01,0.79083E-02,-0.19064E-02,0.39403E-01
> >
> > I give these R commands to import the file
> >
> > quattro <- read.csv('data-4-bk.csv', header=TRUE)
> > attach(quattro)
> > names(quattro)
> >
> > Then i'd like to calculate the new variable "t" defined as:
> >
> > First element of u/U_b column * Second element of Y/h column
> > Second element of u/U_b column * Third element of Y/h column
> > etc.. etc..
> >
> > Now i' d like to print the values of t as a new column on the original
> > data-4-bk.csv
> >
> > Thanks and sorry for my newbie request.
>
> My previous solution will work but you need to drop last element from u/U
> column.
>
> so do not attach and use
>
> quattro[-nrow(quattro),"u/U"] * quattro[-1,"Y/h"]
>
> then you will get one item less and you need to decide if NA value will be
> at the beginning or at the end.
>
> Regards
> Petr
>
>
>
>
> >
> >
> >
> >
> >
> > 2009/6/2 Simon Pickett 
> >
> > > you could use a loop but maybe easier would be
> > > x<-c(NA,x)
> > > y<-c(y,NA)
> > > t<-x*y
> > >
> > > use write.table() to write the table to your hard drive
> > >
> > > e.g.
> > >
> > > write.table(t, file="C:/Documents and Settings/simonp/My
> Documents/RELU/GIS
> > > data/Land Cover Map working/squares plus adjoining
> parcels/Scotland/scotland
> > > adj squares.csv", sep = ",",row.names = F)
> > >
> > > HTH, Si.
> > >
> > > - Original Message - From: "Carletto Rossi"
> 
> > > To: 
> > > Sent: Tuesday, June 02, 2009 11:22 AM
> > > Subject: [R] newbie help: simple operations in R
> > >
> > >
> > >  Hi, i' d like to use R for simple calculations. I show you an
> examples to
> > >> make clear my help request
> > >>
> > >> I' ve a file .csv like this (my real file is composed by 10.000 lines
> and
> > >> 8
> > >> columns)
> > >>
> > >> x y
> > >> 3 4
> > >> 1 7
> > >>
> > >> I' ve imported in R correctly. Now i want create a new variable named
> "t"
> > >> and t is defined throught this relation:
> > >>
> > >> t = 4 (second element on x column) * 4 (first element on y column)
> > >>
> > >> in what way can i calculate t and print its value on an external file
> or,
> > >> better, append t values as a column on my original csv???
> > >>
> > >> Thanks
> > >>
> > >> Emanuele
> > >>
> > >> [[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.
>
>

[[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] newbie help: simple operations in R

2009-06-02 Thread Petr PIKAL
Hi

r-help-boun...@r-project.org napsal dne 02.06.2009 13:20:26:

> The solution I provided should work
> 
> First off all give your data frame shorter and easier names e.g.
> 
> names(quatrro)<-c("x","y",etc)
> 
> since you want y(n)*x(n+1) an easy way to code this is to add on an "NA" 
to 
> the start of x so everything shifts down a row and add an NA on the end 
of Y 
> so that X and Y are the same length. look up the concatentae function ?c 
to 
> understand this.
> 
> Data frame is not a problem. In that case its...
> 
> x<-c(NA,quattro$x)
> y<-c(quattro$y,NA)
> quattro$t<-quattro$x*quatrro$y

Above will not work as your result has one value more then original data 
frame

> df$t<-c(df$x,NA)*c(NA,df$y)
Error in `$<-.data.frame`(`*tmp*`, "t", value = c(NA, 3, 28, NA)) : 
  replacement has 4 rows, data has 3
>

She need to drop the appropriate one.

Regards
Petr

> 
> then
> 
> write.table(quattro,file="where you want the table to go.csv",sep="")
> 
> HTH, Si.
> 
> 
> 
>   - Original Message - 
>   From: Carletto Rossi 
>   To: Simon Pickett ; r-help@r-project.org 
>   Sent: Tuesday, June 02, 2009 12:03 PM
>   Subject: Re: [R] newbie help: simple operations in R
> 
> 
>   I' ve tried your suggestions but the results are wrong.I don't 
> understand...i explain my request in a new way.
>   I have this table named data-4-bk.csv
> 
>   "Y/h","u/U_b","v/U_b","uu/U_b^2","vv/U_b^2","uv/U_b^2","k/U_b^2"
> 
0.16067E-02,-0.11652E-01,0.30712E-04,0.11377E-02,0.37886E-06,-0.12657E-05,0.13570E-02
> 
0.48616E-02,-0.28583E-01,-0.10085E-03,0.72322E-02,0.44299E-04,-0.17874E-04,0.78991E-02
> 
0.82005E-02,-0.40079E-01,-0.25124E-03,0.14272E-01,0.2E-03,-0.75078E-04,0.15054E-01
> 
0.11625E-01,-0.47481E-01,-0.50081E-03,0.19783E-01,0.60134E-03,-0.17623E-03,0.20764E-01
> 
0.15139E-01,-0.52047E-01,-0.78504E-03,0.23607E-01,0.11297E-02,-0.31123E-03,0.25042E-01
> 
0.18743E-01,-0.54658E-01,-0.11273E-02,0.26189E-01,0.17884E-02,-0.46941E-03,0.28287E-01
> 
0.22439E-01,-0.55902E-01,-0.15016E-02,0.27935E-01,0.25450E-02,-0.64447E-03,0.30825E-01
> 
0.26231E-01,-0.56181E-01,-0.19149E-02,0.29136E-01,0.33728E-02,-0.83204E-03,0.32881E-01
> 
0.30121E-01,-0.55777E-01,-0.23570E-02,0.29974E-01,0.42480E-02,-0.10299E-02,0.34591E-01
> 
0.34111E-01,-0.54897E-01,-0.28303E-02,0.30577E-01,0.51528E-02,-0.12376E-02,0.36045E-01
> 
0.38204E-01,-0.53696E-01,-0.33293E-02,0.31034E-01,0.60717E-02,-0.14533E-02,0.37305E-01
> 
0.42403E-01,-0.52267E-01,-0.38533E-02,0.31403E-01,0.69931E-02,-0.16763E-02,0.38415E-01
> 
0.46709E-01,-0.50663E-01,-0.43996E-02,0.31712E-01,0.79083E-02,-0.19064E-02,0.39403E-01
> 
>   I give these R commands to import the file
> 
>   quattro <- read.csv('data-4-bk.csv', header=TRUE)
>   attach(quattro)
>   names(quattro)
> 
>   Then i'd like to calculate the new variable "t" defined as:
> 
>   First element of u/U_b column * Second element of Y/h column
>   Second element of u/U_b column * Third element of Y/h column
>   etc.. etc..
> 
>   Now i' d like to print the values of t as a new column on the original 
data-4-bk.csv
> 
>   Thanks and sorry for my newbie request.
> 
> 
> 
> 
> 
> 
>   2009/6/2 Simon Pickett 
> 
> you could use a loop but maybe easier would be
> x<-c(NA,x)
> y<-c(y,NA)
> t<-x*y
> 
> use write.table() to write the table to your hard drive
> 
> e.g.
> 
> write.table(t, file="C:/Documents and Settings/simonp/My 
Documents/RELU/
> GIS data/Land Cover Map working/squares plus adjoining parcels/Scotland/
> scotland adj squares.csv", sep = ",",row.names = F)
> 
> HTH, Si.
> 
> - Original Message - From: "Carletto Rossi" 

> To: 
> Sent: Tuesday, June 02, 2009 11:22 AM
> Subject: [R] newbie help: simple operations in R
> 
> 
> 
>   Hi, i' d like to use R for simple calculations. I show you an 
examples to
>   make clear my help request
> 
>   I' ve a file .csv like this (my real file is composed by 10.000 
lines and 8
>   columns)
> 
>   x y
>   3 4
>   1 7
> 
>   I' ve imported in R correctly. Now i want create a new variable 
named "t"
>   and t is defined throught this relation:
> 
>   t = 4 (second element on x column) * 4 (first element on y column)
> 
>   in what way can i calculate t and print its value on an external 
file or,
>   better, append t values as a column on my original csv???
> 
>   Thanks
> 
>   Emanuele
> 
> 
>   [[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 guid

Re: [R] Most used R editors

2009-06-02 Thread Mike Lawrence
I'm on Mac OS X and I've been using TextMate, though I feel guilty
that it's non-open-source/pay software :Op

On Tue, Jun 2, 2009 at 5:02 AM, Ronggui Huang  wrote:
> I personally use ESS now. I think it is great for programming. I used
> kate under KDE once, and it worked fine. I quite like kate though I am
> not a fan of KDE.
>
> Ronggui
>
> 2009/6/2 Martial Sankar :
>>
>> Hi,
>>
>> I am a little lonely as R users in my group. So, I would like to know which 
>> editor is the most used in the R community.
>> This post is some kind of survey.
>>
>> Personally, I use  Emacs with ESS, It permits to :
>>
>> - open more than one R session
>> - split the emacs editor as many part as you want.
>> - use a lot of keybindings.
>> ...
>>
>> I also tried Rkwards, Scilab (windows), JGR etc... but they are not suitable 
>> for what I do.
>>
>> Best,
>>
>> - Martial
>>
>>
>> _
>> Découvrez toutes les possibilités de communication avec vos proches
>>
>>        [[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.
>>
>>
>
>
>
> --
> HUANG Ronggui, Wincent
> PhD Candidate
> Dept of Public and Social Administration
> City University of Hong Kong
> Home page: http://asrr.r-forge.r-project.org/rghuang.html
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University

Looking to arrange a meeting? Check my public calendar:
http://tr.im/mikes_public_calendar

~ Certainty is folly... I think. ~

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


Re: [R] Most used R editors

2009-06-02 Thread Peter Flom
I use WinEct, which is shareware and has a variation just for R, called RWinEdt.

Peter

-Original Message-
>From: Mike Lawrence 
>Sent: Jun 2, 2009 7:51 AM
>To: rhelp 
>Subject: Re: [R] Most used R editors
>
>I'm on Mac OS X and I've been using TextMate, though I feel guilty
>that it's non-open-source/pay software :Op
>
>On Tue, Jun 2, 2009 at 5:02 AM, Ronggui Huang  wrote:
>> I personally use ESS now. I think it is great for programming. I used
>> kate under KDE once, and it worked fine. I quite like kate though I am
>> not a fan of KDE.
>>
>> Ronggui
>>
>> 2009/6/2 Martial Sankar :
>>>
>>> Hi,
>>>
>>> I am a little lonely as R users in my group. So, I would like to know which 
>>> editor is the most used in the R community.
>>> This post is some kind of survey.
>>>
>>> Personally, I use  Emacs with ESS, It permits to :
>>>
>>> - open more than one R session
>>> - split the emacs editor as many part as you want.
>>> - use a lot of keybindings.
>>> ...
>>>
>>> I also tried Rkwards, Scilab (windows), JGR etc... but they are not 
>>> suitable for what I do.
>>>
>>> Best,
>>>
>>> - Martial
>>>
>>>
>>> _
>>> Découvrez toutes les possibilités de communication avec vos proches
>>>
>>>        [[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.
>>>
>>>
>>
>>
>>
>> --
>> HUANG Ronggui, Wincent
>> PhD Candidate
>> Dept of Public and Social Administration
>> City University of Hong Kong
>> Home page: http://asrr.r-forge.r-project.org/rghuang.html
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
>-- 
>Mike Lawrence
>Graduate Student
>Department of Psychology
>Dalhousie University
>
>Looking to arrange a meeting? Check my public calendar:
>http://tr.im/mikes_public_calendar
>
>~ Certainty is folly... I think. ~
>
>__
>R-help@r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.


Peter L. Flom, PhD
Statistical Consultant
www DOT peterflomconsulting DOT 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] Most used R editors

2009-06-02 Thread Jim Lemon

Mike Lawrence wrote:

I'm on Mac OS X and I've been using TextMate, though I feel guilty
that it's non-open-source/pay software :Op
  
Don't worry, Mike, quite a few of us have given up trading mangelwurzels 
for animal hides.


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] newbie help: simple operations in R

2009-06-02 Thread Carletto Rossi
I'm sorry but i verify that Simon solution doesn't work. It makes only the
product between the corrispondent element of the columns (first with first,
second with seconds, etc,...)
These are the list of R commands:

> quattro <- read.csv('new_data.csv', header=TRUE)
> names(quattro)<-c("x","y")
> x<-c(NA,quattro$x)
> y<-c(quattro$y,NA)
> quattro$t<-quattro$x*quattro$y
> write.table(quattro,file="with_t.csv",sep="")


This is the new_data.csv file

"Y/h","u/U_b"
0.16067E-02,-0.11652E-01
0.48616E-02,-0.28583E-01
0.82005E-02,-0.40079E-01
0.11625E-01,-0.47481E-01
0.15139E-01,-0.52047E-01
0.18743E-01,-0.54658E-01
0.22439E-01,-0.55902E-01
0.26231E-01,-0.56181E-01
0.30121E-01,-0.55777E-01
0.34111E-01,-0.54897E-01
0.38204E-01,-0.53696E-01
0.42403E-01,-0.52267E-01
0.46709E-01,-0.50663E-01
0.51126E-01,-0.48919E-01
0.55658E-01,-0.47059E-01
0.60306E-01,-0.45100E-01
0.65073E-01,-0.43057E-01
0.69964E-01,-0.40940E-01
0.74980E-01,-0.38733E-01
0.80126E-01,-0.36428E-01
0.85404E-01,-0.34044E-01
0.90817E-01,-0.31620E-01
0.96371E-01,-0.29153E-01
0.10207E+00,-0.26602E-01
0.10791E+00,-0.23957E-01
0.11390E+00,-0.21238E-01

This is the with_t.csv new file:

"x","y","t"
"1",0.0016067,-0.011652,-1.87212684e-05
"2",0.0048616,-0.028583,-0.0001389591128
"3",0.0082005,-0.040079,-0.0003286678395
"4",0.011625,-0.047481,-0.000551966625
"5",0.015139,-0.052047,-0.000787939533
"6",0.018743,-0.054658,-0.001024454894
"7",0.022439,-0.055902,-0.001254384978
"8",0.026231,-0.056181,-0.001473683811
"9",0.030121,-0.055777,-0.001680059017
"10",0.034111,-0.054897,-0.001872591567
"11",0.038204,-0.053696,-0.002051401984
"12",0.042403,-0.052267,-0.002216277601
"13",0.046709,-0.050663,-0.002366418067
"14",0.051126,-0.048919,-0.002501032794
"15",0.055658,-0.047059,-0.002619209822
"16",0.060306,-0.0451,-0.0027198006
"17",0.065073,-0.043057,-0.002801848161
"18",0.069964,-0.04094,-0.00286432616
"19",0.07498,-0.038733,-0.00290420034
"20",0.080126,-0.036428,-0.002918829928
"21",0.085404,-0.034044,-0.002907493776
"22",0.090817,-0.03162,-0.00287163354
"23",0.096371,-0.029153,-0.002809503763
"24",0.10207,-0.026602,-0.00271526614
"25",0.10791,-0.023957,-0.00258519987
"26",0.1139,-0.021238,-0.0024190082

Thanks.
Regards

PS Can i avoid to print the column with "1","2","3","4", etc... ??




2009/6/2 Petr PIKAL 

> Hi
>
> r-help-boun...@r-project.org napsal dne 02.06.2009 13:20:26:
>
> > The solution I provided should work
> >
> > First off all give your data frame shorter and easier names e.g.
> >
> > names(quatrro)<-c("x","y",etc)
> >
> > since you want y(n)*x(n+1) an easy way to code this is to add on an "NA"
> to
> > the start of x so everything shifts down a row and add an NA on the end
> of Y
> > so that X and Y are the same length. look up the concatentae function ?c
> to
> > understand this.
> >
> > Data frame is not a problem. In that case its...
> >
> > x<-c(NA,quattro$x)
> > y<-c(quattro$y,NA)
> > quattro$t<-quattro$x*quatrro$y
>
> Above will not work as your result has one value more then original data
> frame
>
> > df$t<-c(df$x,NA)*c(NA,df$y)
> Error in `$<-.data.frame`(`*tmp*`, "t", value = c(NA, 3, 28, NA)) :
>  replacement has 4 rows, data has 3
> >
>
> She need to drop the appropriate one.
>
> Regards
> Petr
>
> >
> > then
> >
> > write.table(quattro,file="where you want the table to go.csv",sep="")
> >
> > HTH, Si.
> >
> >
> >
> >   - Original Message -
> >   From: Carletto Rossi
> >   To: Simon Pickett ; r-help@r-project.org
> >   Sent: Tuesday, June 02, 2009 12:03 PM
> >   Subject: Re: [R] newbie help: simple operations in R
> >
> >
> >   I' ve tried your suggestions but the results are wrong.I don't
> > understand...i explain my request in a new way.
> >   I have this table named data-4-bk.csv
> >
> >   "Y/h","u/U_b","v/U_b","uu/U_b^2","vv/U_b^2","uv/U_b^2","k/U_b^2"
> >
>
> 0.16067E-02,-0.11652E-01,0.30712E-04,0.11377E-02,0.37886E-06,-0.12657E-05,0.13570E-02
> >
>
> 0.48616E-02,-0.28583E-01,-0.10085E-03,0.72322E-02,0.44299E-04,-0.17874E-04,0.78991E-02
> >
>
> 0.82005E-02,-0.40079E-01,-0.25124E-03,0.14272E-01,0.2E-03,-0.75078E-04,0.15054E-01
> >
>
> 0.11625E-01,-0.47481E-01,-0.50081E-03,0.19783E-01,0.60134E-03,-0.17623E-03,0.20764E-01
> >
>
> 0.15139E-01,-0.52047E-01,-0.78504E-03,0.23607E-01,0.11297E-02,-0.31123E-03,0.25042E-01
> >
>
> 0.18743E-01,-0.54658E-01,-0.11273E-02,0.26189E-01,0.17884E-02,-0.46941E-03,0.28287E-01
> >
>
> 0.22439E-01,-0.55902E-01,-0.15016E-02,0.27935E-01,0.25450E-02,-0.64447E-03,0.30825E-01
> >
>
> 0.26231E-01,-0.56181E-01,-0.19149E-02,0.29136E-01,0.33728E-02,-0.83204E-03,0.32881E-01
> >
>
> 0.30121E-01,-0.55777E-01,-0.23570E-02,0.29974E-01,0.42480E-02,-0.10299E-02,0.34591E-01
> >
>
> 0.34111E-01,-0.54897E-01,-0.28303E-02,0.30577E-01,0.51528E-02,-0.12376E-02,0.36045E-01
> >
>
> 0.38204E-01,-0.53696E-01,-0.33293E-02,0.31034E-01,0.60717E-02,-0.14533E-02,0.37305E-01
> >
>
> 0.42403E-01,-0.52267E-01,-0.38533E-02,0.31403E-01,0.69931E-02,-0.16763E-02,0.38415E-01
> >
>
> 0.46709E-01,-0.50663E-01,-0.43996E-02,0.31712E-0

Re: [R] Fwd: how to add value on the bar ploted by barplot()

2009-06-02 Thread David Winsemius
This is the trivial modification to the example on the help page that  
I was thinking of.


#the example code
  mp <- barplot(VADeaths) # default
  tot <- colMeans(VADeaths)
  text(mp, tot + 3, format(tot), xpd = TRUE, col = "blue")
#the modification
  tot <- colSums(VADeaths)
  text(mp, tot + 3, format(tot), xpd = TRUE, col = "red")

You can learn quite a bit by running the examples on graphics pages.

--
David

On Jun 2, 2009, at 12:08 AM, Xiaogang Yang wrote:


-- Forwarded message --
From: Xiaogang Yang 
Date: Mon, Jun 1, 2009 at 9:02 PM
Subject: Re: [R] how to add value on the bar ploted by barplot()
To: David Winsemius 


I mean I have bar in my plot graph, but I want add the bar real  
value at top

of it.

On Mon, Jun 1, 2009 at 8:46 PM, David Winsemius >wrote:




On Jun 1, 2009, at 11:21 PM, Xiaogang Yang wrote:

how to add value on the bar ploted by barplot()?




Depending on what you really mean, possibly:

?barplot
?text  # there _is_ a worked example on the barplot help page.
 # true, it does put the labels above the bars, but the  
modification

would be trivial.
# or
?addtable2plot {in package plotrix}



and the axis label is too big, anyone know how to change their  
font ,

thanks



?barplot   # again ...  barplots help page seems quite clear

cex.names = 0.5# or a number less than one of your choice

--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT





--
Xiaogang Yang
Sensorweb Research Laboratory
http://sensorweb.vancouver.wsu.edu/
Washington State University Vancouver



--
Xiaogang Yang
Sensorweb Research Laboratory
http://sensorweb.vancouver.wsu.edu/
Washington State University Vancouver

[[alternative HTML version deleted]]

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


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

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


Re: [R] newbie help: simple operations in R

2009-06-02 Thread Petr PIKAL
Hi

Carletto Rossi  napsal dne 02.06.2009 14:12:12:

> I'm sorry but i verify that Simon solution doesn't work. It makes only 
the 

It partially works

> product between the corrispondent element of the columns (first with 
first, 
> second with seconds, etc,...)
> These are the list of R commands:
> 
> > quattro <- read.csv('new_data.csv', header=TRUE)
> > names(quattro)<-c("x","y")
> > x<-c(NA,quattro$x)
> > y<-c(quattro$y,NA)
> > quattro$t<-quattro$x*quattro$y

x and y is not quattro$x and quattro$y try

quattro$t<-x*y

instead although itself it does not work too. It throws error as x*y has 
one value more then is length of your quattro data frame. You need to drop 
either first or last value from x*y, it depends on you.

e.g.
quattro$t<-(x*y)[-1]

Regards
Petr



> > write.table(quattro,file="with_t.csv",sep="")
> 
> 
> This is the new_data.csv file
> 
> "Y/h","u/U_b"
> 0.16067E-02,-0.11652E-01
> 0.48616E-02,-0.28583E-01
> 0.82005E-02,-0.40079E-01
> 0.11625E-01,-0.47481E-01
> 0.15139E-01,-0.52047E-01
> 0.18743E-01,-0.54658E-01
> 0.22439E-01,-0.55902E-01
> 0.26231E-01,-0.56181E-01
> 0.30121E-01,-0.55777E-01
> 0.34111E-01,-0.54897E-01
> 0.38204E-01,-0.53696E-01
> 0.42403E-01,-0.52267E-01
> 0.46709E-01,-0.50663E-01
> 0.51126E-01,-0.48919E-01
> 0.55658E-01,-0.47059E-01
> 0.60306E-01,-0.45100E-01
> 0.65073E-01,-0.43057E-01
> 0.69964E-01,-0.40940E-01
> 0.74980E-01,-0.38733E-01
> 0.80126E-01,-0.36428E-01
> 0.85404E-01,-0.34044E-01
> 0.90817E-01,-0.31620E-01
> 0.96371E-01,-0.29153E-01
> 0.10207E+00,-0.26602E-01
> 0.10791E+00,-0.23957E-01
> 0.11390E+00,-0.21238E-01
> 
> This is the with_t.csv new file:
> 
> "x","y","t"
> "1",0.0016067,-0.011652,-1.87212684e-05
> "2",0.0048616,-0.028583,-0.0001389591128
> "3",0.0082005,-0.040079,-0.0003286678395
> "4",0.011625,-0.047481,-0.000551966625
> "5",0.015139,-0.052047,-0.000787939533
> "6",0.018743,-0.054658,-0.001024454894
> "7",0.022439,-0.055902,-0.001254384978
> "8",0.026231,-0.056181,-0.001473683811
> "9",0.030121,-0.055777,-0.001680059017
> "10",0.034111,-0.054897,-0.001872591567
> "11",0.038204,-0.053696,-0.002051401984
> "12",0.042403,-0.052267,-0.002216277601
> "13",0.046709,-0.050663,-0.002366418067
> "14",0.051126,-0.048919,-0.002501032794
> "15",0.055658,-0.047059,-0.002619209822
> "16",0.060306,-0.0451,-0.0027198006
> "17",0.065073,-0.043057,-0.002801848161
> "18",0.069964,-0.04094,-0.00286432616
> "19",0.07498,-0.038733,-0.00290420034
> "20",0.080126,-0.036428,-0.002918829928
> "21",0.085404,-0.034044,-0.002907493776
> "22",0.090817,-0.03162,-0.00287163354
> "23",0.096371,-0.029153,-0.002809503763
> "24",0.10207,-0.026602,-0.00271526614
> "25",0.10791,-0.023957,-0.00258519987
> "26",0.1139,-0.021238,-0.0024190082
> 
> Thanks.
> Regards
> 
> PS Can i avoid to print the column with "1","2","3","4", etc... ??
> 
> 
> 

> 2009/6/2 Petr PIKAL 
> Hi
> 
> r-help-boun...@r-project.org napsal dne 02.06.2009 13:20:26:
> 
> > The solution I provided should work
> >
> > First off all give your data frame shorter and easier names e.g.
> >
> > names(quatrro)<-c("x","y",etc)
> >
> > since you want y(n)*x(n+1) an easy way to code this is to add on an 
"NA"
> to
> > the start of x so everything shifts down a row and add an NA on the 
end
> of Y
> > so that X and Y are the same length. look up the concatentae function 
?c
> to
> > understand this.
> >
> > Data frame is not a problem. In that case its...
> >
> > x<-c(NA,quattro$x)
> > y<-c(quattro$y,NA)
> > quattro$t<-quattro$x*quatrro$y

> Above will not work as your result has one value more then original data
> frame
> 
> > df$t<-c(df$x,NA)*c(NA,df$y)
> Error in `$<-.data.frame`(`*tmp*`, "t", value = c(NA, 3, 28, NA)) :
>  replacement has 4 rows, data has 3
> >
> 
> She need to drop the appropriate one.
> 
> Regards
> Petr
> 
> >
> > then
> >
> > write.table(quattro,file="where you want the table to go.csv",sep="")
> >
> > HTH, Si.
> >
> >
> >
> >   - Original Message -
> >   From: Carletto Rossi
> >   To: Simon Pickett ; r-help@r-project.org
> >   Sent: Tuesday, June 02, 2009 12:03 PM
> >   Subject: Re: [R] newbie help: simple operations in R
> >
> >
> >   I' ve tried your suggestions but the results are wrong.I don't
> > understand...i explain my request in a new way.
> >   I have this table named data-4-bk.csv
> >
> >   "Y/h","u/U_b","v/U_b","uu/U_b^2","vv/U_b^2","uv/U_b^2","k/U_b^2"
> >
> 
0.16067E-02,-0.11652E-01,0.30712E-04,0.11377E-02,0.37886E-06,-0.12657E-05,0.13570E-02
> >
> 
0.48616E-02,-0.28583E-01,-0.10085E-03,0.72322E-02,0.44299E-04,-0.17874E-04,0.78991E-02
> >
> 
0.82005E-02,-0.40079E-01,-0.25124E-03,0.14272E-01,0.2E-03,-0.75078E-04,0.15054E-01
> >
> 
0.11625E-01,-0.47481E-01,-0.50081E-03,0.19783E-01,0.60134E-03,-0.17623E-03,0.20764E-01
> >
> 
0.15139E-01,-0.52047E-01,-0.78504E-03,0.23607E-01,0.11297E-02,-0.31123E-03,0.25042E-01
> >
> 
0.18743E-01,-0.54658E-01,-0.11273E-02,0.26189E-01,0.17884E-02,-0.46941E-03,0.28287E-01
> >
> 
0.22439E-01,-0.55902E-01,-0.15016E-02,0.27935E-01,0.25450E-02,-0.64

[R] RES: Most used R editors

2009-06-02 Thread Rodrigo Aluizio
Well, on windows an excellent and free software for R scrip editing is Tinn-R. 
Works on XP and Vista and it is constantly reviewed and updated.

Rodrigo.

-Mensagem original-
De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em nome 
de Peter Flom
Enviada em: terça-feira, 2 de junho de 2009 09:01
Para: Mike Lawrence; rhelp
Assunto: Re: [R] Most used R editors

I use WinEct, which is shareware and has a variation just for R, called RWinEdt.

Peter

-Original Message-
>From: Mike Lawrence 
>Sent: Jun 2, 2009 7:51 AM
>To: rhelp 
>Subject: Re: [R] Most used R editors
>
>I'm on Mac OS X and I've been using TextMate, though I feel guilty
>that it's non-open-source/pay software :Op
>
>On Tue, Jun 2, 2009 at 5:02 AM, Ronggui Huang  wrote:
>> I personally use ESS now. I think it is great for programming. I used
>> kate under KDE once, and it worked fine. I quite like kate though I am
>> not a fan of KDE.
>>
>> Ronggui
>>
>> 2009/6/2 Martial Sankar :
>>>
>>> Hi,
>>>
>>> I am a little lonely as R users in my group. So, I would like to know which 
>>> editor is the most used in the R community.
>>> This post is some kind of survey.
>>>
>>> Personally, I use  Emacs with ESS, It permits to :
>>>
>>> - open more than one R session
>>> - split the emacs editor as many part as you want.
>>> - use a lot of keybindings.
>>> ...
>>>
>>> I also tried Rkwards, Scilab (windows), JGR etc... but they are not 
>>> suitable for what I do.
>>>
>>> Best,
>>>
>>> - Martial
>>>
>>>
>>> _
>>> Découvrez toutes les possibilités de communication avec vos proches
>>>
>>>[[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.
>>>
>>>
>>
>>
>>
>> --
>> HUANG Ronggui, Wincent
>> PhD Candidate
>> Dept of Public and Social Administration
>> City University of Hong Kong
>> Home page: http://asrr.r-forge.r-project.org/rghuang.html
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
>-- 
>Mike Lawrence
>Graduate Student
>Department of Psychology
>Dalhousie University
>
>Looking to arrange a meeting? Check my public calendar:
>http://tr.im/mikes_public_calendar
>
>~ Certainty is folly... I think. ~
>
>__
>R-help@r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.


Peter L. Flom, PhD
Statistical Consultant
www DOT peterflomconsulting DOT 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] creating list with 200 identical objects

2009-06-02 Thread Rainer M Krug
On Tue, Jun 2, 2009 at 10:44 AM, Wacek Kusnierczyk
 wrote:
> Rainer M Krug wrote:
>> Thanks a lot Wacek for this clear description of the problem - I was
>> not aware, that it is that complex.
>> I definitely did not consider the initialize() function in writing my code.
>>
>> But as I only want to allocate the space for the objects, it does not
>> matter here. But when I write a simulation and want to initialize it
>> with two hundred different individuals, this definitely becomes
>> crucial - thanks again for this clarification and the very useful
>> references (especially [2] for the moment).
>>
>> Am I right that all assignments of classes via <- or -> are by value
>> and NOT by reference? So when
>>
>> setClass('foo',
>>        representation=representation(content='character'),
>>        prototype=list(content='foo'))
>>
>> A <- new("foo")
>> B <- A
>>
>
> i guess [sic] that what happens at this point is the usual thing:  B
> refers to the *same* object, which now has an increased accession counter.

As far as I understand it, a "class" is an abstract definition of a
certain type of object, which can be instantiated by using new(). This
returns an "object", or an instance of the class. Each of these
"objects" allocate a separate memory. Therefore, they can hold
different values in their "slots".
So if you are referring to the same "object", this would mean that it
points to the same memory space, and consequently contains the same
values.
But if the two instances of the "class" can hold different data,
everything is fine.

>
>> B is a different object then A, i.e. changes in B are not reflected in
>> A and vice versa, but they have the same content.
>>
>
> well.  i guess [sic] that when you assign to a slot of b, it is that
> object that is reproduced, which also triggers a reproduction of the
> instance object itself (note:  without 'new' and any initializer being

This sounds reasonable and makes perfect sense.

> called).  however, this does not happen if the slot is an environment,
> because r won't reproduce an environment on assignment.  in this case,
> you still have A and B being the same object, with modified content:

I must admit, I have never looked into environments - I probably
should - they sound interesting.

>
>    setClass('foo',
>        representation=representation(foo='environment'),
>        prototype=list(foo=new.env()))
>
>    a = new('foo')
>    b = a
>   �...@foo$bar = 'bar'
>   �...@foo$bar
>    # "bar"
>
>
> to be sure, you may want to check with the sources -- i haven't done it
> yet, hence the guesswork.
>
>
>> It seems that if foo has a slot O containing an object of class
>> "fooInFoo", this object O also copied by value. I.e. when, following
>> above,
>>
>> setClass('foo2',
>>        representation=representation(content='character'),
>>        prototype=list(content='fooInFoo'))
>> setClass('foo',
>>        representation=representation(content='character', O='foo2'),
>>        prototype=list(content='foo', O=new('foo2')))
>> A <- new("foo")
>> B <- A
>>
>> a...@o@content <- "AA"
>> a...@o@content
>>   [1] "AA"
>> b...@o@content
>>   [1] "fooInFoo"
>>
>> Is this always the case? and is there a way of copying by reference
>> (or passing an object to a function by reference)?
>>
>
> using environments provides a straightforward way to pass by reference,
> because that's how they are passed.  (the claim that r passes by value,
> made here and there, is incorrect and misleading, for this and other
> reasons.)

Good to know.

>
> otherwise, r's object systems -- s3 and s4 -- are so good that people
> have been inventing their own ways to deal with the trouble.  For
> example, R.oo, available from cran, is a package with
>
> "Methods and classes for object-oriented programming in R with or
> without references. [...] This is a cross-platform package implemented
> in pure R that defines standard S3 classes without any tricks."

I have looked into R.oo, but not further - probably I should. But if I
can do the same without additional packages, I prefer to avoid them.

Rainer

>
> vQ
>
>



-- 
Rainer M. Krug, Centre of Excellence for Invasion Biology,
Stellenbosch University, South Africa

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


Re: [R] newbie help: simple operations in R

2009-06-02 Thread Simon Pickett

thats true actually,

The new variables will be one character too long to fit back into quattro, 
but you can make a new data frame or just use one of the more elegant 
solutions provided by Petr.


Cheers.

- Original Message - 
From: "Petr PIKAL" 

To: "Carletto Rossi" 
Cc: 
Sent: Tuesday, June 02, 2009 1:22 PM
Subject: Re: [R] newbie help: simple operations in R



Hi

Carletto Rossi  napsal dne 02.06.2009 14:12:12:


I'm sorry but i verify that Simon solution doesn't work. It makes only

the

It partially works


product between the corrispondent element of the columns (first with

first,

second with seconds, etc,...)
These are the list of R commands:

> quattro <- read.csv('new_data.csv', header=TRUE)
> names(quattro)<-c("x","y")
> x<-c(NA,quattro$x)
> y<-c(quattro$y,NA)
> quattro$t<-quattro$x*quattro$y


x and y is not quattro$x and quattro$y try

quattro$t<-x*y

instead although itself it does not work too. It throws error as x*y has
one value more then is length of your quattro data frame. You need to drop
either first or last value from x*y, it depends on you.

e.g.
quattro$t<-(x*y)[-1]

Regards
Petr




> write.table(quattro,file="with_t.csv",sep="")


This is the new_data.csv file

"Y/h","u/U_b"
0.16067E-02,-0.11652E-01
0.48616E-02,-0.28583E-01
0.82005E-02,-0.40079E-01
0.11625E-01,-0.47481E-01
0.15139E-01,-0.52047E-01
0.18743E-01,-0.54658E-01
0.22439E-01,-0.55902E-01
0.26231E-01,-0.56181E-01
0.30121E-01,-0.55777E-01
0.34111E-01,-0.54897E-01
0.38204E-01,-0.53696E-01
0.42403E-01,-0.52267E-01
0.46709E-01,-0.50663E-01
0.51126E-01,-0.48919E-01
0.55658E-01,-0.47059E-01
0.60306E-01,-0.45100E-01
0.65073E-01,-0.43057E-01
0.69964E-01,-0.40940E-01
0.74980E-01,-0.38733E-01
0.80126E-01,-0.36428E-01
0.85404E-01,-0.34044E-01
0.90817E-01,-0.31620E-01
0.96371E-01,-0.29153E-01
0.10207E+00,-0.26602E-01
0.10791E+00,-0.23957E-01
0.11390E+00,-0.21238E-01

This is the with_t.csv new file:

"x","y","t"
"1",0.0016067,-0.011652,-1.87212684e-05
"2",0.0048616,-0.028583,-0.0001389591128
"3",0.0082005,-0.040079,-0.0003286678395
"4",0.011625,-0.047481,-0.000551966625
"5",0.015139,-0.052047,-0.000787939533
"6",0.018743,-0.054658,-0.001024454894
"7",0.022439,-0.055902,-0.001254384978
"8",0.026231,-0.056181,-0.001473683811
"9",0.030121,-0.055777,-0.001680059017
"10",0.034111,-0.054897,-0.001872591567
"11",0.038204,-0.053696,-0.002051401984
"12",0.042403,-0.052267,-0.002216277601
"13",0.046709,-0.050663,-0.002366418067
"14",0.051126,-0.048919,-0.002501032794
"15",0.055658,-0.047059,-0.002619209822
"16",0.060306,-0.0451,-0.0027198006
"17",0.065073,-0.043057,-0.002801848161
"18",0.069964,-0.04094,-0.00286432616
"19",0.07498,-0.038733,-0.00290420034
"20",0.080126,-0.036428,-0.002918829928
"21",0.085404,-0.034044,-0.002907493776
"22",0.090817,-0.03162,-0.00287163354
"23",0.096371,-0.029153,-0.002809503763
"24",0.10207,-0.026602,-0.00271526614
"25",0.10791,-0.023957,-0.00258519987
"26",0.1139,-0.021238,-0.0024190082

Thanks.
Regards

PS Can i avoid to print the column with "1","2","3","4", etc... ??






2009/6/2 Petr PIKAL 
Hi

r-help-boun...@r-project.org napsal dne 02.06.2009 13:20:26:

> The solution I provided should work
>
> First off all give your data frame shorter and easier names e.g.
>
> names(quatrro)<-c("x","y",etc)
>
> since you want y(n)*x(n+1) an easy way to code this is to add on an

"NA"

to
> the start of x so everything shifts down a row and add an NA on the

end

of Y
> so that X and Y are the same length. look up the concatentae function

?c

to
> understand this.
>
> Data frame is not a problem. In that case its...
>
> x<-c(NA,quattro$x)
> y<-c(quattro$y,NA)
> quattro$t<-quattro$x*quatrro$y



Above will not work as your result has one value more then original data
frame

> df$t<-c(df$x,NA)*c(NA,df$y)
Error in `$<-.data.frame`(`*tmp*`, "t", value = c(NA, 3, 28, NA)) :
 replacement has 4 rows, data has 3
>

She need to drop the appropriate one.

Regards
Petr

>
> then
>
> write.table(quattro,file="where you want the table to go.csv",sep="")
>
> HTH, Si.
>
>
>
>   - Original Message -
>   From: Carletto Rossi
>   To: Simon Pickett ; r-help@r-project.org
>   Sent: Tuesday, June 02, 2009 12:03 PM
>   Subject: Re: [R] newbie help: simple operations in R
>
>
>   I' ve tried your suggestions but the results are wrong.I don't
> understand...i explain my request in a new way.
>   I have this table named data-4-bk.csv
>
>   "Y/h","u/U_b","v/U_b","uu/U_b^2","vv/U_b^2","uv/U_b^2","k/U_b^2"
>


0.16067E-02,-0.11652E-01,0.30712E-04,0.11377E-02,0.37886E-06,-0.12657E-05,0.13570E-02

>


0.48616E-02,-0.28583E-01,-0.10085E-03,0.72322E-02,0.44299E-04,-0.17874E-04,0.78991E-02

>


0.82005E-02,-0.40079E-01,-0.25124E-03,0.14272E-01,0.2E-03,-0.75078E-04,0.15054E-01

>


0.11625E-01,-0.47481E-01,-0.50081E-03,0.19783E-01,0.60134E-03,-0.17623E-03,0.20764E-01

>


0.15139E-01,-0.52047E-01,-0.78504E-03,0.23607E-01,0.11297E-02,-0.31123E-03,0.25042E-01

>


0.18743E-01,-0.54658E-01,-0.11273E-02,0.26189E-01,0.17884E-02,

Re: [R] RES: Most used R editors

2009-06-02 Thread Andrew Dolman
For Windows I've been using Notepad++ with npptor

http://sourceforge.net/projects/npptor/


Simple and lightweight. Syntax highlighting, code folding and code passing
are all I want.






andydol...@gmail.com


2009/6/2 Rodrigo Aluizio 

> Well, on windows an excellent and free software for R scrip editing is
> Tinn-R. Works on XP and Vista and it is constantly reviewed and updated.
>
> Rodrigo.
>
> -Mensagem original-
> De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em
> nome de Peter Flom
> Enviada em: terça-feira, 2 de junho de 2009 09:01
> Para: Mike Lawrence; rhelp
> Assunto: Re: [R] Most used R editors
>
> I use WinEct, which is shareware and has a variation just for R, called
> RWinEdt.
>
> Peter
>
> -Original Message-
> >From: Mike Lawrence 
> >Sent: Jun 2, 2009 7:51 AM
> >To: rhelp 
> >Subject: Re: [R] Most used R editors
> >
> >I'm on Mac OS X and I've been using TextMate, though I feel guilty
> >that it's non-open-source/pay software :Op
> >
> >On Tue, Jun 2, 2009 at 5:02 AM, Ronggui Huang 
> wrote:
> >> I personally use ESS now. I think it is great for programming. I used
> >> kate under KDE once, and it worked fine. I quite like kate though I am
> >> not a fan of KDE.
> >>
> >> Ronggui
> >>
> >> 2009/6/2 Martial Sankar :
> >>>
> >>> Hi,
> >>>
> >>> I am a little lonely as R users in my group. So, I would like to know
> which editor is the most used in the R community.
> >>> This post is some kind of survey.
> >>>
> >>> Personally, I use  Emacs with ESS, It permits to :
> >>>
> >>> - open more than one R session
> >>> - split the emacs editor as many part as you want.
> >>> - use a lot of keybindings.
> >>> ...
> >>>
> >>> I also tried Rkwards, Scilab (windows), JGR etc... but they are not
> suitable for what I do.
> >>>
> >>> Best,
> >>>
> >>> - Martial
> >>>
> >>>
> >>> _
> >>> Découvrez toutes les possibilités de communication avec vos proches
> >>>
> >>>[[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.
> >>>
> >>>
> >>
> >>
> >>
> >> --
> >> HUANG Ronggui, Wincent
> >> PhD Candidate
> >> Dept of Public and Social Administration
> >> City University of Hong Kong
> >> Home page: http://asrr.r-forge.r-project.org/rghuang.html
> >>
> >> __
> >> R-help@r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
> >
> >
> >--
> >Mike Lawrence
> >Graduate Student
> >Department of Psychology
> >Dalhousie University
> >
> >Looking to arrange a meeting? Check my public calendar:
> >http://tr.im/mikes_public_calendar
> >
> >~ Certainty is folly... I think. ~
> >
> >__
> >R-help@r-project.org mailing list
> >https://stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> >and provide commented, minimal, self-contained, reproducible code.
>
>
> Peter L. Flom, PhD
> Statistical Consultant
> www DOT peterflomconsulting DOT 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.
>

[[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] variance does not equal serial covariance of lag zero?

2009-06-02 Thread Liviu Andronic
Dear all,
Does this make any sense:
var() = cov() != acf(lag.max=0, type="covariance")?

I have daily data of IBM for May 2005, and I'm using the logarithmic return:
> ibm200505$LRAdj.Close
 [1] NA  0.0203152  0.0005508 -0.0148397 -0.0025182  0.0092025
-0.0013889
 [8]  0.0098196 -0.0103757 -0.0274917  0.0005716 -0.0159842 -0.0074306
 0.0091710
[15]  0.0002898  0.0226306  0.0036754  0.0005643  0.0206567 -0.0079052
 0.0005568
> with(ibm200505, {var(RAdj.Close, na.rm=TRUE)})
[1] 0.0001627
> with(ibm200505, {cov(RAdj.Close, RAdj.Close, use="pairwise.complete.obs")})
[1] 0.0001627
> with(ibm200505, {acf(RAdj.Close, lag.max=0, type="covariance", 
> na.action=na.pass, plot=F)})$acf[1]
[1] 0.0001546

For the correlation, the function yields expected results:
> with(ibm200505, {cor(RAdj.Close, RAdj.Close, use="pairwise.complete.obs")})
[1] 1
> with(ibm200505, {acf(RAdj.Close, lag.max=0, type="correlation", 
> na.action=na.pass, plot=F)})$acf[1]
[1] 1

Is this a bug, or am I doing anything stupid?
Thank you
Liviu




-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail

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


Re: [R] newbie help: simple operations in R

2009-06-02 Thread Wacek Kusnierczyk
Carletto Rossi wrote:
> I'm sorry but i verify that Simon solution doesn't work. It makes only the
> product between the corrispondent element of the columns (first with first,
> second with seconds, etc,...)
> These are the list of R commands:
>
>   
>> quattro <- read.csv('new_data.csv', header=TRUE)
>> names(quattro)<-c("x","y")
>> x<-c(NA,quattro$x)
>> y<-c(quattro$y,NA)
>> quattro$t<-quattro$x*quattro$y
>> write.table(quattro,file="with_t.csv",sep="")
>> 
>
>   

you have 2 columns of n values each.  if you multiply each of the n
values in one column with the value from the other column residing in
the next row, the last value in the first column is multiplied by a
non-available value (the non-existent n+1 th entry), and the first value
in the second column is not used.  is this what you want?  then this
should work:

result = first * c(second[-1], NA)

or alternatively

result = (c(NA, first) * c(second, NA))[-1]

if you do just

result = c(NA, first) * c(second, NA)

then length(result) == n+1

if you use the above

x<-c(NA,quattro$x)
y<-c(quattro$y,NA)
quattro$t<-quattro$x*quattro$y

you effectively compute row products without the shift, because you use
the original columns, ignoring the x and y created one step earlier.

vQ

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


Re: [R] RES: Most used R editors

2009-06-02 Thread Robert Kinley
#
Not sure whether anyone has mentioned Crimson Editor (for windows) so far 
...

http://www.crimsoneditor.com/

In Linux/Unixland there is  'kate'


Bob Kinley
[[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] variance does not equal serial covariance of lag zero?

2009-06-02 Thread Thomas Lumley


The answers differ by a factor of 19/20, ie, (n-1)/n, so it is presumably 
the choice of denominator for the variance that differs.


-thomas

On Tue, 2 Jun 2009, Liviu Andronic wrote:


Dear all,
Does this make any sense:
var() = cov() != acf(lag.max=0, type="covariance")?

I have daily data of IBM for May 2005, and I'm using the logarithmic return:

ibm200505$LRAdj.Close

[1] NA  0.0203152  0.0005508 -0.0148397 -0.0025182  0.0092025
-0.0013889
[8]  0.0098196 -0.0103757 -0.0274917  0.0005716 -0.0159842 -0.0074306
0.0091710
[15]  0.0002898  0.0226306  0.0036754  0.0005643  0.0206567 -0.0079052
0.0005568

with(ibm200505, {var(RAdj.Close, na.rm=TRUE)})

[1] 0.0001627

with(ibm200505, {cov(RAdj.Close, RAdj.Close, use="pairwise.complete.obs")})

[1] 0.0001627

with(ibm200505, {acf(RAdj.Close, lag.max=0, type="covariance", 
na.action=na.pass, plot=F)})$acf[1]

[1] 0.0001546

For the correlation, the function yields expected results:

with(ibm200505, {cor(RAdj.Close, RAdj.Close, use="pairwise.complete.obs")})

[1] 1

with(ibm200505, {acf(RAdj.Close, lag.max=0, type="correlation", 
na.action=na.pass, plot=F)})$acf[1]

[1] 1

Is this a bug, or am I doing anything stupid?
Thank you
Liviu




--
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail

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



Thomas Lumley   Assoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity of Washington, Seattle

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


Re: [R] warning message when running quantile regression

2009-06-02 Thread jude.ryan
Thanks Rongui! I wasn't aware of this FAQ page. I will look at that page.

Jude

-Original Message-
From: Ronggui Huang [mailto:ronggui.hu...@gmail.com] 
Sent: Monday, June 01, 2009 10:11 PM
To: Ryan, Jude
Cc: r-help@r-project.org
Subject: Re: [R] warning message when running quantile regression

You may not get response as this is in faq of rq package.

7. [Non-positive fis]  "What does the message "Non-positive fis" mean?

   When method ="nid" is used in summary local density estimates are made at
   each x_i value, in some cases these estimates can be negative and if so
   they are set to zero.  This is generally harmless, leading to a somewhat
   conservative (larger) estimate of the standard errors, however if the
   reported number of non-positive fis is large relative to the sample size
   then it is an indication of misspecification of the model.
(http://www.econ.uiuc.edu/~roger/research/rq/FAQ)

Ronggui

2009/6/1  :
> Hi All,
>
>
>
> I am running quantile regression in a "for loop" starting with 1
> variable and adding a variable at a time reaching a maximum of 20
> variables.
>
> I get the following warning messages after my "for" loop runs. Should I
> be concerned about these messages? I am building predictive models and
> am not interested in inference.
>
>
>
> Warning messages:
>
> 1: In summary.rq(quantreg.emaff) : 3 non-positive fis   <- I don't
> understand this message - is this a cause for concern?
>
> 2: In summary.rq(quantreg.emaff) : 3 non-positive fis
>
> 3: In summary.rq(quantreg.emaff) : 5 non-positive fis
>
> 4: In rq.fit.br(x, y, tau = tau, ...) : Solution may be nonunique
>
> 5: In summary.rq(quantreg.emaff) : 6 non-positive fis
>
> 6: In summary.rq(quantreg.emaff) : 5 non-positive fis
>
> 7: In summary.rq(quantreg.emaff) : 5 non-positive fis
>
> 8: In summary.rq(quantreg.emaff) : 7 non-positive fis
>
> 9: In summary.rq(quantreg.emaff) : 10 non-positive fis
>
> 10: In summary.rq(quantreg.emaff) : 9 non-positive fis
>
> 11: In summary.rq(quantreg.emaff) : 8 non-positive fis
>
> 12: In summary.rq(quantreg.emaff) : 9 non-positive fis
>
> 13: In summary.rq(quantreg.emaff) : 8 non-positive fis
>
> 14: In summary.rq(quantreg.emaff) : 11 non-positive fis
>
>
>
> I understand the "non-unique solution" message.
>
>
>
> Thanks in advance,
>
>
>
> Jude Ryan
>
>
>
> ___
> Jude Ryan
> Director, Client Analytical Services
> Strategy & Business Development
> UBS Financial Services Inc.
> 1200 Harbor Boulevard, 4th Floor
> Weehawken, NJ 07086-6791
> Tel. 201-352-1935
> Fax 201-272-2914
> Email: jude.r...@ubs.com
>
>
>
>
> Please do not transmit orders or instructions regarding a UBS
> account electronically, including but not limited to e-mail,
> fax, text or instant messaging. The information provided in
> this e-mail or any attachments is not an official transaction
> confirmation or account statement. For your protection, do not
> include account numbers, Social Security numbers, credit card
> numbers, passwords or other non-public information in your e-mail.
> Because the information contained in this message may be privileged,
> confidential, proprietary or otherwise protected from disclosure,
> please notify us immediately by replying to this message and
> deleting it from your computer if you have received this
> communication in error. Thank you.
>
> UBS Financial Services Inc.
> UBS International Inc.
> UBS Financial Services Incorporated of Puerto Rico
> UBS AG
>
>
> UBS reserves the right to retain all messages. Messages are protected
> and accessed only in legally justified cases.
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



-- 
HUANG Ronggui, Wincent
PhD Candidate
Dept of Public and Social Administration
City University of Hong Kong
Home page: http://asrr.r-forge.r-project.org/rghuang.html
Please do not transmit orders or instructions regarding a UBS 
account electronically, including but not limited to e-mail, 
fax, text or instant messaging. The information provided in 
this e-mail or any attachments is not an official transaction 
confirmation or account statement. For your protection, do not 
include account numbers, Social Security numbers, credit card 
numbers, passwords or other non-public information in your e-mail. 
Because the information contained in this message may be privileged, 
confidential, proprietary or otherwise protected from disclosure, 
please notify us immediately by replying to this message and 
deleting it from your computer if you have received this 
communication in error. Thank you. 

UBS Financial Services Inc. 
UBS International Inc. 
UBS Financial Services Incorporated of Puerto Rico 
UBS AG

 
UBS reserves the right to retain all messages. Messages are protected
an

Re: [R] GTK Tooltips under Linux

2009-06-02 Thread Michael Lawrence
I think I've got the threaded event loop working. Uploaded it to CRAN as
2.12.12. Should appear in a few days.

Michael

On Fri, May 29, 2009 at 11:24 AM, Ronggui Huang wrote:

> Noted with thanks.
>
> Regards
>
> Ronggui
>
> 2009/5/29 Michael Lawrence :
> >
> >
> > On Thu, May 28, 2009 at 7:35 PM, Ronggui Huang 
> > wrote:
> >>
> >> Dear all,
> >>
> >> I want to set tool-tips for a gtkButton. I use the following code
> >> which works under Windows. However, it doesn't work under Linux. Any
> >> hints? Thanks.
> >
> > Unfortunately, on platforms besides Windows, the event loop runs via an
> > input handler connected to X11. If you're waiting for a tooltip to show
> up,
> > there's obviously no input, so the event loop is not iterated.
> >
> > I think I could fix this by creating a separate thread that writes to a
> file
> > descriptor connected to an input handler. I'll try to do that.
> >
> > Michael
> >
> >>
> >> library(RGtk2)
> >> b<-gtkButtonNewWithLabel("OK")
> >> gtkTooltips()$setTip(b,"Memo for a Button.")
> >> gw <- gtkWindow(show=F)
> >> gw$Add(b)
> >> gw$Show()
> >>
> >> > sessionInfo()
> >> R version 2.8.0 Patched (2008-12-10 r47137)
> >> i686-pc-linux-gnu
> >>
> >> locale:
> >>
> >>
> LC_CTYPE=zh_CN.UTF-8;LC_NUMERIC=C;LC_TIME=zh_CN.UTF-8;LC_COLLATE=zh_CN.UTF-8;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=zh_CN.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=zh_CN.UTF-8;LC_IDENTIFICATION=C
> >>
> >> attached base packages:
> >> [1] stats graphics  grDevices utils datasets  methods   base
> >>
> >> other attached packages:
> >> [1] RGtk2_2.12.11RQDA_0.1-8   igraph_0.5.2-2
> >> [4] gWidgetsRGtk2_0.0-51 gWidgets_0.0-35  RSQLite_0.7-1
> >> [7] DBI_0.2-4
> >>
> >> loaded via a namespace (and not attached):
> >> [1] tools_2.8.0
> >>
> >> --
> >> HUANG Ronggui, Wincent
> >> PhD Candidate
> >> Dept of Public and Social Administration
> >> City University of Hong Kong
> >> Home page: http://asrr.r-forge.r-project.org/rghuang.html
> >>
> >> __
> >> R-help@r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> >> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >
> >
>
>
>
> --
> HUANG Ronggui, Wincent
> PhD Candidate
> Dept of Public and Social Administration
> City University of Hong Kong
> Home page: http://asrr.r-forge.r-project.org/rghuang.html
>

[[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] Most used R editors

2009-06-02 Thread Tomas Lanczos
On Tue, 2009-06-02 at 07:06 +, Martial Sankar wrote:
> Hi,
> 
> I am a little lonely as R users in my group. So, I would like to know which 
> editor is the most used in the R community.
> This post is some kind of survey.
> 
> Personally, I use  Emacs with ESS, It permits to :
> 
> - open more than one R session 
> - split the emacs editor as many part as you want.
> - use a lot of keybindings.
> ...
> 
> I also tried Rkwards, Scilab (windows), JGR etc... but they are not suitable 
> for what I do.
> 
> Best,

I am quite satisfied with the R Commander (Ubuntu 8.10, 9.04), I made
most of R jobs related to my PhD work with it. Optionally I used also
the Gedit standard text editor in Gnome.

Regards

Tomas


> - Martial

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


Re: [R] Most used R editors

2009-06-02 Thread Tomas Lanczos
On Tue, 2009-06-02 at 07:06 +, Martial Sankar wrote:
> Hi,
> 
> I am a little lonely as R users in my group. So, I would like to know which 
> editor is the most used in the R community.
> This post is some kind of survey.
> 
> Personally, I use  Emacs with ESS, It permits to :
> 
> - open more than one R session 
> - split the emacs editor as many part as you want.
> - use a lot of keybindings.
> ...
> 
> I also tried Rkwards, Scilab (windows), JGR etc... but they are not suitable 
> for what I do.
> 
> Best,

I am quite satisfied with the R Commander (Ubuntu 8.10, 9.04), I made
most of R jobs related to my PhD work with it. Optionally I used also
the Gedit standard text editor in Gnome.

Regards

Tomas


> - Martial

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


Re: [R] GTK Tooltips under Linux

2009-06-02 Thread Ronggui Huang
Thanks, Michael.

2009/6/2 Michael Lawrence :
> I think I've got the threaded event loop working. Uploaded it to CRAN as
> 2.12.12. Should appear in a few days.
>
> Michael
>
> On Fri, May 29, 2009 at 11:24 AM, Ronggui Huang 
> wrote:
>>
>> Noted with thanks.
>>
>> Regards
>>
>> Ronggui
>>
>> 2009/5/29 Michael Lawrence :
>> >
>> >
>> > On Thu, May 28, 2009 at 7:35 PM, Ronggui Huang 
>> > wrote:
>> >>
>> >> Dear all,
>> >>
>> >> I want to set tool-tips for a gtkButton. I use the following code
>> >> which works under Windows. However, it doesn't work under Linux. Any
>> >> hints? Thanks.
>> >
>> > Unfortunately, on platforms besides Windows, the event loop runs via an
>> > input handler connected to X11. If you're waiting for a tooltip to show
>> > up,
>> > there's obviously no input, so the event loop is not iterated.
>> >
>> > I think I could fix this by creating a separate thread that writes to a
>> > file
>> > descriptor connected to an input handler. I'll try to do that.
>> >
>> > Michael
>> >
>> >>
>> >> library(RGtk2)
>> >> b<-gtkButtonNewWithLabel("OK")
>> >> gtkTooltips()$setTip(b,"Memo for a Button.")
>> >> gw <- gtkWindow(show=F)
>> >> gw$Add(b)
>> >> gw$Show()
>> >>
>> >> > sessionInfo()
>> >> R version 2.8.0 Patched (2008-12-10 r47137)
>> >> i686-pc-linux-gnu
>> >>
>> >> locale:
>> >>
>> >>
>> >> LC_CTYPE=zh_CN.UTF-8;LC_NUMERIC=C;LC_TIME=zh_CN.UTF-8;LC_COLLATE=zh_CN.UTF-8;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=zh_CN.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=zh_CN.UTF-8;LC_IDENTIFICATION=C
>> >>
>> >> attached base packages:
>> >> [1] stats     graphics  grDevices utils     datasets  methods   base
>> >>
>> >> other attached packages:
>> >> [1] RGtk2_2.12.11        RQDA_0.1-8           igraph_0.5.2-2
>> >> [4] gWidgetsRGtk2_0.0-51 gWidgets_0.0-35      RSQLite_0.7-1
>> >> [7] DBI_0.2-4
>> >>
>> >> loaded via a namespace (and not attached):
>> >> [1] tools_2.8.0
>> >>
>> >> --
>> >> HUANG Ronggui, Wincent
>> >> PhD Candidate
>> >> Dept of Public and Social Administration
>> >> City University of Hong Kong
>> >> Home page: http://asrr.r-forge.r-project.org/rghuang.html
>> >>
>> >> __
>> >> R-help@r-project.org mailing list
>> >> https://stat.ethz.ch/mailman/listinfo/r-help
>> >> PLEASE do read the posting guide
>> >> http://www.R-project.org/posting-guide.html
>> >> and provide commented, minimal, self-contained, reproducible code.
>> >
>> >
>>
>>
>>
>> --
>> HUANG Ronggui, Wincent
>> PhD Candidate
>> Dept of Public and Social Administration
>> City University of Hong Kong
>> Home page: http://asrr.r-forge.r-project.org/rghuang.html
>
>



-- 
HUANG Ronggui, Wincent
PhD Candidate
Dept of Public and Social Administration
City University of Hong Kong
Home page: http://asrr.r-forge.r-project.org/rghuang.html

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


Re: [R] variance does not equal serial covariance of lag zero?

2009-06-02 Thread Liviu Andronic
On Tue, Jun 2, 2009 at 3:34 PM, Thomas Lumley  wrote:
> The answers differ by a factor of 19/20, ie, (n-1)/n, so it is presumably
> the choice of denominator for the variance that differs.
>
Same issue is present in ccf():
cov() != ccf(lag.max=0, type="covariance").

Liviu

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


Re: [R] Most used R editors

2009-06-02 Thread Bos, Roger
I have not seen Tinn-R mentioned so I will mention it.  Its worked great for 
me.  Eclipse is a nice IDE, but its more complicated that what is necessary for 
R programming.
 

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Martial Sankar
Sent: Tuesday, June 02, 2009 3:06 AM
To: rhelp
Subject: [R] Most used R editors


Hi,

I am a little lonely as R users in my group. So, I would like to know which 
editor is the most used in the R community.
This post is some kind of survey.

Personally, I use  Emacs with ESS, It permits to :

- open more than one R session
- split the emacs editor as many part as you want.
- use a lot of keybindings.
...

I also tried Rkwards, Scilab (windows), JGR etc... but they are not suitable 
for what I do.

Best,

- Martial


_
Découvrez toutes les possibilités de communication avec vos proches

[[alternative HTML version deleted]]


** *
This message is for the named person's use only. It may 
contain confidential, proprietary or legally privileged 
information. No right to confidential or privileged treatment 
of this message is waived or lost by any error in 
transmission. If you have received this message in error, 
please immediately notify the sender by e-mail, 
delete the message and all copies from your system and destroy 
any hard copies. You must not, directly or indirectly, use, 
disclose, distribute, print or copy any part of this message 
if you are not the intended recipient. 

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


Re: [R] [ANN] ggplot2 + rggobi course. July 30-31, Washington DC

2009-06-02 Thread hadley wickham
Hi everyone,

We still have places available for our two-day looking-at-data course:

July 30-31
Washington DC

Day one: static graphics with ggplot2
Day two: interactive graphics with rggobi and GGobi.

You can attend one day (for $295) or both days (for $550).
Student discounts are available.

All proceeds go to the GGobi Foundation to support graphics research.

Find out more, and book your tickets online at
http://lookingatdata.com

Regards,

Hadley Wickham
Dianne Cook

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


[R] help on understanding a code

2009-06-02 Thread Hongyuan Cao
Dear R user,

I am trying to understand this following code. Basically it's using a
permutation method to calculate p value. But I would like to know exactly
how the permutation works.

#calculates null statistics
tt0 <- 0
set.seed(123)
B <- 100
for(i in 1:B) {
v <- sample(y)
tt0 <- c(tt0,ttest(dat,v)$tt)
}
tt0 <- tt0[-1]
#form p-values
att <- abs(tt)
att0 <- abs(tt0)
v <- c(rep(T,m),rep(F,m*B))
v <- v[rev(order(c(att,att0)))]
u <- 1:length(v)
w <- 1:m
p <- (u[v==TRUE]-w)/(B*m)
p <- p[rank(-att)]

For some reason, I couldn't get any results for p. Maybe R encoded T and F
to corresponding numerical ones.

Any idea?

Thanks,
Hongyuan

[[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] Most used R editors

2009-06-02 Thread Ronggui Huang
Yes, Tinn-R is great for windows users. However, if you work under
different OS, it would be great to have an OS-independent editor.

Ronggui

2009/6/2 Bos, Roger :
> I have not seen Tinn-R mentioned so I will mention it.  Its worked great for 
> me.  Eclipse is a nice IDE, but its more complicated that what is necessary 
> for R programming.
>
>
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
> Behalf Of Martial Sankar
> Sent: Tuesday, June 02, 2009 3:06 AM
> To: rhelp
> Subject: [R] Most used R editors
>
>
> Hi,
>
> I am a little lonely as R users in my group. So, I would like to know which 
> editor is the most used in the R community.
> This post is some kind of survey.
>
> Personally, I use  Emacs with ESS, It permits to :
>
> - open more than one R session
> - split the emacs editor as many part as you want.
> - use a lot of keybindings.
> ...
>
> I also tried Rkwards, Scilab (windows), JGR etc... but they are not suitable 
> for what I do.
>
> Best,
>
> - Martial
>
>
> _
> Découvrez toutes les possibilités de communication avec vos proches
>
>        [[alternative HTML version deleted]]
>
>
> ** *
> This message is for the named person's use only. It may
> contain confidential, proprietary or legally privileged
> information. No right to confidential or privileged treatment
> of this message is waived or lost by any error in
> transmission. If you have received this message in error,
> please immediately notify the sender by e-mail,
> delete the message and all copies from your system and destroy
> any hard copies. You must not, directly or indirectly, use,
> disclose, distribute, print or copy any part of this message
> if you are not the intended recipient.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
HUANG Ronggui, Wincent
PhD Candidate
Dept of Public and Social Administration
City University of Hong Kong
Home page: http://asrr.r-forge.r-project.org/rghuang.html

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


[R] Sample size - proportion continuity correction

2009-06-02 Thread Karl Knoblick

Hallo!

Does anybody know how to calculate a sample size estimation for proportions 
with continuity correction?
 
I only found EpiR which seems to calculate without continuity correction:

library(epiR)
epi.studysize(treat = .65, control = .50, n = NA, sigma = NA,
power = 0.80, r = 1, conf.level = 0.95, sided.test = 2, method = "cohort")
$n
[1] 340


Thanks!
Karl





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


Re: [R] R: subset dataframe/list

2009-06-02 Thread David Winsemius


Also look at the documentation for read.csv2().

--  
David.


On Jun 2, 2009, at 5:43 AM, Cecilia Carmo wrote:


Thank you all!!!

The problem was the decimal symbol! My data was saved in a txt file,  
so I’ve introduced the dec="," in «read.table» and it worked.  
What I’ve done was

coeficientes<-read.table("coeficientes.txt",sep="\t",header=T,dec=",")

Then, subset worked fine
coeficientesWanted<-subset(coeficientes,b1>0)

Thanks again,
Cecília Carmo (Universidade de Aveiro – Portugal)

Doesn´t work neither!


head(coeficientes)

  caedois   b1   b2   b3
11   0,033120395 -20,29478338 -0,274638864
22 -0,040629634  74,54239889 -0,069958424
35-0,001116816   35,2398622  0,214327185
4   10 0,171875
5   140,007288399  40,06560548 -0,081828338
6   150,027530346  0,969969409  0,10277

I’ve done
coeficientes$b1<-as.numeric(as.character(coeficientes$b1))
And b1 was substituted by NA’s

Then I’ve done
coeficientes$b1<-as.numeric(coeficientes$b1)
And b1 was transformed in other numbers
caedois   b1   b2   b3
1138-20,29478338 -0,274638864
22 7 74,54239889 -0,069958424
35 2 35,2398622  0,214327185
4   1048
5   1415  40,06560548 -0,081828338
6   1531  0,969969409  0,10277

Thanks anyway,
Cecília


Em Mon, 01 Jun 2009 13:11:48 -0500 (CDT)
markle...@verizon.net escreveu:
hi: when I sent you my solution,  I didn't realize that you had  
factors. if you change the
factors  to characters as described in that email, and then use my  
approach , i think it should still work.
On Jun 1, 2009, markle...@verizon.net wrote: Hi: coeficientes[, 
(coeficientes[,"b1"] > 0)]
will i think give you all the rows of the object where b1 is  
greater than zero.
I can't tell if coeficients is a data frame or a matrix but the  
above should work in either case.
On Jun 1, 2009, Cecilia Carmo  wrote: Hi R- 
helpers!

I have the following object:

head(coeficientes)

   caedois   b1   b2   b3
1   10,033120395 -20,29478338 -0,274638864
2   2   -0,040629634  74,54239889 -0,069958424
3   5   -0,001116816   35,2398622  0,214327185
4  10 0,171875
5  14   0,007288399  40,06560548 -0,081828338
6  15   0,027530346  0,969969409  0,10277
I´ve tried to subset it like this:

coefSelected<-subset(coeficientes,"b1">0)

but it does nothing
Then I’ve tried:

coefSelected<-subset(coeficientes,b1>0)

But I´ve got the following
Warning message:
In Ops.factor(b1, 0) : > not meaningful for factors
So I’ve tried:

coefSelected<-subset(coeficientes,coeficientes$b1>0)

Warning message:
In Ops.factor(coeficientes$b1, 0) : > not meaningful for factors
I´ve done

mode(coeficientes)

[1] "list"
But I don´t know how to handle it!
Coul anyone help me?
Thanks,
Cecília Carmo (Universidade de Aveiro – Portugal


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

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


Re: [R] help on understanding a code

2009-06-02 Thread Mike Lawrence
You haven't provided us enough information. You should also provide
examples where we can access all the called objects; for example,
ttest() is not a built-in function, so we have no idea what it is.
Same goes for dat and y.

On Tue, Jun 2, 2009 at 11:43 AM, Hongyuan Cao  wrote:
> Dear R user,
>
> I am trying to understand this following code. Basically it's using a
> permutation method to calculate p value. But I would like to know exactly
> how the permutation works.
>
> #calculates null statistics
> tt0 <- 0
> set.seed(123)
> B <- 100
> for(i in 1:B) {
> v <- sample(y)
> tt0 <- c(tt0,ttest(dat,v)$tt)
> }
> tt0 <- tt0[-1]
> #form p-values
> att <- abs(tt)
> att0 <- abs(tt0)
> v <- c(rep(T,m),rep(F,m*B))
> v <- v[rev(order(c(att,att0)))]
> u <- 1:length(v)
> w <- 1:m
> p <- (u[v==TRUE]-w)/(B*m)
> p <- p[rank(-att)]
>
> For some reason, I couldn't get any results for p. Maybe R encoded T and F
> to corresponding numerical ones.
>
> Any idea?
>
> Thanks,
> Hongyuan
>
>        [[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.
>



-- 
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University

Looking to arrange a meeting? Check my public calendar:
http://tr.im/mikes_public_calendar

~ Certainty is folly... I think. ~

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

2009-06-02 Thread Karl Knoblick

Hallo!

Does anybody know what epiR calculates with method = "survival"? 

library(epiR)
library(survival)
epi.studysize(treat = .65, control = .50, n = NA, sigma = NA,
power = 0.80, r = 1, conf.level = 0.95, sided.test = 2, method = "survival")

Because I found out that method "proportion" does not do what I admitted, I am 
somehow careful with the examples
 

Thanks!
Karl




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


Re: [R] Most used R editors

2009-06-02 Thread Joseph Magagnoli
on windows I use Rwinedt, and under linux I use  SciViews-k (
http://www.sciviews.org/SciViews-K/index.html),
works well for me
joe



On Tue, Jun 2, 2009 at 9:44 AM, Ronggui Huang wrote:

> Yes, Tinn-R is great for windows users. However, if you work under
> different OS, it would be great to have an OS-independent editor.
>
> Ronggui
>
> 2009/6/2 Bos, Roger :
> > I have not seen Tinn-R mentioned so I will mention it.  Its worked great
> for me.  Eclipse is a nice IDE, but its more complicated that what is
> necessary for R programming.
> >
> >
> > -Original Message-
> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Martial Sankar
> > Sent: Tuesday, June 02, 2009 3:06 AM
> > To: rhelp
> > Subject: [R] Most used R editors
> >
> >
> > Hi,
> >
> > I am a little lonely as R users in my group. So, I would like to know
> which editor is the most used in the R community.
> > This post is some kind of survey.
> >
> > Personally, I use  Emacs with ESS, It permits to :
> >
> > - open more than one R session
> > - split the emacs editor as many part as you want.
> > - use a lot of keybindings.
> > ...
> >
> > I also tried Rkwards, Scilab (windows), JGR etc... but they are not
> suitable for what I do.
> >
> > Best,
> >
> > - Martial
> >
> >
> > _
> > Découvrez toutes les possibilités de communication avec vos proches
> >
> >[[alternative HTML version deleted]]
> >
> >
> > ** *
> > This message is for the named person's use only. It may
> > contain confidential, proprietary or legally privileged
> > information. No right to confidential or privileged treatment
> > of this message is waived or lost by any error in
> > transmission. If you have received this message in error,
> > please immediately notify the sender by e-mail,
> > delete the message and all copies from your system and destroy
> > any hard copies. You must not, directly or indirectly, use,
> > disclose, distribute, print or copy any part of this message
> > if you are not the intended recipient.
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
>
> --
> HUANG Ronggui, Wincent
> PhD Candidate
> Dept of Public and Social Administration
> City University of Hong Kong
> Home page: http://asrr.r-forge.r-project.org/rghuang.html
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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] Sample size - proportion continuity correction

2009-06-02 Thread Frank E Harrell Jr

Karl Knoblick wrote:

Hallo!

Does anybody know how to calculate a sample size estimation for proportions 
with continuity correction?


That would lose power.

Frank

 
I only found EpiR which seems to calculate without continuity correction:


library(epiR)
epi.studysize(treat = .65, control = .50, n = NA, sigma = NA,
power = 0.80, r = 1, conf.level = 0.95, sided.test = 2, method = "cohort")
$n
[1] 340


Thanks!
Karl





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


[R] bigmemory - extracting submatrix from big.matrix object

2009-06-02 Thread utkarshsinghal
I am using the library(bigmemory) to handle large datasets, say 1 GB, 
and facing following problems. Any hints from anybody can be helpful.


_Problem-1:
_
I am using "read.big.matrix" function  to create a filebacked big matrix 
of my data and get the following warning:


> x = 
read.big.matrix("/home/utkarsh.s/data.csv",header=T,type="double",shared=T,backingfile 
= "backup", backingpath = "/home/utkarsh.s")


Warning message:
In filebacked.big.matrix(nrow = numRows, ncol = numCols, type = type,  :
 A descriptor file has not been specified.  A descriptor named 
backup.desc will be created.


However there is no such argument in "read.big.matrix". Although there 
is an argument "descriptorfile" in the function "as.big.matrix" but if I 
try to use it in "read.big.matrix", I get an error showing it as unused 
argument (as expected).



_Problem-2:_

I want to get a filebacked *sub*matrix of "x", say only selected 
columns: x[, 1:100]. Is there any way of doing that without actually 
loading the data into R memory.


_
Problem-3

_There are functions available like:  summary, colmean, colsd, ... for 
standard summary statistics. But is there any way to calculate other 
summaries say number of missing values or skewness of each variable, 
without loading the whole data into R memory.



Regards
Utkarsh

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


Re: [R] Nested variables

2009-06-02 Thread DanielWC

Hi again
I read the chapter and it says that I can nest B in A by writing A/B. But it
doesnt seem to work properly. The package I use is pscl, I am trying to
model zero inflated data. Here is the full model:

zip1<-zeroinfl(Visitation ~ Habitat/Site + Sps + TP + Resource +
Sps*Habitat/Site + Sps*Resource + Sps*TP + TP*Resource + TP*Habitat/Site |
TP + Sps + Resource + Habitat/Site + TP*Sps + Sps*Resource + TP*Resource +
TP*Habitat/Site, data = data1)

where as you can see I have tried to include Habitat/Site. But it doesnt
seem like its possible to create interaction links that way. I would like
create the interaction link between say Sps and Habitat/Site. If I write
Sps*Habitat/Site R somehow thinks that its a 3-way interaction link and
still includes habitat as a single variable. Here is the summary just so you
can see:

Count model coefficients (poisson with log link):
   Estimate Std. Error z value Pr(>|z|)
(Intercept)   3.8643338  0.3450539  11.199  < 2e-16 ***
Habitat  -3.2757473  0.4871726  -6.724 1.77e-11 ***
Sps  -0.3332371  0.1117680  -2.982  0.00287 ** 
TP   -0.3857513  0.0975556  -3.954 7.68e-05 ***
Resource  0.0130935  0.0009545  13.717  < 2e-16 ***
Habitat:Site  0.2487012  0.0415908   5.980 2.24e-09 ***
Habitat:Sps   0.5432845  0.1230434   4.415 1.01e-05 ***
Sps:Resource -0.0041420  0.0002632 -15.738  < 2e-16 ***
Sps:TP0.0438085  0.0189411   2.313  0.02073 *  
TP:Resource  -0.0009413  0.0002887  -3.260  0.00111 ** 
Habitat:TP0.1549435  0.1205884   1.285  0.19883
Habitat:Site:Sps -0.0305628  0.0107794  -2.835  0.00458 ** 
Habitat:Site:TP  -0.0096408  0.0098497  -0.979  0.32768

Zero-inflation model coefficients (binomial with logit link):
  Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.3160850  0.8200631  -1.605   0.1085
TP   0.2808474  0.2657544   1.057   0.2906
Sps  0.8023648  0.1281520   6.261 3.82e-10 ***
Resource-0.0075967  0.0035817  -2.121   0.0339 *  
Habitat -1.3122811  1.1348922  -1.156   0.2476
Habitat:Site 0.1390498  0.0984716   1.412   0.1579
TP:Sps  -0.0189088  0.0406299  -0.465   0.6417
Sps:Resource-0.0005548  0.0006843  -0.811   0.4175
TP:Resource  0.0007100  0.0008454   0.840   0.4010
TP:Habitat   0.7195254  0.3666809   1.962   0.0497 *  
TP:Habitat:Site -0.0782610  0.0314229  -2.491   0.0128 *

Thanks again


Mark Difford wrote:
> 
> Daniel,
> 
>>> Yes I am trying to model such data, and i need R to know that Site is
>>> nested within Habitat. 
>>> Do I use some kind of command before running the model (like factor()
>>> and so on) or do i 
>>> write it in the model formula. If so, how?
> 
> You still are not telling the list enough, since nesting specifications
> are sometimes package/program specific. You could help yourself by reading
> some of R's basic documentation about how to specify a nested model. Then
> "it" will tell you what to do.
> 
> ?formula
> 
> Or read §11.1 of "An Introduction to R" (one of R's manuals).
> 
> Regards, Mark.
> 
> 
> DanielWC wrote:
>> 
>> Hi. 
>> Yes I am trying to model such data, and i need R to know that Site is
>> nested within Habitat. Do I use some kind of command before running the
>> model (like factor() and so on) or do i write it in the model formula. If
>> so, how?
>> 
>> Thanks
>> 
>> 
>> 
>> Douglas Bates-2 wrote:
>>> 
>>> On Fri, May 29, 2009 at 7:50 AM, DanielWC 
>>> wrote:
>>> 
 Hello
 I am working with a biological data including variables called Habitat
 and
 Site, example:
>>> 
 Habitat     Site
>>> 
 Forest      Low
 Forest      Low
 Forest      High
 Forest      High
>>> 
 I want to tell R that the Site variable is nested within the Forest
 variable
 (that it is not a new variable).
 Does anyone know how to do this?
>>> 
>>> If you could explain what you mean by "tell R", it would help.  Are
>>> you trying to model such data and you want to know how to express the
>>> relationship between such factors in a model formula?
>>> 
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/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/Nested-variables-tp23779402p23830019.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] Problem downloading webpages using batchfiles and RCurl from command line in Vista Basic - couldn't connect to host

2009-06-02 Thread Tony Breyal
Dear all,

I am having a problem downloading webpages through R when i run it in
the DOS window under Windows Vista Basic. I have downloaded the
batchfiles from http://code.google.com/p/batchfiles/ and have
successfully set the PATH.

I open up 'Command Prompt' in Vista and type (after the C:\...>
stuff):

### START ###
C:\Users\Karen>Rscript -e "library(RCurl); getURL('http://
www.google.com')"
Loading required package: methods
Loading required package: bitops
Error in curlPerform(curl = curl, .opts = opts, .encoding
= .encoding) :
  couldn't connect to host
Calls: getURL -> curlPerform -> .Call
Execution halted
### END ###

I think this means that R could not connect to the internet. However,
if i run the same code in Rgui (i.e. opening R normally, not command
line) then this code works correctly.

Also, on my other computer which runs Windows Vista Ultimate, the
command line version works correctly and downloads the webpage.

I need to get this to work because i need to do some web crawls in
batch mode using R.

Any help would be most appreciated. Thank you kindly for your time in
advance,
Tony Breyal

> sessionInfo()
R version 2.9.0 (2009-04-17)
i386-pc-mingw32

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

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

other attached packages:
[1] RCurl_0.95-1   rcom_2.1-3 rscproxy_1.3-1

loaded via a namespace (and not attached):
[1] tools_2.9.0

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] What do you think about my function?

2009-06-02 Thread Grześ

Hello,
I want to know what do you think about my function. I know that it isn't
briliant :/ but what do you think? What I should do that my function will be
better? (now is very slow and not ideal, sometimes I also get a mistake!)

## My function  #
dzieci<-transform(dzieci, zywnosc=0)

zywnoscCalosc<- function( jedzenie, sklep, n1, n2, n3, n4, d1, d2, d3, d4 )
{ 
   skl <- sklep
   wynik <- vector() 
   wynik <- jedzenie

   ndf <- data.frame(nn1=n1,nn2=n2,nn3=n3,nn4=n4)
   ddf <- data.frame(dd1=d1,dd2=d2,dd3=d3,dd4=d4)

   for (i in 1:length(n1)){
  
  wekt_n = ndf[i,]
  wekt_d = ddf[i,]

  wekt_n_ok = wekt_n[!is.na(wekt_n)]
  wekt_n_ok = as.numeric(wekt_n_ok)
  wekt_d_ok = wekt_d[!is.na(wekt_d)]
  wekt_d_ok = as.numeric(wekt_d_ok)

  dl_n = length(wekt_n_ok)
  dl_d = length(wekt_d_ok)

  if (skl[i] %in% NA){ wynik[i]=NA}

  else {wynik[i] =
sum(((1*wekt_n_ok)+(3*wekt_n_ok))/((1*dl_n)+(3*dl_d)))}
  }
return (wynik)
}

### Call function ### 

dzieci$zywnosc <- zywnoscCalosc(dzieci$zywnosc, dzieci$sklepik,
dzieci$sklslodycze, dzieci$sklnapojegazowane, dzieci$sklfastfood,
dzieci$sklsloneprzekaski, dzieci$sklmlekoiproduktymleczne,
dzieci$sklwodamineralnasoki, dzieci$sklkanapki, dzieci$sklwarzywaiowoce)

#

And about mistake in my function:
This is one row from my database where I get a mistake and I don't know why?

sklepik; sklslodycze; sklnapojegazowane;
   1   1  1
sklmlekoiproduktymleczne; sklfastfood; sklwodamineralnasoki;
   1 11
sklsloneprzekaski; sklkanapki; sklwarzywaiowoce; 
   1 01 

Afetr call my function I get as a result: 
dzieci$zywnosc[7590]
[1] 1
But in my opinion I should get a value = 0.75 What is wrong?


-- 
View this message in context: 
http://www.nabble.com/What-do-you-think-about-my-function--tp23831687p23831687.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] Plots automatically closing when using RScript

2009-06-02 Thread Rhizomorph

Gabor, thanks for the quick reply. Yeah, I know that I can always save the
output to a file, but the goal was to be able to leave the window up and
allow the user a chance to inspect/resize it before they saved it.


Gabor Grothendieck wrote:
> 
> Try this:
> 
> Rscript -e "png('abc.png');plot(1:10);dev.off()" && abc.png
> 
> On Mon, Jun 1, 2009 at 3:23 PM, Rhizomorph  wrote:
>>
>> I would like to be able to run an R script from the command line using
>> RScript.exe. The problem is, my script generates some plots which are
>> being
>> automatically closed as soon as the script reaches its end. Is there a
>> way
>> to force the plot windows to remain open until the user explicitly closes
>> them?
>>
>> Example:
>>
>> Rscript --vanilla -e "plot(1:100)"
>>
>> The above line will create a plot that exists for a split second and then
>> is
>> gone - this seems like completely retarded behavior for a programming
>> language that is so dependent upon plots.
>> --
>> View this message in context:
>> http://www.nabble.com/Plots-automatically-closing-when-using-RScript-tp23820355p23820355.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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Plots-automatically-closing-when-using-RScript-tp23820355p23832039.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] Changing state in ODE

2009-06-02 Thread Paul Hutson
I am trying to fit data from human and animal pharmacokinetic studies in 
which drug concentrations have been determined over time over the course 
of several doses.  In this case, the data are expected to be fit by a 
saturable (Michaelis-Menton) process.  I can get the ode routine to run 
with only one, initial dose.  How can I modify the state at intermediate 
time points to reflect additional input functions?  My script follows, 
with the doses and times noted.

Thanks in advance.  Paul

# Script for running mixed order (Michaelis-Menton) fit of data

BB_sim1 <- read.table("BB_sim1.csv", sep=",", header=TRUE, na.strings=".")
Time <- BB_sim1$TIME
MM.1dose<-function(time, state, pars)
{
with(as.list(c(state,pars))
{
dA <- Vmax * CONC[1] /(Km + CONC)
return (list(c(dA)))
}
   )
}

name.column(BB_sim1)
Doses<-c(0.2, 1, 5)

#if(Time==0) Dose=Doses[1]
#if(Time==10 ) Dose=Doses[2]
#if(Time==25) Dose=Doses[3]

state <- c(CONC=CONC+Dose/V)
parms <- c (
   Vmax = 20
   Km = 2
   V = 0.07
   )

require(deSolve)
MM1.out <- as.data.frame(ode(state, Time, MM.1dose, parms))

ylim <- reange(c(MM1.out$Conc)
plot(MM1.out$Time, MM1.out$Conc, xlab="Time", ylab="Conc", type="1", 
ylim=ylim

--

Paul R. Hutson, Pharm.D.

Associate Professor

UW School of Pharmacy

777 Highland Avenue

Madison WI 53705-

Tel  608.263.2496

Fax 608.265.5421

Pager 608.265.7000, p7856

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


Re: [R] Sample size calculation proportions with EpiR: Discrepancy to other calculators

2009-06-02 Thread Karl Knoblick

Thanks for the answers. 

Does anybody have more examples than in the help of epiR? After the experience 
of "proportion" and "cohort" I am somehow uncertain.

Karl



- Ursprüngliche Mail 
Von: Thomas Lumley 
An: Chuck Cleland 
CC: Karl Knoblick ; r-h...@stat.math.ethz.ch
Gesendet: Dienstag, den 26. Mai 2009, 16:43:09 Uhr
Betreff: Re: [R] Sample size calculation proportions with EpiR: Discrepancy to 
other calculators

On Tue, 26 May 2009, Chuck Cleland wrote:

> On 5/26/2009 2:53 AM, Karl Knoblick wrote:
>> Hallo!
>>
>> I have done a sample size calculation for proportions with EpiR. The input 
>> is:
>> treatment group rate p=0.65
>> control group rate p=0.50
>> significance level 0.95
>> power 0.80
>> two-sided
>> ration group 1 and 2: 1.0
>>
>> I have done this in the following way:
>> library(epiR)
>> epi.studysize(treat = 0.65, control = 0.5, n = NA, sigma = NA, power = 0.80,
>>    r = 1, conf.level = 0.95, sided.test = 2, method = "proportions")
>>
>> Result:
>> $n
>> [1] 82
>>
>> PASS 2002 and NQuery give both 170 subjects per group without continuity 
>> correction. With continuity correction 183 per group.
>>
>> Looking at http://statpages.org/proppowr.html I get 182 subjects per group 
>> (with continuity correction, I admit).
>>
>> What am I doing wrong? Can anybody explain this?
>
> epi.studysize(treat = .65, control = .50, n = NA, sigma = NA,
> power = 0.80, r = 1, conf.level = 0.95, sided.test = 2, method = "cohort")
>
>  gives the same sample size as PASS 2002 and NQuery (170 per group).
>

And simulation confirms that the larger numbers are correct. I don't know 
what is happening with epi.studysize(,method="proportion").

epi.studysize(,method="cohort") doesn't seem exactly appropriate, since 
judging from the example on the help page the inputs are supposed to be 
cumulative incidence rather than probabilities.

    -thomas

Thomas Lumley            Assoc. Professor, Biostatistics
tlum...@u.washington.edu    University of Washington, Seattle





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


Re: [R] What do you think about my function?

2009-06-02 Thread Mike Lawrence
It would help to explain the problem that the function is designed to solve.

On Tue, Jun 2, 2009 at 9:35 AM, Grześ  wrote:
>
> Hello,
> I want to know what do you think about my function. I know that it isn't
> briliant :/ but what do you think? What I should do that my function will be
> better? (now is very slow and not ideal, sometimes I also get a mistake!)
>
> ## My function  #
> dzieci<-transform(dzieci, zywnosc=0)
>
> zywnoscCalosc<- function( jedzenie, sklep, n1, n2, n3, n4, d1, d2, d3, d4 )
> {
>   skl <- sklep
>   wynik <- vector()
>   wynik <- jedzenie
>
>   ndf <- data.frame(nn1=n1,nn2=n2,nn3=n3,nn4=n4)
>   ddf <- data.frame(dd1=d1,dd2=d2,dd3=d3,dd4=d4)
>
>   for (i in 1:length(n1)){
>
>      wekt_n = ndf[i,]
>      wekt_d = ddf[i,]
>
>      wekt_n_ok = wekt_n[!is.na(wekt_n)]
>      wekt_n_ok = as.numeric(wekt_n_ok)
>      wekt_d_ok = wekt_d[!is.na(wekt_d)]
>      wekt_d_ok = as.numeric(wekt_d_ok)
>
>      dl_n = length(wekt_n_ok)
>      dl_d = length(wekt_d_ok)
>
>      if (skl[i] %in% NA){ wynik[i]=NA}
>
>      else {wynik[i] =
> sum(((1*wekt_n_ok)+(3*wekt_n_ok))/((1*dl_n)+(3*dl_d)))}
>      }
> return (wynik)
> }
>
> ### Call function ###
>
> dzieci$zywnosc <- zywnoscCalosc(dzieci$zywnosc, dzieci$sklepik,
> dzieci$sklslodycze, dzieci$sklnapojegazowane, dzieci$sklfastfood,
> dzieci$sklsloneprzekaski, dzieci$sklmlekoiproduktymleczne,
> dzieci$sklwodamineralnasoki, dzieci$sklkanapki, dzieci$sklwarzywaiowoce)
>
> #
>
> And about mistake in my function:
> This is one row from my database where I get a mistake and I don't know why?
>
> sklepik; sklslodycze; sklnapojegazowane;
>   1           1                      1
> sklmlekoiproduktymleczne; sklfastfood; sklwodamineralnasoki;
>           1                             1                    1
> sklsloneprzekaski; sklkanapki; sklwarzywaiowoce;
>   1                         0                    1
>
> Afetr call my function I get as a result:
> dzieci$zywnosc[7590]
> [1] 1
> But in my opinion I should get a value = 0.75 What is wrong?
>
>
> --
> View this message in context: 
> http://www.nabble.com/What-do-you-think-about-my-function--tp23831687p23831687.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.
>



-- 
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University

Looking to arrange a meeting? Check my public calendar:
http://tr.im/mikes_public_calendar

~ Certainty is folly... I think. ~

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


Re: [R] Problem downloading webpages using batchfiles and RCurl from command line in Vista Basic - couldn't connect to host

2009-06-02 Thread Gabor Grothendieck
On Tue, Jun 2, 2009 at 7:09 AM, Tony Breyal  wrote:
> Dear all,
>
> I am having a problem downloading webpages through R when i run it in
> the DOS window under Windows Vista Basic. I have downloaded the
> batchfiles from http://code.google.com/p/batchfiles/ and have
> successfully set the PATH.

You don't need to set your PATH if you use batchfiles.  Their
purpose is avoid having to do that in the first place.That
may not be related to your main problem though.

>
> I open up 'Command Prompt' in Vista and type (after the C:\...>
> stuff):
>
> ### START ###
> C:\Users\Karen>Rscript -e "library(RCurl); getURL('http://
> www.google.com')"
> Loading required package: methods
> Loading required package: bitops
> Error in curlPerform(curl = curl, .opts = opts, .encoding
> = .encoding) :
>  couldn't connect to host
> Calls: getURL -> curlPerform -> .Call
> Execution halted
> ### END ###

Here are two things to try:

1. Just a guess but you may need to run this elevated.  Using
el.js from the batchfiles:

el cmd

and allow it to proceed when asked.  That
will spawn a new window from which everything will run in
elevated mode.  Try your Rscript command in that.

2. Another thing to try is running without using the batchfiles.
Go into R and enter this:
 file.path(R.home(), "bin", "Rscript.exe")

and it will give you the path to Rscript.exe.  Using that path
try this:

"...whatever.../Rscript.exe" -e ...your command...

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


[R] ggplot2-legend overlaps with strip

2009-06-02 Thread Felipe Carrillo
Hi: See the attached pdf graphic. The legend overlaps a little bit with the 
strip. Is there a way to move it over a half a cm?


Felipe D. Carrillo  
Supervisory Fishery Biologist  
Department of the Interior  
US Fish & Wildlife Service  
California, USA


  

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


[R] Help deciding on data format for sales data (newbie)

2009-06-02 Thread jonathanbriggs

Dear All

Beginning data mining and need some help working out the best way to
represent data. I have searched here and online and not found any real help.
Imagines that I have a file of order(sales) data

OrderNo CustomerNo ItemsInOrder
1   1a,b,c
2   1d
3   2a,d

I can represent this as a data.frame but then need to parse my ItemsInOrder?
This seems quite clumsy. Alternatively I can try this sort of representation

OrderNo  CustomerNo  a  b  c  d
111  1   1  NA
21NA NA NA 1
321  NA  NA 1

Are these really the two choices and how well does the second representation
scale? (I have 50,000 SKUs)

Can anyone point me in the direction of some worked examples that take such
data and manipulate it; looking for association rules and clusters?

Thanks

Jonathan
-- 
View this message in context: 
http://www.nabble.com/Help-deciding-on-data-format-for-sales-data-%28newbie%29-tp23835331p23835331.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Help deciding on data format for sales data (newbie)

2009-06-02 Thread Daniel Malter
Depending on what you want to do, the second format (wide) maybe useful; but
it can get very clumsy if there are many potential items. You may think
about the long format:

OrderNo Customer Item
1   1   a
1   1   b
1   1   c
2   1   d
3   2   a
3   2   d

The long (above) and the wide format (your second example) are the most
widely used and most software packages have functions to reshape the dataset
from one into the other.

You may also want want to think about reducing the dimensionality of your
data. If, say, "a" were a right shoe and "b" were a left shoe, then "a" is
typically always sold with "b." Then you would want to create one indicator
from the two (admittedly, a pretty stupid example) to get the number of
unique items reduced. Alternatively, you may also be interested in only a
subset of the items (e.g. shoes only).

Hope this helps,
Daniel

-
cuncta stricte discussurus
-

-Ursprüngliche Nachricht-
Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im
Auftrag von jonathanbriggs
Gesendet: Tuesday, June 02, 2009 11:47 AM
An: r-help@r-project.org
Betreff: [R] Help deciding on data format for sales data (newbie)


Dear All

Beginning data mining and need some help working out the best way to
represent data. I have searched here and online and not found any real help.
Imagines that I have a file of order(sales) data

OrderNo CustomerNo ItemsInOrder
1   1a,b,c
2   1d
3   2a,d

I can represent this as a data.frame but then need to parse my ItemsInOrder?
This seems quite clumsy. Alternatively I can try this sort of representation

OrderNo  CustomerNo  a  b  c  d
111  1   1  NA
21NA NA NA 1
321  NA  NA 1

Are these really the two choices and how well does the second representation
scale? (I have 50,000 SKUs)

Can anyone point me in the direction of some worked examples that take such
data and manipulate it; looking for association rules and clusters?

Thanks

Jonathan
--
View this message in context:
http://www.nabble.com/Help-deciding-on-data-format-for-sales-data-%28newbie%
29-tp23835331p23835331.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] Axis label spanning multiple plots

2009-06-02 Thread Greg Snow
You will need to tell mtext something about where to position the text (at 
least until the esp package becomes available).  Sometimes using the adj 
argument gives a good enough result, if not then you will need to use the at 
argument, the grconvertY function (and grconvertX) is one way to find 
coordinates to use,
 you could use the top of the second figure region as the center of the text 
with something like:

> mtext('sample text', side=2, outer=TRUE, adj=0.5, at= grconvertY(1, 
> from='nfc', to='ndc'))

Or use layout as has been suggested (but the grconvertY (and X) functions may 
helpful for variations on your second question).

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Andre Nathan
> Sent: Monday, June 01, 2009 2:03 PM
> To: Greg Snow
> Cc: r-help@r-project.org
> Subject: Re: [R] Axis label spanning multiple plots
> 
> Hello
> 
> On Wed, 2009-05-27 at 13:38 -0600, Greg Snow wrote:
> > Create an outer margin (see ?par), then use mtext to put the title in
> the outer margin.
> 
> Sorry for taking that long to reply...
> 
> I created an outer margin with
> 
>   par(oma = c (0, 2, 0, 0))
> 
> and then did
> 
>   par(mfrow = c(2, 1))
>   plot(...)
>   plot(...)
>   mtext("title 1", side = 2, outer = T)
> 
> With that, the text "title 1" appears to the left of the second plot,
> and not to the left of both plots, centered between them, which is what
> I was trying to do. Is there a way to accomplish that (without manual
> text positioning, that is)?
> 
> Thanks,
> Andre
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] RKWard: R backend requests information

2009-06-02 Thread AG

Hello List

I've decided to dive into R and found a useful GUI for GNU/Linux (Debian 
testing/ Squeeze) called RKWard.  However, when I fire it up a dialog 
box appears with the statement "R backend requests information".  I have 
tried entering the path to the R libraries (e.g. /usr/bin/R; /etc/R; and 
so on) but none of these work, and the darn thing won't go away without 
killing the entire program.  It also will not allow me to by-pass it, 
nor access any help files, etc.  Does anyone know just what "backends" 
it is looking for?


Thanks

AG

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


Re: [R] RKWard: R backend requests information

2009-06-02 Thread Romain Francois

Hi,

rkward has its own mailing list where people will be able to help you.
https://lists.sourceforge.net/lists/listinfo/rkward-users

Romain

AG wrote:


Hello List

I've decided to dive into R and found a useful GUI for GNU/Linux 
(Debian testing/ Squeeze) called RKWard.  However, when I fire it up a 
dialog box appears with the statement "R backend requests 
information".  I have tried entering the path to the R libraries (e.g. 
/usr/bin/R; /etc/R; and so on) but none of these work, and the darn 
thing won't go away without killing the entire program.  It also will 
not allow me to by-pass it, nor access any help files, etc.  Does 
anyone know just what "backends" it is looking for?


Thanks

AG


--
Romain Francois
Independent R Consultant
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr

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


Re: [R] how to add value on the bar ploted by barplot()

2009-06-02 Thread Greg Snow
I would suggest reading the discussion that follows the post at:
http://tolstoy.newcastle.edu.au/R/e2/help/07/08/22858.html

It includes the answer to your question as well as the answers to other 
questions that you did not ask, but probably should.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Xiaogang Yang
> Sent: Monday, June 01, 2009 9:22 PM
> To: r-help
> Subject: [R] how to add value on the bar ploted by barplot()
> 
> how to add value on the bar ploted by barplot()?
> 
> and the axis label is too big, anyone know how to change their font ,
> thanks
> 
> --
> Xiaogang Yang
> Sensorweb Research Laboratory
> http://sensorweb.vancouver.wsu.edu/
> Washington State University Vancouver
> 
>   [[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] Correlation structure in AR(2) and ARMA(p,q)

2009-06-02 Thread FMH
Hi,

Let theta be the coefficient in AR(1) model, the components of the correlation 
structure is equal to 1 for times s = t, and theta^|t-s| for t > s. 

Could someone do me a favour to give some ideas on the correlation structure in 
AR(2) model and correlation structure of ARMA(p,q), as well?

Thank you

Fir


  
[[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] allEffects() with lm

2009-06-02 Thread Mikhail Spivakov

Dear John Fox and everyone, 

I have been using the effects library with glms and have found it very
useful. 
Now I'm trying it with lms and I'm not sure if the results of the
allEffects() are as expected.

I've got a model that looks like this:

mymodel = lm(formula = A ~ B + C + D + B:D + C:D)

Residuals:
 Min   1Q   Median   3Q  Max 
-3.80156 -0.73486 -0.09792  0.63602  4.77747 

Coefficients:
   Estimate Std. Error t value Pr(>|t|)
(Intercept)0.551727   0.014788  37.310  < 2e-16 ***
B  0.112033   0.014067   7.964 1.82e-15 ***
C  0.150992   0.010281  14.686  < 2e-16 ***
D  0.319938   0.018451  17.340  < 2e-16 ***
B:D   0.042949   0.008208   5.233 1.70e-07 ***
C:D   0.077968   0.010054   7.755 9.58e-15 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Residual standard error: 1.083 on 11555 degrees of freedom
Multiple R-squared: 0.2412, Adjusted R-squared: 0.2409 
F-statistic: 734.6 on 5 and 11555 DF,  p-value: < 2.2e-16 

When I ran plot(allEffects(mymodel)), I was expecting that the effect
diagrams for the interaction terms will include the effects of the
individual terms as well.  However, this was not the case, since despite the
strong individual terms, with one of the terms set to zero the regression
line for the second one was invariably A=0.

I'm wondering if this is a bug or a "feature" and in the latter case, what
can be done to display effects of the terms in a "combined" way, such that
the contribution of both them on their own and as part of an interaction
term is taken into account.

Many thanks
Mikhail

--
Mikhail Spivakov, PhD
European Bioinformatics Institute
Hinxton 
Cambridgeshire CB10 1SD
UK

spiva...@ebi.ac.uk
-- 
View this message in context: 
http://www.nabble.com/allEffects%28%29-with-lm-tp23837461p23837461.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] bigmemory - extracting submatrix from big.matrix object

2009-06-02 Thread Jay Emerson
Thanks for trying this out.

Problem 1.  We'll check this.  Options should certainly be available.  Thanks!

Problem 2. Fascinating.  We just (yesterday) implemented a
sub.big.matrix() function doing exactly
this, creating something that is a big matrix but which just
references a contiguous subset of the
original matrix.  This will be available in an upcoming version
(hopefully in the next week).  A more
specialized function would create an entirely new big.matrix from a
subset of a first big.matrix,
making an actual copy, but this is something else altogether. You
could do this entirely within R
without much work, by the way, and only 2* memory overhead.

Problem 3. You can count missing values using mwhich().  For other
exploration (e.g. skewness)
at the moment you should just extract a single column (variable)  at a
time into R, study it, then get the
next column, etc... .  We will not be implementing all of R's
functions directly with big.matrix objects.
We will be creating a new package "bigmemoryAnalytics" and would
welcome contributions to the
package.

Feel free to email us directly with bugs, questions, etc...

Cheers,

Jay


--

From: utkarshsinghal 
Date: Tue, Jun 2, 2009 at 8:25 AM
Subject: [R] bigmemory - extracting submatrix from big.matrix object
To: r help 
I am using the library(bigmemory) to handle large datasets, say 1 GB,
and facing following problems. Any hints from anybody can be helpful.
_Problem-1:
_
I am using "read.big.matrix" function  to create a filebacked big
matrix of my data and get the following warning:
> x = 
> read.big.matrix("/home/utkarsh.s/data.csv",header=T,type="double",shared=T,backingfile
>  = "backup", backingpath = "/home/utkarsh.s")
Warning message:
In filebacked.big.matrix(nrow = numRows, ncol = numCols, type = type,  :
 A descriptor file has not been specified.  A descriptor named
backup.desc will be created.
However there is no such argument in "read.big.matrix". Although there
is an argument "descriptorfile" in the function "as.big.matrix" but if
I try to use it in "read.big.matrix", I get an error showing it as
unused argument (as expected).
_Problem-2:_
I want to get a filebacked *sub*matrix of "x", say only selected
columns: x[, 1:100]. Is there any way of doing that without actually
loading the data into R memory.
_
Problem-3
_There are functions available like:  summary, colmean, colsd, ... for
standard summary statistics. But is there any way to calculate other
summaries say number of missing values or skewness of each variable,
without loading the whole data into R memory.
Regards
Utkarsh

--
John W. Emerson (Jay)
Assistant Professor of Statistics
Department of Statistics
Yale University
http://www.stat.yale.edu/~jay

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] C++ to R : 64bit to 32bit problem.

2009-06-02 Thread H c
Hi,

I'm new to calling C++/C programs from R and am having some trouble getting
started.  Following Sigal Blay (Simon Fraser University)'s instructions, I
have a .c file called "useC1.c":

/* useC1.c*/

void useC(int *i) {
i[0] = 11;
}


This produces a .o file : "useC1.o" in a specified directory.  I then open
R, set the proper directory and:


 dyn.load("useC1.o")

Unfortunately I am met with the following:

Error in inDL(x, as.logical(local), as.logical(now), ...) :
  unable to load shared library 'C:/Users/Harlan/Desktop/useC1.o':
  LoadLibrary failure:  %1 is not a valid Win32 application.


My guess is that this is due to the fact that I am running Windows Vista
with 64bit and R is built on 32bit.  Any suggestions to fix this problem ?
 Or any easier ways for someone in my situation to call  C++ from R?

Thanks,

Harlan Campbell
McGill 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] Creating a plot with an image as background

2009-06-02 Thread Greg Snow
The RgoogleMaps package does something similar to this, you could look at the 
code to see how those functions work and if they can be modified to work with 
your graphic.

The general idea is to load the picture and plot it (the rimage package reads 
and plots jpeg images, there are some other functions for other formats), then 
work out some mapping between the coordinates in the plot and the information 
that you want to add to the plot.  One of the easiest ways to do this is using 
the updateusr function in the TeachingDemos package (find 2 points that you can 
find in the current plot/image (corners work great, or use locator) and that 
you know the coordinates of in the new coordinate system, pass that info to 
updateusr), then just use the points/lines/symbols function to add the 
information to the background picture.

You may want to look at the animation package for the second part of your 
question.

Hope this helps,



-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Søren Højsgaard
> Sent: Monday, June 01, 2009 4:18 PM
> To: r-h...@stat.math.ethz.ch
> Subject: [R] Creating a plot with an image as background
> 
> I want to create a plot of positions (x(t),y(t)) of animals in a barn
> for t=1,2,... (I have in mind creating many of these, saving them as
> png's and combining them into a small movie). I have an image file
> showing the physical layout of the barn, and I would like to have that
> image as background for the plots. Can that be done in R (easily) or is
> that something I should do outside of R using e.g. ImageMagick?
> (Creating the .png's with R and then subsequently overlaying them???).
> Thanks
> Søren
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] RKWard: R backend requests information

2009-06-02 Thread AG

Romain Francois wrote:

Hi,

rkward has its own mailing list where people will be able to help you.
https://lists.sourceforge.net/lists/listinfo/rkward-users

Romain

AG wrote:


Hello List

I've decided to dive into R and found a useful GUI for GNU/Linux 
(Debian testing/ Squeeze) called RKWard.  However, when I fire it up 
a dialog box appears with the statement "R backend requests 
information".  I have tried entering the path to the R libraries 
(e.g. /usr/bin/R; /etc/R; and so on) but none of these work, and the 
darn thing won't go away without killing the entire program.  It also 
will not allow me to by-pass it, nor access any help files, etc.  
Does anyone know just what "backends" it is looking for?


Thanks

AG



Thank you.  Will try them.

AG

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


Re: [R] Most used R editors

2009-06-02 Thread Ian Fiske

If you are developing packages, the Eclipse plugin StatET is excellent.  You
get all of the fancy coding features of Eclipse plus many useful tools
specifically for R package building.  Combining this with the SVN plugin
subclipse has been a fantastic combination for me.

Ian Fiske
-- 
View this message in context: 
http://www.nabble.com/Most-used-R-editors-tp23827544p23838468.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] lattice: horizontal alignment of labels in key

2009-06-02 Thread Thomas Zumbrunn
Dear R users

I have problems horizontally aligning labels in keys of lattice plots when the 
labels make use of plotmath. Here's a self-contained example:

dat <- data.frame(x = rnorm(10),
  y = rnorm(10),
  z = factor(rep(c("a", "b"), each = 5)))
xyplot(y ~ x, dat, groups = z,
   auto.key = list(columns = 2,
 text = c(expression(plain("alright")),
   expression(italic("too low")

It seems like the grid object which the lattice function creates from the key 
arguments has different heights for the two labels since the second label does 
not stretch over the baseline.

Any ideas how I could circumvent the problem (other than manipulating the key 
grob)?

Best wishes
Thomas Zumbrunn

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


Re: [R] C++ to R : 64bit to 32bit problem.

2009-06-02 Thread Thomas Lumley

On Tue, 2 Jun 2009, H c wrote:


Hi,

I'm new to calling C++/C programs from R and am having some trouble getting
started.  Following Sigal Blay (Simon Fraser University)'s instructions, I
have a .c file called "useC1.c":

/* useC1.c*/

void useC(int *i) {
   i[0] = 11;
}


This produces a .o file : "useC1.o" in a specified directory.  I then open
R, set the proper directory and:


dyn.load("useC1.o")


That's not what Sigal Blay's instructions say (if you mean 
http://www.sfu.ca/~sblay/R-C-interface.txt) They say

  dyn.load("useC1.so")

Now, that won't work either, because the correct extension under Windows 
is .dll rather than .so (look at .Platform to see the correct extension 
for your platform).


If you do
  dyn.load("useC1.dll")
the rest of the instructions should work.  They do for me on Vista.

-thomas

Thomas Lumley   Assoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity of Washington, Seattle

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


[R] Plot with different x axis

2009-06-02 Thread Irina Foss
dear,

I am trying to plot a standard plot, but I want the x axis to be 1,2,4,8,16 
with equal intervals between them on plot.

I will appreciate some help.

Thank you,

Irina



Irina Foss
Environmental Research Institute
North Highland College
UHI Millennium Institute
Castle Street
Thurso, Caithness
Scotland
KW14 7JD
United Kingdom

Tel:  +44 (0) 1847 889 587
Fax: +44 (0) 1847 890 014
http://www.eri.ac.uk/sub/staff.php?id=11

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

2009-06-02 Thread ms.com

Dear all
i got a problem in monthly mean temperature. here i am attaching the data set 
as well as the plot i got with the following command
plot(month,type='n')
plot(month,X1999)

this command gave the plot where the month names are in alphabetic order, i 
want the plot in monthly sequence
could you please suggest me how can i solve my problem?

thanking you

regard
madan

_
Lauren found her dream laptop. Find the PC that’s right for you.

month   196719681969197019711972197319741975
1976197719781979198019811982198319841985
1986198719881989199019911992199319941995
1996199719981999200020012002200320042005
20062007
Janaury 13.312.912.711.914.513.618  DNA 11.5
11.912.911.413.712.512.314.511.5DNA 13.9
14.3DNA 14.812.716.213  13.513.315.412.7
14.212.714.415  14.614.213.914.713.613.4
18.214.6
Frebuary15  15.617.313.814.414.516.3DNA 
14.315.414.914  14.614.116.513.214.2DNA 
15.115.9DNA 16.715.814.317.613.615.915.2
14.316.113.616.420  14.517.617.215.315.9
17.519.113.7
March   16.819.119.118.818.620.219.7DNA 19.5
18.919.716.718.918.217.817.719.3DNA 21.1
18.9DNA 19.118.817  19.521.817.719.419.7
20.319  17.721.719.119.719.518.421.620  
20  18.8
April   DNA 22.421.921.618.521.523.7DNA 23.6
21.420.120.521.923.719.721.620.421.522.8
21.520.922.522.821.222.224  21.322.423.3
22.919.321.525  22.722.521.622.621.922.7
21.722.6
May 23.923.322.623.120.823.121.5DNA 23.6
21.220.421.924  22.521.823.821.522  22.7
21.624.423.623.722.524  22.423.124.125.6
24.623.323.724.223.823  22.623.623.623.4
23.324
June24.722.123  22.122.423.622.2DNA 23.4
22  22.823  23.422.423.423.324.423.525  
23.922.923.724  25  23.924.924.324.623.8
23.724.325.824.124.124.223.924.123.924.7
24.223.6
JulyDNA 24  22.722.322.423  22.9DNA 22.1
22.622.922.422.922.822.823.523.922.422.6
23.122.723.923.223.924.523.824.325  23.6
23.224.523.924  24.524.623.824  23.223.9
24.623.5
August  24.722.622.422.821.822.822.6DNA 22.8
21.322.723.222.622.623.623.623.623.925.1
24  22.323.723.924.124  23.823.724.624.2
23.824.123.323.323.924.323.824.224.524.3
24.524.1
Spetemberr  23.823.121.822  21.921.521.5DNA 
20.921.222.121.521.522.122.622.523.121.5
22.122.323  23.523  23.623.623.623.123.6
23.323.623.224.223.722.823.823  23.623  
24.423.523
October 21.119.319.219.820.520.219.4DNA 20.4
19.318.819.719  19.920.919.7DNA 21.819.8
20.420.622.322  20.822.120.821.921.521.8
21.619.823.421.722.122  21.122.120.621.6
22.221.9
November15.917.116.516  16.717.816.3DNA 
15.516.416.615.717.717.317.316.417.316.9
16.716.918.318.117.119.317  17.518  17.4
18.318.618.120  18.618.418.918.418.417  
18.218.1DNA
December15.714.513.915.614  17.213.1DNA 
13.415  12.615.313.115.314  14.215  DNA 
15.8DNA 16.215.414.815.814.714.316.115.1
14.715.814.416.515.415.315  15.314.915.3
16.415.716
__
R-help@r-project.org mailing list
ht

Re: [R] Problem downloading webpages using batchfiles and RCurl from command line in Vista Basic - couldn't connect to host

2009-06-02 Thread Tony Breyal
Hi Gabor,

Thank you kindly for your response.

Re: Don't need to set PATH -- When I read the batchfiles page, the
opening paragraph says "just place any or all of them anywhere in your
Windows path and you will be able to access them in any Windows
console session". My interpretation of this was that I am suppose to
alter the PATH variable, so that if i create a new batchfile of my
own, then instead of having to write

"C:\...\R-2.8.1\bin\R.exe" CMD BATCH --vanilla --slave "C:\...
\myRScript.R"

I would instead write:

RCMD BATCH --vanilla --slave "C:\...\myRScript.R"

which would refer to the latest version of R, and is therefore a very
nice short hand i think? Other than that, I must admit that I'm not
exactly sure what batchfiles is for, but i have seen it spoken of
quite a bit on this forum and therefore figured that it is the best
way to handle batch jobs. When i look at the webpage, it says that
"[batch]files useful in conjuction with R and R packages on Microsoft
Windows" but not why it's useful, if you see what i mean? The README
has a good first line though "batchfiles contains batch and GUI files
for installing and maintaing R." which is not stated on the webpage
but would be nice if it was.  :-)

Re: Elevated mode -- I did as you advised but unfortunately i ended up
with the same couldn't connect to host error.

Re: running without batchfiles -- I did as you advised and got this as
the path "C:\\PROGRA~1\\R\\R-29~1.0/bin/Rscript.exe" but unfortunately
i ended up with the same couldn't connect to host error.

As this batch process has worked before in Vista Ulitmate, is it
possible that Vista Basic is different enough to stop R batch jobs
from connecting to the internet?

Warm Regards,
Tony


On 2 June, 16:52, Gabor Grothendieck  wrote:
> On Tue, Jun 2, 2009 at 7:09 AM, Tony Breyal  
> wrote:
> > Dear all,
>
> > I am having a problem downloading webpages through R when i run it in
> > the DOS window under Windows Vista Basic. I have downloaded the
> > batchfiles fromhttp://code.google.com/p/batchfiles/and have
> > successfully set the PATH.
>
> You don't need to set your PATH if you use batchfiles.  Their
> purpose is avoid having to do that in the first place.    That
> may not be related to your main problem though.
>
>
>
> > I open up 'Command Prompt' in Vista and type (after the C:\...>
> > stuff):
>
> > ### START ###
> > C:\Users\Karen>Rscript -e "library(RCurl); getURL('http://
> >www.google.com')"
> > Loading required package: methods
> > Loading required package: bitops
> > Error in curlPerform(curl = curl, .opts = opts, .encoding
> > = .encoding) :
> >  couldn't connect to host
> > Calls: getURL -> curlPerform -> .Call
> > Execution halted
> > ### END ###
>
> Here are two things to try:
>
> 1. Just a guess but you may need to run this elevated.  Using
> el.js from the batchfiles:
>
> el cmd
>
> and allow it to proceed when asked.  That
> will spawn a new window from which everything will run in
> elevated mode.  Try your Rscript command in that.
>
> 2. Another thing to try is running without using the batchfiles.
> Go into R and enter this:
>  file.path(R.home(), "bin", "Rscript.exe")
>
> and it will give you the path to Rscript.exe.  Using that path
> try this:
>
> "...whatever.../Rscript.exe" -e ...your command...
>
> __
> r-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] montly mean temp plot

2009-06-02 Thread Emmanuel Charpentier
Le mardi 02 juin 2009 à 16:32 +, ms.com a écrit :
> Dear all
> i got a problem in monthly mean temperature. here i am attaching the data set 
> as well as the plot i got with the following command
> plot(month,type='n')
> plot(month,X1999)
> 
> this command gave the plot where the month names are in alphabetic order, i 
> want the plot in monthly sequence
> could you please suggest me how can i solve my problem?


>From the depths of my limbic system:
? factor
? relevel
? ordered
(two different solutions, with varying implications...).

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


[R] R constrict digits number after point precision?

2009-06-02 Thread Xiaogang Yang
R constrict  digits number after point  precision?

[[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] Conducting data modelling on weighted data using R

2009-06-02 Thread Harding, Peter
Hello,

I am starting to use R for various analyses, for example I use the ca package 
to do Correspondence Analysis.  I am also looking to use packages such as:

pls Partial Least Squares
plspmPartial Least Squares  Path Modelling

However, although I can use packages such as these on un-weighted data there 
does not appear to be a facility to take account of weighted data.

I am a statistician working for a Market Research company where in many 
projects I work on weighted data. Typically, the data will be structured in the 
following manner:

Case_id y   x1  x2  x3  x4  weight
1   5   3   4   1   4   0.345
2   3   4   3   1   5   0.543
3   2   2   3   3   3   1.456
4   4   4   2   4   3   0.345
5   3   3   4   3   2   1.200
.
.
etc

The above data is fictional.Where y is the dependent variable, and there 
are 4 independent variables (x1, x2, x3 and x4),  and weight is the weighting 
factor variable.

For some functions in R such as lm   (Linear Regression) the functionality is 
provided to conduct linear regression on weighted data:

e.g.  model <- lm(y ~ x1+x2+x3+x4, weights=weight)


I was just wondering if anyone had any suggestions of how to apply packages 
such as pls and plspm on weighted data?  Or should I contact the Maintainers of 
the packages to see if they can include a weights command?

Many Thanks for any assistance in this area.

Kind Regards

Peter





Peter Harding | Senior Methodologist | Marketing Sciences & Advanced Analytics 
| Harris Interactive 
O: +44 (0)20 8263 5249 |  M: +44 (0)7890 561391 | E: 
phard...@harrisinteractive.com
Watermans Park, High Street, Brentford, TW8 0BB, UK
www.harrisinteractive.com/europe

Remember that we have a global online omnibus service at your disposal. 25+ 
markets run as frequently as weekly, and priced from £195 per question.  
Flexibility of 1,000 or 2,000 people each time.  See our omnibus in action in 
the FT, Herald Tribune, the Metro and many more. 







[[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] montly mean temp plot

2009-06-02 Thread jim holtman
THe problem is that when you read the data in, 'month' was converted to a
factor.  Try the following to get it converted to a factor, but in the order
you want for processing:

x <- read.table(yourFile, ..., as.is=TRUE, na.strings="DNA")  # prevent
conversion to factor
x$month <- factor(x$month, levels=x$month)

This will create the factor levels in the order you want.
On Tue, Jun 2, 2009 at 12:32 PM, ms.com  wrote:

>
> Dear all
> i got a problem in monthly mean temperature. here i am attaching the data
> set as well as the plot i got with the following command
> plot(month,type='n')
> plot(month,X1999)
>
> this command gave the plot where the month names are in alphabetic order, i
> want the plot in monthly sequence
> could you please suggest me how can i solve my problem?
>
> thanking you
>
> regard
> madan
>
> _
> Lauren found her dream laptop. Find the PC that’s right for you.
>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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?

[[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] How to convert blanks to NA

2009-06-02 Thread Mark Na
Hi R-helpers,

I have imported data from Excel using the following code:

library(xlsReadWrite)
data <- read.xls(data,colClasses=c("character"))

and this results in all of the empty (blank) cells in the imported
Excel file also being empty (blank) in the resulting dataframe.

I am not used to having blanks (rather NAs) and I think these are
caused by the colClasses argument.

I would like to convert all the empty (blank) cells in my dataframe to NA.

Thanks for any help you might provide.

Mark

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


Re: [R] Plot with different x axis

2009-06-02 Thread Greg Snow
Try:

xpts <- 2^(0:4)

x <- 2^runif(100, 0,4)
y <- rnorm(100)

plot( log(x, base=2), y, xlab='x', xaxt='n' )
axis(1, at=log(xpts, base=2), lab=xpts)

plot(x,y) # for comparison


see ?par and ?axis for details

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Irina Foss
> Sent: Tuesday, June 02, 2009 1:14 PM
> To: r-h...@r-project; r-help@r-project.org; r-help@r-project.org
> Subject: [R] Plot with different x axis
> 
> dear,
> 
> I am trying to plot a standard plot, but I want the x axis to be
> 1,2,4,8,16 with equal intervals between them on plot.
> 
> I will appreciate some help.
> 
> Thank you,
> 
> Irina
> 
> 
> 
> Irina Foss
> Environmental Research Institute
> North Highland College
> UHI Millennium Institute
> Castle Street
> Thurso, Caithness
> Scotland
> KW14 7JD
> United Kingdom
> 
> Tel:  +44 (0) 1847 889 587
> Fax: +44 (0) 1847 890 014
> http://www.eri.ac.uk/sub/staff.php?id=11
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] montly mean temp plot

2009-06-02 Thread Greg Snow
Without a reproducible example (we don't have month and X1999) it is hard to 
tell for sure, but my guess is that month is an (unordered) factor without the 
ordering specified, so it defaults to alphabetic.  Change it to a factor with 
the months properly ordered and the plot should match what you want.  One 
possible way to do this is:

> month <- factor(month, levels=month.name)

Or

> month <- factor(month, levels=month.abb)

Or if those don't work, then you will need to provide a set of months in the 
correct order that match with your data.

If that does not help, then send us more info on your month variable 
(str(month)), or better, a full reproducible example.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of ms.com
> Sent: Tuesday, June 02, 2009 10:33 AM
> To: r forum
> Subject: [R] montly mean temp plot
> 
> 
> Dear all
> i got a problem in monthly mean temperature. here i am attaching the
> data set as well as the plot i got with the following command
> plot(month,type='n')
> plot(month,X1999)
> 
> this command gave the plot where the month names are in alphabetic
> order, i want the plot in monthly sequence
> could you please suggest me how can i solve my problem?
> 
> thanking you
> 
> regard
> madan
> 
> _
> Lauren found her dream laptop. Find the PC that's right for you.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
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 checking whether elements of a vector changed or not.

2009-06-02 Thread Linlin Yan
> c(x[1], x[-length(x)]) != x
[1] FALSE FALSE FALSE  TRUE  TRUE FALSE  TRUE

On Mon, Jun 1, 2009 at 11:57 PM, liujb  wrote:
>
> Hello,
>
> I have a vector:
> x <- c("A", "A", "A", "B", "A", "A", "C")
>
> I'd like to compare each of elements of vector x from its previous element
> (except for the 1st element which does not have previous element). So I'd
> like to get a vector y (of same length) that looks something like
> (0, 0, 0, 1, 1, 0, 1) or
> (F, F, F, T, T, F, T)
>
> Is there a command that do this?
>
> I was thinking to construct another variable x1 from x as follows:
> x1 <- vector(length=length(x))
> x1[1] <- x[1]
> x1[2:length(x)] <- x[1:(length(x)-1)]
> x1
>
> Now, x1 is ("A" "A" "B" "B" "B" "A"). However, I don't know how to compare 2
> vectors (of same length) elements by elements and a vector that indicates
> change or no change.
>
> Or there is a easier way to do this?
>
> Thank you very much
> Julia
>
>
>
> --
> View this message in context: 
> http://www.nabble.com/how-to-checking-whether-elements-of-a-vector-changed-or-not.-tp23817310p23817310.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] R constrict digits number after point precision?

2009-06-02 Thread jim holtman
?sprintf  # for output
?round

On Tue, Jun 2, 2009 at 3:12 PM, Xiaogang Yang  wrote:

> R constrict  digits number after point  precision?
>
>[[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.
>



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

What is the problem that you are trying to solve?

[[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 convert blanks to NA

2009-06-02 Thread John Kane

Does this do what you want

x <- data.frame(1,"" , 5)
x[x==""]  <- NA
x

where x is substituted for your 'data'?




- Original Message 
From: Mark Na 
To: r-help@r-project.org
Sent: Tuesday, June 2, 2009 3:14:00 PM
Subject: [R] How to convert blanks to NA

Hi R-helpers,

I have imported data from Excel using the following code:

library(xlsReadWrite)
data <- read.xls(data,colClasses=c("character"))

and this results in all of the empty (blank) cells in the imported
Excel file also being empty (blank) in the resulting dataframe.

I am not used to having blanks (rather NAs) and I think these are
caused by the colClasses argument.

I would like to convert all the empty (blank) cells in my dataframe to NA.

Thanks for any help you might provide.

Mark

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

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


[R] Barplot: annotations at tips of each bar?

2009-06-02 Thread tsunhin wong
Dear R-users,

I have searched through examples of barplot in R.
But there seems to be no advanced annotation options in R for their barplot.
What I am trying to do is to do some annotations at the tip of each
bar in a barplot, similar to the graph below:
http://www.lakesuperiorstreams.org/understanding/images/parameters/king_barplot.gif

What method(s) do you use for these annotations?
Am I going to do some text-overlay on graph mainly?

Thanks a lot!

- John

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

2009-06-02 Thread Henrique Dallazuanna
Try this:

sapply(x, function(f){is.na(f)<-which(f == '');f})

On Tue, Jun 2, 2009 at 4:14 PM, Mark Na  wrote:

> Hi R-helpers,
>
> I have imported data from Excel using the following code:
>
> library(xlsReadWrite)
> data <- read.xls(data,colClasses=c("character"))
>
> and this results in all of the empty (blank) cells in the imported
> Excel file also being empty (blank) in the resulting dataframe.
>
> I am not used to having blanks (rather NAs) and I think these are
> caused by the colClasses argument.
>
> I would like to convert all the empty (blank) cells in my dataframe to NA.
>
> Thanks for any help you might provide.
>
> Mark
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

[[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] getting elements out of list automatically

2009-06-02 Thread stephen sefick
o <- (structure(list(sand.silt = structure(list(statistic =
structure(185, .Names = "W"),
parameter = NULL, p.value = 0.0478835773838087, null.value =
structure(0, .Names = "location shift"),
alternative = "two.sided", method = "Wilcoxon rank sum test with
continuity correction",
data.name = ".column by site"), .Names = c("statistic", "parameter",
"p.value", "null.value", "alternative", "method", "data.name"
), class = "htest"), gravel = structure(list(statistic =
structure(249.5, .Names = "W"),
parameter = NULL, p.value = 0.528568586705971, null.value =
structure(0, .Names = "location shift"),
alternative = "two.sided", method = "Wilcoxon rank sum test with
continuity correction",
data.name = ".column by site"), .Names = c("statistic", "parameter",
"p.value", "null.value", "alternative", "method", "data.name"
), class = "htest"), cobble = structure(list(statistic =
structure(340, .Names = "W"),
parameter = NULL, p.value = 0.19522724195, null.value =
structure(0, .Names = "location shift"),
alternative = "two.sided", method = "Wilcoxon rank sum test with
continuity correction",
data.name = ".column by site"), .Names = c("statistic", "parameter",
"p.value", "null.value", "alternative", "method", "data.name"
), class = "htest"), boulder.bedrock = structure(list(statistic =
structure(368, .Names = "W"),
parameter = NULL, p.value = 0.0193433582385429, null.value =
structure(0, .Names = "location shift"),
alternative = "two.sided", method = "Wilcoxon rank sum test with
continuity correction",
data.name = ".column by site"), .Names = c("statistic", "parameter",
"p.value", "null.value", "alternative", "method", "data.name"
), class = "htest"), fine.root = structure(list(statistic =
structure(395.5, .Names = "W"),
parameter = NULL, p.value = 0.0147991488721795, null.value =
structure(0, .Names = "location shift"),
alternative = "two.sided", method = "Wilcoxon rank sum test with
continuity correction",
data.name = ".column by site"), .Names = c("statistic", "parameter",
"p.value", "null.value", "alternative", "method", "data.name"
), class = "htest"), course.root = structure(list(statistic =
structure(244.5, .Names = "W"),
parameter = NULL, p.value = 0.202661704288995, null.value =
structure(0, .Names = "location shift"),
alternative = "two.sided", method = "Wilcoxon rank sum test with
continuity correction",
data.name = ".column by site"), .Names = c("statistic", "parameter",
"p.value", "null.value", "alternative", "method", "data.name"
), class = "htest"), wood = structure(list(statistic =
structure(289.5, .Names = "W"),
parameter = NULL, p.value = 0.82819937730819, null.value =
structure(0, .Names = "location shift"),
alternative = "two.sided", method = "Wilcoxon rank sum test with
continuity correction",
data.name = ".column by site"), .Names = c("statistic", "parameter",
"p.value", "null.value", "alternative", "method", "data.name"
), class = "htest"), leaf = structure(list(statistic = structure(257,
.Names = "W"),
parameter = NULL, p.value = 0.566029791094808, null.value =
structure(0, .Names = "location shift"),
alternative = "two.sided", method = "Wilcoxon rank sum test with
continuity correction",
data.name = ".column by site"), .Names = c("statistic", "parameter",
"p.value", "null.value", "alternative", "method", "data.name"
), class = "htest"), leaf.sand = structure(list(statistic =
structure(194, .Names = "W"),
parameter = NULL, p.value = 0.0149634957806214, null.value =
structure(0, .Names = "location shift"),
alternative = "two.sided", method = "Wilcoxon rank sum test with
continuity correction",
data.name = ".column by site"), .Names = c("statistic", "parameter",
"p.value", "null.value", "alternative", "method", "data.name"
), class = "htest"), veg = structure(list(statistic = structure(399.5,
.Names = "W"),
parameter = NULL, p.value = 0.0091447786580201, null.value =
structure(0, .Names = "location shift"),
alternative = "two.sided", method = "Wilcoxon rank sum test with
continuity correction",
data.name = ".column by site"), .Names = c("statistic", "parameter",
"p.value", "null.value", "alternative", "method", "data.name"
), class = "htest"), pool = structure(list(statistic = structure(273,
.Names = "W"),
parameter = NULL, p.value = 0.776755854519814, null.value =
structure(0, .Names = "location shift"),
alternative = "two.sided", method = "Wilcoxon rank sum test with
continuity correction",
data.name = ".column by site"), .Names = c("statistic", "parameter",
"p.value", "null.value", "alternative", "method", "data.name"
), class = "htest")), .Names = c("sand.silt", "gravel", "cobble",
"boulder.bedrock", "fine.root", "course.root", "wood", "leaf",
"leaf.sand", "veg", "pool")))


I know that I can get the elements of this list that I want by

test <- rbind(c(o$veg$p.value, o$veg$statistic), c(o$pool$p.value,
o$pool$statistic))
colnames(test) <- c("p.value", "W")

is 

Re: [R] Nested variables

2009-06-02 Thread Mark Difford

Hi Daniel,

>> I read the chapter and it says that I can nest B in A by writing A/B. But
>> it doesnt seem to 
>> work properly.

Then you need to read it again, and you need to play with some simple
models, so that you learn how to specify a model properly, using the formula
interface. (Achim Zeileis wrote the pscl function, which uses the formula
interface, so it almost certainly works as it should.)

It also is not at all clear what model you are trying to fit, since I only
have an R-specified model to go on, and your concept of what that means is
different from mine (and R's).

>> If I write Sps*Habitat/Site R somehow thinks that its a 3-way interaction
>> link and still 
>> includes habitat as a single variable.

It will, because that is what you are specifying.

Reread this (from §11.1):
y ~ A*B
y ~ A + B + A:B
y ~ B %in% A
y ~ A/B
Two factor non-additive model of y on A and B. The first two specify the
same crossed classification and the second two specify the same nested
classification. In abstract terms all four specify the same model subspace.

And this (from §11.1):
y ~ (A + B + C)^2
y ~ A*B*C - A:B:C
Three factor experiment but with a model containing main effects and two
factor interactions only. Both formulae specify the same model.

What happens if you do something like the following?

zeroinfl(Visitation ~ Sps*Habitat/Site - Sps:Habitat:Site, data = data1)
zeroinfl(Visitation ~ Sps*Habitat/Site - Sps - Sps:Habitat:Site, data =
data1)

Regards,
Mark.


DanielWC wrote:
> 
> Hi again
> I read the chapter and it says that I can nest B in A by writing A/B. But
> it doesnt seem to work properly. The package I use is pscl, I am trying to
> model zero inflated data. Here is the full model:
> 
> zip1<-zeroinfl(Visitation ~ Habitat/Site + Sps + TP + Resource +
> Sps*Habitat/Site + Sps*Resource + Sps*TP + TP*Resource + TP*Habitat/Site |
> TP + Sps + Resource + Habitat/Site + TP*Sps + Sps*Resource + TP*Resource +
> TP*Habitat/Site, data = data1)
> 
> where as you can see I have tried to include Habitat/Site. But it doesnt
> seem like its possible to create interaction links that way. I would like
> create the interaction link between say Sps and Habitat/Site. If I write
> Sps*Habitat/Site R somehow thinks that its a 3-way interaction link and
> still includes habitat as a single variable. Here is the summary just so
> you can see:
> 
> Count model coefficients (poisson with log link):
>Estimate Std. Error z value Pr(>|z|)
> (Intercept)   3.8643338  0.3450539  11.199  < 2e-16 ***
> Habitat  -3.2757473  0.4871726  -6.724 1.77e-11 ***
> Sps  -0.3332371  0.1117680  -2.982  0.00287 ** 
> TP   -0.3857513  0.0975556  -3.954 7.68e-05 ***
> Resource  0.0130935  0.0009545  13.717  < 2e-16 ***
> Habitat:Site  0.2487012  0.0415908   5.980 2.24e-09 ***
> Habitat:Sps   0.5432845  0.1230434   4.415 1.01e-05 ***
> Sps:Resource -0.0041420  0.0002632 -15.738  < 2e-16 ***
> Sps:TP0.0438085  0.0189411   2.313  0.02073 *  
> TP:Resource  -0.0009413  0.0002887  -3.260  0.00111 ** 
> Habitat:TP0.1549435  0.1205884   1.285  0.19883
> Habitat:Site:Sps -0.0305628  0.0107794  -2.835  0.00458 ** 
> Habitat:Site:TP  -0.0096408  0.0098497  -0.979  0.32768
> 
> Zero-inflation model coefficients (binomial with logit link):
>   Estimate Std. Error z value Pr(>|z|)
> (Intercept) -1.3160850  0.8200631  -1.605   0.1085
> TP   0.2808474  0.2657544   1.057   0.2906
> Sps  0.8023648  0.1281520   6.261 3.82e-10 ***
> Resource-0.0075967  0.0035817  -2.121   0.0339 *  
> Habitat -1.3122811  1.1348922  -1.156   0.2476
> Habitat:Site 0.1390498  0.0984716   1.412   0.1579
> TP:Sps  -0.0189088  0.0406299  -0.465   0.6417
> Sps:Resource-0.0005548  0.0006843  -0.811   0.4175
> TP:Resource  0.0007100  0.0008454   0.840   0.4010
> TP:Habitat   0.7195254  0.3666809   1.962   0.0497 *  
> TP:Habitat:Site -0.0782610  0.0314229  -2.491   0.0128 *
> 
> Thanks again
> 
> 
> Mark Difford wrote:
>> 
>> Daniel,
>> 
 Yes I am trying to model such data, and i need R to know that Site is
 nested within Habitat. 
 Do I use some kind of command before running the model (like factor()
 and so on) or do i 
 write it in the model formula. If so, how?
>> 
>> You still are not telling the list enough, since nesting specifications
>> are sometimes package/program specific. You could help yourself by
>> reading some of R's basic documentation about how to specify a nested
>> model. Then "it" will tell you what to do.
>> 
>> ?formula
>> 
>> Or read §11.1 of "An Introduction to R" (one of R's manuals).
>> 
>> Regards, Mark.
>> 
>> 
>> DanielWC wrote:
>>> 
>>> Hi. 
>>> Yes I am trying to model such data, and i need R to know that Site is
>>> nested within Habitat. Do I use some kind of command before running the
>>> model (like fa

Re: [R] R constrict digits number after point precision?

2009-06-02 Thread Wacek Kusnierczyk
jim holtman wrote:
> ?sprintf  # for output
> ?round
>   
... and
   
sprintf(round(...))

for correct output

vQ

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


Re: [R] Barplot: annotations at tips of each bar?

2009-06-02 Thread Greg Snow
This is the second post on this topic today.  Is this part of an assignment or 
something?

You should read the discussion/thread that follows this post:
http://tolstoy.newcastle.edu.au/R/e2/help/07/08/22858.html

The answer to your question and to other questions that you should be asking 
are in there.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of tsunhin wong
> Sent: Tuesday, June 02, 2009 1:57 PM
> To: r-help@r-project.org
> Subject: [R] Barplot: annotations at tips of each bar?
> 
> Dear R-users,
> 
> I have searched through examples of barplot in R.
> But there seems to be no advanced annotation options in R for their
> barplot.
> What I am trying to do is to do some annotations at the tip of each
> bar in a barplot, similar to the graph below:
> http://www.lakesuperiorstreams.org/understanding/images/parameters/king
> _barplot.gif
> 
> What method(s) do you use for these annotations?
> Am I going to do some text-overlay on graph mainly?
> 
> Thanks a lot!
> 
> - John
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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 checking whether elements of a vector changed or not.

2009-06-02 Thread David Winsemius

Gabor;

Did you perhaps get an undesired doubling of "!"?

> x1 <-c("A", "A", "B", "B", "B", "A")
> x1[2:length(x1)] == x1[1:(length(x1)-1)]
[1]  TRUE FALSE  TRUE  TRUE FALSE

> !!diff(c(factor(x1)))
[1] FALSE  TRUE FALSE FALSE  TRUE

(Your trick of computing differences of the underlying factor  
representation ... ganz raffiniert.)


--
David Winsemius

On Jun 1, 2009, at 6:21 PM, Gabor Grothendieck wrote:


Try this:

c(FALSE, !!diff(c(factor(x


On Mon, Jun 1, 2009 at 11:57 AM, liujb  wrote:


Hello,

I have a vector:
x <- c("A", "A", "A", "B", "A", "A", "C")

I'd like to compare each of elements of vector x from its previous  
element
(except for the 1st element which does not have previous element).  
So I'd

like to get a vector y (of same length) that looks something like
(0, 0, 0, 1, 1, 0, 1) or
(F, F, F, T, T, F, T)

Is there a command that do this?

I was thinking to construct another variable x1 from x as follows:
x1 <- vector(length=length(x))
x1[1] <- x[1]
x1[2:length(x)] <- x[1:(length(x)-1)]
x1

Now, x1 is ("A" "A" "B" "B" "B" "A"). However, I don't know how to  
compare 2
vectors (of same length) elements by elements and a vector that  
indicates

change or no change.

Or there is a easier way to do this?

Thank you very much
Julia



David Winsemius, MD
Heritage Laboratories
West Hartford, CT

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


  1   2   >