Re: [R] vectors cross-product V1 x V2

2011-07-08 Thread Hans Werner Borchers
> RSiteSearch("cross product")
> library(pracma)
> ?cross
>
> Speed is usually desired in the context of many similar computations, and
is
> normally achieved in R by vectorizing computation, so storing the large
> number of 3d vectors together in a structure like a Nx3 matrix so the
code
> can be vectorized is the logical approach.  The cross() function takes
> inputs in this form, but the current implementation (0.6-3) then fails to
> take advantage of that storage since it iterates with a for loop. A
better
> core implementation of cross() might be:
>
> vcrossp <- function( a, b ) {
>result <- matrix( NA, nrow( a ), 3 )
>result[,1] <- a[,2] * b[,3] - a[,3] * b[,2]
>result[,2] <- a[,3] * b[,1] - a[,1] * b[,3]
>result[,3] <- a[,1] * b[,2] - a[,2] * b[,1]
>result
> }
>
> which is about 20 times faster than cross() on my machine.

Thanks, Jeff, for the hint.  I think most of the functions in package
'pracma'
are vectorized (if appropriate), but this one was a real oversight. I has
been
corrected in version 0.7-1 (on R-Forge).

--  Hans Werner

[[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] vectors cross-product V1 x V2

2011-07-08 Thread Bai
Thank you all.
I do have two huge matrix like M1[x,y,z,3] x M2[x,y,z,3].
I'll try it.

Best,
Bai

On Fri, Jul 8, 2011 at 11:56 PM, Jeff Newmiller
 wrote:
> RSiteSearch("cross product")
> library(pracma)
> ?cross
>
> Speed is usually desired in the context of many similar computations, and is
> normally achieved in R by vectorizing computation, so storing the large
> number of 3d vectors together in a structure like a Nx3 matrix so the code
> can be vectorized is the logical approach.  The cross() function takes
> inputs in this form, but the current implementation (0.6-3) then fails to
> take advantage of that storage since it iterates with a for loop. A better
> core implementation of cross() might be:
>
> vcrossp <- function( a, b ) {
>  result <- matrix( NA, nrow( a ), 3 )
>  result[,1] <- a[,2] * b[,3] - a[,3] * b[,2]
>  result[,2] <- a[,3] * b[,1] - a[,1] * b[,3]
>  result[,3] <- a[,1] * b[,2] - a[,2] * b[,1]
>  result
> }
>
> which is about 20 times faster than cross() on my machine.
>
> On 07/08/2011 05:52 AM, Eik Vettorazzi wrote:
>>
>> Hi,
>> how about this:
>>
>> mm<-cbind(V1,V2)
>> xy<-sapply(1:3,function(x)det(mm[-x,])*(2*(x%%2)-1))
>>
>> #some checks
>> all.equal(0,as.vector(xy%*%V1))
>> all.equal(0,as.vector(xy%*%V2))
>>
>>
>> Am 08.07.2011 08:27, schrieb Bai:
>>>
>>> Hi, everyone,
>>>
>>> I need an efficient way to do vectors cross product in R.
>>>
>>> Set vectors,
>>> V1 = ai + bj + ck
>>> V2 = di + ej + fk
>>>
>>> then the cross product is
>>>   V1 x V2    =  (bf - ce) i + (cd - af) j + (ae - bd) k
>>>
>>>
>>> As shown here ( http://en.wikipedia.org/wiki/Cross_product ).
>>>
>>> Thanks.
>>>
>>> Best,
>>> Bai
>>>
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/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] computing functions with Euler's number (e^n)

2011-07-08 Thread Daniel Malter
The problem arises in the computation of U where (-dummy+1) turns negative
(the eighth and higher index values of "dummy"). You raise a negative number
to a non-integer power, for example, (-pi)^exp(1), which fails because you
would not be able to tell, which sign the resulting number should have.
Generally, non-integer powers of negative numbers are only defined in a
specific subset of cases.

(-dummy[8]+1)^B[1]
[1] NaN

HTH,
Daniel


William Armstrong-2 wrote:
> 
> I am trying to create a set of wavelets in frequency space--namely Cauchy
> wavelets for an intensity analysis (von Tscharner, 2000).  The wavelets
> are
> defined by the following formula:
> 
> [(f/cf)^(cf*scale)]*[e^((-f/cf)+1)^(cf*scale)]
> 
> where *f *is frequency of length *n*, *cf* is center frequency (defined
> below) and is an array of *j *columns and *n* row, and scale is a
> constant.
> 
> cf = (1/scale)*(j + q)^r
> where *j *is the number of center frequencies (i.e., columns), and *q* and
> *
> r* are constants.
> 
> When I get to Q, the output returns numbers only up to cf.  Beyond cf, Q
> and
> subsequently W return "NA." I understand this is because when fq >/=  cf 
> U
> becomes zero^B[j] or a negative^B[j].  From here, Q should equal 1/exp(U)
> to
> compute W.  I know that I need to create a loop here, but as a newbie to
> R,
> I don't know how to write the correct loop that will work for me.  Any
> suggestions??
> 
> 
> 
> Here is the code I have been using (less the numerous if...else attempts):
> 
> 
> 
>> J <- 12
> 
>> r_ <- 1.959
> 
>> q_ <- 1.45
> 
>> scale_ <- 0.3
> 
>> N <- 500
> 
>> fq <- seq(0, N, 1)
> 
>> center_frequencies <- function(J = 12, r_ = 1.959, q_ = 1.45, scale_ =
> 0.3){
> 
> + j <- seq(0,J-1,1)
> 
> + fc <- (q_ + j)^r_/scale_
> 
> + }
> 
>> fc <- center_frequencies(12,r_,q_,scale_)
> 
>> cf <- t(fc)
> 
>> lambda <- function(cf, J = 12, scale_ = 0.3){
> 
> + B <- cf*scale_
> 
> + }
> 
>> B <- lambda(cf, 12, 0.3)
> 
>> dummy <- fq/cf[1]
> 
>> Z <- dummy**B[1] # Note here I tried using '^' to raise dummy to the
>> power
> B[j], but it didn't work.  I tried '**' which serves the same purpose in
> LabVIEW, and it worked.  There is no references to this in any of the R
> documentation that I have read.  Should '^' work here???
> 
>> U <- (-dummy+1)**B[1]
> 
>> Q <- exp(U)
> 
>> Q <- ifelse(Q>30,30,Q)  # Not sure why I use this.
> 
>> W <- Z*Q
> 
> 
> -- 
> *W. Jeffrey Armstrong, Ph.D.
> *Assistant Professor
> Exercise Science
> 
> *Managing Editor
> Clinical Kinesiology*
> Official Journal of the American Kinesiotherapy Association
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

--
View this message in context: 
http://r.789695.n4.nabble.com/computing-functions-with-Euler-s-number-e-n-tp3655205p3655505.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] ASCII values to Decimal

2011-07-08 Thread Bansal, Vikas
Dear all,

I have a data frame which is like-

V1  V2   V3  V4
  9  2 .,  a\
  9  2.$,  a`
 13  1  ,   a
 13  1  ,   a
 13  1  ,   a
 13  1  ,   a
 13  1  ,   `
 13  1  ,   ^
 13  1  ,   a
 13  1 ,$   a

Column V4 contains ASCII values.I want to convert them into decimal.I am using-

df$V4=lapply(df[,4], function(c) as.numeric(charToRaw(c)))


I want to ask that,is this the right way to convert these values into decimal?

Thanking you,
Warm Regards
Vikas Bansal
Msc Bioinformatics
Kings College London
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Excel export date format

2011-07-08 Thread Jim Lemon

Hi folks,
I have been tormented for some time by Excel's habit of exporting dates 
to CSV files as mm/dd/ format even if the dates are formatted 
dd/mm/ in the display. What's worse, if there are dates that are of 
ambiguous (6/6/2011) and unambiguous (16/6/2011) format in the same 
column, Excel reformats the unambiguous dates and leaves the ambiguous 
ones as they were! Yesterday I discovered that if the dates are in 
international format (2011-6-6) Excel seems to export them as 
dd/mm/, and all correctly. As I suspect that there are a lot of R 
users who suffer from this, I thought I would pass on the info.


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] manipulating "by" lists and "ave()" functions

2011-07-08 Thread ivo welch
It does!!  why is this function not mentioned in the "See also" docpage for
"by" (and friends)???  (Also, "ave" should be mentioned there, too.)

do I post this suggestion to add it to r-devel, or is there a way to find
out who is in charge of the docpage for "by"?

regards,

/iaw


On Fri, Jul 8, 2011 at 4:17 PM, William Dunlap  wrote:

> Q1.  simplify2array(b) gives the transpose of what
> I think you want.
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
> > -Original Message-
> > From: r-help-boun...@r-project.org
> > [mailto:r-help-boun...@r-project.org] On Behalf Of ivo welch
> > Sent: Friday, July 08, 2011 3:43 PM
> > To: r-help
> > Subject: [R] manipulating "by" lists and "ave()" functions
> >
> > dear R wizards---more ignorance on my part, exacerbated by too few
> > examples in the function documentations.
> >
> > > d <- data.frame( id=rep(1:3,3), x=rnorm(9), y=rnorm(9))
> >
> > Question 1: how do I work with the output of "by"?  for example,
> >
> > > b <- by( d, d$id, function(x) coef(lm( y ~ x, data=x ) ))
> > > b
> >
> > d$id: 1
> > (Intercept)   x
> >  0.2303  0.3618
> > --
> > -
> > d$id: 2
> > (Intercept)   x
> > 0.05785-0.40617
> > --
> > -
> > d$id: 3
> > (Intercept)   x
> >   0.269  -0.378
> >
> > getting the categories is easy:
> >
> > >  names(b)
> >  [1] "1" "2" "3"
> >
> > but how do I transform the non-name info in this by() data structure
> > into a matrix with dimensions 3 by 2?  (presumably, there is some
> > vector operator that can do this kind of magic.)
> >
> >
> > Question 2:  Let's say I want to add only one of the two coefficients
> > to d.  The naive approach
> >   a <- ave( d, d$id, FUN=function(x) coef(lm( y ~ x, data=x ))[2] )
> > gives me the right coefficient in each row, but overwrites every
> > entry.  I guess I can keep only the first column of a, and add it to
> > d, but this seems a rather ugly and inefficient way.  How is this done
> > better?
> >
> > Question 3: repeat question 2, but keep both the intercept
> > and the slope.
> >
> >
> > thanks in advance, as always, for any advice.
> >
> > /iaw
> > 
> > Ivo Welch (ivo.we...@gmail.com)
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>

[[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] manipulating "by" lists and "ave()" functions

2011-07-08 Thread William Dunlap
Q1.  simplify2array(b) gives the transpose of what
 I think you want.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com  

> -Original Message-
> From: r-help-boun...@r-project.org 
> [mailto:r-help-boun...@r-project.org] On Behalf Of ivo welch
> Sent: Friday, July 08, 2011 3:43 PM
> To: r-help
> Subject: [R] manipulating "by" lists and "ave()" functions
> 
> dear R wizards---more ignorance on my part, exacerbated by too few
> examples in the function documentations.
> 
> > d <- data.frame( id=rep(1:3,3), x=rnorm(9), y=rnorm(9))
> 
> Question 1: how do I work with the output of "by"?  for example,
> 
> > b <- by( d, d$id, function(x) coef(lm( y ~ x, data=x ) ))
> > b
> 
> d$id: 1
> (Intercept)   x
>  0.2303  0.3618
> --
> -
> d$id: 2
> (Intercept)   x
> 0.05785-0.40617
> --
> -
> d$id: 3
> (Intercept)   x
>   0.269  -0.378
> 
> getting the categories is easy:
> 
> >  names(b)
>  [1] "1" "2" "3"
> 
> but how do I transform the non-name info in this by() data structure
> into a matrix with dimensions 3 by 2?  (presumably, there is some
> vector operator that can do this kind of magic.)
> 
> 
> Question 2:  Let's say I want to add only one of the two coefficients
> to d.  The naive approach
>   a <- ave( d, d$id, FUN=function(x) coef(lm( y ~ x, data=x ))[2] )
> gives me the right coefficient in each row, but overwrites every
> entry.  I guess I can keep only the first column of a, and add it to
> d, but this seems a rather ugly and inefficient way.  How is this done
> better?
> 
> Question 3: repeat question 2, but keep both the intercept 
> and the slope.
> 
> 
> thanks in advance, as always, for any advice.
> 
> /iaw
> 
> Ivo Welch (ivo.we...@gmail.com)
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

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


Re: [R] manipulating "by" lists and "ave()" functions

2011-07-08 Thread Joshua Wiley
Hi Ivo,

See inline.

On Fri, Jul 8, 2011 at 3:42 PM, ivo welch  wrote:
> dear R wizards---more ignorance on my part, exacerbated by too few
> examples in the function documentations.
>
>> d <- data.frame( id=rep(1:3,3), x=rnorm(9), y=rnorm(9))
>
> Question 1: how do I work with the output of "by"?  for example,
>
>> b <- by( d, d$id, function(x) coef(lm( y ~ x, data=x ) ))
>> b
>
> d$id: 1
> (Intercept)           x
>     0.2303      0.3618
> ---
> d$id: 2
> (Intercept)           x
>    0.05785    -0.40617
> ---
> d$id: 3
> (Intercept)           x
>      0.269      -0.378
>
> getting the categories is easy:
>
>>  names(b)
>  [1] "1" "2" "3"
>
> but how do I transform the non-name info in this by() data structure
> into a matrix with dimensions 3 by 2?  (presumably, there is some
> vector operator that can do this kind of magic.)

Here is one option:

a <- do.call(cbind, b)

>
>
> Question 2:  Let's say I want to add only one of the two coefficients
> to d.  The naive approach
>  a <- ave( d, d$id, FUN=function(x) coef(lm( y ~ x, data=x ))[2] )
> gives me the right coefficient in each row, but overwrites every
> entry.  I guess I can keep only the first column of a, and add it to
> d, but this seems a rather ugly and inefficient way.  How is this done
> better?

Do you actually want the coefficients duplicated for every row where
id is the same?

d$coef <- a[, as.character(d$id)]


>
> Question 3: repeat question 2, but keep both the intercept and the slope.

d <- cbind(d, t(a[, as.character(d$id)]))

though you'll get a rowname warning

HTH,

Josh

>
>
> thanks in advance, as always, for any advice.
>
> /iaw
> 
> Ivo Welch (ivo.we...@gmail.com)
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
https://joshuawiley.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] lattice: How to vertically adjust an axis label?

2011-07-08 Thread David Winsemius


On Jul 8, 2011, at 6:54 PM, Marius Hofert wrote:


Dear expeRts,

How can I vertically adjust an axis tick label so that it is nicely  
aligned with

the other labels?

library(lattice)
xyplot(0~0, xlim=c(0,3), scales=list(x=list(at=c(1,1.1),  
labels=c(expression(hat(theta)[italic(n)]),expression(theta)
## aim: move the leftmost expression up so that theta is nicely  
aligned with the second


I don't know how to make a phantom ,  so see if this is any more  
aesthetically acceptable:


xyplot(0~0, xlim=c(0,3), scales=list(x=list(at=c(1,1.1),labels=c(
  expression(atop(phantom(), hat(theta)[italic(n)])),
   expression(atop(phantom(),theta)) )
)))


theta.

Cheers,

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


David Winsemius, MD
West Hartford, CT

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


Re: [R] For column values-Quality control

2011-07-08 Thread Bansal, Vikas
So i think I am doing mistake in converting ASCII values in col V10 in my data 
frame (dfa.).can you please tell me that, is this the right way to convert 
ASCII values into decimal-

dfa$V10=lapply(dfa[,4], function(c) as.numeric(charToRaw(c)))




Thanking you,
Warm Regards
Vikas Bansal
Msc Bioinformatics
Kings College London

From: David Winsemius [dwinsem...@comcast.net]
Sent: Saturday, July 09, 2011 12:04 AM
To: Bansal, Vikas
Cc: r-help@r-project.org
Subject: Re: [R] For column values-Quality control

On Jul 8, 2011, at 6:46 PM, Bansal, Vikas wrote:

> Yes sir.you are right.after this I use this code to convert ASCII
> values in column V10 to decimal numbers-
>
> dfa$V10=lapply(dfa[,4], function(c) as.numeric(charToRaw(c)))
>
> now u will get output something like this-
>
> V7 V8
> V9   V10
>  0  1
> G82
>  0  1  CGT
> c(90, 92, 96)
>  0  1
> GA c(78, 92)
>  0  1  GAG
> c(90, 92, 92)
>  0  1
> G88
>  0  1
> A96
>  0  1  ATT
> c(90, 96, 92)
>  0  1
> T94
>  0  1
> C97
>
> now after this I am facing the problem-
>

I don't think so: Here's what I getas teh top pf dfa after that
operation:
 > str(dfa)
'data.frame':   111 obs. of  4 variables:
  $ V7 : chr  "0" "0" "0" "0" ...
  $ V8 : chr  "1" "1" "1" "1" ...
  $ V9 : chr  "G" "T" "C" "A" ...
  $ V10:List of 111
   ..$ : num 96
   ..$ : num 97
   ..$ : num 97
   ..$ : num 97
   ..$ : num 95
   ..$ : num 90
   ..$ : num 94
   ..$ : num 92
   ..$ : num 90
   ..$ : num 97
   ..$ : num 94
   ..$ : num 92
   ..$ : num 95
   ..$ : num 97
   ..$ : num 88
   ..$ : num 96
   ..$ : num 97
   ..$ : num 95
   ..$ : num 97
   ..$ : num 97
   ..$ : num 97
   ..$ : num 97
   ..$ : num 97
   ..$ : num 97
   ..$ : num 97
   ..$ : num 95
   ..$ : num 88
   ..$ : num 96
   ..$ : num  92 92
   ..$ : num  91 94
   ..$ : num  89 94
 more follows and output was terminated

I say again/// read the Posting Guide and use dump() or dput().

--
David.


> the values in column V10 corresponds to A,C,G T in column V9.I want
> only those, whose score is more than 91.so output of above should be-
>
> V7 V8
> V9   V10
>  0  1  GT
> c(90, 92, 96)
>  0  1  A
> c(78, 92)
>  0  1  AG
> c(90, 92, 92)
>  0  1
> A96
>  0  1  TT
> c(90, 96, 92)
>  0  1
> T94
>  0  1
> C97
>
> First row should be deleted because it contains 82 which is less
> than 91.In second row C should deleted because it has less than 91
> score in col V10.
>
>
> Thanking you,
> Warm Regards
> Vikas Bansal
> Msc Bioinformatics
> Kings College London
> 
> From: David Winsemius [dwinsem...@comcast.net]
> Sent: Friday, July 08, 2011 11:37 PM
> To: Bansal, Vikas
> Cc: r-help@r-project.org
> Subject: Re: [R] For column values-Quality control
>
> I get something entirely different when I execute that input command
> with the attached file:
>
> This is what I see as the first 14 lines for a displayed value for
> dfa:
>
>> dfa
> V7 V8  V9  V10
> 10  1   G`
> 20  1   Ta
> 30  1   Ca
> 40  1   Aa
> 50  1   G_
> 60  1   GZ
> 70  1   C^
> 80  1   C   \\
> 90  1   AZ
> 10   0  1   Ta
> 11   0  1   g^
> 12   0  1   A   \\
> 13   0  1   C_
> 14   0  1   Ga
>
> If this is different than what you see when you type dfa after input
> of that file in that manner then you should consider alternative
> methods of communicating an unambiguous representation of your dfa
> object as I have detailed in prior private messages.
>
> --
>
> David.
>
> On Jul 8, 2011, at 6:10 PM, Bansal, Vikas wrote:
>
>>
>> Dear all,
>>
>> I am really sorry for not giving the input file because in my mail,I
>> did not explain my problem in a best way.
>>
>> I have a file that is summary.txt(I have attached it) .we can read
>> this file using-
>>
>> dfa=read.table("summar.txt",fill=T,colClasses = "character",header=T)
>>
>> In V10 column I have  ASCII values which I converted into decimal
>> numbers using this code-
>>
>> dfa$V10=lapply(dfa[,4], function(c) as.numeric(charToRaw(c)))
>>
>> Now I have a dataframe dfa with these columns something like this-
>>
>> V7 V8
>> V9   V10
>> 0  1
>> G82
>> 0  1  CGT
>> c(

Re: [R] binary conversion list to data.frame with plyr... AND NO LOOPS!

2011-07-08 Thread jim holtman
try this:

> x <- c(36, 40, 10, 4)
> x.m <- matrix(as.integer(intToBits(x)), byrow = TRUE, ncol = 32)[, 1:20]
> x.m <- data.frame(x.m)  # convert to data.frame
> x.m
  X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20
1  0  0  1  0  0  1  0  0  0   0   0   0   0   0   0   0   0   0   0   0
2  0  0  0  1  0  1  0  0  0   0   0   0   0   0   0   0   0   0   0   0
3  0  1  0  1  0  0  0  0  0   0   0   0   0   0   0   0   0   0   0   0
4  0  0  1  0  0  0  0  0  0   0   0   0   0   0   0   0   0   0   0   0
>


On Fri, Jul 8, 2011 at 6:39 PM, Justin Haynes  wrote:
> Happy weekend helpeRs!
>
> As usual, I'm stumped by R...
>
> My plan was to take an integer number, convert it to binary and wind
> up with a data.frame where each column is either 1 or 0 so I can see
> which bits are changing:
>
> bb<-function(i) ifelse(i, paste(bb(i %/% 2), i %% 2, sep=""), "")
> my.dat<-c(36,40,10,4)
> my.binary.dat<-bb(my.dat)
> my.list<-strsplit(my.binary.dat,'')
>
> max.len<-max(ldply(my.list,length))
> len<-length(my.list)
> my.df<-data.frame(two=rep(0,len),four=rep(0,len),eight=rep(0,len),sixteen=rep(0,len),thirtytwo=rep(0,len),sixtyfour=rep(0,len))
> for(i in 1:length(my.list)){
>        for(j in 1:length(my.list[[i]])){
>                my.df[i,max.len-length(my.list[[i]])+j]<-my.list[[i]][j]
>        }
> }
>
> But this isn't exactly feasable on a million+ rows where some binary
> numbers are 20 digits...  I know theres a way without loops I just
> know it!
>
> Ideally, I can do this to multiple columns of a data.frame and have
> them named accordingly (V1.two,V1.four... V2.two,V2.four, etc.)
>
>
> Thanks,
>
> Justin
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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
Data Munger Guru

What is the problem that you are trying to solve?

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


Re: [R] For column values-Quality control

2011-07-08 Thread David Winsemius


On Jul 8, 2011, at 6:46 PM, Bansal, Vikas wrote:

Yes sir.you are right.after this I use this code to convert ASCII  
values in column V10 to decimal numbers-


dfa$V10=lapply(dfa[,4], function(c) as.numeric(charToRaw(c)))

now u will get output something like this-

V7 V8  
V9   V10
 0  1   
G82
 0  1  CGT  
c(90, 92, 96)
 0  1   
GA c(78, 92)
 0  1  GAG  
c(90, 92, 92)
 0  1   
G88
 0  1   
A96
 0  1  ATT  
c(90, 96, 92)
 0  1   
T94
 0  1   
C97


now after this I am facing the problem-



I don't think so: Here's what I getas teh top pf dfa after that  
operation:

> str(dfa)
'data.frame':   111 obs. of  4 variables:
 $ V7 : chr  "0" "0" "0" "0" ...
 $ V8 : chr  "1" "1" "1" "1" ...
 $ V9 : chr  "G" "T" "C" "A" ...
 $ V10:List of 111
  ..$ : num 96
  ..$ : num 97
  ..$ : num 97
  ..$ : num 97
  ..$ : num 95
  ..$ : num 90
  ..$ : num 94
  ..$ : num 92
  ..$ : num 90
  ..$ : num 97
  ..$ : num 94
  ..$ : num 92
  ..$ : num 95
  ..$ : num 97
  ..$ : num 88
  ..$ : num 96
  ..$ : num 97
  ..$ : num 95
  ..$ : num 97
  ..$ : num 97
  ..$ : num 97
  ..$ : num 97
  ..$ : num 97
  ..$ : num 97
  ..$ : num 97
  ..$ : num 95
  ..$ : num 88
  ..$ : num 96
  ..$ : num  92 92
  ..$ : num  91 94
  ..$ : num  89 94
 more follows and output was terminated

I say again/// read the Posting Guide and use dump() or dput().

--
David.


the values in column V10 corresponds to A,C,G T in column V9.I want  
only those, whose score is more than 91.so output of above should be-


V7 V8  
V9   V10
 0  1  GT  
c(90, 92, 96)
 0  1  A  
c(78, 92)
 0  1  AG  
c(90, 92, 92)
 0  1   
A96
 0  1  TT  
c(90, 96, 92)
 0  1   
T94
 0  1   
C97


First row should be deleted because it contains 82 which is less  
than 91.In second row C should deleted because it has less than 91  
score in col V10.



Thanking you,
Warm Regards
Vikas Bansal
Msc Bioinformatics
Kings College London

From: David Winsemius [dwinsem...@comcast.net]
Sent: Friday, July 08, 2011 11:37 PM
To: Bansal, Vikas
Cc: r-help@r-project.org
Subject: Re: [R] For column values-Quality control

I get something entirely different when I execute that input command
with the attached file:

This is what I see as the first 14 lines for a displayed value for  
dfa:



dfa

V7 V8  V9  V10
10  1   G`
20  1   Ta
30  1   Ca
40  1   Aa
50  1   G_
60  1   GZ
70  1   C^
80  1   C   \\
90  1   AZ
10   0  1   Ta
11   0  1   g^
12   0  1   A   \\
13   0  1   C_
14   0  1   Ga

If this is different than what you see when you type dfa after input
of that file in that manner then you should consider alternative
methods of communicating an unambiguous representation of your dfa
object as I have detailed in prior private messages.

--

David.

On Jul 8, 2011, at 6:10 PM, Bansal, Vikas wrote:



Dear all,

I am really sorry for not giving the input file because in my mail,I
did not explain my problem in a best way.

I have a file that is summary.txt(I have attached it) .we can read
this file using-

dfa=read.table("summar.txt",fill=T,colClasses = "character",header=T)

In V10 column I have  ASCII values which I converted into decimal
numbers using this code-

dfa$V10=lapply(dfa[,4], function(c) as.numeric(charToRaw(c)))

Now I have a dataframe dfa with these columns something like this-

V7 V8
V9   V10
0  1
G82
0  1  CGT
c(90, 92, 96)
0  1
GA c(78, 92)
0  1  GAG
c(90, 92, 92)
0  1
G88
0  1
A96
0  1  ATT
c(90, 96, 92)
0  1
T  

[R] lattice: How to vertically adjust an axis label?

2011-07-08 Thread Marius Hofert
Dear expeRts,

How can I vertically adjust an axis tick label so that it is nicely aligned with
the other labels?

library(lattice)
xyplot(0~0, xlim=c(0,3), scales=list(x=list(at=c(1,1.1), 
labels=c(expression(hat(theta)[italic(n)]),expression(theta)
## aim: move the leftmost expression up so that theta is nicely aligned with 
the second theta.

Cheers,

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


Re: [R] For column values-Quality control

2011-07-08 Thread Bansal, Vikas
Yes sir.you are right.after this I use this code to convert ASCII values in 
column V10 to decimal numbers-

dfa$V10=lapply(dfa[,4], function(c) as.numeric(charToRaw(c)))

now u will get output something like this-

V7 V8 V9   V10
  0  1  G82
  0  1  CGT c(90, 92, 
96)
  0  1  GA c(78, 92)
  0  1  GAG c(90, 92, 
92)
  0  1  G88
  0  1  A96
  0  1  ATT c(90, 96, 
92)
  0  1  T94
  0  1  C97

now after this I am facing the problem-

the values in column V10 corresponds to A,C,G T in column V9.I want only those, 
whose score is more than 91.so output of above should be-

V7 V8 V9   V10
  0  1  GT c(90, 92, 96)
  0  1  A c(78, 92)
  0  1  AG c(90, 92, 92)
  0  1  A96
  0  1  TT c(90, 96, 92)
  0  1  T94
  0  1  C97

First row should be deleted because it contains 82 which is less than 91.In 
second row C should deleted because it has less than 91 score in col V10.


Thanking you,
Warm Regards
Vikas Bansal
Msc Bioinformatics
Kings College London

From: David Winsemius [dwinsem...@comcast.net]
Sent: Friday, July 08, 2011 11:37 PM
To: Bansal, Vikas
Cc: r-help@r-project.org
Subject: Re: [R] For column values-Quality control

I get something entirely different when I execute that input command
with the attached file:

This is what I see as the first 14 lines for a displayed value for dfa:

 > dfa
 V7 V8  V9  V10
10  1   G`
20  1   Ta
30  1   Ca
40  1   Aa
50  1   G_
60  1   GZ
70  1   C^
80  1   C   \\
90  1   AZ
10   0  1   Ta
11   0  1   g^
12   0  1   A   \\
13   0  1   C_
14   0  1   Ga

If this is different than what you see when you type dfa after input
of that file in that manner then you should consider alternative
methods of communicating an unambiguous representation of your dfa
object as I have detailed in prior private messages.

--

David.

On Jul 8, 2011, at 6:10 PM, Bansal, Vikas wrote:

>
> Dear all,
>
> I am really sorry for not giving the input file because in my mail,I
> did not explain my problem in a best way.
>
> I have a file that is summary.txt(I have attached it) .we can read
> this file using-
>
> dfa=read.table("summar.txt",fill=T,colClasses = "character",header=T)
>
> In V10 column I have  ASCII values which I converted into decimal
> numbers using this code-
>
> dfa$V10=lapply(dfa[,4], function(c) as.numeric(charToRaw(c)))
>
> Now I have a dataframe dfa with these columns something like this-
>
> V7 V8
> V9   V10
>  0  1
> G82
>  0  1  CGT
> c(90, 92, 96)
>  0  1
> GA c(78, 92)
>  0  1  GAG
> c(90, 92, 92)
>  0  1
> G88
>  0  1
> A96
>  0  1  ATT
> c(90, 96, 92)
>  0  1
> T94
>  0  1
> C97
>
> the values in column V10 corresponds to A,C,G T in column V9.I want
> only those whose score is more than 91.so output of above should be-
>
> V7 V8
> V9   V10
>  0  1  GT
> c(90, 92, 96)
>  0  1  A
> c(78, 92)
>  0  1  AG
> c(90, 92, 92)
>  0  1
> A96
>  0  1  TT
> c(90, 96, 92)
>  0  1
> T94
>  0  1
> C97
>
> Can you please tell me the solution.
>
> Thanking you,
> Warm Regards
> Vikas Bansal
> Msc Bioinformatics
> Kings College
> London__
> 

[R] manipulating "by" lists and "ave()" functions

2011-07-08 Thread ivo welch
dear R wizards---more ignorance on my part, exacerbated by too few
examples in the function documentations.

> d <- data.frame( id=rep(1:3,3), x=rnorm(9), y=rnorm(9))

Question 1: how do I work with the output of "by"?  for example,

> b <- by( d, d$id, function(x) coef(lm( y ~ x, data=x ) ))
> b

d$id: 1
(Intercept)   x
 0.2303  0.3618
---
d$id: 2
(Intercept)   x
0.05785-0.40617
---
d$id: 3
(Intercept)   x
  0.269  -0.378

getting the categories is easy:

>  names(b)
 [1] "1" "2" "3"

but how do I transform the non-name info in this by() data structure
into a matrix with dimensions 3 by 2?  (presumably, there is some
vector operator that can do this kind of magic.)


Question 2:  Let's say I want to add only one of the two coefficients
to d.  The naive approach
  a <- ave( d, d$id, FUN=function(x) coef(lm( y ~ x, data=x ))[2] )
gives me the right coefficient in each row, but overwrites every
entry.  I guess I can keep only the first column of a, and add it to
d, but this seems a rather ugly and inefficient way.  How is this done
better?

Question 3: repeat question 2, but keep both the intercept and the slope.


thanks in advance, as always, for any advice.

/iaw

Ivo Welch (ivo.we...@gmail.com)

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


[R] binary conversion list to data.frame with plyr... AND NO LOOPS!

2011-07-08 Thread Justin Haynes
Happy weekend helpeRs!

As usual, I'm stumped by R...

My plan was to take an integer number, convert it to binary and wind
up with a data.frame where each column is either 1 or 0 so I can see
which bits are changing:

bb<-function(i) ifelse(i, paste(bb(i %/% 2), i %% 2, sep=""), "")
my.dat<-c(36,40,10,4)
my.binary.dat<-bb(my.dat)
my.list<-strsplit(my.binary.dat,'')

max.len<-max(ldply(my.list,length))
len<-length(my.list)
my.df<-data.frame(two=rep(0,len),four=rep(0,len),eight=rep(0,len),sixteen=rep(0,len),thirtytwo=rep(0,len),sixtyfour=rep(0,len))
for(i in 1:length(my.list)){
for(j in 1:length(my.list[[i]])){
my.df[i,max.len-length(my.list[[i]])+j]<-my.list[[i]][j]
}
}

But this isn't exactly feasable on a million+ rows where some binary
numbers are 20 digits...  I know theres a way without loops I just
know it!

Ideally, I can do this to multiple columns of a data.frame and have
them named accordingly (V1.two,V1.four... V2.two,V2.four, etc.)


Thanks,

Justin

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


Re: [R] For column values-Quality control

2011-07-08 Thread David Winsemius
I get something entirely different when I execute that input command  
with the attached file:


This is what I see as the first 14 lines for a displayed value for dfa:

> dfa
V7 V8  V9  V10
10  1   G`
20  1   Ta
30  1   Ca
40  1   Aa
50  1   G_
60  1   GZ
70  1   C^
80  1   C   \\
90  1   AZ
10   0  1   Ta
11   0  1   g^
12   0  1   A   \\
13   0  1   C_
14   0  1   Ga

If this is different than what you see when you type dfa after input  
of that file in that manner then you should consider alternative  
methods of communicating an unambiguous representation of your dfa  
object as I have detailed in prior private messages.


--

David.

On Jul 8, 2011, at 6:10 PM, Bansal, Vikas wrote:



Dear all,

I am really sorry for not giving the input file because in my mail,I  
did not explain my problem in a best way.


I have a file that is summary.txt(I have attached it) .we can read  
this file using-


dfa=read.table("summar.txt",fill=T,colClasses = "character",header=T)

In V10 column I have  ASCII values which I converted into decimal  
numbers using this code-


dfa$V10=lapply(dfa[,4], function(c) as.numeric(charToRaw(c)))

Now I have a dataframe dfa with these columns something like this-

V7 V8  
V9   V10
 0  1   
G82
 0  1  CGT  
c(90, 92, 96)
 0  1   
GA c(78, 92)
 0  1  GAG  
c(90, 92, 92)
 0  1   
G88
 0  1   
A96
 0  1  ATT  
c(90, 96, 92)
 0  1   
T94
 0  1   
C97


the values in column V10 corresponds to A,C,G T in column V9.I want  
only those whose score is more than 91.so output of above should be-


V7 V8  
V9   V10
 0  1  GT  
c(90, 92, 96)
 0  1  A  
c(78, 92)
 0  1  AG  
c(90, 92, 92)
 0  1   
A96
 0  1  TT  
c(90, 96, 92)
 0  1   
T94
 0  1   
C97


Can you please tell me the solution.

Thanking you,
Warm Regards
Vikas Bansal
Msc Bioinformatics
Kings College  
London__

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


David Winsemius, MD
West Hartford, CT

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


Re: [R] Packages for quasi-symmetry and quasi-independence

2011-07-08 Thread Michael Friendly

On 7/7/2011 9:14 PM, michael.laviole...@dhhs.state.nh.us wrote:

Are there any packages with functions that can fit quasi-symmetry and
quasi-indepedence models to square contingency tables?

M. Laviolette



Yes.
See the gnm package for convenience functions that work with
glm() and gnm().
See the vcdExtra package for examples and vignettes

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

2011-07-08 Thread jorge alonso Carné/adiskide
Hello,
Sorry if it's a simple question, this is my first script complex, but can
not find solution in the list

 I have many TXT files with daily data of meteorological stations and a
table that connects it with each of these stations. (More than one table per
station and date).

With the Script attempt:

 º1 Fit the data and create a regular series from  01.01.2000 to 12.31.2010
data for all tables by creating rows with null values ​​when is necessary to
facilitate further calculations

2 º From my table that relating data and stations obtaining the mean of the
results for each station.


The problem happens to me in the first step.

To optimize the script,

1, check year by year if I have 365 days. (If it´s true Is OK)

2 If not, check month after month.

3 ° For each time check if the number of existing data matches the number of
days in the month.

4 ° For cases that do not, add new rows to the table with these dates and null
value.

Well, the fact is that R skips the rule and not know that I am wrong. Can
you help?

Copy the script piece of Interest:

daysanyo<-c(31,28,31,30,31,30,31,31,30,31,30,31)
daysanyoBIS<-c(31,29,31,30,31,30,31,31,30,31,30,31)

addfilas<-function(table){
table$year=substr(table[[3]],1,4)
table$mes=substr(table[[3]],5,6)
table$day=substr(table[[3]],7,8)
table=subset(table,table$V3>="2101" & table$V3<="20101231")
table$year<-as.numeric(table$year)
table$mes<-as.numeric(table$mes)
table$day<-as.numeric(table$day)


for (anyo in 2000:2010){
table2=subset(table,table$year==anyo)
ndias=length(table2$year)
 if(ndias<365){
  for (ms in 1:12){
   table2=subset(table2,table2$mes==ms)
ndays=length(table2$year)
  a<-(anyo==2000 | anyo==2004 | anyo==2008) &
(ndays__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] For column values-Quality control

2011-07-08 Thread Bansal, Vikas

Dear all,

I am really sorry for not giving the input file because in my mail,I did not 
explain my problem in a best way.

I have a file that is summary.txt(I have attached it) .we can read this file 
using-

dfa=read.table("summar.txt",fill=T,colClasses = "character",header=T)

 In V10 column I have  ASCII values which I converted into decimal numbers 
using this code-

dfa$V10=lapply(dfa[,4], function(c) as.numeric(charToRaw(c)))

Now I have a dataframe dfa with these columns something like this-

V7 V8 V9   V10
  0  1  G82
  0  1  CGT c(90, 92, 
96)
  0  1  GA c(78, 92)
  0  1  GAG c(90, 92, 
92)
  0  1  G88
  0  1  A96
  0  1  ATT c(90, 96, 
92)
  0  1  T94
  0  1  C97

the values in column V10 corresponds to A,C,G T in column V9.I want only those 
whose score is more than 91.so output of above should be-

V7 V8 V9   V10
  0  1  GT c(90, 92, 96)
  0  1  A c(78, 92)
  0  1  AG c(90, 92, 92)
  0  1  A96
  0  1  TT c(90, 96, 92)
  0  1  T94
  0  1  C97

Can you please tell me the solution.

Thanking you,
Warm Regards
Vikas Bansal
Msc Bioinformatics
Kings College London V7 V8  V9  V10
  0  1   G`
  0  1   Ta
  0  1   Ca
  0  1   Aa
  0  1   G_
  0  1   GZ
  0  1   C^
  0  1   C\
  0  1   AZ
  0  1   Ta
  0  1   g^
  0  1   A\
  0  1   C_
  0  1   Ga
  0  1   CX
  0  1   C`
  0  1   Ga
  0  1   G_
  0  1   Ga
  0  1   Ga
  0  1   Aa
  0  1   Ga
  0  1   Ga
  0  1   Ca
  0  1   Aa
  0  1   C_
  0  1   AX
  0  1   g`
  0  2  GG   \\
  0  2  GG   [^
  0  2  AA   Y^
  0  2  GG   `]
  0  2  AA   a^
  0  2  GG   ]^
  0  2  AA  a\
  0  2  GG   a]
  0  2  GG   Z]
  0  2  GG   ]^
  0  2  CC  W\
  0  2  CC   a]
  0  2  TT   ``
  0  2  GG  a\
  0  2  GG   ``
  0  2  aa   aa
  0  2  AA   a^
  0  2  CC   b`
  0  2  AA  _\
  0  2  CC   ]`
  0  2  TT  ^\
  0  2  CC   Z`
  0  2  Ac   `a
  0  3 AAA  b`a
  0  3 GGG  aa]
  0  3 AAA  `[_
  0  3 CCC  a`_
  0  3 TTT  _]^
  0  3 CCC  aaa
  0  3 CCC  ^a`
  0  3 CCC  _``
  0  3 AAA  Z`]
  0  3 CCC  \a]
  0  2  GG   `_
  0  2  GG   `Y
  0  2  AA   a]
  0  1   GZ
  0  1   G_
  0  1   T^
  0  1   T^
  0  1   CY
  0  1   A\
  0  1   G]
  0  1   T[
  0  1   T^
  0  1   C[
  0  1   C\
  0  1   A^
  0  1   C^
  0  1   A^
  0  1   CY
  0  1   T^
  0  1   CY
  0  1   C\
  0  1   CQ
  0  1   CX
  0  1   T^
  0  1   CZ
  0  1   CX
  0  1   ca
  0  1   aa
  0  1   ca
  0  1   c^
  0  1   ta
  0  1   t_
  0  1   ca
  0  1   Aa
  0  1   ga
  0  1   aa
  0  1   ca
  0  1   Aa
  0  1   Ga
  0  1   Ca
  0  1   Aa
  0  1   Ca
  0  1   C_
  0  1   Ca
  0  1   T`
  0  1   C`
  0  1   Ca
  0  1   C^
  0  1   C`
  0  1   G_
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] For column values-Quality control

2011-07-08 Thread Bansal, Vikas
Dear all,

I am really sorry for not giving the input file because in my mail,I did not 
explain my problem in a best way.

I have a file that is summary.txt(I have attached it) .we can read this file 
using-

dfa=read.table("summar.txt",fill=T,colClasses = "character",header=T)

 In V10 column I have  ASCII values which I converted into decimal numbers 
using this code-

dfa$V10=lapply(dfa[,4], function(c) as.numeric(charToRaw(c)))

Now I have a dataframe dfa with these columns something like this-

V7 V8 V9   V10
  0  1  G82
  0  1  CGT c(90, 92, 
96)
  0  1  GA c(78, 92)
  0  1  GAG c(90, 92, 
92)
  0  1  G88
  0  1  A96
  0  1  ATT c(90, 96, 
92)
  0  1  T94
  0  1  C97

the values in column V10 corresponds to A,C,G T in column V9.I want only those 
whose score is more than 91.so output of above should be-

V7 V8 V9   V10
  0  1  GT c(90, 92, 96)
  0  1  A c(78, 92)
  0  1  AG c(90, 92, 92)
  0  1  A96
  0  1  TT c(90, 96, 92)
  0  1  T94
  0  1  C97

Can you please tell me the solution.




Thanking you,
Warm Regards
Vikas Bansal
Msc Bioinformatics
Kings College London

From: Bansal, Vikas
Sent: Friday, July 08, 2011 9:15 PM
To: r-help@r-project.org; dwinsem...@comcast.net
Subject: For column values-Quality control

Dear sir,

I am struggling with a problem.Please help me.
Now I have a dataframe with these columns-

V7 V8 V9   V10
  0  1  G82
  0  1  CGT c(90, 92, 
96)
  0  1  GA c(78, 92)
  0  1  GAG c(90, 92, 
92)
  0  1  G88
  0  1  A96
  0  1  ATT c(90, 96, 
92)
  0  1  T94
  0  1  C97

the values in column V10 corresponds to A,C,G T in column V9.I want only those 
whose score is more than 91.so output of above should be-

V7 V8 V9   V10
  0  1  GT c(90, 92, 96)
  0  1  A c(78, 92)
  0  1  AG c(90, 92, 92)
  0  1  A96
  0  1  TT c(90, 96, 92)
  0  1  T94
  0  1  C97

Can you please tell me the solution.





Thanking you,
Warm Regards
Vikas Bansal
Msc Bioinformatics
Kings College London

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


Re: [R] Simple R graph question

2011-07-08 Thread Duncan Mackay

At 07:12 09/07/2011, you wrote:

Dear jholtman,

Thanks for the reply & sorry for the been unclear before.

My desire graph is to have multiply plots showing Y1,Y2,Y3 with the same X,
were each plot is month-year (e.g., 5-2001, 6-2001, etc). It ill be great if
each Y can have a different line and point style.

The Lattice graphic
(http://addictedtor.free.fr/graphiques/graphcode.php?graph=48) looks similar
to what I want but the script looks complex for me.

Thanks in advance.


--
View this message in context: 
http://r.789695.n4.nabble.com/Simple-R-graph-question-tp3653493p3655142.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.


Hi ashz

Try the following simplification which incorporates the par.settings 
into xyplot


xyplot(height ~ dist | geology, data = tmp,
   groups = species,
   layout = c(2,2),
   auto.key = list(columns = 2, lines = TRUE),
   par.settings = list(superpose.symbol = list(pch = 1:6, cex = 1.2),
   superpose.line = list(col = "grey", lty = 1)),
   panel = function(x, y, type, ...) {
 panel.superpose(x, y, type="l", ...)
 panel.superpose(x, y, type="p",...)
   },
)

which can be further simplified to :
xyplot(height ~ dist | geology, data = tmp,
   groups = species,
   layout = c(2,2),
   auto.key = list(columns = 2, lines = TRUE),
   par.settings = list(superpose.symbol = list(pch = 1:6, cex = 1.2),
   superpose.line = list(col = "grey", lty = 1)),
   panel = function(x, y, type, ...) {
 panel.superpose(x, y, type="b", ...)
   },
)

or an alternative

xyplot(height ~ dist | geology, data = tmp,
   groups = species,
   layout = c(2,2),
   auto.key = list(columns = 2, lines = TRUE),
   par.settings = list(superpose.symbol = list(pch = 1:6, cex = 1.2),
   superpose.line = list(col = "grey", lty = 1)),
   panel = function(x, y, type, ...) {
 panel.superpose(x, y, type="o", ...)
   },
)

study
?xyplot

Regards

Duncan Mackay

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
ARMIDALE NSW 2351
Email: home mac...@northnet.com.au

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] computing functions with Euler's number (e^n)

2011-07-08 Thread William Armstrong
I am trying to create a set of wavelets in frequency space--namely Cauchy
wavelets for an intensity analysis (von Tscharner, 2000).  The wavelets are
defined by the following formula:

[(f/cf)^(cf*scale)]*[e^((-f/cf)+1)^(cf*scale)]

where *f *is frequency of length *n*, *cf* is center frequency (defined
below) and is an array of *j *columns and *n* row, and scale is a constant.

cf = (1/scale)*(j + q)^r
where *j *is the number of center frequencies (i.e., columns), and *q* and *
r* are constants.

When I get to Q, the output returns numbers only up to cf.  Beyond cf, Q and
subsequently W return "NA." I understand this is because when fq >/=  cf  U
becomes zero^B[j] or a negative^B[j].  From here, Q should equal 1/exp(U) to
compute W.  I know that I need to create a loop here, but as a newbie to R,
I don't know how to write the correct loop that will work for me.  Any
suggestions??



Here is the code I have been using (less the numerous if...else attempts):



> J <- 12

> r_ <- 1.959

> q_ <- 1.45

> scale_ <- 0.3

> N <- 500

> fq <- seq(0, N, 1)

> center_frequencies <- function(J = 12, r_ = 1.959, q_ = 1.45, scale_ =
0.3){

+ j <- seq(0,J-1,1)

+ fc <- (q_ + j)^r_/scale_

+ }

> fc <- center_frequencies(12,r_,q_,scale_)

> cf <- t(fc)

> lambda <- function(cf, J = 12, scale_ = 0.3){

+ B <- cf*scale_

+ }

> B <- lambda(cf, 12, 0.3)

> dummy <- fq/cf[1]

> Z <- dummy**B[1] # Note here I tried using '^' to raise dummy to the power
B[j], but it didn't work.  I tried '**' which serves the same purpose in
LabVIEW, and it worked.  There is no references to this in any of the R
documentation that I have read.  Should '^' work here???

> U <- (-dummy+1)**B[1]

> Q <- exp(U)

> Q <- ifelse(Q>30,30,Q)  # Not sure why I use this.

> W <- Z*Q


-- 
*W. Jeffrey Armstrong, Ph.D.
*Assistant Professor
Exercise Science

*Managing Editor
Clinical Kinesiology*
Official Journal of the American Kinesiotherapy Association

[[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] RES: For column values-Quality control

2011-07-08 Thread Filipe Leme Botelho
--- Begin Message ---
Hi Vikas. Apply the logic in the example below in your dataframe

> dta
  V1 V1
1 85 32
2 80 33
3 77 11
4 75 56
5 96 43
6 99 12
7 94 32
8 97 44

> dta[,1]>€
[1]  TRUE  TRUE FALSE FALSE  TRUE  TRUE  TRUE  TRUE

> which(dta[,1]>€)
[1] 1 2 5 6 7 8

> ref <- which(dta[,1]>€)

> dta[ref,]
  V1 V1
1 85 32
2 80 33
5 96 43
6 99 12
7 94 32
8 97 44

Tip: pay more attention to what is stored in the R-Help archive and keep
a hardcopy of the Ref-card close to you. A colleague even posted the
newest version today.

http://rpad.googlecode.com/svn/Rpad_homepage/R-refcard.pdf

Cheers,
Filipe

Filipe Botelho
Analista de Riscos
Tesouraria Corporativa
www.votorantim.com.br
fone 55 (11) 3704-3576
fax 55 (11) 3167-1550


-Mensagem original-
De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
Em nome de Bansal, Vikas
Enviada em: sexta-feira, 8 de julho de 2011 17:16
Para: r-help@r-project.org; dwinsem...@comcast.net
Assunto: [R] For column values-Quality control

Dear sir,

I am struggling with a problem.Please help me.
Now I have a dataframe with these columns-

V7 V8 V9
V10
  0  1  G
82
  0  1  CGT
c(90, 92, 96)
  0  1  GA
c(78, 92)
  0  1  GAG
c(90, 92, 92)
  0  1  G
88
  0  1  A
96
  0  1  ATT
c(90, 96, 92)
  0  1  T
94
  0  1  C
97

the values in column V10 corresponds to A,C,G T in column V9.I want only
those whose score is more than 91.so output of above should be-

V7 V8 V9
V10
  0  1  GT c(90,
92, 96)
  0  1  A
c(78, 92)
  0  1  AG c(90,
92, 92)
  0  1  A
96
  0  1  TT c(90,
96, 92)
  0  1  T
94
  0  1  C
97

Can you please tell me the solution.





Thanking you,
Warm Regards
Vikas Bansal
Msc Bioinformatics
Kings College London
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 ---
"This message and its attachments may contain confidential and/or privileged 
information. If you are not the addressee, please, advise the sender 
immediately by replying to the e-mail and delete this message."

"Este mensaje y sus anexos pueden contener información confidencial o 
privilegiada. Si ha recibido este e-mail por error por favor bórrelo y envíe un 
mensaje al remitente."

"Esta mensagem e seus anexos podem conter informação confidencial ou 
privilegiada. Caso não seja o destinatário, solicitamos a imediata notificação 
ao remetente e exclusão da mensagem."__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Simple R graph question

2011-07-08 Thread ashz
Dear jholtman,

Thanks for the reply & sorry for the been unclear before. 

My desire graph is to have multiply plots showing Y1,Y2,Y3 with the same X, 
were each plot is month-year (e.g., 5-2001, 6-2001, etc). It ill be great if
each Y can have a different line and point style.
 
The Lattice graphic
(http://addictedtor.free.fr/graphiques/graphcode.php?graph=48) looks similar
to what I want but the script looks complex for me.

Thanks in advance.


--
View this message in context: 
http://r.789695.n4.nabble.com/Simple-R-graph-question-tp3653493p3655142.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] Referencing a vector of data labels in ggplot function

2011-07-08 Thread Ben Hunter
Hi,

I really feel I've looked everywhere, although I know this can't be a hard
problem. I'd like to be able to call the graph below as a function, but I
can't get the function to recognize variables beyond 'dframe'. I've read
through many papers on writing functions in R, but I can't get this to work.

data <- data.frame('date' = as.Date(rep(c(15101,
15108, 15115, 15122, 15129, 15136, 15143, 15150),4),
origin = '1899-12-30'),
'factor' = factor(rep(c('first','second'), each = 8, 2)),
'value' = rep(c(429258, 430645, 431165, 431360, 452284, 467316,
467326, 467330,
375588, 411383, 427179, 364582, 351494, 359034, 374047,
339628),2),
'Facet' = rep(c('bottom','top'), each = 16))

pTitle <- 'Main Title'
plines <- c('Line 1', 'Line 2','Line 3', 'Line 4')
col1 <- c('#ec421e', '#f7bd2e','#ec421e', '#f7bd2e')

#If I use the line below and explicitly place plines, pTitle and col1 in the
appropriate places
#it will work fine. I want to use the line as written without the hashmark.
#simple <- function(dframe){

withNames <- function(dframe, lineNames, plotName, colors){
p <- ggplot(dframe, aes(date, value, group = factor, color = factor))
p2 <- p + geom_line(size = 1)
#   + opts(title = plotName)
p2 <- p2 + facet_grid(Facet~., scales = 'free') +
#p2 <- p2 + geom_text(data = dframe[dframe[,'date'] == '1941-06-16',],
#  aes(date, value, label = lineNames, vjust = 1)) +
  scale_colour_manual(values = colors)
}

finalP <- withNames(data, plines, pTitle, col1)

#finalP <- simple(data)

[[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] For column values-Quality control

2011-07-08 Thread Bansal, Vikas
Dear sir,

I am struggling with a problem.Please help me.
Now I have a dataframe with these columns-

V7 V8 V9   V10
  0  1  G82
  0  1  CGT c(90, 92, 
96)
  0  1  GA c(78, 92)
  0  1  GAG c(90, 92, 
92)
  0  1  G88
  0  1  A96
  0  1  ATT c(90, 96, 
92)
  0  1  T94
  0  1  C97

the values in column V10 corresponds to A,C,G T in column V9.I want only those 
whose score is more than 91.so output of above should be-

V7 V8 V9   V10
  0  1  GT c(90, 92, 96)
  0  1  A c(78, 92)
  0  1  AG c(90, 92, 92)
  0  1  A96
  0  1  TT c(90, 96, 92)
  0  1  T94
  0  1  C97

Can you please tell me the solution.





Thanking you,
Warm Regards
Vikas Bansal
Msc Bioinformatics
Kings College London
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Selecting subset of a given vector

2011-07-08 Thread Dennis Murphy
Hi:

Do you want the N points in the vector closest to a fixed point? If
so, then try this:

f <- function(vec, center, nselect) {
d <- (vec - center)^2
vec[order(d)][1:nselect]
  }

v <- rnorm(1000)
f(v, 0, 10)# select the ten points in v closest to zero

Your goal is subject to multiple interpretations, so if this is not
what you require, perhaps you should sharpen your question.

HTH,
Dennis

On Fri, Jul 8, 2011 at 12:16 PM, Nipesh Bajaj  wrote:
> Hi there, given a numeric vector, I can select numbers within a
> specific range. However presently, I have something related but
> different problem. Suppose I have a numeric vector. Now take an
> arbitrary number. Goal to to chose a specific subset with a given
> length, from that given vector, so that those chosen numbers are
> centered around that given constant.
>
> Here is one example:
>
> ### My original vector
> Vec <- rnorm(1000)
>
> ### Now chose some arbitrary number
> Number <- 0
>
> ### Chose the length of the resulting vector
> New.Len <- 10
>
> Now I have to chose 10 numbers from 'Vec' around 'Number'. If my 'Vec'
> contains one or more zero then those zero(s) also be selected.
>
>
> Can somebody help me with some pointer how can I achieve that?
>
> Thanks,
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] How to label specific points on a scatterplot

2011-07-08 Thread David Winsemius


On Jul 8, 2011, at 2:53 PM, rstudent wrote:

I have only been using R for a very short time and I'm trying to  
learn.


What information do you need to help me?


As it says at the bottom of every message to Rhelp:

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



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-label-specific-points-on-a-scatterplot-tp3654697p3654903.html
Sent from the R help mailing list archive at Nabble.com.

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


David Winsemius, MD
West Hartford, CT

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


Re: [R] How to label specific points on a scatterplot

2011-07-08 Thread VictorDelgado
rstudent,

one solution could be given by spliting your graph in two parts:

part_1 <- # take the desired four points subset #
part_2 <- # all rest points not to label

You will also need one vector with your names. I supose:

list <- c("B13", "G13", "K14", "N14")

So

plot(part_1$x, part_1$y)
text(part_1$x, part_1$y+.1, list)
points(part_2$x, part_2$y)

Maybe you will have to set the limits (xlim and ylim) of your graph and
chage .1 to a more precise value.
Please, take care and ensure carefully reading of command internal help
(typing ?text, for example), the R's help-pages are very clear and didactic. 

Be sure also, searching for previous questions already made in "r-help",
preventing double questions on basic isues, and be more specific possible
about your problem. If your data is from base, I could give you one better
answer.

Take care, Have a god job!

Victor Delgado
cedeplar.ufmg.br P.H.D. student
www.fjp.mg.gov.br reseacher

--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-label-specific-points-on-a-scatterplot-tp3654697p3654978.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] How to label specific points on a scatterplot

2011-07-08 Thread rstudent
I have only been using R for a very short time and I'm trying to learn.

What information do you need to help me?

--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-label-specific-points-on-a-scatterplot-tp3654697p3654903.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] Selecting subset of a given vector

2011-07-08 Thread David Winsemius


On Jul 8, 2011, at 3:16 PM, Nipesh Bajaj wrote:


Hi there, given a numeric vector, I can select numbers within a
specific range. However presently, I have something related but
different problem. Suppose I have a numeric vector. Now take an
arbitrary number. Goal to to chose a specific subset with a given
length, from that given vector, so that those chosen numbers are
centered around that given constant.

Here is one example:

### My original vector
Vec <- rnorm(1000)

### Now chose some arbitrary number
Number <- 0

### Chose the length of the resulting vector
New.Len <- 10

Now I have to chose 10 numbers from 'Vec' around 'Number'. If my 'Vec'
contains one or more zero then those zero(s) also be selected.


An odd number of values would be easier to "center" around the closest  
to zero value. Here is a reduced example that picks out the 7 values  
(3 on either side of the closest to zero whose order statistic is  
closest to the value closest to zero:


> x <- rnorm(20) # Sorry, forgot to set.seed()
> ?which min
> sort(x)[which.min(abs(sort(x))]
# closest to zero is the 9th value in sort(x)
> sort(x)[(which.min(abs(sort(x)))-3):(which.min(abs(sort(x)))+3)]
[1] -0.15579551 -0.05612874 -0.04493361 -0.01619026  0.07456498   
0.38984324

[7]  0.41794156

--

David Winsemius, MD
West Hartford, CT

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


[R] Selecting subset of a given vector

2011-07-08 Thread Nipesh Bajaj
Hi there, given a numeric vector, I can select numbers within a
specific range. However presently, I have something related but
different problem. Suppose I have a numeric vector. Now take an
arbitrary number. Goal to to chose a specific subset with a given
length, from that given vector, so that those chosen numbers are
centered around that given constant.

Here is one example:

### My original vector
Vec <- rnorm(1000)

### Now chose some arbitrary number
Number <- 0

### Chose the length of the resulting vector
New.Len <- 10

Now I have to chose 10 numbers from 'Vec' around 'Number'. If my 'Vec'
contains one or more zero then those zero(s) also be selected.


Can somebody help me with some pointer how can I achieve that?

Thanks,

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


Re: [R] How to generate heterosced​astic random numbers?

2011-07-08 Thread Arun Kumar Saha
Answering 
http://r.789695.n4.nabble.com/How-to-generate-heteroscedastic-random-numbers-td3654534.html

I think best way to generated Heterosced​astic data would be, first
fix or assume some DGP of your choice, you may assume any arbitrary
model parameter(s) provided forms of those parameters are legitimate
under the model space. Then just simulate numbers starting from the
Residual (the form of that residual you already must have assumed).
Given some initial value(s), you would then get some Time series. You
may chose to generate a lengthy TS as most of the parameters
estimations happen within Asymptotic concept. Then apply your
statistical test on that realized series.

You may repeatedly generate TS and check the distribution of estimated
model parameters etc.

HTH
_

Arun Kumar Saha, FRM
QUANTITATIVE RISK AND HEDGE CONSULTING SPECIALIST
Visit me at: http://in.linkedin.com/in/ArunFRM

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

2011-07-08 Thread Gene Leynes
I noticed that there is a newer version of Tom Short's "cheat sheet" than
the version currently posted on CRAN.

Personally I like the newer version, but maybe keeping the old version is
deliberate.  Anyway, I was wondering if there's someone that I can notify
that can update the content.

New version:  http://rpad.googlecode.com/svn/Rpad_homepage/R-refcard.pdf
CRAN version:  http://cran.r-project.org/doc/contrib/Short-refcard.pdf

[[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] Working in subdirectories

2011-07-08 Thread Duncan Murdoch

On 08/07/2011 2:47 PM, ssathnur wrote:

I want to call in files from subdirectories without changing my working
directory within my script. Is that possible? And if so what would be the
simplest way to do that?

for example, if I do setwd("C:/Users/Hello")

but I have files in C:/Users/Hello/Data1 and C:/Users/Hello/Data2, can I
still keep my working directory as C:/Users/Hello/ while calling in files in
Data1 and Data2?


Yes, just refer to the files using relative paths, e.g. Data1/something 
and Data2/something.


Duncan Murdoch

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


[R] Working in subdirectories

2011-07-08 Thread ssathnur
I want to call in files from subdirectories without changing my working
directory within my script. Is that possible? And if so what would be the
simplest way to do that?

for example, if I do setwd("C:/Users/Hello")

but I have files in C:/Users/Hello/Data1 and C:/Users/Hello/Data2, can I
still keep my working directory as C:/Users/Hello/ while calling in files in
Data1 and Data2?



--
View this message in context: 
http://r.789695.n4.nabble.com/Working-in-subdirectories-tp3654886p3654886.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] Polynomial fitting

2011-07-08 Thread Matti Jokipii

Thank you Gerrit for the quick reply! And yes, i'm Matti.

I can get the coeffs now, though i'm not sure whether i'm doing 
something wrong or whether poly is just not the right method for what 
i'm trying to find. I will look into this more closely and give it 
another try.


Is poly best for fitting on noisy data that's been generated by a 
polynomial and not that good for approximating an arbitrary function? I 
tried a least squares fitting with a web applet and got all exited 
because the approximation looked quite promising. I understand that R is 
designed mainly for statistical computing and may not be the best tool 
for my purposes. Before i look elsewhere i would like to ask if there is 
some other R method i should try, perhaps a least squares approximation?


Thank you for your help!

Matti Jokipii

08.07.2011 08:25, Gerrit Eichner kirjoitti:

Hello, mfa (Matti?),

if x and y contain the coordinates of your data points and k is the
wanted polynomial degree, then

fit <- lm( y ~ poly( x, k))

fits orthonormal polynomials up to degree k to your data. Using

dummy.coef( fit)

should give the coefficients you are interested in.

Hth -- Gerrit

On Thu, 7 Jul 2011, mfa wrote:


Hello,

i'm fairly familiar with R and use it every now and then for math related
tasks.

I have a simple non polynomial function that i would like to approximate
with a polynomial. I already looked into poly, but was unable to
understand
what to do with it. So my problem is this. I can generate virtually any
number of datapoints and would like to find the coeffs a1, a2, ... up
to a
given degree for a polynomial a1x^1 + a2x^2 + ... that approximates my
simple function. How can i do this with R?

Your help will be highly appreciated!

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


-
Dr. Gerrit Eichner Mathematical Institute, Room 212
gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen
Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany
Fax: +49-(0)641-99-32109 http://www.uni-giessen.de/cms/eichner
-



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

2011-07-08 Thread David Winsemius


On Jul 8, 2011, at 2:02 PM, rstudent wrote:

I can use the text() command to label all points but how do you  
specify only

to label those four specific points on the graph?



No context, no example, evidence that you read the rest of my message,  
no further response.



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-label-specific-points-on-a-scatterplot-tp3654697p3654777.html
Sent from the R help mailing list archive at Nabble.com.

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


David Winsemius, MD
West Hartford, CT

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


Re: [R] How to label specific points on a scatterplot

2011-07-08 Thread rstudent
I can use the text() command to label all points but how do you specify only
to label those four specific points on the graph?

--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-label-specific-points-on-a-scatterplot-tp3654697p3654777.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] Extremum index from a sampling time series data

2011-07-08 Thread David Winsemius


On Jul 8, 2011, at 1:44 PM, FMH wrote:


Dear All,

I am working on a time series of hourly river flow measurements from  
2000 - 2003  and have been trying to compute the extremum index from  
the original series as well as a new series from  sampling with  
replacement . The extremum Index produced from the original data  
series looks  fine but sadly, a strange value of index is given from  
the sampling. The flow measurements are in range of 0.1 to 35m3/s  
and are stored in data frame with the codes and  results are as  
follows:


##

### Codes   ###
attach(data)


Nope, no data. Consult the Posting Guide. See link below.


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.


David Winsemius, MD
West Hartford, CT

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


Re: [R] How to label specific points on a scatterplot

2011-07-08 Thread David Winsemius


On Jul 8, 2011, at 1:31 PM, rstudent wrote:


Command I am using for the plot:

plot(Raw[][Plate==101]~well[][Plate==101], xlab="Well", ylab="Raw",
main="Plate 101")

I only want to label points on the graph where well equals B13, G13,  
K14 and

N14 with the name of the well.


?"%in%"
?text




Thank you for your help.

--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-label-specific-points-on-a-scatterplot-tp3654697p3654697.html
Sent from the R help mailing list archive at Nabble.com.

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


David Winsemius, MD
West Hartford, CT

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


[R] Extremum index from a sampling time series data

2011-07-08 Thread FMH
Dear All,
 
I am working on a time series of hourly river flow measurements from 2000 - 
2003  and have been trying to compute the extremum index from the original 
series as well as a new series from  sampling with replacement . The extremum 
Index produced from the original data series looks  fine but sadly, a strange 
value of index is given from the sampling. The flow measurements are in range 
of 0.1 to 35m3/s and are stored in data frame with the codes and  results are 
as follows:
 
##
 
### Codes   ###
attach(data)
 
# Estimates of extremum index 
 
library(evd)
library(boot)
set.seed(101)
 
threshold <- 15

ej <- exi(data$flow, u=threshold)   # 
Extremum Index computed from the original series of river flow
ei <- exi(sample(data$flow, replace=T), u=threshold) # Extremum Index 
computed from sampling of the original flow series with replacement
ei; ej
mean(ei); mean(ej)
 
###
 
 Results 
ei = 0.4
ej = 1
mean(ei) = 1.023
mean(ej) = 1.014
 
###
 
I would  expect that the results for both index should be slightly similar as 
the features of both original & sampling series are more or less the same as 
highlighted by their sample mean and so, could  anybody please advice me on 
this matter?
 
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] Visualizing a dissimilarity matrix in Euclidean space

2011-07-08 Thread Tea Los
Hi,

I have a set of nodes and a dissimilarity matrix for them, as well as a csv
file in which the diss matrix has been converted to [node_1, node_2,
dissimilarity] format.  I would like to visualize this as a graph in
Euclidean space (that is, similar nodes clumped together in clusters),
rather than the seriation visualization given by dissplot(). I am using
Network WorkBench for my visualizations and thus want the R output to be in
graphml.  If I use, say, graph.data.frame(), it will read the dissimilarity
column as an edge attribute rather than as distance between nodes, which is
what I want.

How should I go about this?

Many thanks!

[[alternative HTML version deleted]]

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


Re: [R] Simple conditional plot

2011-07-08 Thread VictorDelgado
Another possibility without using subset():

plot(Well[][Plate==101]~Raw[][Plate==101])

This also works to '>=' '<=' and other conditions.  

--
View this message in context: 
http://r.789695.n4.nabble.com/Simple-conditional-plot-tp3654300p3654666.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] How to label specific points on a scatterplot

2011-07-08 Thread rstudent
Command I am using for the plot:

plot(Raw[][Plate==101]~well[][Plate==101], xlab="Well", ylab="Raw",
main="Plate 101")

I only want to label points on the graph where well equals B13, G13, K14 and
N14 with the name of the well.

Thank you for your help.

--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-label-specific-points-on-a-scatterplot-tp3654697p3654697.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] How to generate heteroscedastic random numbers?

2011-07-08 Thread Duncan Murdoch

On 08/07/2011 12:15 PM, UnitRoot wrote:

Hello,
I have tried to generate numbers randomly which follow normal, Student-t and
skewed Student-t distributions. However, when I check those series for
heteroscedastisity test (ARCH) results are showing that there is no
heteroscedastisity.
As we all know, returns (financial returns) usually have heteroscedastisity.
My question is, is it possible somehow generate random numbers which have
hetescedastisity?
I was thinking about generating random numbers and sort them out and then
allocate them, so they will have some level of heteroscedastisity. However,
I am not sure if this is correct way of doing it.
I appreciate any input. Thank you.


"Heteroscedastic" just means that the variance is not constant.  So

rnorm(10, sd=1:10)

gives heteroscedastic values.

If you are using some ARCH model to generate the random numbers, they 
may well be heteroscedastic, but that doesn't mean your test will detect 
it.  Tests are fallible, especially on small datasets.


Duncan Murdoch

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


Re: [R] Getting wrong NA values using "for" cmd

2011-07-08 Thread VictorDelgado
ty S. Goslee,

It's helpfull to test the condition:

> all.equal(s[4],0.15)
[1] TRUE

instead the previous "FALSE" answer obtained with

>s[4]==0.15
[1] FALSE

but I still need get it to vector r:

Victor Delgado wrote:
> 
> 
>> for (w in 1:length(s)){
>> r[w] <- dados[,3][dados[,2]==s[w]][1]
>> }
> 

I just managed this, writing:

s <- seq(0,1,0.05)
r <- NULL
for (w in 1:length(s)){
r[w] <- dados[,3][dados[,2]==*round(s[w],2)*][1]
}

Now, I get the right answer to r-vector

Thanks for helping!

--
View this message in context: 
http://r.789695.n4.nabble.com/Getting-wrong-NA-values-using-for-cmd-tp3654335p3654548.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] Condional Density Plot from different data

2011-07-08 Thread rstudent
Tried this and received this error:

Error in hist.default(x = integer(0), plot = FALSE) : 
  invalid number of 'breaks'

--
View this message in context: 
http://r.789695.n4.nabble.com/Condional-Density-Plot-from-different-data-tp3080615p3654634.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] How to generate heteroscedastic random numbers?

2011-07-08 Thread UnitRoot
Hello,
I have tried to generate numbers randomly which follow normal, Student-t and
skewed Student-t distributions. However, when I check those series for
heteroscedastisity test (ARCH) results are showing that there is no
heteroscedastisity.
As we all know, returns (financial returns) usually have heteroscedastisity.
My question is, is it possible somehow generate random numbers which have
hetescedastisity?
I was thinking about generating random numbers and sort them out and then
allocate them, so they will have some level of heteroscedastisity. However,
I am not sure if this is correct way of doing it.
I appreciate any input. Thank you.

--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-generate-heteroscedastic-random-numbers-tp3654534p3654534.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] Using Windows 7 Task Scheduler with R source scripts

2011-07-08 Thread Tracy Waldon
 
In Windows Vista, here is what I do:

Create a .bat file that calls R to run the script.  Then set the task
scheduler to run the batch file.  It's a round about way but it works
for me.  


# begin example of *.bat file contents

cd C:\R\R-2.13.0\bin
R CMD BATCH "C:\MyBats\MyBat.R" "C:\MyBats\MyOutput\MyBat.Rout"

# end example


HTH,

Tracy



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of daniel.e...@barclayswealth.com
Sent: Friday, July 08, 2011 10:33 AM
To: r-help@r-project.org
Subject: [R] Using Windows 7 Task Scheduler with R source scripts

Hello all,

I'm trying to get a specific source file to run at a certain time each
day with WindowsScheduler
http://windows.microsoft.com/en-US/windows7/schedule-a-task

I've tried a number of methods, none of which work:
My best guess was:
1. Associate the script.R file with R in FileTypes.
2. Call the script.R file in the scheduler

This definitely opens R, but the source file doesn't execute.

Any ideas?

Much thanks,
Dan




Barclays Wealth is the wealth management division of Barclays Bank PLC.
This email may relate to or be sent from other members of the Barclays
Group.

The availability of products and services may be limited by the
applicable laws and regulations in certain jurisdictions. The Barclays
Group does not normally accept or offer business instructions via
internet email. Any action that you might take upon this message might
be at your own risk.

This email and any attachments are confidential and\ int...{{dropped:10}}

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


Re: [R] Using Windows 7 Task Scheduler with R source scripts

2011-07-08 Thread Pfaff, Bernhard Dr.
Hello Dan,

I reckon that you need to path a batch-file to the scheduler, i.e. something 
along the lines 

R CMD BATCH script.R

shall be included in, say, 'RBatchjob.bat' and this file shall then be called 
by the task scheduler. 

Best,
Bernhard
 

> -Ursprüngliche Nachricht-
> Von: r-help-boun...@r-project.org 
> [mailto:r-help-boun...@r-project.org] Im Auftrag von 
> daniel.e...@barclayswealth.com
> Gesendet: Freitag, 8. Juli 2011 16:33
> An: r-help@r-project.org
> Betreff: [R] Using Windows 7 Task Scheduler with R source scripts
> 
> Hello all,
> 
> I'm trying to get a specific source file to run at a certain 
> time each day with WindowsScheduler 
> http://windows.microsoft.com/en-US/windows7/schedule-a-task
> 
> I've tried a number of methods, none of which work:
> My best guess was:
> 1. Associate the script.R file with R in FileTypes.
> 2. Call the script.R file in the scheduler
> 
> This definitely opens R, but the source file doesn't execute.
> 
> Any ideas?
> 
> Much thanks,
> Dan
> 
> 
> 
> 
> Barclays Wealth is the wealth management division of Barclays 
> Bank PLC. This email may relate to or be sent from other 
> members of the Barclays Group.
> 
> The availability of products and services may be limited by 
> the applicable laws and regulations in certain jurisdictions. 
> The Barclays Group does not normally accept or offer business 
> instructions via internet email. Any action that you might 
> take upon this message might be at your own risk.
> 
> This email and any attachments are confidential and ...{{dropped:21}}

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


Re: [R] Using t tests

2011-07-08 Thread Marc Schwartz
Just to add onto Greg's comments, you may want to review this thread over on 
MedStats, since this topic was just discussed extensively this week, initially 
as a query about using LOS as a covariate:

  
http://groups.google.com/group/medstats/browse_thread/thread/f875fdeeaf48dc38?hl=en

It is highly unlikely that LOS is normally distributed.

HTH,

Marc Schwartz

On Jul 8, 2011, at 10:43 AM, Greg Snow wrote:

> How are you measuring length of stay?  A chi-square test suggests that you 
> have it categorized, a t-test assumes it is continuous (and relatively 
> symmetric with the amount depending on sample size).
> 
> Do you have any censoring? (patients dying or transferring before discharge) 
> if so you should look at survival analysis.
> 
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
> Behalf Of gwanme...@aol.com
> Sent: Friday, July 08, 2011 3:23 AM
> To: r-help@r-project.org
> Subject: [R] Using t tests
> 
> Dear Sir,
> 
> I am doing some work on a population of patients. About half of them are  
> admitted into hospital with albumin levels less than 33. The other half have  
> albumin levels greater than 33, so I stratify them into 2 groups, x and y  
> respectively.
> 
> I suspect that the average length of stay in hospital for the group of  
> patients (x) with albumin levels less than 33 is greater than those  with 
> albumin levels greater than 33 (y).
> 
> What command function do I use (assuming that I will be using the chi  
> square test) to show that the length of stay in hospital of those in group x 
> is  
> statistically significantly different from those in group y?
> 
> I look forward to your thoughts.
> 
> Ivo Gwanmesia

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


Re: [R] Using t tests

2011-07-08 Thread Greg Snow
How are you measuring length of stay?  A chi-square test suggests that you have 
it categorized, a t-test assumes it is continuous (and relatively symmetric 
with the amount depending on sample size).

Do you have any censoring? (patients dying or transferring before discharge) if 
so you should look at survival analysis.

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of gwanme...@aol.com
Sent: Friday, July 08, 2011 3:23 AM
To: r-help@r-project.org
Subject: [R] Using t tests

Dear Sir,
 
I am doing some work on a population of patients. About half of them are  
admitted into hospital with albumin levels less than 33. The other half have  
albumin levels greater than 33, so I stratify them into 2 groups, x and y  
respectively.
 
I suspect that the average length of stay in hospital for the group of  
patients (x) with albumin levels less than 33 is greater than those  with 
albumin levels greater than 33 (y).
 
What command function do I use (assuming that I will be using the chi  
square test) to show that the length of stay in hospital of those in group x is 
 
statistically significantly different from those in group y?
 
I look forward to your thoughts.
 
Ivo Gwanmesia

[[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] Simple conditional plot

2011-07-08 Thread David Winsemius


On Jul 8, 2011, at 10:55 AM, rstudent wrote:


I just started using R last week.

I have a dataset with 3 columns - Plate, Well and Raw

I need to make a simple plot(Well~Raw) but only when Plate = 101


?subset

# Some plotting paradigms allow you to use a subset =  but  
any  program that had a data= option would allow data=subset(dfrm,  
Plate==101)


newseRs:  Remember to use double "=="'s



Thanks for your help.

--
View this message in context: 
http://r.789695.n4.nabble.com/Simple-conditional-plot-tp3654300p3654300.html
Sent from the R help mailing list archive at Nabble.com.

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


David Winsemius, MD
West Hartford, CT

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


Re: [R] How do I overlay two trellis plots of lme fitted lines produced by plot.augPred?

2011-07-08 Thread rwnahhas
In case anyone else is interested... I just found another solution, which has
some pros and cons compared to Dennis' solution...

plot(comparePred(fit.lme, update(fit.lme, y ~ log(age
# Pros - Automatically adds a legend
# Cons - Only works for comparing two models

# Dennis' solution extends to more than two models
p1 <- plot(augPred(  fit.lme  ),
ylim=c(20,65) )
p2 <- plot(augPred(update(fit.lme, y ~ log(age))  ), ylim=c(20,65),
col.line = "red")
p3 <- plot(augPred(update(fit.lme, y ~ age + I(age^2))), ylim=c(20,65),
col.line="green")
p1+p2+p3

Ramzi


--
View this message in context: 
http://r.789695.n4.nabble.com/How-do-I-overlay-two-trellis-plots-of-lme-fitted-lines-produced-by-plot-augPred-tp3652204p3654443.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] Taking inputs from the user

2011-07-08 Thread Greg Snow
Are your users willing to install an Excel plug-in?  If so, look at the RExcel 
project, it does what you describe and the common user thinks they are just 
using Excel with a plug-in without realizing that they have installed and are 
using a useful tool in the background.

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Verma, Ankur
Sent: Friday, July 08, 2011 12:11 AM
To: 'jim holtman'
Cc: r-help@r-project.org
Subject: Re: [R] Taking inputs from the user

Hi Jim,

Thanks for your response. I was actually thinking in terms of an executable 
file which could return the output back to an excel sheet. I was thinking of 
having a small script/executable which would read an excel file get the 
values... Run the modelget the prediction and return the values back to 
the excel. 

But am also interested in the solution you were talking about wherein we setup 
a central server etc.

By the way I'm using Windows XP.

Regards,
Ankur 

-Original Message-
From: jim holtman [mailto:jholt...@gmail.com] 
Sent: Thursday, July 07, 2011 7:44 PM
To: Verma, Ankur
Cc: r-help@r-project.org
Subject: Re: [R] Taking inputs from the user

Give them an Excel spreadsheet that they can fill in the values.  They can then 
send the spreadsheet to you can you can have your R script read the information 
from it and send it back.  You did not mention how they are supposed to"get the 
output".  Do you want to setup a central server that can receive the email, run 
the script and then send back the results?

On Thu, Jul 7, 2011 at 9:38 AM, Verma, Ankur  wrote:
> Hi,
>
> I am currently a new user in R and was working on the randomForest package. I 
> am trying to predict price points using this statistical package. The issue 
> is that I need to setup a tool so that I can give it to Sales Executive who 
> can plug in the necessary variables and get the output. Is there a way to do 
> that ?? They don't have R on their systems and I doubt they are going to 
> install it.
>
> Need urgent help on this.
>
> Thanks,
> Ankur
>
> This e-mail (and any attachments), is confidential and may be 
> privileged. It may be read, copied and used only by intended 
> recipients. Unauthorized access to this e-mail (or attachments) and 
> disclosure or copying of its contents or any action taken in reliance on it 
> is unlawful. Unintended recipients must notify the sender immediately by 
> e-mail/phone & delete it from their system without making any copies or 
> disclosing it to a third person.


>
>        [[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
Data Munger Guru

What is the problem that you are trying to solve?
This e-mail (and any attachments), is confidential and may be privileged. It 
may be read, copied and used only
by intended recipients. Unauthorized access to this e-mail (or attachments) and 
disclosure or copying of its 
contents or any action taken in reliance on it is unlawful. Unintended 
recipients must notify the sender immediately 
by e-mail/phone & delete it from their system without making any copies or 
disclosing it to a third person.


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

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


Re: [R] Simple conditional plot

2011-07-08 Thread Greg Snow
Try 

plot(Well~Raw, subset= Plate==101)

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of rstudent
Sent: Friday, July 08, 2011 8:56 AM
To: r-help@r-project.org
Subject: [R] Simple conditional plot

I just started using R last week.

I have a dataset with 3 columns - Plate, Well and Raw

I need to make a simple plot(Well~Raw) but only when Plate = 101

Thanks for your help.

--
View this message in context: 
http://r.789695.n4.nabble.com/Simple-conditional-plot-tp3654300p3654300.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] Getting wrong NA values using "for" cmd

2011-07-08 Thread Sarah Goslee
Looks like FAQ 7.31 to me.

Try all.equal() instead of ==.

Sarah

On Fri, Jul 8, 2011 at 11:06 AM, VictorDelgado
 wrote:
> Hi There,
>
> I'm facing one problem to construct a vector using the "for" command:
>
> I have one matrix named 'dados' (same as /data/ from portuguese), for
> example:
>
>> dados[140:150,]
>          [,1] [,2] [,3]
>  [1,] 212.7298 0.14 0.11
>  [2,] 213.3778 0.14 0.11
>  [3,] 214.0257 0.15 0.11
>  [4,] 214.6737 0.15 0.12
>  [5,] 215.3217 0.15 0.12
>  [6,] 215.9696 0.15 0.12
>  [7,] 216.6176 0.16 0.12
>  [8,] 217.2656 0.16 0.13
>  [9,] 217.9135 0.16 0.13
> [10,] 218.5615 0.16 0.13
> [11,] 219.2094 0.17 0.13
>
> So, I need one vector getting the values from the third column given
> specific values of the second:
>
> s <- seq(0,1,0.05)
> r <- NULL
> for (w in 1:length(s)){
> r[w] <- dados[,3][dados[,2]==s[w]][1]
> }
>
> This vector 'r' are working well to many values, but there are some
> inconsistency (NA's) for others:
>
>> r
>  [1] 0.00 0.03 0.07   NA 0.16 0.21   NA   NA 0.36 0.41 0.46 0.52   NA 0.63
> NA
> [16] 0.74 0.79   NA 0.90   NA 1.00
>
> and dissecting this:
>
>> s[4]
> [1] 0.15
>> dados[,3][dados[,2]==0.15][1]
> [1] 0.11
>> dados[,3][dados[,2]==s[4]][1]
> [1] NA
>> s[4]==0.15
> [1] FALSE
>> s[5]==0.20
> [1] TRUE
>> dados[,3][dados[,2]==s[5]][1]
> [1] 0.16
>
> Anyone could help me to discover why this is occorring?
>
> dados[,2] and dados[,3] came from rounded values. Could this fact interfere
> the results?
>
> Thanks in advance.
>
> --

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

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


Re: [R] gdata read.xls() values format problem

2011-07-08 Thread Gabor Grothendieck
On Thu, Jul 7, 2011 at 6:07 PM, Gabor Grothendieck
 wrote:
> On Thu, Jul 7, 2011 at 4:23 PM, Victor11  wrote:
>> Dear All,
>>
>> When I use read.xls() in gdata package to read xls files, I noticed an issue
>> and couldn't find any solutions after I serched all previous posts.
>>
>> In the excel file, the number value, for example, is actually 2.3456789 but
>> formatted as 2.3 (Format Cells ---> Decimal places:1). After I use
>> read.xls() to import the excel file, I found that, in R, this number is read
>> as the formatted value 2.3, instead of the actural value 2.3456789.
>>
>> Since I usually read many excel files at the same time, it would be
>> inconvenient if I change the format in each excel file. So I'm wondering if
>> there is any argument in read.xls() or any other ways so it can read the
>> actual value?
>>
>> I would realy appcireate for your help.
>>
>
> I don't think gdata can handle that.  Suggest you try one of the other
> packages listed on this page:
>
> http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows&s=excel

Just one correction to my post above.  gdata's read.xls does not
handle that for the older xls files but for xlsx files, i.e. used by
the current version of Excel, it does handle it.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

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


Re: [R] Naive Bayes Classifier

2011-07-08 Thread Petr Savicky
On Thu, Jul 07, 2011 at 02:18:17PM -0700, m.marcinmichal wrote:
> Hi,
> Currently I testing the packets that contain built-in features for
> classification. Actually I looked packages such as: e1071, Klar, Caret,
> CORElearn. However, from what I noticed when building a naive Bayesian
> classifier, that they package use of the finite mixture model to estimate P
> (x | C) and using a normal distribution. In my research I use binary data
> and I want modeled P (x | C), eg the Poisson distribution.

Hi.

For binary attributes, the distribution P(x | C) is binomial. This
is the way, how binary attributes are treated in function
CoreModel(y ~ ., lrn, model="bayes") in package CORElearn. I assume
that the binomial distribution is used also in other implementations
of naive Bayes for binary data.

Petr Savicky.

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


Re: [R] ASCII values to Decimal

2011-07-08 Thread Matthew Maycock
You can do:

 as.numeric(charToRaw(paste(df[,4], collapse="")))

If you somehow want each row to be its own sequence of integers, you
could do something like:

 lapply(df[,4], function(c) as.numeric(charToRaw(c)));

~Matthew Maycock


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Bansal, Vikas
Sent: Friday, July 08, 2011 4:42 PM
To: r-help@r-project.org
Subject: [R] ASCII values to Decimal

Dear all,

I have a file and I am using a code-

df=read.table("Case2.pileup",fill=T,sep="\t",colClasses = "character")

to create a data frame that is df.
now in 4th column I have ASCII values which I want to convert in decimal
values.the data frame is like this-



V1  V2   V3  V4
  9  2 .,  a\
  9  2.$,  a`
 13  1  ,   a
 13  1  ,   a
 13  1  ,   a
 13  1  ,   a
 13  1  ,   `
 13  1  ,   ^
 13  1  ,   a
 13  1 ,$   a

I am using this code to convert it-

as.numeric(charToRaw(df[,4]))
it is showing this error-

Warning message:
In charToRaw(df[, 4]) : argument should be a character vector of length
1
all but the first element will be ignored

and it is converting only the value in first row.How can I do this for
all rows in my data frame.

Please help me.I am new user for R.I will be very thankful to you.



Thanking you,
Warm Regards
Vikas Bansal
Msc Bioinformatics
Kings College London
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Getting wrong NA values using "for" cmd

2011-07-08 Thread VictorDelgado
Hi There,

I'm facing one problem to construct a vector using the "for" command: 

I have one matrix named 'dados' (same as /data/ from portuguese), for
example:

> dados[140:150,]
  [,1] [,2] [,3]
 [1,] 212.7298 0.14 0.11
 [2,] 213.3778 0.14 0.11
 [3,] 214.0257 0.15 0.11
 [4,] 214.6737 0.15 0.12
 [5,] 215.3217 0.15 0.12
 [6,] 215.9696 0.15 0.12
 [7,] 216.6176 0.16 0.12
 [8,] 217.2656 0.16 0.13
 [9,] 217.9135 0.16 0.13
[10,] 218.5615 0.16 0.13
[11,] 219.2094 0.17 0.13

So, I need one vector getting the values from the third column given
specific values of the second:

s <- seq(0,1,0.05)
r <- NULL
for (w in 1:length(s)){
r[w] <- dados[,3][dados[,2]==s[w]][1]
}

This vector 'r' are working well to many values, but there are some
inconsistency (NA's) for others:

> r
 [1] 0.00 0.03 0.07   NA 0.16 0.21   NA   NA 0.36 0.41 0.46 0.52   NA 0.63  
NA
[16] 0.74 0.79   NA 0.90   NA 1.00

and dissecting this:

> s[4]
[1] 0.15
> dados[,3][dados[,2]==0.15][1]
[1] 0.11
> dados[,3][dados[,2]==s[4]][1]
[1] NA
> s[4]==0.15
[1] FALSE
> s[5]==0.20
[1] TRUE
> dados[,3][dados[,2]==s[5]][1]
[1] 0.16

Anyone could help me to discover why this is occorring?

dados[,2] and dados[,3] came from rounded values. Could this fact interfere
the results? 

Thanks in advance.

--
View this message in context: 
http://r.789695.n4.nabble.com/Getting-wrong-NA-values-using-for-cmd-tp3654335p3654335.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] Simple conditional plot

2011-07-08 Thread rstudent
I just started using R last week.

I have a dataset with 3 columns - Plate, Well and Raw

I need to make a simple plot(Well~Raw) but only when Plate = 101

Thanks for your help.

--
View this message in context: 
http://r.789695.n4.nabble.com/Simple-conditional-plot-tp3654300p3654300.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] Using Windows 7 Task Scheduler with R source scripts

2011-07-08 Thread daniel.egan
Hello all,

I'm trying to get a specific source file to run at a certain time each day with 
WindowsScheduler
http://windows.microsoft.com/en-US/windows7/schedule-a-task

I've tried a number of methods, none of which work:
My best guess was:
1. Associate the script.R file with R in FileTypes.
2. Call the script.R file in the scheduler

This definitely opens R, but the source file doesn't execute.

Any ideas?

Much thanks,
Dan




Barclays Wealth is the wealth management division of Barclays Bank PLC. This 
email may relate to or be sent from other members of the Barclays Group.

The availability of products and services may be limited by the applicable laws 
and regulations in certain jurisdictions. The Barclays Group does not normally 
accept or offer business instructions via internet email. Any action that you 
might take upon this message might be at your own risk.

This email and any attachments are confidential and inte...{{dropped:27}}

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


Re: [R] Making a new package: licence

2011-07-08 Thread Gabor Grothendieck
On Fri, Jul 8, 2011 at 11:16 AM, Federico Calboli
 wrote:
> On 8 Jul 2011, at 16:12, Barry Rowlingson wrote:
>
>> On Fri, Jul 8, 2011 at 4:07 PM, Federico Calboli
>>  wrote:
>>> On 8 Jul 2011, at 15:56, Spencer Graves wrote:
> Ok, thanks for that. I though that, since R in under GPL-v2, I can only 
> release my code under GPL-v2 because the code is written in R and 
> probably qualifies as a derivative work.

      Did you include someone else's GPL-vx code (possibly modified by you) 
 as part of your code in a way that someone could claim that your code does 
 NOT have a useful functionality and independent existence without that?
>>>
>>> Nope. Nevertheless my code would not have a functionality without R, hence 
>>> I feel GPL v2, the same R is under, is appropiate for my package.
>>
>> Note that whatever GPL version you want to release your code as you
>> can't just say "This code is released under GPL-blah". You also have
>> to include a copy of the relevant GPL license, usually in a file
>> called LICENSE or COPYING. I think. A lawyer I am not.
>
> The vast majority of CRAN libraries seem to be released under some sort of 
> GPL version. I never seen a license though.

Type license() at the R command prompt and you will get a message
giving a URL which lists the content of various licenses. Also see
?license where it discusses various RShowDoc commands which can also
show various licenses.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

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


Re: [R] Making a new package: licence

2011-07-08 Thread Barry Rowlingson
On Fri, Jul 8, 2011 at 4:16 PM, Federico Calboli
 wrote:

> The vast majority of CRAN libraries seem to be released under some sort of 
> GPL version. I never seen a license though.

 You're right. The GNU people say "should":

http://www.gnu.org/licenses/gpl-howto.html

---

You should also include a copy of the license itself somewhere in the
distribution of your program. All programs, whether they are released
under the GPL or LGPL, should include the text version of the GPL. In
GNU programs the license is usually in a file called COPYING.

 ---

But it seems you have to add a copyright and permission notice to every file:

---
Whichever license you plan to use, the process involves adding two
elements to each source file of your program: a copyright notice (such
as “Copyright 1999 Terry Jones”), and a statement of copying
permission, saying that the program is distributed under the terms of
the GNU General Public License (or the Lesser GPL).
---

I just picked one random R package from CRAN ("tgram") and it doesn't
comply (no copyright mention, no LICENSE file, just License: GPL (>=2)
in the DESCRIPTION). I suspect most of my own code doesn't comply
either. Told you I wasn't a lawyer...

Barry

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


Re: [R] Making a new package: licence

2011-07-08 Thread Duncan Murdoch

On 08/07/2011 10:56 AM, Spencer Graves wrote:

On 7/8/2011 4:26 AM, Federico Calboli wrote:
>  On 8 Jul 2011, at 12:06, Duncan Murdoch wrote:
>
>>  On 11-07-08 6:20 AM, Federico Calboli wrote:
>>>  HI All,
>>>
>>>  I have written and succesfully uploaded a new package. The licence it is under is 'GPL' --no 
version. My assumption is, since all the code is written in R the licence R used for R would affect the code 
(hence my "GPL" stands for "whatever version of the GPL R is under")
>>>
>>>  I am happy with the licencing I used, but I'd like to ask if there is any 
transitive propery of IP licencing or if I am mistaken.
>>  I believe you are mistaken:  your package is your code, so the license 
someone else used is irrelevant.  I would interpret 'GPL' to mean 'whatever version 
of GPL the user finds to be convenient'.  So if GPL v1 (which I've never actually 
seen) or GPL v4 (which has not been released) contained some right that I liked, I 
would assume that you've granted me that right.
>  Ok, thanks for that. I though that, since R in under GPL-v2, I can only 
release my code under GPL-v2 because the code is written in R and probably 
qualifies as a derivative work.

Did you include someone else's GPL-vx code (possibly modified by
you) as part of your code in a way that someone could claim that your
code does NOT have a useful functionality and independent existence
without that?  I'm not an attorney, but I have read the GPL and
discussed it with attorneys, and it's my understanding that the
definition of "derivative work" encompasses essentially what I just
described.  Another example:  According to the Wikipedia article on
Linux, the (first) GPL was written for the GNU Linux project.  In that
context, you can NOT charge someone for Linux nor for any modification
of it you may make, because such modifications would make it a
derivative work.


Just a nitpick:  Nothing in the GPL prevents you from charging someone 
for your changes.  It is often pointless, because when you deliver them, 
you are also obligated to deliver the source code and the right to 
redistribute everything.However, if someone really wants a new 
feature in Linux or R, they could hire you to produce it, and it is 
perfectly legal for you to charge them for the changes.


Duncan Murdoch

   However, if you can run your own code written in
whatever language under Linux, because presumably your code has an
existence independent of Linux and could theoretically run (with
modifications) on some other operating system.


 Hope this helps.
Spencer

>
>  On uploading the new version (a matter of days), I will specify the GPL 
version.
>
>  Bw
>
>  Federico
>
>
>>  Duncan Murdoch
>>
>>>  bw
>>>
>>>  Federico
>>>
>>>
>>>  --
>>>  Federico C. F. Calboli
>>>  Department of Epidemiology and Biostatistics
>>>  Imperial College, St. Mary's Campus
>>>  Norfolk Place, London W2 1PG
>>>
>>>  Tel +44 (0)20 75941602   Fax +44 (0)20 75943193
>>>
>>>  f.calboli [.a.t] imperial.ac.uk
>>>  f.calboli [.a.t] gmail.com
>>>
>>>  __
>>>  R-help@r-project.org mailing list
>>>  https://stat.ethz.ch/mailman/listinfo/r-help
>>>  PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
>>>  and provide commented, minimal, self-contained, reproducible code.
>  --
>  Federico C. F. Calboli
>  Department of Epidemiology and Biostatistics
>  Imperial College, St. Mary's Campus
>  Norfolk Place, London W2 1PG
>
>  Tel +44 (0)20 75941602   Fax +44 (0)20 75943193
>
>  f.calboli [.a.t] imperial.ac.uk
>  f.calboli [.a.t] gmail.com
>
>  __
>  R-help@r-project.org mailing list
>  https://stat.ethz.ch/mailman/listinfo/r-help
>  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>  and provide commented, minimal, self-contained, reproducible code.



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


Re: [R] Making a new package: licence

2011-07-08 Thread Spencer Graves

On 7/8/2011 8:07 AM, Federico Calboli wrote:

On 8 Jul 2011, at 15:56, Spencer Graves wrote:

Ok, thanks for that. I though that, since R in under GPL-v2, I
can only release my code under GPL-v2 because the code is written
in R and probably qualifies as a derivative work.

Did you include someone else's GPL-vx code (possibly modified by
you) as part of your code in a way that someone could claim that
your code does NOT have a useful functionality and independent
existence without that?

Nope. Nevertheless my code would not have a functionality without R,
hence I feel GPL v2, the same R is under, is appropiate for my
package.



  It could presumably run unchanged under S-Plus, and the same
license could probably be claimed to apply to a version that ran under 
Matlab.  Either of these could arguably give it an independent 
existence, even if that independent existence were never exercised. 
However, as I said, I'm not an attorney.



Spencer



Bw

F



I'm not an attorney, but I have read the GPL and discussed it with
attorneys, and it's my understanding that the definition of
"derivative work" encompasses essentially what I just described.
Another example:  According to the Wikipedia article on Linux, the
(first) GPL was written for the GNU Linux project.  In that
context, you can NOT charge someone for Linux nor for any
modification of it you may make, because such modifications would
make it a derivative work.  However, if you can run your own code
written in whatever language under Linux, because presumably your
code has an existence independent of Linux and could theoretically
run (with modifications) on some other operating system.


Hope this helps. Spencer


On uploading the new version (a matter of days), I will specify
the GPL version.

Bw

Federico



Duncan Murdoch


bw

Federico


-- Federico C. F. Calboli Department of Epidemiology and
Biostatistics Imperial College, St. Mary's Campus Norfolk
Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com

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

-- Federico C. F. Calboli Department of Epidemiology and
Biostatistics Imperial College, St. Mary's Campus Norfolk Place,
London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com

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

-- Federico C. F. Calboli Department of Epidemiology and
Biostatistics Imperial College, St. Mary's Campus Norfolk Place,
London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com



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

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


Re: [R] Making a new package: licence

2011-07-08 Thread Marc Schwartz

On Jul 8, 2011, at 9:58 AM, Spencer Graves wrote:

> On 7/8/2011 4:26 AM, Federico Calboli wrote:
>> On 8 Jul 2011, at 12:06, Duncan Murdoch wrote:
>> 
>>> On 11-07-08 6:20 AM, Federico Calboli wrote:
 HI All,
 
 I have written and succesfully uploaded a new package. The licence it is 
 under is 'GPL' --no version. My assumption is, since all the code is 
 written in R the licence R used for R would affect the code (hence my 
 "GPL" stands for "whatever version of the GPL R is under")
 
 I am happy with the licencing I used, but I'd like to ask if there is any 
 transitive propery of IP licencing or if I am mistaken.
>>> I believe you are mistaken:  your package is your code, so the license 
>>> someone else used is irrelevant.  I would interpret 'GPL' to mean 'whatever 
>>> version of GPL the user finds to be convenient'.  So if GPL v1 (which I've 
>>> never actually seen) or GPL v4 (which has not been released) contained some 
>>> right that I liked, I would assume that you've granted me that right.
>> Ok, thanks for that. I though that, since R in under GPL-v2, I can only 
>> release my code under GPL-v2 because the code is written in R and probably 
>> qualifies as a derivative work.
> 
>  Did you include someone else's GPL-vx code (possibly modified by you) as 
> part of your code in a way that someone could claim that your code does NOT 
> have a useful functionality and independent existence without that?  I'm not 
> an attorney, but I have read the GPL and discussed it with attorneys, and 
> it's my understanding that the definition of "derivative work" encompasses 
> essentially what I just described.  Another example:  According to the 
> Wikipedia article on Linux, the (first) GPL was written for the GNU Linux 
> project.  In that context, you can NOT charge someone for Linux nor for any 
> modification of it you may make, because such modifications would make it a 
> derivative work.  However, if you can run your own code written in whatever 
> language under Linux, because presumably your code has an existence 
> independent of Linux and could theoretically run (with modifications) on some 
> other operating system.

Spencer, your comments about charging for Linux are not correct. You are free 
to charge whatever you think you can sell GPL based software for. Just ask the 
folks at Red Hat and their shareholders, since RH is a for-profit company. 
Arguably, they are charging for the value add of their support and service, on 
top of their Linux distribution (RHEL). You can get a fully free version of 
RHEL (sans RH copyrighted materials, such as graphics), called CentOS and can 
obtain the RHEL source RPMS for free.

The GPL is about copying and distribution, not about preventing you from making 
a profit from it.

BTW, with R 2.13.1, R is now licensed under GPL 2 or 3.

> license()

This software is distributed under the terms of the GNU General
Public License, either Version 2, June 1991 or Version 3, June 2007.
The terms of version 2 of the license are in a file called COPYING
which you should have received with
this software and which can be displayed by RShowDoc("COPYING").

Copies of both versions 2 and 3 of the license can be found
at http://www.R-project.org/Licenses/.

A small number of files (the API header files listed in
R_DOC_DIR/COPYRIGHTS) are distributed under the
Lesser GNU General Public LIcense version 2.1.
This can be displayed by RShowDoc("COPYING.LIB"),
or obtained at the URI given.

'Share and Enjoy.'


HTH,

Marc Schwartz

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


Re: [R] Making a new package: licence

2011-07-08 Thread Federico Calboli
On 8 Jul 2011, at 16:12, Barry Rowlingson wrote:

> On Fri, Jul 8, 2011 at 4:07 PM, Federico Calboli
>  wrote:
>> On 8 Jul 2011, at 15:56, Spencer Graves wrote:
 Ok, thanks for that. I though that, since R in under GPL-v2, I can only 
 release my code under GPL-v2 because the code is written in R and probably 
 qualifies as a derivative work.
>>> 
>>>  Did you include someone else's GPL-vx code (possibly modified by you) 
>>> as part of your code in a way that someone could claim that your code does 
>>> NOT have a useful functionality and independent existence without that?
>> 
>> Nope. Nevertheless my code would not have a functionality without R, hence I 
>> feel GPL v2, the same R is under, is appropiate for my package.
> 
> Note that whatever GPL version you want to release your code as you
> can't just say "This code is released under GPL-blah". You also have
> to include a copy of the relevant GPL license, usually in a file
> called LICENSE or COPYING. I think. A lawyer I am not.

The vast majority of CRAN libraries seem to be released under some sort of GPL 
version. I never seen a license though.


> 
> Barry

--
Federico C. F. Calboli
Department of Epidemiology and Biostatistics
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

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


Re: [R] Making a new package: licence

2011-07-08 Thread Barry Rowlingson
On Fri, Jul 8, 2011 at 4:07 PM, Federico Calboli
 wrote:
> On 8 Jul 2011, at 15:56, Spencer Graves wrote:
>>> Ok, thanks for that. I though that, since R in under GPL-v2, I can only 
>>> release my code under GPL-v2 because the code is written in R and probably 
>>> qualifies as a derivative work.
>>
>>      Did you include someone else's GPL-vx code (possibly modified by you) 
>> as part of your code in a way that someone could claim that your code does 
>> NOT have a useful functionality and independent existence without that?
>
> Nope. Nevertheless my code would not have a functionality without R, hence I 
> feel GPL v2, the same R is under, is appropiate for my package.

 Note that whatever GPL version you want to release your code as you
can't just say "This code is released under GPL-blah". You also have
to include a copy of the relevant GPL license, usually in a file
called LICENSE or COPYING. I think. A lawyer I am not.

Barry

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


Re: [R] Making a new package: licence

2011-07-08 Thread Jeff Newmiller

On 07/08/2011 07:58 AM, Spencer Graves wrote:

On 7/8/2011 4:26 AM, Federico Calboli wrote:

On 8 Jul 2011, at 12:06, Duncan Murdoch wrote:


On 11-07-08 6:20 AM, Federico Calboli wrote:

HI All,

I have written and succesfully uploaded a new package. The licence it 
is under is 'GPL' --no version. My assumption is, since all the code is 
written in R the licence R used for R would affect the code (hence my 
"GPL" stands for "whatever version of the GPL R is under")


I am happy with the licencing I used, but I'd like to ask if there is 
any transitive propery of IP licencing or if I am mistaken.
I believe you are mistaken:  your package is your code, so the license 
someone else used is irrelevant.  I would interpret 'GPL' to mean 
'whatever version of GPL the user finds to be convenient'.  So if GPL v1 
(which I've never actually seen) or GPL v4 (which has not been released) 
contained some right that I liked, I would assume that you've granted me 
that right.
Ok, thanks for that. I though that, since R in under GPL-v2, I can only 
release my code under GPL-v2 because the code is written in R and 
probably qualifies as a derivative work.


  Did you include someone else's GPL-vx code (possibly modified by 
you) as part of your code in a way that someone could claim that your code 
does NOT have a useful functionality and independent existence without 
that?  I'm not an attorney, but I have read the GPL and discussed it with 
attorneys, and it's my understanding that the definition of "derivative 
work" encompasses essentially what I just described.  Another example:  
According to the Wikipedia article on Linux, the (first) GPL was written 
for the GNU Linux project.  In that context, you can NOT charge someone 
for Linux nor for any modification of it you may make, because such 
modifications would make it a derivative work.  However, if you can run 
your own code written in whatever language under Linux, because presumably 
your code has an existence independent of Linux and could theoretically 
run (with modifications) on some other operating system.




GPL is not about compensation, it is about distribution and the rights and 
responsibilities ensuing.




   Hope this helps.
  Spencer



On uploading the new version (a matter of days), I will specify the GPL 
version.


Bw

Federico



Duncan Murdoch


bw

Federico


--
Federico C. F. Calboli
Department of Epidemiology and Biostatistics
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

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

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

--
Federico C. F. Calboli
Department of Epidemiology and Biostatistics
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

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





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


Re: [R] Making a new package: licence

2011-07-08 Thread Federico Calboli
On 8 Jul 2011, at 15:56, Spencer Graves wrote:
>> Ok, thanks for that. I though that, since R in under GPL-v2, I can only 
>> release my code under GPL-v2 because the code is written in R and probably 
>> qualifies as a derivative work.
> 
>  Did you include someone else's GPL-vx code (possibly modified by you) as 
> part of your code in a way that someone could claim that your code does NOT 
> have a useful functionality and independent existence without that?  

Nope. Nevertheless my code would not have a functionality without R, hence I 
feel GPL v2, the same R is under, is appropiate for my package.

Bw

F


> I'm not an attorney, but I have read the GPL and discussed it with attorneys, 
> and it's my understanding that the definition of "derivative work" 
> encompasses essentially what I just described.  Another example:  According 
> to the Wikipedia article on Linux, the (first) GPL was written for the GNU 
> Linux project.  In that context, you can NOT charge someone for Linux nor for 
> any modification of it you may make, because such modifications would make it 
> a derivative work.  However, if you can run your own code written in whatever 
> language under Linux, because presumably your code has an existence 
> independent of Linux and could theoretically run (with modifications) on some 
> other operating system.
> 
> 
>   Hope this helps.
>  Spencer
> 
>> 
>> On uploading the new version (a matter of days), I will specify the GPL 
>> version.
>> 
>> Bw
>> 
>> Federico
>> 
>> 
>>> Duncan Murdoch
>>> 
 bw
 
 Federico
 
 
 --
 Federico C. F. Calboli
 Department of Epidemiology and Biostatistics
 Imperial College, St. Mary's Campus
 Norfolk Place, London W2 1PG
 
 Tel +44 (0)20 75941602   Fax +44 (0)20 75943193
 
 f.calboli [.a.t] imperial.ac.uk
 f.calboli [.a.t] gmail.com
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
>> --
>> Federico C. F. Calboli
>> Department of Epidemiology and Biostatistics
>> Imperial College, St. Mary's Campus
>> Norfolk Place, London W2 1PG
>> 
>> Tel +44 (0)20 75941602   Fax +44 (0)20 75943193
>> 
>> f.calboli [.a.t] imperial.ac.uk
>> f.calboli [.a.t] gmail.com
>> 
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 

--
Federico C. F. Calboli
Department of Epidemiology and Biostatistics
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

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


Re: [R] gdata read.xls() values format problem

2011-07-08 Thread Victor11
Thank you for your suggestion Gabor. I hope they can fix this in later
versions.

Victor

--
View this message in context: 
http://r.789695.n4.nabble.com/gdata-read-xls-values-format-problem-tp3652494p3654334.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] Making a new package: licence

2011-07-08 Thread Spencer Graves

On 7/8/2011 4:26 AM, Federico Calboli wrote:

On 8 Jul 2011, at 12:06, Duncan Murdoch wrote:


On 11-07-08 6:20 AM, Federico Calboli wrote:

HI All,

I have written and succesfully uploaded a new package. The licence it is under is 'GPL' --no 
version. My assumption is, since all the code is written in R the licence R used for R would affect 
the code (hence my "GPL" stands for "whatever version of the GPL R is under")

I am happy with the licencing I used, but I'd like to ask if there is any 
transitive propery of IP licencing or if I am mistaken.

I believe you are mistaken:  your package is your code, so the license someone 
else used is irrelevant.  I would interpret 'GPL' to mean 'whatever version of 
GPL the user finds to be convenient'.  So if GPL v1 (which I've never actually 
seen) or GPL v4 (which has not been released) contained some right that I 
liked, I would assume that you've granted me that right.

Ok, thanks for that. I though that, since R in under GPL-v2, I can only release 
my code under GPL-v2 because the code is written in R and probably qualifies as 
a derivative work.


  Did you include someone else's GPL-vx code (possibly modified by 
you) as part of your code in a way that someone could claim that your 
code does NOT have a useful functionality and independent existence 
without that?  I'm not an attorney, but I have read the GPL and 
discussed it with attorneys, and it's my understanding that the 
definition of "derivative work" encompasses essentially what I just 
described.  Another example:  According to the Wikipedia article on 
Linux, the (first) GPL was written for the GNU Linux project.  In that 
context, you can NOT charge someone for Linux nor for any modification 
of it you may make, because such modifications would make it a 
derivative work.  However, if you can run your own code written in 
whatever language under Linux, because presumably your code has an 
existence independent of Linux and could theoretically run (with 
modifications) on some other operating system.



   Hope this helps.
  Spencer



On uploading the new version (a matter of days), I will specify the GPL version.

Bw

Federico



Duncan Murdoch


bw

Federico


--
Federico C. F. Calboli
Department of Epidemiology and Biostatistics
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

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

--
Federico C. F. Calboli
Department of Epidemiology and Biostatistics
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

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



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

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


Re: [R] vectors cross-product V1 x V2

2011-07-08 Thread Jeff Newmiller

RSiteSearch("cross product")
library(pracma)
?cross

Speed is usually desired in the context of many similar computations, and is 
normally achieved in R by vectorizing computation, so storing the large 
number of 3d vectors together in a structure like a Nx3 matrix so the code 
can be vectorized is the logical approach.  The cross() function takes 
inputs in this form, but the current implementation (0.6-3) then fails to 
take advantage of that storage since it iterates with a for loop. A better 
core implementation of cross() might be:


vcrossp <- function( a, b ) {
  result <- matrix( NA, nrow( a ), 3 )
  result[,1] <- a[,2] * b[,3] - a[,3] * b[,2]
  result[,2] <- a[,3] * b[,1] - a[,1] * b[,3]
  result[,3] <- a[,1] * b[,2] - a[,2] * b[,1]
  result
}

which is about 20 times faster than cross() on my machine.

On 07/08/2011 05:52 AM, Eik Vettorazzi wrote:

Hi,
how about this:

mm<-cbind(V1,V2)
xy<-sapply(1:3,function(x)det(mm[-x,])*(2*(x%%2)-1))

#some checks
all.equal(0,as.vector(xy%*%V1))
all.equal(0,as.vector(xy%*%V2))


Am 08.07.2011 08:27, schrieb Bai:

Hi, everyone,

I need an efficient way to do vectors cross product in R.

Set vectors,
V1 = ai + bj + ck
V2 = di + ej + fk

then the cross product is
   V1 x V2=  (bf - ce) i + (cd - af) j + (ae - bd) k


As shown here ( http://en.wikipedia.org/wiki/Cross_product ).

Thanks.

Best,
Bai

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

2011-07-08 Thread Bansal, Vikas
Dear all,

I have a file and I am using a code-

df=read.table("Case2.pileup",fill=T,sep="\t",colClasses = "character")

to create a data frame that is df.
now in 4th column I have ASCII values which I want to convert in decimal 
values.the data frame is like this-



V1  V2   V3  V4
  9  2 .,  a\
  9  2.$,  a`
 13  1  ,   a
 13  1  ,   a
 13  1  ,   a
 13  1  ,   a
 13  1  ,   `
 13  1  ,   ^
 13  1  ,   a
 13  1 ,$   a

I am using this code to convert it-

as.numeric(charToRaw(df[,4]))
it is showing this error-

Warning message:
In charToRaw(df[, 4]) : argument should be a character vector of length 1
all but the first element will be ignored

and it is converting only the value in first row.How can I do this for all rows 
in my data frame.

Please help me.I am new user for R.I will be very thankful to you.



Thanking you,
Warm Regards
Vikas Bansal
Msc Bioinformatics
Kings College London
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Model fit using mcexact from exactLoglinTest

2011-07-08 Thread Michael . Laviolette

I'm using the mcexact function from the exactLoglinTest package on data
comparing performance of rapid and laboratory tests for detection of H1N1
flu. My setup is as follows:

ridt.res <- c("A-B-", "A+B-", "A-B+")
pcr.res <- c("Negative", "AH3", "B")
xtab <- expand.grid(ridt = ridt.res, pcr = pcr.res)
xtab$counts <- c(271, 68, 7, 2, 74, 0, 3, 0, 9)
xtab$sym.pair <- factor(c(1, 2, 3, 2, 5, 4, 3, 4, 6))

Note that the table is mostly sparse off the main diagonal and that it
contains a symmetric pair of zeros. I'm trying to fit a quasi-symmetry
model with

mcexact(counts ~ ridt + sym.pair, data = xtab)

but I get the following error message:

Error in temp %*% solve(v[(n1 + 1):n, (n1 + 1):n]) %*% t(temp) :
  non-conformable arguments

Could you provide some guidance? Thanks.

-M. Laviolette

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


Re: [R] Vertical Labels in plot graph - normally working fine but not on this graph

2011-07-08 Thread Berry Boessenkool


Hey Paolo,

you should specify las BEFORE you send the axis command.
It would also be good to set greater margins, this needs to be set before the 
entire plot, thus in following order:

par(las = 3, mar=c(6,2,2,2))
plot(ExtAvgCWV, ann=FALSE, xaxt="n", yaxt="n" )
axis(side =1 , at = tickplaces, labels = Labels)

If you only want to use las, you can also use this as an arument in the axis 
function.

HTH,
Berry

-
Berry Boessenkool
Potsdam
-


> Date: Fri, 8 Jul 2011 13:20:51 +0100
> From: statmailingli...@googlemail.com
> To: r-help@r-project.org
> Subject: [R] Vertical Labels in plot graph - normally working fine but not
> on this graph
> 
> Hello,
> 
> I wonder if someone can elaborate on why in the first graph I am able to set
> labels vertical to the x-axis but not in the second.
> 
> I tried to select the window but it didnt really help.
> 
> 
> Many Thanks
> 
> Paolo
> 
> 
> 
> ExtAvgCWV = rnorm(200)
> ExtAvgDemand = rnorm(200)
> ExtGasDays =   seq(from = as.Date("2010-8-4", "%Y-%m-%d"), along.with =
> ExtAvgCWV, by = "days")
> plot(ExtAvgCWV, ann=FALSE, xaxt="n", yaxt="n" )
> tickplaces <-  seq( from = 1, by = 21, to = length(ExtGasDays))
> Labels = ExtGasDays[tickplaces]
> axis(side =1 , at = tickplaces, labels = Labels)
> par(las = 3)
> 
> windows()
> plot(ExtAvgDemand, ann=FALSE, xaxt="n", yaxt="n" )
> #dev.set(which = 4)
> axis(side =1 , at = tickplaces, labels = Labels)
> par(las = 3)
> 
>   [[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] Return invisible list

2011-07-08 Thread S Ellison
> -Original Message-
> [mailto:r-help-boun...@r-project.org] On Behalf Of francisco.ahued
> Subject: [R] Return invisible list
> 
> x=read.table("data.txt",header=T)
> goa=(x[,3])
> meplot(goa)
> 
> I can see the plot, but I would like to see the values of the 
> x and y axis. 
> 

Something returned as invisible is returned but not printed. 
You just need to catch it in a suitable variable. That's what you do with any 
other function where you want to keep the value: 

 x=read.table("data.txt",header=T)
 goa=(x[,3])
mplist <-  meplot(goa) #assigns the output to a variable called mplist

mplist  #calls the default print method for that object.

If you don't need to keep the values for re-use, putting something in 
parentheses evaluates the expression and returns the result, effectively 
removing the invisibility cloak without explicit assignment.

Example

z<-rnorm(100)
hist( z ) #returns invisible list

but

( hist( z ) ) #additionally displays the output.

S Ellison***
This email and any attachments are confidential. Any use...{{dropped:8}}

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


[R] coxme for random effects only model

2011-07-08 Thread Chang, Yu-Mei
Dear all,

 

I have encountered the following problem where coxme seems to allow
model with only random effect in R 2.11.1 but not in R 2.13.0. Following
is the error message using rat example data. Any comment on this is
appreciated. 

 

In R2.13

> library(coxme)

> rat1 <- coxme(Surv(time, status) ~ rx + (1|litter), rats)

> rat0 <- coxme(Surv(time, status) ~ (1|litter), rats)

Error in coxme.fit(X, Y, strats, offset, init, control, weights =
weights,  : 

  No starting estimate was successful

 

 

In R 2.11.1

> library(coxme)

> rat1 <- coxme(Surv(time, status) ~ rx + (1|litter), rats)

> rat0 <- coxme(Surv(time, status) ~ (1|litter), rats)

> rat0

Cox mixed-effects model fit by maximum likelihood

  Data: rats

  events, n = 40, 150

  Iterations= 22 113 

NULL Integrated Penalized

Log-likelihood -185.6556  -184.8205 -177.8707

 

  Chisqdf   p   AICBIC

Integrated loglik  1.67  1.00 0.19623 -0.33  -2.02

Penalized loglik 15.57 12.03 0.21372 -8.50 -28.82

 

Model:  Surv(time, status) ~ (1 | litter) 

 

Random effects

Group  Variable  Std Dev   Variance 

 litter Intercept 0.6441629 0.4149458

 

Ruby Chang


[[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] Vertical Labels in plot graph - normally working fine but not on this graph

2011-07-08 Thread Paolo Rossi
Hi Berry,

True, it works. Thanks for this and teh general advice. I have been doing
things wrong from day 1 and never realised it!

Cheers,

Paolo


On 8 July 2011 13:43, Berry Boessenkool wrote:

>
>
> Hey Paolo,
>
> you should specify las BEFORE you send the axis command.
> It would also be good to set greater margins, this needs to be set before
> the entire plot, thus in following order:
>
> par(las = 3, mar=c(6,2,2,2))
> plot(ExtAvgCWV, ann=FALSE, xaxt="n", yaxt="n" )
> axis(side =1 , at = tickplaces, labels = Labels)
>
> If you only want to use las, you can also use this as an arument in the
> axis function.
>
> HTH,
> Berry
>
> -
> Berry Boessenkool
> Potsdam
> -
>
>
> > Date: Fri, 8 Jul 2011 13:20:51 +0100
> > From: statmailingli...@googlemail.com
> > To: r-help@r-project.org
> > Subject: [R] Vertical Labels in plot graph - normally working fine but
> noton this graph
>  >
> > Hello,
> >
> > I wonder if someone can elaborate on why in the first graph I am able to
> set
> > labels vertical to the x-axis but not in the second.
> >
> > I tried to select the window but it didnt really help.
> >
> >
> > Many Thanks
> >
> > Paolo
> >
> >
> >
> > ExtAvgCWV = rnorm(200)
> > ExtAvgDemand = rnorm(200)
> > ExtGasDays =   seq(from = as.Date("2010-8-4", "%Y-%m-%d"), along.with =
> > ExtAvgCWV, by = "days")
> > plot(ExtAvgCWV, ann=FALSE, xaxt="n", yaxt="n" )
> > tickplaces <-  seq( from = 1, by = 21, to = length(ExtGasDays))
> > Labels = ExtGasDays[tickplaces]
> > axis(side =1 , at = tickplaces, labels = Labels)
> > par(las = 3)
> >
> > windows()
> > plot(ExtAvgDemand, ann=FALSE, xaxt="n", yaxt="n" )
> > #dev.set(which = 4)
> > axis(side =1 , at = tickplaces, labels = Labels)
> > par(las = 3)
> >
> >   [[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] Vertical Labels in plot graph - normally working fine but not on this graph

2011-07-08 Thread Alexander Engelhardt

Hey,

from what I see, you try to use the par(las=3) function after the plot 
command. You should use it before it, though. Somewhat liek this:


ExtAvgCWV = rnorm(200)
ExtAvgDemand = rnorm(200)
ExtGasDays =   seq(from = as.Date("2010-8-4", "%Y-%m-%d"), along.with =
ExtAvgCWV, by = "days")
op <- par(las = 3)
plot(ExtAvgCWV, ann=FALSE, xaxt="n", yaxt="n" )
tickplaces <-  seq( from = 1, by = 21, to = length(ExtGasDays))
Labels = ExtGasDays[tickplaces]
axis(side =1 , at = tickplaces, labels = Labels)
par(op)

X11() ## windows()
op <- par(las = 3)
plot(ExtAvgDemand, ann=FALSE, xaxt="n", yaxt="n" )
#dev.set(which = 4)
axis(side =1 , at = tickplaces, labels = Labels)
par(op)


Am 08.07.2011 14:20, schrieb Paolo Rossi:

Hello,

I wonder if someone can elaborate on why in the first graph I am able to set
labels vertical to the x-axis but not in the second.

I tried to select the window but it didnt really help.


Many Thanks

Paolo



ExtAvgCWV = rnorm(200)
ExtAvgDemand = rnorm(200)
ExtGasDays =   seq(from = as.Date("2010-8-4", "%Y-%m-%d"), along.with =
ExtAvgCWV, by = "days")
plot(ExtAvgCWV, ann=FALSE, xaxt="n", yaxt="n" )
tickplaces<-  seq( from = 1, by = 21, to = length(ExtGasDays))
Labels = ExtGasDays[tickplaces]
axis(side =1 , at = tickplaces, labels = Labels)
par(las = 3)

windows()
plot(ExtAvgDemand, ann=FALSE, xaxt="n", yaxt="n" )
#dev.set(which = 4)
axis(side =1 , at = tickplaces, labels = Labels)
par(las = 3)


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


Re: [R] vectors cross-product V1 x V2

2011-07-08 Thread Eik Vettorazzi
Hi,
how about this:

mm<-cbind(V1,V2)
xy<-sapply(1:3,function(x)det(mm[-x,])*(2*(x%%2)-1))

#some checks
all.equal(0,as.vector(xy%*%V1))
all.equal(0,as.vector(xy%*%V2))


Am 08.07.2011 08:27, schrieb Bai:
> Hi, everyone,
> 
> I need an efficient way to do vectors cross product in R.
> 
> Set vectors,
> V1 = ai + bj + ck
> V2 = di + ej + fk
> 
> then the cross product is
>   V1 x V2=  (bf - ce) i + (cd - af) j + (ae - bd) k
> 
> 
> As shown here ( http://en.wikipedia.org/wiki/Cross_product ).
> 
> Thanks.
> 
> Best,
> Bai
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790

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

2011-07-08 Thread Prof Brian Ripley
It is a warning: it will fall back to the version used in your 
unstated version of R.  Nothing you show justifies your claim



i can't install the packages


However, most likely you have a problem connecting to the internet at 
all: see the FAQ relevant to your unstated OS or ask your local IT 
help.


On Fri, 8 Jul 2011, Md Mahmudul Haque wrote:


Dear Sir,

When i am trying to set CRAN mirror to install packages, its showing 
the following messages, i can't install the packages



chooseCRANmirror()

Warning message:
In open.connection(con, "r") :
 unable to connect to 'cran.r-project.org' on port 80.

Best regards
Mahmud

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


PLEASE do: we needed the 'at a minimum' information asked for, and a 
complete session transcript showing all the messages.



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

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


Re: [R] How do I overlay two trellis plots of lme fitted lines produced by plot.augPred?

2011-07-08 Thread rwnahhas
Thank you! Exactly what I wanted.

Ramzi

--
View this message in context: 
http://r.789695.n4.nabble.com/How-do-I-overlay-two-trellis-plots-of-lme-fitted-lines-produced-by-plot-augPred-tp3652204p3653988.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] survConcordance with 'counting' type Surv()

2011-07-08 Thread Eleni Rapsomaniki
Dear Prof. Therneau
 
I was impressed to discover that the 'survConcordance' now handles Surv() 
objects in counting format (example below to clarify what I mean). This is not 
documented in the help page for the function. I am very curious to see how a 
c-index is estimated in this case, using just the linear predictors. It was my 
impression that with left truncation the ordering of individuals might change 
over time as the baseline hazard is no longer monotonic. So ordering based on 
just the linear predictors would not be appropriate but risk to t should be 
used (after choosing a t). Am I wrong?
 
 
Example:
 
lung$time2=lung$time/365
lung2=na.omit(lung)

# the usual c-index
fit1 <- coxph(Surv(time, status) ~ ph.ecog+ph.karno+pat.karno+meal.cal+wt.loss 
+ age + sex, lung2)
survConcordance(Surv(time, status) ~predict(fit1), lung2)
 
# and the corresponding c-index for start, stop data (counting)
fit2 <- coxph(Surv(age,age+time2, status) ~ ph.ecog 
+ph.karno+pat.karno+meal.cal+wt.loss + age + sex, lung2)
survConcordance(Surv(time, status) ~predict(fit2), lung2)
 
Many thanks 
Eleni Rapsomaniki
Research Associate
Department of Public Health and Primary Care
University of Cambridge

[[alternative HTML version deleted]]

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


Re: [R] Simple R graph question

2011-07-08 Thread jim holtman
A little more specificity required; sample of the data, do you want
multiple plots each with a single variable, or do you want them all on
one plot as lines/areas/points/etc.  Do you want then broken down by
year, month, or some other way.  It is easy to generate plots once you
know what you want.  Have you looked at the R-Gallery of plots and is
there one there that you like?

On Fri, Jul 8, 2011 at 4:26 AM, ashz  wrote:
> Dear All,
>
> I have several objects (imported from excel via using “xlsx”) with the field
> names: Month/Year, X, Y1, Y2, Y3.
>
> What is the best library/way to generate a graph which will be consist of
> multiple plots (Month/Year) that each contain the X, Y1, Y2, Y3 dataset.
>
> Thanks a lot.
>
> Cheers,
> Asher
>
>
>
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Simple-R-graph-question-tp3653493p3653493.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?

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


[R] Vertical Labels in plot graph - normally working fine but not on this graph

2011-07-08 Thread Paolo Rossi
Hello,

I wonder if someone can elaborate on why in the first graph I am able to set
labels vertical to the x-axis but not in the second.

I tried to select the window but it didnt really help.


Many Thanks

Paolo



ExtAvgCWV = rnorm(200)
ExtAvgDemand = rnorm(200)
ExtGasDays =   seq(from = as.Date("2010-8-4", "%Y-%m-%d"), along.with =
ExtAvgCWV, by = "days")
plot(ExtAvgCWV, ann=FALSE, xaxt="n", yaxt="n" )
tickplaces <-  seq( from = 1, by = 21, to = length(ExtGasDays))
Labels = ExtGasDays[tickplaces]
axis(side =1 , at = tickplaces, labels = Labels)
par(las = 3)

windows()
plot(ExtAvgDemand, ann=FALSE, xaxt="n", yaxt="n" )
#dev.set(which = 4)
axis(side =1 , at = tickplaces, labels = Labels)
par(las = 3)

[[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 Get option prices of first date and expiry date alone

2011-07-08 Thread Subramanian S
i have option prices of 1 month option contract for several days in a csv
file. The data is in chronological order of dates. Within each date, price
quotes for each strike appears (about 30 strikes per month- so there are in
30 rows per day for many days and many months). i want only the quote on the
first date of the month (when the options are introduced) and on the last
Thursday of the month or the previous day if the last Thursday is a holiday
(i.e. the date when the options expire). i want the rows for all strikes for
only these two dates alone (i.e. 30 begin date of each month + 30 rows
expiry date each month) for all months in my data. Please guide.

Subramanian

[[alternative HTML version deleted]]

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


[R] R-help: need help in obtaining training data and predictions for neural networks

2011-07-08 Thread Hafsa Hassan
Dear list,

 

I am new to R and am using it to develop and test my own neural network
codes.

I need some training datasets that have the prediction results that
should (approximately) appear when the datasets are passed through a
good neural network, in order to test whether my code is working
according to standards or not.

Currently I am using nnet() and predict() function in nnet package to
get predictions for datasets like iris or USArrest, and then compare
them with the results of my code. But I need something better for
testing in my project. I have searched a few links for conferences or
workshops for these datasets and their predictions, but they are not
available open source. 

Can someone please help me with a link, or guide me where to look?

 

Thanks,

Hafsa



--
View this message in context: 
http://r.789695.n4.nabble.com/R-help-need-help-in-obtaining-training-data-and-predictions-for-neural-networks-tp3653691p3653691.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

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


[R] Fwd: logistic regression with combination to distributed lag

2011-07-08 Thread meghana kulkarni
Hello all,

I am facing difficulty in deciding how to go about analysis of a situation
explained as follows:

I have two variables Y (response) and X (explanatory)
(There are several other potential candidate explanatory variables, but
right now I am looking at only one variable.)

Y is binary taking values 1 and 0.
X is a continuous variable.

Both variables are observed over a equally spaced time period (say every
day).
moreover, I am suspecting that Y(t) will not only depend on the X(t), but
also X(t-1) ...( or may be till X(t-k))


so I want to construct a model (logistic) :

Y(t) (with logit link)  = alpha + beta1* X(t) + beta2*X(t-1) +.. + e

I was looking at literature and then I found these 'distributed lag' models
which are very much similar what I want to do.
But then, first of all, they are mainly meant for continuous Y ( I haven't
come across the case where they have tried to to that for binary stuff).
And secondly in those cases, intercept is not included in the model
(geometric lag or polynomial lag structure).

Since X(t) is a time series, it is showing lag dependency and hence
contributes to collinearity in the model.
Does the distributed lag structure help removing the collinearity structure?


Else how can I transform the X(t), X(t-1).. so that they will become
independent?
(May I add that deletion of a variable is not the solution for me.)

How do I go about it? Is there any way we can combine logistic regression
with distributed lag structure in explanatory variables?
It will be great if I get directions to do this stuff in R.


thanks in advanced.

-Meghana

[[alternative HTML version deleted]]

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


Re: [R] R-help Digest, Vol 101, Issue 8

2011-07-08 Thread mihalicza . peter
Július 7-től 14-ig irodán kívül vagyok, és az emailjeimet nem érem el.

Sürgős esetben kérem forduljon Kárpáti Edithez (karpati.e...@gyemszi.hu).

Üdvözlettel,
Mihalicza Péter


I will be out of the office from 7 July till 14 July with no access to my 
emails.

In urgent cases please contact Ms. Edit Kárpáti (karpati.e...@gyemszi.hu).

With regards,
Peter Mihalicza

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

2011-07-08 Thread ashz
Dear All,

I have several objects (imported from excel via using “xlsx”) with the field
names: Month/Year, X, Y1, Y2, Y3.

What is the best library/way to generate a graph which will be consist of
multiple plots (Month/Year) that each contain the X, Y1, Y2, Y3 dataset.

Thanks a lot.

Cheers,
Asher




--
View this message in context: 
http://r.789695.n4.nabble.com/Simple-R-graph-question-tp3653493p3653493.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] vectors cross-product V1 x V2

2011-07-08 Thread Bai
Hi, everyone,

I need an efficient way to do vectors cross product in R.

Set vectors,
V1 = ai + bj + ck
V2 = di + ej + fk

then the cross product is
  V1 x V2=  (bf - ce) i + (cd - af) j + (ae - bd) k


As shown here ( http://en.wikipedia.org/wiki/Cross_product ).

Thanks.

Best,
Bai

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


Re: [R] Taking inputs from the user

2011-07-08 Thread Verma, Ankur
Hi Jim,

Thanks for your response. I was actually thinking in terms of an executable 
file which could return the output back to an excel sheet. I was thinking of 
having a small script/executable which would read an excel file get the 
values... Run the modelget the prediction and return the values back to 
the excel. 

But am also interested in the solution you were talking about wherein we setup 
a central server etc.

By the way I'm using Windows XP.

Regards,
Ankur 

-Original Message-
From: jim holtman [mailto:jholt...@gmail.com] 
Sent: Thursday, July 07, 2011 7:44 PM
To: Verma, Ankur
Cc: r-help@r-project.org
Subject: Re: [R] Taking inputs from the user

Give them an Excel spreadsheet that they can fill in the values.  They can then 
send the spreadsheet to you can you can have your R script read the information 
from it and send it back.  You did not mention how they are supposed to"get the 
output".  Do you want to setup a central server that can receive the email, run 
the script and then send back the results?

On Thu, Jul 7, 2011 at 9:38 AM, Verma, Ankur  wrote:
> Hi,
>
> I am currently a new user in R and was working on the randomForest package. I 
> am trying to predict price points using this statistical package. The issue 
> is that I need to setup a tool so that I can give it to Sales Executive who 
> can plug in the necessary variables and get the output. Is there a way to do 
> that ?? They don't have R on their systems and I doubt they are going to 
> install it.
>
> Need urgent help on this.
>
> Thanks,
> Ankur
>
> This e-mail (and any attachments), is confidential and may be 
> privileged. It may be read, copied and used only by intended 
> recipients. Unauthorized access to this e-mail (or attachments) and 
> disclosure or copying of its contents or any action taken in reliance on it 
> is unlawful. Unintended recipients must notify the sender immediately by 
> e-mail/phone & delete it from their system without making any copies or 
> disclosing it to a third person.

>
>        [[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
Data Munger Guru

What is the problem that you are trying to solve?
This e-mail (and any attachments), is confidential and may be privileged. It 
may be read, copied and used only
by intended recipients. Unauthorized access to this e-mail (or attachments) and 
disclosure or copying of its 
contents or any action taken in reliance on it is unlawful. Unintended 
recipients must notify the sender immediately 
by e-mail/phone & delete it from their system without making any copies or 
disclosing it to a third person.


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

2011-07-08 Thread Md Mahmudul Haque
Dear Sir,

When i am trying to set CRAN mirror to install packages, its showing the 
following messages, i can't install the packages

> > > chooseCRANmirror()
Warning message:
In open.connection(con, "r") :
  unable to connect to 'cran.r-project.org' on port 80.

Best regards
Mahmud

[[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] reference on graph theory

2011-07-08 Thread Guilherme Wood

Dear r users,

does anyone have a suggestion of a book on graph theory, which may help 
designing the analysis of neuroimaging resting-states data?

Thanks,
Guilherme

  
[[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] Create simulated data's using mvrnorm

2011-07-08 Thread Uwe Ligges

Not sure if I understand your problem completely.

If so, you could try to run an LDA on the x with y as classlabels 
factor(rep(1:3, each=10)) and see if it can perfectly separate the classes.


Uwe Ligges




On 06.07.2011 17:31, Aparna Sampath wrote:

Hi All

This might be something very trivial but I seem to miss something in the
syntax or logic which makes me keep wandering around the problem without
arriving at a solution.

What I want to do is to simulate a sample data for performing cluster
analysis. I tried to use
x1= mvrnorm(10,rep(0.8,3),diag(3))
x2= mvrnorm(10,rep(0,3),diag(3))
x3= mvrnorm(10,rep(-0.5,3),diag(3))

x=rbind(x1,x2,x3)

I would like use table() to see if the separation is wide apart such that
the first 10 rows of x are clustered together. for eg: when I use table()
and if I get an ouptut like

 1 2  3
1  100  0

2  0 10 0

3  0  0 10


Is there any way to get this kind of output?

Thanks a lot! :)





--
View this message in context: 
http://r.789695.n4.nabble.com/Create-simulated-data-s-using-mvrnorm-tp3649118p3649118.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.


  1   2   >