[R] Help in installing and loading the BradleyTerry add on package in R

2007-09-10 Thread Kalyan Roy \(DEL/MSG\)
How do I install and load the BradleyTerry add on package in R 2.5.1 in
MSWindowsXP environment?

 

Kalyan Roy

Indian Market Research Bureau (IMRB) International

New Delhi, India


[[alternative HTML version deleted]]

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


Re: [R] Help in installing and loading the BradleyTerry add on package in R

2007-09-10 Thread Turner, Heather
However you may also need to install the package brlr, since the
BradleyTerry package depends on this.

For Windows users, it's usually easiest to install packages using the
Packages menu in the RGui - any dependencies are then automatically
installed.

Heather

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jim Lemon
Sent: 10 September 2007 12:07
To: [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Help in installing and loading the BradleyTerry add on
package in R

Kalyan Roy (DEL/MSG) wrote:
 How do I install and load the BradleyTerry add on package in R 2.5.1
in
 MSWindowsXP environment?
 
Hi Kalyan,
If

R CMD INSTALL

doesn't work, you can use WinZip or Zip Reader to unzip the package to:

C:\Program Files\R-2.5.1\library

or whatever your path to the library directory is, and then hand edit 
the packages.html file in:

C:\Program Files\R-2.5.1\doc\html

to include the new package in your HTML listing. This will allow you to 
access the help files and use the package.

Jim

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


Re: [R] Help in installing and loading the BradleyTerry add on package in R

2007-09-10 Thread Jim Lemon
Kalyan Roy (DEL/MSG) wrote:
 How do I install and load the BradleyTerry add on package in R 2.5.1 in
 MSWindowsXP environment?
 
Hi Kalyan,
If

R CMD INSTALL

doesn't work, you can use WinZip or Zip Reader to unzip the package to:

C:\Program Files\R-2.5.1\library

or whatever your path to the library directory is, and then hand edit 
the packages.html file in:

C:\Program Files\R-2.5.1\doc\html

to include the new package in your HTML listing. This will allow you to 
access the help files and use the package.

Jim

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


Re: [R] Help with color coded bar graph

2007-09-08 Thread Jim Lemon
Luis Naver wrote:
 I have a list of observations that are -1, 1 or 0.  I would like to  
 represent them in a horizontal bar color coded based on value like a  
 stacked bar graph. I can achieve this in the form of a png with the  
 following code:
 
 A = floor(runif(10)*3) - 1
 
 png(width=100, height=10)
 par(mar=c(0,0,0,0))
 image(matrix(A), col=grey(c(0.1, 0.5, 0.9)))
 dev.off()
 
 However I would like to do this with one of the standard plotting  
 tools (i.e. barplot) to take advantage of labels and multiple  
 series.  Any help would be appreciated.
 
Hi Luis,
I understood your request as wanting a single horizontal bar with 10 
segments, each colored according to the value of A. If this is correct, 
you might want:

library(plotrix)
plot(1,xlim=c(-1,1),ylim=c(-1,1),xlab=,ylab=,type=n,axes=FALSE)
gradient.rect(-1,-0.1,1,0.1,col=grey(c(0.1,0.5,0.9))[A+2])

Jim

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


Re: [R] help on replacing values

2007-09-07 Thread Gabor Grothendieck
Your columns are factors, not character strings.  Use as.is = TRUE as
an argument to read.table.   Also its a bit dangerous to use T although
not wrong.  Its safer to use TRUE.

On 9/7/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Dear List,

 I have a newbie question. I have read in a data.frame as follows:

  data = read.table(table.txt, header = T)
  data
  X1 X2 X3 X4
 A AB AC AB AC
 B AB AC AA AB
 C AA AB AA AB
 D AA AB AB AC
 E AB AA AA AB
 F AB AA AB AC
 B AB AC AB AA

 I would like to replace AA values by BB in column X2. I have tried
 using replace() with no success, although I am not sure this is the
 right function. This is the code I have used:

 data$X2 - replace(data$X2, data$X2 ==AA,BB)
 Warning message:
 invalid factor level, NAs generated in: `[-.factor`(`*tmp*`, list,
 value = BB)

 What is wrong with the code? How can I get this done? how about
 changing AA values by BB in all 4 columns simultaneously? Actually
 this is a small example dataframe, the real one would have about 1000
 columns.

 Extendind this, I found a similar thread dated July 2006 that used
 replace() on iris dataset, but I have tried reproducing it obtaining
 same warning message

  iris$Species - replace(iris$Species, iris$Species
 == setosa,NewName)
 Warning message:
 invalid factor level, NAs generated in: `[-.factor`(`*tmp*`, list,
 value = NewName)

 Thanks in advance your help,

 David

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


[R] help on replacing values

2007-09-07 Thread darteta001
Dear List,

I have a newbie question. I have read in a data.frame as follows:

 data = read.table(table.txt, header = T)
 data
  X1 X2 X3 X4
A AB AC AB AC
B AB AC AA AB
C AA AB AA AB
D AA AB AB AC
E AB AA AA AB
F AB AA AB AC
B AB AC AB AA

I would like to replace AA values by BB in column X2. I have tried 
using replace() with no success, although I am not sure this is the 
right function. This is the code I have used:

data$X2 - replace(data$X2, data$X2 ==AA,BB)
Warning message:
invalid factor level, NAs generated in: `[-.factor`(`*tmp*`, list, 
value = BB)

What is wrong with the code? How can I get this done? how about 
changing AA values by BB in all 4 columns simultaneously? Actually 
this is a small example dataframe, the real one would have about 1000 
columns.

Extendind this, I found a similar thread dated July 2006 that used 
replace() on iris dataset, but I have tried reproducing it obtaining 
same warning message

 iris$Species - replace(iris$Species, iris$Species 
== setosa,NewName)
Warning message:
invalid factor level, NAs generated in: `[-.factor`(`*tmp*`, list, 
value = NewName)

Thanks in advance your help,

David

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


Re: [R] help on replacing values

2007-09-07 Thread darteta001
Thanks a lot Gabor, that was very helpful. All sorted now!

Best

David

 Your columns are factors, not character strings.  Use as.is = TRUE as
 an argument to read.table.   Also its a bit dangerous to use T 
although
 not wrong.  Its safer to use TRUE.
 
 On 9/7/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Dear List,
 
  I have a newbie question. I have read in a data.frame as follows:
 
   data = read.table(table.txt, header = T)
   data
   X1 X2 X3 X4
  A AB AC AB AC
  B AB AC AA AB
  C AA AB AA AB
  D AA AB AB AC
  E AB AA AA AB
  F AB AA AB AC
  B AB AC AB AA
 
  I would like to replace AA values by BB in column X2. I have tried
  using replace() with no success, although I am not sure this is the
  right function. This is the code I have used:
 
  data$X2 - replace(data$X2, data$X2 ==AA,BB)
  Warning message:
  invalid factor level, NAs generated in: `[-.factor`(`*tmp*`, list,
  value = BB)
 
  What is wrong with the code? How can I get this done? how about
  changing AA values by BB in all 4 columns simultaneously? Actually
  this is a small example dataframe, the real one would have about 
1000
  columns.
 
  Extendind this, I found a similar thread dated July 2006 that used
  replace() on iris dataset, but I have tried reproducing it 
obtaining
  same warning message
 
   iris$Species - replace(iris$Species, iris$Species
  == setosa,NewName)
  Warning message:
  invalid factor level, NAs generated in: `[-.factor`(`*tmp*`, list,
  value = NewName)
 
  Thanks in advance your help,
 
  David
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 with color coded bar graph

2007-09-07 Thread Luis Naver
I have a list of observations that are -1, 1 or 0.  I would like to  
represent them in a horizontal bar color coded based on value like a  
stacked bar graph. I can achieve this in the form of a png with the  
following code:

A = floor(runif(10)*3) - 1

png(width=100, height=10)
par(mar=c(0,0,0,0))
image(matrix(A), col=grey(c(0.1, 0.5, 0.9)))
dev.off()

However I would like to do this with one of the standard plotting  
tools (i.e. barplot) to take advantage of labels and multiple  
series.  Any help would be appreciated.

- Luis Naver

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


Re: [R] Help with color coded bar graph

2007-09-07 Thread Marc Schwartz
On Fri, 2007-09-07 at 12:45 -0700, Luis Naver wrote:
 I have a list of observations that are -1, 1 or 0.  I would like to  
 represent them in a horizontal bar color coded based on value like a  
 stacked bar graph. I can achieve this in the form of a png with the  
 following code:
 
 A = floor(runif(10)*3) - 1
 
 png(width=100, height=10)
 par(mar=c(0,0,0,0))
 image(matrix(A), col=grey(c(0.1, 0.5, 0.9)))
 dev.off()
 
 However I would like to do this with one of the standard plotting  
 tools (i.e. barplot) to take advantage of labels and multiple  
 series.  Any help would be appreciated.
 
 - Luis Naver

How about this:

  barplot(rep(1, length(A)), col = black, space = 0, border = 0)

  barplot(A, col = grey(0.9), space = 0, border = 0, add = TRUE)

The first call sets the plot region to black, ensuring that the x and y
axes are consistent with the second call.

Alternatively, you can use barplot2() in the gplots CRAN package to do
this in a single call, as it has an argument to color the plot region.

HTH,

Marc Schwartz

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


Re: [R] Help with color coded bar graph

2007-09-07 Thread Achim Zeileis
On Fri, 7 Sep 2007, Luis Naver wrote:

 I have a list of observations that are -1, 1 or 0.  I would like to
 represent them in a horizontal bar color coded based on value like a
 stacked bar graph. I can achieve this in the form of a png with the
 following code:

 A = floor(runif(10)*3) - 1

 png(width=100, height=10)
 par(mar=c(0,0,0,0))
 image(matrix(A), col=grey(c(0.1, 0.5, 0.9)))
 dev.off()

If I understand you correctly, you want a sequence of bars with equal 
height and colors coded by A (treated like a factor). So Maybe something 
like
   cA - grey.colors(3)[factor(A)]
   barplot(rep(1, length(A)), col = cA, border = cA)
or
   barplot(rep(1, length(A)), col = cA, border = cA, space = 0,
 xaxs = i, axes = FALSE)
?

hth,
Z


 However I would like to do this with one of the standard plotting
 tools (i.e. barplot) to take advantage of labels and multiple
 series.  Any help would be appreciated.

 - Luis Naver

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


Re: [R] Help with color coded bar graph

2007-09-07 Thread Marc Schwartz
On Fri, 2007-09-07 at 15:07 -0500, Marc Schwartz wrote:
 On Fri, 2007-09-07 at 12:45 -0700, Luis Naver wrote:
  I have a list of observations that are -1, 1 or 0.  I would like to  
  represent them in a horizontal bar color coded based on value like a  
  stacked bar graph. I can achieve this in the form of a png with the  
  following code:
  
  A = floor(runif(10)*3) - 1
  
  png(width=100, height=10)
  par(mar=c(0,0,0,0))
  image(matrix(A), col=grey(c(0.1, 0.5, 0.9)))
  dev.off()
  
  However I would like to do this with one of the standard plotting  
  tools (i.e. barplot) to take advantage of labels and multiple  
  series.  Any help would be appreciated.
  
  - Luis Naver
 
 How about this:
 
   barplot(rep(1, length(A)), col = black, space = 0, border = 0)
 
   barplot(A, col = grey(0.9), space = 0, border = 0, add = TRUE)
 
 The first call sets the plot region to black, ensuring that the x and y
 axes are consistent with the second call.
 
 Alternatively, you can use barplot2() in the gplots CRAN package to do
 this in a single call, as it has an argument to color the plot region.

Actually, here is an easier way:

barplot(rep(1, length(A)), 
col = ifelse(A == 0, black, grey(0.9)), space = 0, border = 0)

Just set 'col' based upon the value in 'A'.

HTH,

Marc

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


Re: [R] Help with color coded bar graph

2007-09-07 Thread Luis Naver
Thanks to all who replied (and very quickly).   Unfortunatly I was  
not clear enough as to my intentions.  My goal is to replicate a  
graph I saw in the work by Perry, Miller and Enright in A comparison  
of methods for the statistical analysis of spatial point patterns in  
plant ecology (http://www.springerlink.com/content/ 
013275pp7376v0hx).  For those without the article here is a copy of  
the graph in question (replicated without permission) http:// 
img511.imageshack.us/img511/8720/barexamplejl8.png.

As you can see in the example, there are several hoizontal bars,  
colored by the values in an array (one for each bar).

I've been thinking of following your examples but setting it to  
stack, such that all the elements would be placed one on top  
another.  While this may work it seems particularly ungraceful.

Again, thanks for the help.

-Luis Naver

On Sep 7, 2007, at 1:21 PM, Marc Schwartz wrote:

 On Fri, 2007-09-07 at 15:07 -0500, Marc Schwartz wrote:
 On Fri, 2007-09-07 at 12:45 -0700, Luis Naver wrote:
 I have a list of observations that are -1, 1 or 0.  I would like to
 represent them in a horizontal bar color coded based on value like a
 stacked bar graph. I can achieve this in the form of a png with the
 following code:

 A = floor(runif(10)*3) - 1

 png(width=100, height=10)
 par(mar=c(0,0,0,0))
 image(matrix(A), col=grey(c(0.1, 0.5, 0.9)))
 dev.off()

 However I would like to do this with one of the standard plotting
 tools (i.e. barplot) to take advantage of labels and multiple
 series.  Any help would be appreciated.

 - Luis Naver

 How about this:

   barplot(rep(1, length(A)), col = black, space = 0, border = 0)

   barplot(A, col = grey(0.9), space = 0, border = 0, add = TRUE)

 The first call sets the plot region to black, ensuring that the x  
 and y
 axes are consistent with the second call.

 Alternatively, you can use barplot2() in the gplots CRAN package  
 to do
 this in a single call, as it has an argument to color the plot  
 region.

 Actually, here is an easier way:

 barplot(rep(1, length(A)),
 col = ifelse(A == 0, black, grey(0.9)), space = 0, border  
 = 0)

 Just set 'col' based upon the value in 'A'.

 HTH,

 Marc



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


Re: [R] Help: how can i build a constrained non-linear model?

2007-09-05 Thread 维娜 缪

Dear all
I try to run the code as follows,
 
test.model-nls(y~exp(A)*(x-PMA)^4+exp(B)*(x-PMA)^2+Const,
data=test,
start=list(A=8,B=5,Const=10,PMA=0),
control=nls.control(maxiter = 50,minFactor=1/1048),
trace=TRUE)
 
But how can i build a selfSart, since i have much data ? 
Thanks for your help first!
Vina
 


From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: Help: how can i build a constrained 
non-linear model?Date: Tue, 4 Sep 2007 07:53:41 +


DearI have a data.frame, and want to fit a constrained non-linear model:data:





x
y

-0.08
20.815

-0.065
19.8128

-0.05
19.1824

-0.03
18.7346

-0.015
18.3129

0.015
18.0269

0.03
18.4715

0.05
18.9517

0.065
19.4184

0.08
20.146

0
18.2947model:y~exp(a)*(x-m)^4+exp(b)*(x-m)^2+const I try to use nls() and set 
start=list(a=1,b=1,c=1,m=1), but which always give me a error message that  
Error in qr.solv(QR.B,cc): singular matrix 'a' in solve. How can i build a 
selfStart? or any suggestion! ThanksRegards,Vina

Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy! Try it! 
_


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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: how can i build a constrained non-linear model?

2007-09-04 Thread 维娜 缪

Dear
I have a data.frame, and want to fit a constrained non-linear model:
data:






x
y

-0.08
20.815

-0.065
19.8128

-0.05
19.1824

-0.03
18.7346

-0.015
18.3129

0.015
18.0269

0.03
18.4715

0.05
18.9517

0.065
19.4184

0.08
20.146

0
18.2947
model:
y~exp(a)*(x-m)^4+exp(b)*(x-m)^2+const
 
I try to use nls() and set start=list(a=1,b=1,c=1,m=1), but which always give 
me a error message that  Error in qr.solv(QR.B,cc): singular matrix 'a' in 
solve. How can i build a selfStart? or any suggestion!
 
ThanksRegards,
Vina
_


[[alternative HTML version deleted]]

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


[R] Help on inverse distribution

2007-09-04 Thread Lisa Hu
Dear All,

I need to use the inverse of some distributions in R for simulation, but I
could not find it, can anyone tell me which package I should install?
thanks

[[alternative HTML version deleted]]

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


Re: [R] Help on inverse distribution

2007-09-04 Thread Lisa Hu
To make it specific, I need to simulation Y with inverse beta distribution,
that is, Y~inverseF(X), where F is the CDF of beta distribution. THANKS

On 9/4/07, Lisa Hu [EMAIL PROTECTED] wrote:

 Dear All,

 I need to use the inverse of some distributions in R for simulation, but I
 could not find it, can anyone tell me which package I should install?
 thanks




[[alternative HTML version deleted]]

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


Re: [R] Help on inverse distribution

2007-09-04 Thread Rolf Turner

On 5/09/2007, at 11:16 AM, Lisa Hu wrote:

 To make it specific, I need to simulation Y with inverse beta  
 distribution,
 that is, Y~inverseF(X), where F is the CDF of beta distribution.  
 THANKS

 On 9/4/07, Lisa Hu [EMAIL PROTECTED] wrote:

 Dear All,

 I need to use the inverse of some distributions in R for  
 simulation, but I
 could not find it, can anyone tell me which package I should install?
 thanks

help.search(distribution)  ?Beta

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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
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 54, Issue 30

2007-08-31 Thread David Duffy
Ron Crump wrote:
 Hi,
 
 I have a dataframe that contains pedigree information;
 that is individual, sire and dam identities as separate
 columns. It also has date of birth.
 
 These identifiers are not numeric, or not sequential.
 
 Obviously, an identifier can appear in one or two columns,
 depending on whether it was a parent or not. These should
 be consistent.
 
 Not all identifiers appear in the individual column - it
 is possible for a parent not to have its own record if its
 parents were not known.
 
 Missing parental (sire and/or dam) identifiers can occur.
 
 I need to export the data for use in another program that
 requires the pedigree to be coded as integers, increasing
 with date of birth (therefore sire and dam always have
 lower identifiers than their offspring) and with missing
 values coded as 0.
 
 How would I go about doing this?


You might look at http://www.qimr.edu.au/davidD/sib-pair.R,
specifically the read.pedigree() and wrlink() functions.  The former is not
very impressive speedwise -- I usually perform these tasks in the
my Sib-pair (Fortran) program, which is on the same webpage.  It will order
the pedigree by generational position, so a DOB is not required to do the sort.

Terry Therneau's kinship package does that ordering, but doesn't include
output routines for the Linkage format.

David Duffy.


| David Duffy (MBBS PhD) ,-_|\
| email: [EMAIL PROTECTED]  ph: INT+61+7+3362-0217 fax: -0101  / *
| Epidemiology Unit, Queensland Institute of Medical Research   \_,-._/
| 300 Herston Rd, Brisbane, Queensland 4029, Australia  GPG 4D0B994A v

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

2007-08-28 Thread Ola Asteman


I got the Warning message below when I tried to load Locfit. What is wrong?

Regards
Ola Asteman

--

R version 2.4.0 (2006-10-03)
Copyright (C) 2006 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

 library(foreign)
 library(mgcv)
This is mgcv 1.3-19
 library(locfit)
Loading required package: akima
Error: package 'akima' could not be loaded
In addition: Warning message:
there is no package called 'akima' in: library(pkg, character.only = TRUE,
logical = TRUE, lib.loc = lib.loc)




--
This e-mail and any attachment may be confidential and may a...{{dropped}}

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


Re: [R] outdated R and package dependencies; was: R Help

2007-08-28 Thread Uwe Ligges


Ola Asteman wrote:
 
 I got the Warning message below when I tried to load Locfit. What is wrong?


Please read the posting guide which suggests to use a sensible subject line.



 Regards
 Ola Asteman
 
 --
 
 R version 2.4.0 (2006-10-03)


It makes sense to upgrade to a recent version of R.



 Copyright (C) 2006 The R Foundation for Statistical Computing
 ISBN 3-900051-07-0
 
 R is free software and comes with ABSOLUTELY NO WARRANTY.
 You are welcome to redistribute it under certain conditions.
 Type 'license()' or 'licence()' for distribution details.
 
 R is a collaborative project with many contributors.
 Type 'contributors()' for more information and
 'citation()' on how to cite R or R packages in publications.
 
 Type 'demo()' for some demos, 'help()' for on-line help, or
 'help.start()' for an HTML browser interface to help.
 Type 'q()' to quit R.
 
 library(foreign)
 library(mgcv)
 This is mgcv 1.3-19
 library(locfit)

How was locfit installed?

   install.packages(locfit, dependencies = TRUE)

should also install the package's dependencies - and you have not all 
installed, among them akima.

Uwe Ligges





 Loading required package: akima
 Error: package 'akima' could not be loaded
 In addition: Warning message:
 there is no package called 'akima' in: library(pkg, character.only = TRUE,
 logical = TRUE, lib.loc = lib.loc)
 
 
 
 --
 This e-mail and any attachment may be confidential and may a...{{dropped}}
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
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

2007-08-28 Thread Henrique Dallazuanna
You don't have installed the akima pakage.

install.packages(akima, dep=T)

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

On 28/08/07, Ola Asteman [EMAIL PROTECTED] wrote:



 I got the Warning message below when I tried to load Locfit. What is
 wrong?

 Regards
 Ola Asteman


 --

 R version 2.4.0 (2006-10-03)
 Copyright (C) 2006 The R Foundation for Statistical Computing
 ISBN 3-900051-07-0

 R is free software and comes with ABSOLUTELY NO WARRANTY.
 You are welcome to redistribute it under certain conditions.
 Type 'license()' or 'licence()' for distribution details.

 R is a collaborative project with many contributors.
 Type 'contributors()' for more information and
 'citation()' on how to cite R or R packages in publications.

 Type 'demo()' for some demos, 'help()' for on-line help, or
 'help.start()' for an HTML browser interface to help.
 Type 'q()' to quit R.

  library(foreign)
  library(mgcv)
 This is mgcv 1.3-19
  library(locfit)
 Loading required package: akima
 Error: package 'akima' could not be loaded
 In addition: Warning message:
 there is no package called 'akima' in: library(pkg, character.only = TRUE,
 logical = TRUE, lib.loc = lib.loc)
 




 --
 This e-mail and any attachment may be confidential and may a...{{dropped}}

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

2007-08-28 Thread Petr PIKAL
[EMAIL PROTECTED] napsal dne 28.08.2007 13:33:13:

 You don't have installed the akima pakage.
 
 install.packages(akima, dep=T)

And wait about two months and update your R version to 2.6.0. Or update 
now to 2.5.1

Regards

Petr


 
 -- 
 Henrique Dallazuanna
 Curitiba-Paraná-Brasil
 25° 25' 40 S 49° 16' 22 O
 
 On 28/08/07, Ola Asteman [EMAIL PROTECTED] wrote:
 
 
 
  I got the Warning message below when I tried to load Locfit. What is
  wrong?
 
  Regards
  Ola Asteman
 
 
  
 
--
 
  R version 2.4.0 (2006-10-03)
  Copyright (C) 2006 The R Foundation for Statistical Computing
  ISBN 3-900051-07-0
 
  R is free software and comes with ABSOLUTELY NO WARRANTY.
  You are welcome to redistribute it under certain conditions.
  Type 'license()' or 'licence()' for distribution details.
 
  R is a collaborative project with many contributors.
  Type 'contributors()' for more information and
  'citation()' on how to cite R or R packages in publications.
 
  Type 'demo()' for some demos, 'help()' for on-line help, or
  'help.start()' for an HTML browser interface to help.
  Type 'q()' to quit R.
 
   library(foreign)
   library(mgcv)
  This is mgcv 1.3-19
   library(locfit)
  Loading required package: akima
  Error: package 'akima' could not be loaded
  In addition: Warning message:
  there is no package called 'akima' in: library(pkg, character.only = 
TRUE,
  logical = TRUE, lib.loc = lib.loc)
  
 
 
 
 
  
--
  This e-mail and any attachment may be confidential and m...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 with aggregate(): tables of means for terms in an mlm

2007-08-28 Thread Michael Friendly
I'm trying to extend some work in the car and heplots packages
that requires getting a table of multivariate means for one
(or later, more) terms in an mlm object.  I can do this for
concrete examples, using aggregate(), but can't figure out how to 
generalize it.  I want to return a result that has the factor-level
combinations as rownames, and the means as the body of the table
(aggregate returns the factors as initial columns).

# Examples: m1  m2 are desired results

  library(car)
  soils.mod - lm(cbind(pH,N,Dens,P,Ca,Mg,K,Na,Conduc) ~ Block + 
Contour*Depth, data=Soils)
  term.names(soils.mod)
[1] (Intercept)   Block Contour   Depth
[5] Contour:Depth
 

  # response variables
  resp- model.response(model.frame(soils.mod))
  # 1-factor means: term=Contour
  m1-aggregate(resp, list(Soils$Contour), mean)
  rownames(m1) - m1[,1]
  ( m1 - m1[,-1] )
   pH   N  Dens PCaMg  KNa Conduc
Depression 4.692 0.08731 1.343 188.2 7.101 8.986 0.3781 5.823  6.946
Slope  4.746 0.10594 1.333 159.4 8.109 8.320 0.4156 6.103  6.964
Top4.570 0.11256 1.272 150.9 8.877 8.088 0.6050 4.872  5.856
 

  # 2-factor means:  term=Contour:Depth
  m2-aggregate(resp, list(Soils$Contour, Soils$Depth), mean)
  rownames(m2) - paste(m2[,1], m2[,2],sep=:)
  ( m2 - m2[,-(1:2)] )
 pH   N   Dens P CaMg  K Na 
Conduc
Depression:0-10  5.353 0.17825 0.9775 333.0 10.685 7.235 0.6250 1.5125 
1.473
Slope:0-10   5.508 0.21900 1.0500 258.0 12.248 7.232 0.6350 1.9900 
2.050
Top:0-10 5.332 0.19550 1.0025 242.8 13.385 6.590 0.8000 0.9225 
1.373
Depression:10-30 4.880 0.08025 1.3575 187.5  7.548 9.635 0.4500 4.6400 
5.480
Slope:10-30  5.283 0.10100 1.3475 160.2  9.515 8.980 0.4800 4.9350 
4.910
Top:10-304.850 0.11750 1.3325 147.5 10.238 8.090 0.6500 2.9800 
3.583
Depression:30-60 4.362 0.05050 1.5350 124.2  5.402 9.918 0.2400 7.5875 
9.393
Slope:30-60  4.268 0.06075 1.5100 114.5  5.877 8.968 0.3000 7.6300 
8.925
Top:30-604.205 0.07950 1.3225 116.2  6.620 8.742 0.5450 6.2975 
7.440
Depression:60-90 4.173 0.04025 1.5025 108.0  4.770 9.157 0.1975 9.5525 
11.438
Slope:60-90  3.927 0.04300 1.4225 105.0  4.798 8.100 0.2475 9.8575 
11.970
Top:60-903.893 0.05775 1.4300  97.0  5.268 8.928 0.4250 9.2900 
11.030
 

Here is the current version of a function that doesn't work, because I
can't supply the factor names to aggregate in the proper way.
Can someone help me make it work?

termMeans.mlm - function( object, term ) {
resp- model.response(model.frame(object))
terms - term.names(soils.mod)
terms - terms[terms != (Intercept)]
factors - strsplit(term, :)
# browser()
means - aggregate(resp, factors, mean)
# rownames(means) - ...
# means - means[, -(1:length(factors)]
}

  termMeans.mlm(soils.mod, Contour)
Error in FUN(X[[1L]], ...) : arguments must have same length

thanks,
-Michael

-- 
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University  Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Streethttp://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA

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


[R] Help on coxph

2007-08-26 Thread Wei Hu
I am new to R. I just installed R2.5.1 in my computer and tried to use
coxph, but it gives me this message:

No documentation for 'coxph' in specified packages and libraries:
you could try 'help.search(coxph)'

can anyone tell me how to install this package? thanks a lot

[[alternative HTML version deleted]]

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


Re: [R] Help on coxph

2007-08-26 Thread Daniel Malter
In the R-surface menu, go to packages - install packages. Select a
server and install the package survival. Then, on the prompt, type:
library(survival)

Then it works. Look up the numerous manual on using R if you need further
help. If that's not the issue, give us more detailed information on the
problem.

Daniel 


PhD Program Strategy
Dept. of Management and Organization
Robert H. Smith School of Business   
University of Maryland
Van Munching Hall   
College Park, MD  20742
www.rhsmith.umd.edu
www.umd.edu

mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Im Auftrag von Wei Hu
Gesendet: Sunday, August 26, 2007 9:49 PM
An: r-help@stat.math.ethz.ch
Betreff: [R] Help on coxph

I am new to R. I just installed R2.5.1 in my computer and tried to use
coxph, but it gives me this message:

No documentation for 'coxph' in specified packages and libraries:
you could try 'help.search(coxph)'

can anyone tell me how to install this package? thanks a lot

[[alternative HTML version deleted]]

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


Re: [R] Help with vector gymnastics

2007-08-23 Thread Eik Vettorazzi
try

5*which(tf)[cumsum(tf)]

Gladwin, Philip schrieb:
 Hello,

 What is the best way of solving this problem?

 answer - ifelse(tf=TRUE, i * 5, previous answer)
 where as an initial condition 
 tf[1] - TRUE


 For example if,
 tf - c(T,F,F,F,T,T,F)
 over i = 1 to 7
 then the output of the function will be
 answer = 5 5 5 5 25 30 30 

 Thank you.

 Phil,

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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
22046 Hamburg

T ++49/40/42803-8243
F ++49/40/42803-7790

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 with vector gymnastics

2007-08-22 Thread Gladwin, Philip
Hello,

What is the best way of solving this problem?

answer - ifelse(tf=TRUE, i * 5, previous answer)
where as an initial condition 
tf[1] - TRUE


For example if,
tf - c(T,F,F,F,T,T,F)
over i = 1 to 7
then the output of the function will be
answer = 5 5 5 5 25 30 30 

Thank you.

Phil,

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


Re: [R] Help with vector gymnastics

2007-08-22 Thread Felix Andrews
library(zoo)
tf - c(T,F,F,F,T,T,F)
i - seq(7)
answer - ifelse(tf, i*5, NA)
answer - na.locf(answer)


On 8/23/07, Gladwin, Philip [EMAIL PROTECTED] wrote:
 Hello,

 What is the best way of solving this problem?

 answer - ifelse(tf=TRUE, i * 5, previous answer)
 where as an initial condition
 tf[1] - TRUE


 For example if,
 tf - c(T,F,F,F,T,T,F)
 over i = 1 to 7
 then the output of the function will be
 answer = 5 5 5 5 25 30 30

 Thank you.

 Phil,

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



-- 
Felix Andrews / 安福立
PhD candidate
Integrated Catchment Assessment and Management Centre
The Fenner School of Environment and Society
The Australian National University (Building 48A), ACT 0200
Beijing Bag, Locked Bag 40, Kingston ACT 2604
http://www.neurofractal.org/felix/
voice:+86_1051404394 (in China)
mobile:+86_13522529265 (in China)
mobile:+61_410400963 (in Australia)
xmpp:[EMAIL PROTECTED]
3358 543D AAC6 22C2 D336  80D9 360B 72DD 3E4C F5D8

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


Re: [R] Help with vector gymnastics

2007-08-22 Thread Erik Iverson
Philip -

I don't know if this is the best way, but it gives you the output you 
want.

Using your tf,

vals - rle(ifelse(tf, 5*which(tf), 0))
vals$values[vals$values == 0] - vals$values[which(vals$values==0) - 1]
inverse.rle(vals)
[1]  5  5  5  5 25 30 30

Gladwin, Philip wrote:
 Hello,
 
 What is the best way of solving this problem?
 
 answer - ifelse(tf=TRUE, i * 5, previous answer)
 where as an initial condition 
 tf[1] - TRUE
 
 
 For example if,
 tf - c(T,F,F,F,T,T,F)
 over i = 1 to 7
 then the output of the function will be
 answer = 5 5 5 5 25 30 30 
 
 Thank you.
 
 Phil,
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 with optimization using GENOUD

2007-08-16 Thread Anup Nandialath
Dear Friends,

I have been trying to learn how to use the derivative free optimization 
algorithms implemented in the package RGENOUD by Mebane and Sekhon. However, it 
does not seem to work for reasons best described as my total ignorance. If 
anybody has experience using this package, it would be really helpful if you 
can point out where I'm making a mistake. 

Thanks in advance

Anup

Sample code attached

library(rgenoud)

nobs - 5000
t.beta - c(0,1,-1)
X - as.matrix(cbind(rep(1, nobs), runif(nobs), runif(nobs))) # Creating the 
design matrix
prodterm - (X%*%t.beta)+rnorm(nrow(X))
Y - as.matrix(ifelse(prodterm0, 0, 1))

# Defining the likelihood function

log.like - function(beta, Y, X)
{
term1 - pnorm(X%*%beta)
term2 - 1-term1
loglik - (sum(Y*log(term1))+sum((1-Y)*log(term2))) # Likelihood function to be 
maximized
}

stval - c(0,0,0)
opt.output - optim(stval,log.like,Y=Y[,1], X=X[,1:3],
hessian=T, method=BFGS, control=c(fnscale=-1,trace=1))
opt.output

### Now using GENOUD gives me errors

genoud.output - genoud(log.like,beta=stval,X=X[,1:3], Y=Y[,1], nvars=3, 
pop.size=3000, max=TRUE)


   
-

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 and Firefox

2007-08-15 Thread Erich Neuwirth
My configuration is  Windows XP, R-2.5.1patched.
My standard browser in Windows is Firefox 2.0.6,
and I am using htmlhelp.
I have problems with starting the browser for displaying help.
help(lm) works as it should when Firefox is already running.
When I do help(lm) and the browser is not yet started,
I get
Error in shell.exec(url) :
'C:\PROGRA~2\R\R-25~1.1\library\stats\html\lm.html' not found
but nevertheless the browser starts and the html file is displayed
some seconds later.

If I try to use help from within a function and the browser is not open,
the browser will not start and therefore help will not be displayed.

Has anybody else experienced the same problem?
Is there a solution?


-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


Re: [R] help and Firefox

2007-08-15 Thread Erich Neuwirth
I found a solution to my problem.
It is describe here.
http://kb.mozillazine.org/Windows_error_opening_Internet_shortcut_or_local_HTML_file_-_Firefox

Essentially, it involves switching off DDE for some file associations
in Windows Explorer.

It really is a Firefox bug.


Erich Neuwirth wrote:
 My configuration is  Windows XP, R-2.5.1patched.
 My standard browser in Windows is Firefox 2.0.6,
 and I am using htmlhelp.
 I have problems with starting the browser for displaying help.
 help(lm) works as it should when Firefox is already running.
 When I do help(lm) and the browser is not yet started,
 I get
 Error in shell.exec(url) :
 'C:\PROGRA~2\R\R-25~1.1\library\stats\html\lm.html' not found
 but nevertheless the browser starts and the html file is displayed
 some seconds later.
 
 If I try to use help from within a function and the browser is not open,
 the browser will not start and therefore help will not be displayed.
 
 Has anybody else experienced the same problem?
 Is there a solution?
 
 


-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


Re: [R] Help with npmc

2007-08-14 Thread Paul Fenner
I cant't seem to get npmc to make a comparison to a control level

summary(npmc(brain), type=BF, control=1)
$`Data-structure`
  group.index class.level nobs
c   1   c   30
l   2   l   30
r   3   r   30

$`Results of the multiple Behrens-Fisher-Test`
  cmpeffect  lower.cl  upper.cl p.value.1s p.value.2s
1 1-2 0.643 0.4610459 0.8256208 0.08595894 0.14750647
2 1-3 0.444 0.2576352 0.6312537 0.99636221 0.75376639
3 2-3 0.328 0.1602449 0.4964218 1. 0.04476692

What elementary error am I making.
Thanks,
Paul

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 with scatterplot3d

2007-08-13 Thread Ryan Briscoe Runquist

Hello,

I am having a bit of trouble with scatterplot3d().

I was able to plot a 3d cloud of points using the following code:

my.3dplot-scatterplot3d(my.coords, pch=19, zlim=c(0,1), scale.y=0.5,
angle=30, box=FALSE)

where my.coords is a data frame that contains x, y, and z coordinates for
grid points whose elevation we sampled.

The problem occurs when I try to add points using points3d.  I tried to
follow the code in the examples of the package pdf.

First, I tried the following code to add all of the points that I wanted:

my.3dplot$points3d(seq(400,600,0.19), seq(600,400,0.295),
seq(800,500,0.24), seq(1000,1400,0.22), seq(1200,600,0.24),
seq(1200,1500,0.28), seq(1300,1400,0.205), seq(1700,500,0.26),
seq(1700,600,0.21), seq(1900,1400,0.255), seq(2300,1400,0.275),
seq(2600,1300,0.225), seq(2700,400,0.235), seq(2700,1300,0.265),
seq(3100,1000,0.135), col=blue, type=h, pch=16)

and got the following error:
Error in seq.default(600, 400, 0.295) : wrong sign in 'by' argument

So I just tried to add the first point using the following code:

my.3dplot$points3d(seq(400,600,0.19), col=blue, type=h, pch=16)

and got the following error message:

Error in xyz.coords(x, y, z) : 'x', 'y' and 'z' lengths differ.

Does anyone know how I can use this function in the scatterplot3d package?

Thanks so much!

Ryan


~~
Ryan D. Briscoe Runquist
Population Biology Graduate Group
University of California, Davis
[EMAIL PROTECTED]

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


Re: [R] help with scatterplot3d

2007-08-13 Thread Duncan Murdoch
On 8/13/2007 3:03 PM, Ryan Briscoe Runquist wrote:
 Hello,
 
 I am having a bit of trouble with scatterplot3d().
 
 I was able to plot a 3d cloud of points using the following code:
 
my.3dplot-scatterplot3d(my.coords, pch=19, zlim=c(0,1), scale.y=0.5,
 angle=30, box=FALSE)
 
 where my.coords is a data frame that contains x, y, and z coordinates for
 grid points whose elevation we sampled.
 
 The problem occurs when I try to add points using points3d.  I tried to
 follow the code in the examples of the package pdf.
 
 First, I tried the following code to add all of the points that I wanted:
 
my.3dplot$points3d(seq(400,600,0.19), seq(600,400,0.295),
 seq(800,500,0.24), seq(1000,1400,0.22), seq(1200,600,0.24),
 seq(1200,1500,0.28), seq(1300,1400,0.205), seq(1700,500,0.26),
 seq(1700,600,0.21), seq(1900,1400,0.255), seq(2300,1400,0.275),
 seq(2600,1300,0.225), seq(2700,400,0.235), seq(2700,1300,0.265),
 seq(3100,1000,0.135), col=blue, type=h, pch=16)

The header to the function (which you can see by evaluating 
my.3dplot$points3d) is

function (x, y = NULL, z = NULL, type = p, ...)

so you are setting x to seq(400,600,0.19), y to seq(600,400,0.295), etc.

I think you probably want

my.3dplot$points3d(x=c(400, 600, ...),
y=c(600, 400, ...),
z=c(0.19, 0.295, ...), ...)

(where the ... is to be filled in by you.)
 
 and got the following error:
 Error in seq.default(600, 400, 0.295) : wrong sign in 'by' argument
 
 So I just tried to add the first point using the following code:
 
my.3dplot$points3d(seq(400,600,0.19), col=blue, type=h, pch=16)
 
 and got the following error message:
 
 Error in xyz.coords(x, y, z) : 'x', 'y' and 'z' lengths differ.
 
 Does anyone know how I can use this function in the scatterplot3d package?

try

my.3dplot$points3d(x=400, y=600, z=0.19, col=blue, type=h, pch=16)

Duncan Murdoch

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


Re: [R] help with scatterplot3d

2007-08-13 Thread Ben Bolker
Ryan Briscoe Runquist rdbriscoe at ucdavis.edu writes:

 
 
 Hello,
 
 I am having a bit of trouble with scatterplot3d().
 
 I was able to plot a 3d cloud of points using the following code:
 
 my.3dplot-scatterplot3d(my.coords, pch=19, zlim=c(0,1), scale.y=0.5,
 angle=30, box=FALSE)
 
 where my.coords is a data frame that contains x, y, and z coordinates for
 grid points whose elevation we sampled.
 
 The problem occurs when I try to add points using points3d.  I tried to
 follow the code in the examples of the package pdf.
 
 First, I tried the following code to add all of the points that I wanted:
 
 my.3dplot$points3d(seq(400,600,0.19), seq(600,400,0.295),
 seq(800,500,0.24), seq(1000,1400,0.22), seq(1200,600,0.24),
 seq(1200,1500,0.28), seq(1300,1400,0.205), seq(1700,500,0.26),
 seq(1700,600,0.21), seq(1900,1400,0.255), seq(2300,1400,0.275),
 seq(2600,1300,0.225), seq(2700,400,0.235), seq(2700,1300,0.265),
 seq(3100,1000,0.135), col=blue, type=h, pch=16)

  I think you probably want:

xvals - c(400,600,800,1000,1200,1200,1300,1700,1700,1900,
2300,2600,2700,2700,3100)
yvals - c(600,400,500,1400,600,1500,1400,500,600,
 1400,1400,1300,400,1300,1000)
zvals - c(0.19,0.295,0.24,0.22,0.24,0.28,0.205,0.26,
   0.21,0.255,0.275,0.225,0.235,0.265,0.135)
my.3dplot$points3d(x=xvals,y=yvals,z=zvals,col=blue,type=h,pch=16)

   Look carefully at ?seq and you may understand what you've
done wrong ...

  Ben Bolker

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


Re: [R] Help using gPath

2007-08-12 Thread hadley wickham
 Here's a partial extract from a sample session after running your code
 (NOTE this is using the development version of R;  grid.ls() does not
 exist in R 2.5.1 or earlier):

 Inspect the grob tree with grid.ls() (similar to Hadley's
 current.grobTree(), but with different formatting) ...

(I'll probably remove current.grobTree as soon as grid.ls makes it to
a released version of R)


   grid.ls()
 plot-surrounds
GRID.cellGrob.118
  background
GRID.cellGrob.119
  plot.gTree.113
background
guide.gTree.90
  background.rect.80
  minor-horizontal.segments.82
  minor-vertical.segments.84
 # OUTPUT TRUNCATED

The format is much nicer than mine!

 ... It is not necessarily obvious which grob is which,
 but a little trial and error (e.g., grid.edit() to change
 the colour of a grob) shows that the border on the first
 panel is 'guide.rect.92', which is a child of 'plot.gTree.113'
 (NOTE the numbers come from a fresh R session).

I will try and rename these grobs so that they are more easily
accessible (and reproducible across multiple calls).  That should make
things easier in the future.

 Use grid.get() to grab that gTree and inspect that
 further using grid.ls(), this time also showing the
 viewports involved ...

What do all the upViewports represent?  Could the downViewports be
incorporating into the same place as the original definition?

 (The remaining code should work for you in your version of R;  it
 is just grid.ls() that is new.)

 Remove the original border rect, ...

   grid.remove(guide.rect.92, global=TRUE)

 ... (need global=TRUE because the border appears twice as a child
 of 'plot.gTree.113' [not sure why that is]) then add some lines that
 only draw the top, right, and bottom borders ...

   grid.add(plot.gTree.113,
 linesGrob(c(0, 1, 1, 0), c(1, 1, 0, 0),
   gp=gpar(col=green),
   vp=vpPath(layout, panel_1_1)))

 ... (I drew the new lines green so that they are easy to see).
 NOTE that in order to put the new lines in the same place as
 the original border, the new lines are added as children of the
 gTree 'plot.gTree.113' and they have a vpPath to make sure
 they get drawn in the right viewport within that gTree.

Do you think it would be worth drawing all these rectangles as lines
to make them easier to edit?

 What would probably be ideal would be a graphical interface to the
 grid.ls()-type information (something like an object explorer) that
 would make it easier to see which object is which and also make it
 easier to add and remove objects.  A nice student project perhaps :)

That would be great!

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

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


Re: [R] Help using gPath

2007-08-11 Thread Paul Murrell
# OUTPUT TRUNCATED

... which shows that 'guide.rect.92' is drawn within the
viewport 'panel_1_1' (which is within the viewport called 'layout').

(The remaining code should work for you in your version of R;  it
is just grid.ls() that is new.)

Remove the original border rect, ...

  grid.remove(guide.rect.92, global=TRUE)

... (need global=TRUE because the border appears twice as a child
of 'plot.gTree.113' [not sure why that is]) then add some lines that
only draw the top, right, and bottom borders ...

  grid.add(plot.gTree.113,
linesGrob(c(0, 1, 1, 0), c(1, 1, 0, 0),
  gp=gpar(col=green),
  vp=vpPath(layout, panel_1_1)))

... (I drew the new lines green so that they are easy to see).
NOTE that in order to put the new lines in the same place as
the original border, the new lines are added as children of the
gTree 'plot.gTree.113' and they have a vpPath to make sure
they get drawn in the right viewport within that gTree.

What would probably be ideal would be a graphical interface to the
grid.ls()-type information (something like an object explorer) that
would make it easier to see which object is which and also make it
easier to add and remove objects.  A nice student project perhaps :)

Paul
-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~paul/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 with cumsum function

2007-08-11 Thread Hectorman Hectorman
Hello!

I have a question regarding the cumsum function that I do not know how to 
solve. Would appreciate help from someone. I have imported data from a 
txtfile with 2 columns. I am interested in the seconds column, which 
contains numbers from i=0 to 40. I would like to count the number of 
instances of the numbers 0 to 40 in the seconds column. My problem is that 
if there are no observations of one number i in the second column cumsum 
skips this in the output.

Below is an example of the output of the argument  Y=cumsum(table(x[,2]))
  0   1   2   3   5 6   789  10  11  12  13  14  15  16  17  18  
19   20   21   22   23   24
  3   5   6  10  13  14  16  18  21  25  27  30  32  35  38  40  42  54 105 
233 306 341 383 417
2526  27  28  2930   31   32  33  34   35   36   37  38   39   40
441 468 487 502 518 532 542 546 552 564 566 574 578 584 591 594

As you can see from the output there are no observations of i=4 in this 
column. Are there any way I could return the following result instead
0   1   2   3   45 6   78  and so on
3   5  6  10  10 13   14  16  18

When i=4 cumsum is the same as when i=3 (10)


I would really appreciate if anyone could help me with this one:)

Jan Moberg

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


Re: [R] Help with cumsum function

2007-08-11 Thread Uwe Ligges


Hectorman Hectorman wrote:
 Hello!
 
 I have a question regarding the cumsum function that I do not know how to 
 solve. Would appreciate help from someone. I have imported data from a 
 txtfile with 2 columns. I am interested in the seconds column, which 
 contains numbers from i=0 to 40. I would like to count the number of 
 instances of the numbers 0 to 40 in the seconds column. My problem is that 
 if there are no observations of one number i in the second column cumsum 
 skips this in the output.
 
 Below is an example of the output of the argument  Y=cumsum(table(x[,2]))
   0   1   2   3   5 6   789  10  11  12  13  14  15  16  17  18  
 19   20   21   22   23   24
   3   5   6  10  13  14  16  18  21  25  27  30  32  35  38  40  42  54 105 
 233 306 341 383 417
 2526  27  28  2930   31   32  33  34   35   36   37  38   39   40
 441 468 487 502 518 532 542 546 552 564 566 574 578 584 591 594
 
 As you can see from the output there are no observations of i=4 in this 
 column. Are there any way I could return the following result instead
 0   1   2   3   45 6   78  and so on
 3   5  6  10  10 13   14  16  18
 
 When i=4 cumsum is the same as when i=3 (10)
 


Y - cumsum(table(factor(x[,2], levels=0:40)))

Uwe Ligges


 I would really appreciate if anyone could help me with this one:)
 
 Jan Moberg
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help using gPath

2007-08-10 Thread Paul Murrell
Hi


Emilio Gagliardi wrote:
 Hi Paul,
 
 I'm sorry for not posting code, I wasn't sure if it would be helpful without
 the data...should I post the code and a sample of the data?  I will remember
 to do that next time!


It's important not only to post code, but also to make sure that other 
people can run it (i.e., include real data or have the code generate 
data or use one of R's predefined data sets).

Also, isn't this next time ? :)


 grid.gedit(gPath(ylabel.text.382), gp=gpar(fontsize=16))
 
 
 OK, I think my confusion comes from the notation that current.grobTree()
 produces and what strings are required in order to make changes to the
 underlying grobs.
 But, from what you've provided, it looks like I can access each grob with
 its unique name, regardless of which parent it is nested in...that helps


Yes.  By default, grid will search the tree of all grobs to find the 
name you provide.  You can even just provide part of the name and it 
will find partial matches (depending on argument settings).  On the 
other hand, by specifying a path that specified parent and child grobs, 
you can make sure you get exactly the grob you want.


 like to remove the left border on the first panel.  I'd like to adjust the


 I'd guess you'd have to remove the grob background.rect.345 and then
 draw in just the sides you want, which would require getting to the
 right viewport, for which you'll need to study the viewport tree (see
 current.vpTree())
 
 
 I did some digging into this and it seems pretty complicated, is there an
 example anywhere that makes sense to the beginner? The whole viewport grob
 relationship is not clear to me. So, accessing viewports and removing
 objects and drawing new ones is beyond me at this point. I can get my mind
 around your example below because I can see the object I want to modify in
 the viewer, and the code changes a property of that object, click enter, and
 bang the object changes.  When you start talking external pointers and
 finding viewports and pushing and popping grobs I just get lost. I found the
 viewports for the grobTree, it looks like this:


There's a book that provides a full explanation and the (basic) grid 
chapter is online (see 
http://www.stat.auckland.ac.nz/~paul/RGraphics/rgraphics.html)


 viewport[ROOT]-(viewport[layout]-(viewport[axis_h_1_1]-(viewport[bottom_axis]-(viewport[labels],
 viewport[ticks])),
 viewport[axis_h_1_2]-(viewport[bottom_axis]-(viewport[labels],
 viewport[ticks])),
 viewport[axis_v_1_1]-(viewport[left_axis]-(viewport[labels],
 viewport[ticks])), viewport[panel_1_1], viewport[panel_1_2],
 viewport[strip_h_1_1], viewport[strip_h_1_2], viewport[strip_v_1_1]))
 
 at that point I was like, ok, I'm done. :S


Yep, the facilities for investigating the viewport and grob tree are 
basically inadequate.  Based on some work Hadley did for ggplot, the 
development version of R has a slightly better tool called grid.ls() 
that can show how the grob tree and the viewport tree intertwine.  That 
would allow you to see which viewport each grob was drawn in, which 
would help you, for example, to know which viewport you had to go to to 
replace a rectangle you want to remove.


 Something like ...

 grid.gedit(geom_bar.rect, gp=gpar(col=green))


 Again, it would really help to have some code to run.
 
 
 My apologies, I thought the grobTree was sufficient in this case.  Thanks
 very much for your help.


Sorry to harp on about it, but if I had your code I could show you an 
example of how grid.ls() might help.

Paul
-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~paul/

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


Re: [R] help with counting how many times each value occur in each column

2007-08-10 Thread François Pinard
[Gabor Grothendieck]

   table(col(mat), mat)

Clever, simple, and elegant! :-)

-- 
François Pinard   http://pinard.progiciels-bpi.ca

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


Re: [R] Help wit matrices

2007-08-10 Thread Ravi Varadhan
An even simpler solution is:

mat2 - 1 * (mat1  0.25)

Ravi.


---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 





-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lanre Okusanya
Sent: Friday, August 10, 2007 2:20 PM
To: jim holtman
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Help wit matrices

that was ridiculously simple. duh.

THanks

Lanre

On 8/10/07, jim holtman [EMAIL PROTECTED] wrote:
 Is this what you want:

  x - matrix(runif(100), 10)
  round(x, 3)
[,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]  [,9] [,10]
  [1,] 0.268 0.961 0.262 0.347 0.306 0.762 0.524 0.062 0.028 0.226
  [2,] 0.219 0.100 0.165 0.131 0.578 0.933 0.317 0.109 0.527 0.131
  [3,] 0.517 0.763 0.322 0.374 0.910 0.471 0.278 0.382 0.880 0.982
  [4,] 0.269 0.948 0.510 0.631 0.143 0.604 0.788 0.169 0.373 0.327
  [5,] 0.181 0.819 0.924 0.390 0.415 0.485 0.702 0.299 0.048 0.507
  [6,] 0.519 0.308 0.511 0.690 0.211 0.109 0.165 0.192 0.139 0.681
  [7,] 0.563 0.650 0.258 0.689 0.429 0.248 0.064 0.257 0.321 0.099
  [8,] 0.129 0.953 0.046 0.555 0.133 0.499 0.755 0.181 0.155 0.119
  [9,] 0.256 0.954 0.418 0.430 0.460 0.373 0.620 0.477 0.132 0.050
 [10,] 0.718 0.340 0.854 0.453 0.943 0.935 0.170 0.771 0.221 0.929
  ifelse(x  .5, 1, 0)
   [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
  [1,]010001100 0
  [2,]000011001 0
  [3,]110010001 1
  [4,]011101100 0
  [5,]011000100 1
  [6,]101100000 1
  [7,]110100000 0
  [8,]010100100 0
  [9,]010000100 0
 [10,]101011010 1


 On 8/10/07, Lanre Okusanya [EMAIL PROTECTED] wrote:
  Hello all,
 
  I am working with a 1000x1000 matrix, and I would like to return a
  1000x1000 matrix that tells me which value in the matrix is greater
  than a theshold value (1 or 0 indicator).
  i have tried
   mat2-as.matrix(as.numeric(mat10.25))
  but that returns a 1:10 matrix.
  I have also tried for loops, but they are grossly inefficient.
 
  THanks for all your help in advance.
 
  Lanre
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 


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

 What is the problem you are trying to solve?


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


Re: [R] Help wit matrices

2007-08-10 Thread John Kane
Will something like this help?

mm - matrix(rnorm(100),nrow=10)
mm
nn  -  mm  .5
nn

--- Lanre Okusanya [EMAIL PROTECTED] wrote:

 Hello all,
 
 I am working with a 1000x1000 matrix, and I would
 like to return a
 1000x1000 matrix that tells me which value in the
 matrix is greater
 than a theshold value (1 or 0 indicator).
 i have tried
   mat2-as.matrix(as.numeric(mat10.25))
 but that returns a 1:10 matrix.
 I have also tried for loops, but they are grossly
 inefficient.
 
 THanks for all your help in advance.
 
 Lanre
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help wit matrices

2007-08-10 Thread Roland Rau
I hope you don't mind that I offer also two solutions. No.1 is really 
bad. No.2 should be on par with the other ones.

Best,
Roland



mydata - matrix(rnorm(10*10), ncol=10)

threshold.value - 1.5

mydata2 - matrix(0, nrow=nrow(mydata), ncol=ncol(mydata))
mydata3 - matrix(0, nrow=nrow(mydata), ncol=ncol(mydata))


### not really the way to go:
for (i in 1:nrow(mydata)) {
   for (j in 1:ncol(mydata)) {
 if (mydata[i,j]threshold.value) {
   mydata2[i,j] - 1
 }
   }
}
### a better way...
mydata3[mydata  threshold.value] - 1
mydata2
mydata3



Lanre Okusanya wrote:
 Hello all,
 
 I am working with a 1000x1000 matrix, and I would like to return a
 1000x1000 matrix that tells me which value in the matrix is greater
 than a theshold value (1 or 0 indicator).
 i have tried
   mat2-as.matrix(as.numeric(mat10.25))
 but that returns a 1:10 matrix.
 I have also tried for loops, but they are grossly inefficient.
 
 THanks for all your help in advance.
 
 Lanre
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help using gPath

2007-08-10 Thread Emilio Gagliardi
haha Paul,


It's important not only to post code, but also to make sure that other
 people can run it (i.e., include real data or have the code generate
 data or use one of R's predefined data sets).


Oh, I hadn't thought of using the predefined datasets, thats a good idea!

Also, isn't this next time ? :)


By next time I meant, when I ask a question in the future, I didn't think
you'd respond!

So here is some code!

library(reshape)
library(ggplot2)

theme_t - list(grid.fill=white,grid.colour=lightgrey,background.colour=
black,axis.colour=dimgrey)
ggtheme(theme_t)

grp -
c(2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3)
time -
c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2)
cc - c(0.7271,0.7563,0.6979,0.8208,0.7521,0.7875,0.7563,0.7771,0.8208,
0.7938,0.8083,0.7188,0.7521,0.7854,0.7979,0.7583,0.7646,0.6938,0.6813,0.7708
,0.7375,0.8104,0.8104,0.7792,0.7833,0.8083,0.8021,0.7313,0.7958,0.7021,
0.8167,0.8167,0.7583,0.7167,0.6563,0.6896,0.7333,0.8208,0.7396,0.8063,0.7083
,0.6708,0.7292,0.7646,0.7667,0.775,0.8021,0.8125,0.7646,0.6917,0.7458,0.7833
,0.7396,0.7229,0.7708,0.7729,0.8083,0.7771,0.6854,0.8417,0.7667,0.7063,0.75,
0.7813,0.8271,0.7896,0.7979,0.625,0.7938,0.7583,0.7396,0.7583,0.7938,0.7333,
0.7875,0.8146)

data - as.data.frame(cbind(time,grp,cc))
data$grp - factor(data$grp,labels=c(Group A,Group B))
data$time - factor(data$time,labels=c(Pre-test,Post-test))
boxplot - qplot(grp, cc, data=data, geom=boxplot,
orientation=horizontal, ylim=c(0.5,1), main=Hello World!, xlab=Label
X, ylab=Label Y, facets=.~time, colour=red, size=2)
boxplot + geom_jitter(aes(colour=steelblue)) + scale_colour_identity() +
scale_size_identity()
grid.gedit(ylabel, gp=gpar(fontsize=16))


 There's a book that provides a full explanation and the (basic) grid
 chapter is online (see
 http://www.stat.auckland.ac.nz/~paul/RGraphics/rgraphics.html)


Awesome, I'll check that out.

Yep, the facilities for investigating the viewport and grob tree are
 basically inadequate.  Based on some work Hadley did for ggplot, the
 development version of R has a slightly better tool called grid.ls()
 that can show how the grob tree and the viewport tree intertwine.  That
 would allow you to see which viewport each grob was drawn in, which
 would help you, for example, to know which viewport you had to go to to
 replace a rectangle you want to remove.


okie dokie, I'm ready to be amazed! hehe.
emilio

[[alternative HTML version deleted]]

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


Re: [R] Help wit matrices

2007-08-10 Thread jim holtman
Is this what you want:

 x - matrix(runif(100), 10)
 round(x, 3)
   [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]  [,9] [,10]
 [1,] 0.268 0.961 0.262 0.347 0.306 0.762 0.524 0.062 0.028 0.226
 [2,] 0.219 0.100 0.165 0.131 0.578 0.933 0.317 0.109 0.527 0.131
 [3,] 0.517 0.763 0.322 0.374 0.910 0.471 0.278 0.382 0.880 0.982
 [4,] 0.269 0.948 0.510 0.631 0.143 0.604 0.788 0.169 0.373 0.327
 [5,] 0.181 0.819 0.924 0.390 0.415 0.485 0.702 0.299 0.048 0.507
 [6,] 0.519 0.308 0.511 0.690 0.211 0.109 0.165 0.192 0.139 0.681
 [7,] 0.563 0.650 0.258 0.689 0.429 0.248 0.064 0.257 0.321 0.099
 [8,] 0.129 0.953 0.046 0.555 0.133 0.499 0.755 0.181 0.155 0.119
 [9,] 0.256 0.954 0.418 0.430 0.460 0.373 0.620 0.477 0.132 0.050
[10,] 0.718 0.340 0.854 0.453 0.943 0.935 0.170 0.771 0.221 0.929
 ifelse(x  .5, 1, 0)
  [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]010001100 0
 [2,]000011001 0
 [3,]110010001 1
 [4,]011101100 0
 [5,]011000100 1
 [6,]101100000 1
 [7,]110100000 0
 [8,]010100100 0
 [9,]010000100 0
[10,]101011010 1


On 8/10/07, Lanre Okusanya [EMAIL PROTECTED] wrote:
 Hello all,

 I am working with a 1000x1000 matrix, and I would like to return a
 1000x1000 matrix that tells me which value in the matrix is greater
 than a theshold value (1 or 0 indicator).
 i have tried
  mat2-as.matrix(as.numeric(mat10.25))
 but that returns a 1:10 matrix.
 I have also tried for loops, but they are grossly inefficient.

 THanks for all your help in advance.

 Lanre

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



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

What is the problem you are trying to solve?

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


Re: [R] help with counting how many times each value occur in each column

2007-08-10 Thread Gabor Grothendieck
Try this where we have constructed the example to illustrate that
it does handle the case where not all values are in each column:

   mat - matrix(rep(1:6, each = 4), 6)

   table(col(mat), mat)

On 8/10/07, Tom Cohen [EMAIL PROTECTED] wrote:
 Dear list,
  I have the following dataset and want to know how many times each value 
 occur in each column.
   data
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
  [1,] -100 -100 -100000000  -100
  [2,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
  [3,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
  [4,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
  [5,] -100 -100 -100 -100 -100 -100 -100 -100 -100   -50
  [6,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
  [7,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
  [8,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
  [9,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [10,] -100 -100 -100  -50 -100 -100 -100 -100 -100  -100
 [11,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [12,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [13,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [14,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [15,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [16,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [17,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [18,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [19,] -100 -100 -100000000  -100
 [20,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
  The result matrix should look like
   -100 0 -50
 [1]   20
 [2]   20
 [3]   20
 [4]   17
 [5]   18
 [6]   18
 [7]   18  and so on
 [8]
 [9]
 [10]

 How can I do this in R ?
  Thanks alot for your help,
 Tom


 -

 Jämför pris på flygbiljetter och hotellrum: 
 http://shopping.yahoo.se/c-169901-resor-biljetter.html
[[alternative HTML version deleted]]


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


Re: [R] Help wit matrices

2007-08-10 Thread Henrique Dallazuanna
mat2-matrix(as.numeric(mat10.25), ncol=1000)
-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

On 10/08/07, Lanre Okusanya [EMAIL PROTECTED] wrote:

 Hello all,

 I am working with a 1000x1000 matrix, and I would like to return a
 1000x1000 matrix that tells me which value in the matrix is greater
 than a theshold value (1 or 0 indicator).
 i have tried
   mat2-as.matrix(as.numeric(mat10.25))
 but that returns a 1:10 matrix.
 I have also tried for loops, but they are grossly inefficient.

 THanks for all your help in advance.

 Lanre

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


Re: [R] help with counting how many times each value occur in each column

2007-08-10 Thread François Pinard
[Tom Cohen]

  I have the following dataset and want to know how many times each value 
 occur in each column.

   data
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] -100 -100 -100000000  -100
 [2,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [3,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [4,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [5,] -100 -100 -100 -100 -100 -100 -100 -100 -100   -50
 [6,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [7,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [8,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [9,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[10,] -100 -100 -100  -50 -100 -100 -100 -100 -100  -100
[11,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[12,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[13,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[14,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[15,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[16,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[17,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[18,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[19,] -100 -100 -100000000  -100
[20,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
  The result matrix should look like
   -100 0 -50
[1]   20  
[2]   20
[3]   20
[4]   17
[5]   18
[6]   18
[7]   18  and so on 
[8] 
[9] 
[10]

Presuming that data is a matrix, one could try a sequence like this:

dataf - factor(data)
dim(dataf) - dim(data)
result - t(apply(dataf, 2, tabulate, nlevels(dataf)))
colnames(result) - levels(dataf)
result

If you want the columns sorted, you might decide the order of the levels 
on the factor() call, or explicitly reorder columns afterwards.

-- 
François Pinard   http://pinard.progiciels-bpi.ca

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 with counting how many times each value occur in each column

2007-08-10 Thread Tom Cohen
Dear list,
  I have the following dataset and want to know how many times each value occur 
in each column.
   data
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] -100 -100 -100000000  -100
 [2,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [3,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [4,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [5,] -100 -100 -100 -100 -100 -100 -100 -100 -100   -50
 [6,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [7,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [8,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [9,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[10,] -100 -100 -100  -50 -100 -100 -100 -100 -100  -100
[11,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[12,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[13,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[14,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[15,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[16,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[17,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[18,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[19,] -100 -100 -100000000  -100
[20,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
  The result matrix should look like
   -100 0 -50
[1]   20  
[2]   20
[3]   20
[4]   17
[5]   18
[6]   18
[7]   18  and so on 
[8] 
[9] 
[10]
  
How can I do this in R ?
  Thanks alot for your help,
Tom

   
-

Jämför pris på flygbiljetter och hotellrum: 
http://shopping.yahoo.se/c-169901-resor-biljetter.html
[[alternative HTML version deleted]]

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


Re: [R] Help wit matrices

2007-08-10 Thread Lanre Okusanya
that was ridiculously simple. duh.

THanks

Lanre

On 8/10/07, jim holtman [EMAIL PROTECTED] wrote:
 Is this what you want:

  x - matrix(runif(100), 10)
  round(x, 3)
[,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]  [,9] [,10]
  [1,] 0.268 0.961 0.262 0.347 0.306 0.762 0.524 0.062 0.028 0.226
  [2,] 0.219 0.100 0.165 0.131 0.578 0.933 0.317 0.109 0.527 0.131
  [3,] 0.517 0.763 0.322 0.374 0.910 0.471 0.278 0.382 0.880 0.982
  [4,] 0.269 0.948 0.510 0.631 0.143 0.604 0.788 0.169 0.373 0.327
  [5,] 0.181 0.819 0.924 0.390 0.415 0.485 0.702 0.299 0.048 0.507
  [6,] 0.519 0.308 0.511 0.690 0.211 0.109 0.165 0.192 0.139 0.681
  [7,] 0.563 0.650 0.258 0.689 0.429 0.248 0.064 0.257 0.321 0.099
  [8,] 0.129 0.953 0.046 0.555 0.133 0.499 0.755 0.181 0.155 0.119
  [9,] 0.256 0.954 0.418 0.430 0.460 0.373 0.620 0.477 0.132 0.050
 [10,] 0.718 0.340 0.854 0.453 0.943 0.935 0.170 0.771 0.221 0.929
  ifelse(x  .5, 1, 0)
   [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
  [1,]010001100 0
  [2,]000011001 0
  [3,]110010001 1
  [4,]011101100 0
  [5,]011000100 1
  [6,]101100000 1
  [7,]110100000 0
  [8,]010100100 0
  [9,]010000100 0
 [10,]101011010 1


 On 8/10/07, Lanre Okusanya [EMAIL PROTECTED] wrote:
  Hello all,
 
  I am working with a 1000x1000 matrix, and I would like to return a
  1000x1000 matrix that tells me which value in the matrix is greater
  than a theshold value (1 or 0 indicator).
  i have tried
   mat2-as.matrix(as.numeric(mat10.25))
  but that returns a 1:10 matrix.
  I have also tried for loops, but they are grossly inefficient.
 
  THanks for all your help in advance.
 
  Lanre
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 


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

 What is the problem you are trying to solve?


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 wit matrices

2007-08-10 Thread Lanre Okusanya
Hello all,

I am working with a 1000x1000 matrix, and I would like to return a
1000x1000 matrix that tells me which value in the matrix is greater
than a theshold value (1 or 0 indicator).
i have tried
  mat2-as.matrix(as.numeric(mat10.25))
but that returns a 1:10 matrix.
I have also tried for loops, but they are grossly inefficient.

THanks for all your help in advance.

Lanre

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


Re: [R] Help wit matrices

2007-08-10 Thread Ted Harding

On 10-Aug-07 18:05:50, Lanre Okusanya wrote:
 Hello all,
 
 I am working with a 1000x1000 matrix, and I would like to return a
 1000x1000 matrix that tells me which value in the matrix is greater
 than a theshold value (1 or 0 indicator).
 i have tried
   mat2-as.matrix(as.numeric(mat10.25))
 but that returns a 1:10 matrix.
 I have also tried for loops, but they are grossly inefficient.
 
 THanks for all your help in advance.
 
 Lanre

Simple-minded, but:

 S-matrix(rnorm(25),nrow=5)
 S
   [,1][,2]   [,3]   [,4]   [,5]
[1,] -0.9283624 -0.44418487  1.1174555  1.9040999 -0.4675796
[2,]  0.2658770 -0.28492642 -1.2271013 -0.5713291  1.8036235
[3,]  0.7010885 -0.42972262  0.7576021  0.3407972 -1.0628487
[4,] -0.2003087  0.87006841  0.6233792 -0.9974902 -0.9104270
[5,]  0.2729014  0.09781886 -1.0004486  1.5987385 -0.4747125
 T-0*S
 T[S0.25] - 1+0*S[S0.25]
 T
 [,1] [,2] [,3] [,4] [,5]
[1,]00110
[2,]10001
[3,]10110
[4,]01100
[5,]10010

Does this work OK for your big matrix?

HTH
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 10-Aug-07   Time: 19:50:37
-- XFMail --

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


Re: [R] help with counting how many times each value occur in eachcolumn

2007-08-10 Thread Gasper Cankar

Tom,

If all values (-100,0,-50) would be in every column then simple

apply(data,2,table)

would work. Even if there aren0t all values in every column you could
correct that and insert additional lines with all values for all columns 
like

data - cbind(data,matrix(ncol=10,nrow=3,rep(c(-100,0,-50),10)))

and then do

apply(data,2,table)-1

to get correct results. But someone on a list can probably make much more
elegant solution.

Bye,

Gasper Cankar, PhD
Researcher
National Examinations Centre
Slovenia

-Original Message-
From: Tom Cohen [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 10, 2007 2:02 PM
To: r-help@stat.math.ethz.ch
Subject: [R] help with counting how many times each value occur in
eachcolumn

Dear list,
  I have the following dataset and want to know how many times each value
occur in each column.
   data
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] -100 -100 -100000000  -100
 [2,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100  
[3,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100  
[4,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
 [5,] -100 -100 -100 -100 -100 -100 -100 -100 -100   -50
 [6,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100  
[7,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100  
[8,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100  
[9,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100 
[10,] -100 -100 -100  -50 -100 -100 -100 -100 -100  -100 
[11,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100 
[12,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100 
[13,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100 
[14,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100 
[15,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100 
[16,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100 
[17,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100 
[18,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
[19,] -100 -100 -100000000  -100
[20,] -100 -100 -100 -100 -100 -100 -100 -100 -100  -100
  The result matrix should look like
   -100 0 -50
[1]   20  
[2]   20
[3]   20
[4]   17
[5]   18
[6]   18
[7]   18  and so on 
[8]
[9]
[10]
  
How can I do this in R ?
  Thanks alot for your help,
Tom

   
-

Jämför pris på flygbiljetter och hotellrum:
http://shopping.yahoo.se/c-169901-resor-biljetter.html
[[alternative HTML version deleted]]

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


[R] Help on R performance using aov function

2007-08-09 Thread Francoise PFIFFELMANN
Hi, 
I’m trying to replace some SAS statistical functions by R (batch calling).
But I’ve seen that calling R in a batch mode (under Unix) takes about 2or 3
times more than SAS software. So it’s a great problem of performance for me.
Here is an extract of the calculation:

stoutput-file(res_oneWayAnova.dat,w); 
cat(Param|F|Prob,file=stoutput,\n); 
for (i in 1:n) { 
p-list_param[[i]] 
aov_-aov(A[,p]~ A[,wafer],data=A); 
anova_-summary(aov_); 
if (!is.na(anova_[[1]][1,5])  anova_[[1]][1,5]=0.0001)
res_aov-cbind(p,anova_[[1]][1,4],0.0001) else
res_aov-cbind(p,anova_[[1]][1,4],anova_[[1]][1,5]); 
cat(res_aov, file=stoutput, append = TRUE,sep = |,\n); 
}; 
close(stoutput); 


A is a data.frame of about (400 lines and 1800 parameters).
I’m a new user of R and I don’t know if it’s a problem in my code or if
there are some tips that I can use to optimise my treatment.

Thanks a lot for your help.

Françoise Pfiffelmann
Engineering Data Analysis Group
--
Crolles2 Alliance
860 rue Jean Monnet
38920 Crolles, France
Tel: +33 438 92 29 84
Email: [EMAIL PROTECTED]

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


Re: [R] Help on R performance using aov function

2007-08-09 Thread Prof Brian Ripley
aov() will handle multiple responses and that would be considerably more 
efficient than running separate fits as you seem to be doing.


Your code is nigh unreadable: please use your spacebar and remove the 
redundant semicolons: `Writing R Extensions' shows you how to tidy up 
your code to make it presentable.  But I think anova_[[1]] is really

coef(summary(aov_)) which is a lot more intelligible.

On Thu, 9 Aug 2007, Francoise PFIFFELMANN wrote:


Hi,
I’m trying to replace some SAS statistical functions by R (batch calling).
But I’ve seen that calling R in a batch mode (under Unix) takes about 2or 3
times more than SAS software. So it’s a great problem of performance for me.
Here is an extract of the calculation:

stoutput-file(res_oneWayAnova.dat,w);
cat(Param|F|Prob,file=stoutput,\n);
for (i in 1:n) {
p-list_param[[i]]
aov_-aov(A[,p]~ A[,wafer],data=A);
anova_-summary(aov_);
if (!is.na(anova_[[1]][1,5])  anova_[[1]][1,5]=0.0001)
res_aov-cbind(p,anova_[[1]][1,4],0.0001) else
res_aov-cbind(p,anova_[[1]][1,4],anova_[[1]][1,5]);
cat(res_aov, file=stoutput, append = TRUE,sep = |,\n);
};
close(stoutput);


A is a data.frame of about (400 lines and 1800 parameters).
I’m a new user of R and I don’t know if it’s a problem in my code or if
there are some tips that I can use to optimise my treatment.

Thanks a lot for your help.

Françoise Pfiffelmann
Engineering Data Analysis Group
--
Crolles2 Alliance
860 rue Jean Monnet
38920 Crolles, France
Tel: +33 438 92 29 84
Email: [EMAIL PROTECTED]

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



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


Re: [R] Help using gPath

2007-08-09 Thread Paul Murrell
Hi


Emilio Gagliardi wrote:
 Hi everyone,I'm trying to figure out how to use gPath and the documentation
 is not very helpful :(
 
 I have the following plot object:
 plot-surrounds::
  background
  plot.gTree.378::
   background
   guide.gTree.355:: (background.rect.345, minor-horizontal.segments.347,
 minor-vertical.segments.349, major-horizontal.segments.351,
 major-vertical.segments.353)
   guide.gTree.356:: (background.rect.345, minor-horizontal.segments.347,
 minor-vertical.segments.349, major-horizontal.segments.351,
 major-vertical.segments.353)
   yaxis.gTree.338::
ticks.segments.321
labels.gTree.335:: (label.text.324, label.text.326, label.text.328,
 label.text.330, label.text.332, label.text.334)
   xaxis.gTree.339::
ticks.segments.309
labels.gTree.315:: (label.text.312, label.text.314)
   xaxis.gTree.340::
ticks.segments.309
labels.gTree.315:: (label.text.312, label.text.314)
   strip.gTree.364:: (background.rect.361, label.text.363)
   strip.gTree.370:: (background.rect.367, label.text.369)
   guide.rect.357
   guide.rect.358
   boxplots.gTree.283::
geom_boxplot.gTree.273:: (GRID.segments.267, GRID.segments.268,
 geom_bar.rect.270, geom_bar.rect.272)
geom_boxplot.gTree.281:: (GRID.segments.275, GRID.segments.276,
 geom_bar.rect.278, geom_bar.rect.280)
   boxplots.gTree.301::
geom_boxplot.gTree.291:: (GRID.segments.285, GRID.segments.286,
 geom_bar.rect.288, geom_bar.rect.290)
geom_boxplot.gTree.299:: (GRID.segments.293, GRID.segments.294,
 geom_bar.rect.296, geom_bar.rect.298)
   geom_jitter.points.303
   geom_jitter.points.305
   guide.rect.357
   guide.rect.358
  ylabel.text.382
  xlabel.text.380
  title


It would be easier to help if we also had the code used to produce this 
plot, but in the meantime ...


 Could someone be so kind and create the proper call to grid.gedit() to
 access a couple of different aspects of this graph?
 I tried:
 grid.gedit(gPath(ylabel.text.382,labels), gp=gpar(fontsize=16)) # error


That is looking for a grob called labels that is the child of a grob 
called ylabel.text.382.  I can see a grob called ylabel.text.382, 
but it has no children.  Try just ...

grid.gedit(gPath(ylabel.text.382), gp=gpar(fontsize=16))


 I'd like to change the margins on the label for the yaxis (not the tick
 marks) to put more space between the label and the tick marks.  I'd also


Margins may be tricky because it likely depends on a layout generated by 
ggplot;   Hadley Wickham may have to help us out with a ggplot argument 
here ... (?)


 like to remove the left border on the first panel.  I'd like to adjust the


I'd guess you'd have to remove the grob background.rect.345 and then 
draw in just the sides you want, which would require getting to the 
right viewport, for which you'll need to study the viewport tree (see 
current.vpTree())


 size of the font for the axis labels independently of the tick marks. I'd


That's the one we've already done, right?


 like to change the color of the lines that make up the boxplots.  Plus, I'd


Something like ...

grid.gedit(geom_bar.rect, gp=gpar(col=green))

...?

Again, it would really help to have some code to run.

Paul


 like to change the margins of the strip labels. If you could show me a
 couple of examples I'm sure I cold get the rest working.
 
 Thanks so much,
 emilio
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~paul/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 with Filtering (interest rates related)

2007-08-09 Thread Bernardo Ribeiro
Dear, r-help,

Long time reader, first time poster,

I'm working on a paper regarding a term structure estimation using the
Kalman Filter Algorithm. The model in question is the Generalized Vasicek,
and since there are coupon-bonds being estimated, I'm supposed to make some
changes on the Kalman Filter.

Does anyone has already used R for these purposes? Any tips?

Does anyone has a Kalman Filter code I could use as a starting point for an
Extended Kalman Filter Approach?

Thanks a lot for the patience and time,

Bernardo Ribeiro

[[alternative HTML version deleted]]

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


Re: [R] Help using gPath

2007-08-09 Thread Emilio Gagliardi
Hi Paul,

I'm sorry for not posting code, I wasn't sure if it would be helpful without
the data...should I post the code and a sample of the data?  I will remember
to do that next time!


 grid.gedit(gPath(ylabel.text.382), gp=gpar(fontsize=16))


OK, I think my confusion comes from the notation that current.grobTree()
produces and what strings are required in order to make changes to the
underlying grobs.
But, from what you've provided, it looks like I can access each grob with
its unique name, regardless of which parent it is nested in...that helps


 like to remove the left border on the first panel.  I'd like to adjust the


 I'd guess you'd have to remove the grob background.rect.345 and then
 draw in just the sides you want, which would require getting to the
 right viewport, for which you'll need to study the viewport tree (see
 current.vpTree())


I did some digging into this and it seems pretty complicated, is there an
example anywhere that makes sense to the beginner? The whole viewport grob
relationship is not clear to me. So, accessing viewports and removing
objects and drawing new ones is beyond me at this point. I can get my mind
around your example below because I can see the object I want to modify in
the viewer, and the code changes a property of that object, click enter, and
bang the object changes.  When you start talking external pointers and
finding viewports and pushing and popping grobs I just get lost. I found the
viewports for the grobTree, it looks like this:

viewport[ROOT]-(viewport[layout]-(viewport[axis_h_1_1]-(viewport[bottom_axis]-(viewport[labels],
viewport[ticks])),
viewport[axis_h_1_2]-(viewport[bottom_axis]-(viewport[labels],
viewport[ticks])),
viewport[axis_v_1_1]-(viewport[left_axis]-(viewport[labels],
viewport[ticks])), viewport[panel_1_1], viewport[panel_1_2],
viewport[strip_h_1_1], viewport[strip_h_1_2], viewport[strip_v_1_1]))

at that point I was like, ok, I'm done. :S


 Something like ...

 grid.gedit(geom_bar.rect, gp=gpar(col=green))


 Again, it would really help to have some code to run.


My apologies, I thought the grobTree was sufficient in this case.  Thanks
very much for your help.

emilio

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 using gPath

2007-08-08 Thread Emilio Gagliardi
Hi everyone,I'm trying to figure out how to use gPath and the documentation
is not very helpful :(

I have the following plot object:
plot-surrounds::
 background
 plot.gTree.378::
  background
  guide.gTree.355:: (background.rect.345, minor-horizontal.segments.347,
minor-vertical.segments.349, major-horizontal.segments.351,
major-vertical.segments.353)
  guide.gTree.356:: (background.rect.345, minor-horizontal.segments.347,
minor-vertical.segments.349, major-horizontal.segments.351,
major-vertical.segments.353)
  yaxis.gTree.338::
   ticks.segments.321
   labels.gTree.335:: (label.text.324, label.text.326, label.text.328,
label.text.330, label.text.332, label.text.334)
  xaxis.gTree.339::
   ticks.segments.309
   labels.gTree.315:: (label.text.312, label.text.314)
  xaxis.gTree.340::
   ticks.segments.309
   labels.gTree.315:: (label.text.312, label.text.314)
  strip.gTree.364:: (background.rect.361, label.text.363)
  strip.gTree.370:: (background.rect.367, label.text.369)
  guide.rect.357
  guide.rect.358
  boxplots.gTree.283::
   geom_boxplot.gTree.273:: (GRID.segments.267, GRID.segments.268,
geom_bar.rect.270, geom_bar.rect.272)
   geom_boxplot.gTree.281:: (GRID.segments.275, GRID.segments.276,
geom_bar.rect.278, geom_bar.rect.280)
  boxplots.gTree.301::
   geom_boxplot.gTree.291:: (GRID.segments.285, GRID.segments.286,
geom_bar.rect.288, geom_bar.rect.290)
   geom_boxplot.gTree.299:: (GRID.segments.293, GRID.segments.294,
geom_bar.rect.296, geom_bar.rect.298)
  geom_jitter.points.303
  geom_jitter.points.305
  guide.rect.357
  guide.rect.358
 ylabel.text.382
 xlabel.text.380
 title

Could someone be so kind and create the proper call to grid.gedit() to
access a couple of different aspects of this graph?
I tried:
grid.gedit(gPath(ylabel.text.382,labels), gp=gpar(fontsize=16)) # error

I'd like to change the margins on the label for the yaxis (not the tick
marks) to put more space between the label and the tick marks.  I'd also
like to remove the left border on the first panel.  I'd like to adjust the
size of the font for the axis labels independently of the tick marks. I'd
like to change the color of the lines that make up the boxplots.  Plus, I'd
like to change the margins of the strip labels. If you could show me a
couple of examples I'm sure I cold get the rest working.

Thanks so much,
emilio

[[alternative HTML version deleted]]

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


[R] help on glmmML

2007-08-07 Thread Fluss
Hello!
I am using glmmML for a logitic regression with random effect.
I use the posterior.mode as an estimate for the random effects.
These can be very different from the estimates obtained using SAS , NLMIXED
in the random with out= option. (all the fixed and standard error of random
effect estimators are almost identical)
Can someone explain to me why is that.

The codes I use:
R:
glmm1-glmmML(mort30 ~ x , data=dat2,cluster=hospital,family=binomial)
print(sort(glmm1$posterior.mode))

SAS:
*

proc* *nlmixed* data*=*dat*;*

eta = b0 + b1*x+ u;

expeta = exp(eta);

p = expeta/(*1*+expeta);

model mort30 ~ binomial(*1*,p);

random u ~ normal(*0*,s2) subject=hospital out=blue;

*run*;
*

proc* *sort* data=blue;by estimate;
*

proc* *print* data=blue;*run*;

**

*THANKS FOR THE HELP*

*RON*

[[alternative HTML version deleted]]

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


[R] help on getting weekday

2007-08-06 Thread Baoqiang Cao
Dear All,

I'd like to know which weekday it is for any given date, such as, what is
the weekday for 2006-06-01? Any help will be highly appreciated.

Best,
Baoqiang

[[alternative HTML version deleted]]

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


Re: [R] help on getting weekday

2007-08-06 Thread Uwe Ligges


Baoqiang Cao wrote:
 Dear All,
 
 I'd like to know which weekday it is for any given date, such as, what is
 the weekday for 2006-06-01? Any help will be highly appreciated.

See ?weekdays

Uwe Ligges




 Best,
 Baoqiang
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help with ROC curve

2007-07-31 Thread gyadav

Hi Ritesh,

may be i can help, but yeah i will try  ? you can reach help to ROCR 
package by 
help.search(ROCR)

What is the structure of your data ? can you give some sample i.e. few 
lines of your dataset ?

To build ROC curve using only PSA(variable) alone of the original cohort
against the ROC of the Model of the original cohort.
what do you intend to do, please clarify more ? it sounds like you have 
been given tutorial, or you are working this for corporate ?

:) cheers





Rithesh M. Mohan [EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED]
07/30/2007 01:06 PM

To
r-help@stat.math.ethz.ch
cc

Subject
[R] help with ROC curve






Hi 

 

I'm new to stats and R, so can you please help me or guide me building
ROC curve in an elaborate way with codes

I loaded ROCR package, but I'm not sure how to use it. 

 

Requirement

To build ROC curve using only PSA(variable) alone of the original cohort
against the ROC of the Model of the original cohort.

 

It would be really great if you could help me with this. 

 

Thanks 

Rithesh M Mohan

 


 [[alternative HTML version deleted]]

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




DISCLAIMER AND CONFIDENTIALITY CAUTION:\ \ This message and ...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 with ROC curve

2007-07-30 Thread Rithesh M. Mohan
Hi 

 

I'm new to stats and R, so can you please help me or guide me building
ROC curve in an elaborate way with codes

I loaded ROCR package, but I'm not sure how to use it. 

 

Requirement

To build ROC curve using only PSA(variable) alone of the original cohort
against the ROC of the Model of the original cohort.

 

It would be really great if you could help me with this. 

 

Thanks 

Rithesh M Mohan

 


[[alternative HTML version deleted]]

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


Re: [R] Help with Dates

2007-07-26 Thread Jeffrey J. Hallman
Are you using the latest version of fame?  1.05 and earlier had a bug in
tisFromCsv that was fixed in 1.08.

Below I show what I get with fame version 1.08.  There is still a problem in
that the frequency-figuring logic appears to think the frequency is bwsunday
(biweekly with weeks ending on Sunday) rather than semimonthly, which would
appear to be a better fit.  That's why the 19860330 observation is getting
filled in with NA's.

Jeff

 Lines - Date  Price Open.Int. Comm.Long Comm.Short net.comm
15-Jan-86 673.25175645 65910  2842537485
31-Jan-86 677.00167350 54060  2712026940
14-Feb-86 680.25157985 37955  2542512530
28-Feb-86 691.75162775 49760  1603033730
14-Mar-86 706.50163495 54120  2799526125
31-Mar-86 709.75164120 54715  3039024325

+ + + + + +  
 boink - tisFromCsv(textConnection(Lines), dateFormat = %d-%b-%y, dateCol = 
 Date, sep = )
 boink
$Price
   [,1]
19860119 673.25
19860202 677.00
19860216 680.25
19860302 691.75
19860316 706.50
19860330 NA
19860413 709.75
class: tis

$Open.Int.
   [,1]
19860119 175645
19860202 167350
19860216 157985
19860302 162775
19860316 163495
19860330 NA
19860413 164120
class: tis

$Comm.Long
  [,1]
19860119 65910
19860202 54060
19860216 37955
19860302 49760
19860316 54120
19860330NA
19860413 54715
class: tis

$Comm.Short
  [,1]
19860119 28425
19860202 27120
19860216 25425
19860302 16030
19860316 27995
19860330NA
19860413 30390
class: tis

$net.comm
  [,1]
19860119 37485
19860202 26940
19860216 12530
19860302 33730
19860316 26125
19860330NA
19860413 24325
class: tis


Gabor Grothendieck [EMAIL PROTECTED] writes:

 On 26 Jul 2007 09:59:31 -0400, Jeffrey J. Hallman [EMAIL PROTECTED] wrote:
  zoo is nice.  'tisFromCsv()' in the fame package is nicer.
 
  Jeff
 
 
 1. What am I doing wrong here?  I only get one data column.
 2. I assume the regularized dates which do not exactly match the input ones
 are intended so as to make this a regularly spaced series.  Is that right?
 3. What is the cause of the warning message?
 4. Why is a list returned with a single component containing the output?
 Thanks.
 
  library(fame)
  Lines -  Date  Price Open.Int. Comm.Long Comm.Short net.comm
 + 15-Jan-86 673.25175645 65910  2842537485
 + 31-Jan-86 677.00167350 54060  2712026940
 + 14-Feb-86 680.25157985 37955  2542512530
 + 28-Feb-86 691.75162775 49760  1603033730
 + 14-Mar-86 706.50163495 54120  2799526125
 + 31-Mar-86 709.75164120 54715  3039024325
 + 
  tisFromCsv(textConnection(Lines), dateFormat = %d-%b-%y, dateCol = 
  Date, sep = )
 [[1]]
[,1]
 19860119 673.25
 19860202 677.00
 19860216 680.25
 19860302 691.75
 19860316 706.50
 19860330 709.75
 class: tis
 
 Warning message:
 number of items to replace is not a multiple of replacement length in:
 x[i] - value
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

-- 
Jeff

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


Re: [R] Help with Dates

2007-07-26 Thread Gabor Grothendieck
Yes, I was using 1.05.  I get the same result as you with 1.08.

On 26 Jul 2007 11:39:41 -0400, Jeffrey J. Hallman [EMAIL PROTECTED] wrote:
 Are you using the latest version of fame?  1.05 and earlier had a bug in
 tisFromCsv that was fixed in 1.08.

 Below I show what I get with fame version 1.08.  There is still a problem in
 that the frequency-figuring logic appears to think the frequency is bwsunday
 (biweekly with weeks ending on Sunday) rather than semimonthly, which would
 appear to be a better fit.  That's why the 19860330 observation is getting
 filled in with NA's.

 Jeff

  Lines - Date  Price Open.Int. Comm.Long Comm.Short net.comm
 15-Jan-86 673.25175645 65910  2842537485
 31-Jan-86 677.00167350 54060  2712026940
 14-Feb-86 680.25157985 37955  2542512530
 28-Feb-86 691.75162775 49760  1603033730
 14-Mar-86 706.50163495 54120  2799526125
 31-Mar-86 709.75164120 54715  3039024325

 + + + + + + 
  boink - tisFromCsv(textConnection(Lines), dateFormat = %d-%b-%y, dateCol 
  = Date, sep = )
  boink
 $Price
   [,1]
 19860119 673.25
 19860202 677.00
 19860216 680.25
 19860302 691.75
 19860316 706.50
 19860330 NA
 19860413 709.75
 class: tis

 $Open.Int.
   [,1]
 19860119 175645
 19860202 167350
 19860216 157985
 19860302 162775
 19860316 163495
 19860330 NA
 19860413 164120
 class: tis

 $Comm.Long
  [,1]
 19860119 65910
 19860202 54060
 19860216 37955
 19860302 49760
 19860316 54120
 19860330NA
 19860413 54715
 class: tis

 $Comm.Short
  [,1]
 19860119 28425
 19860202 27120
 19860216 25425
 19860302 16030
 19860316 27995
 19860330NA
 19860413 30390
 class: tis

 $net.comm
  [,1]
 19860119 37485
 19860202 26940
 19860216 12530
 19860302 33730
 19860316 26125
 19860330NA
 19860413 24325
 class: tis


 Gabor Grothendieck [EMAIL PROTECTED] writes:

  On 26 Jul 2007 09:59:31 -0400, Jeffrey J. Hallman [EMAIL PROTECTED] wrote:
   zoo is nice.  'tisFromCsv()' in the fame package is nicer.
  
   Jeff
 
 
  1. What am I doing wrong here?  I only get one data column.
  2. I assume the regularized dates which do not exactly match the input ones
  are intended so as to make this a regularly spaced series.  Is that 
  right?
  3. What is the cause of the warning message?
  4. Why is a list returned with a single component containing the output?
  Thanks.
 
   library(fame)
   Lines -  Date  Price Open.Int. Comm.Long Comm.Short net.comm
  + 15-Jan-86 673.25175645 65910  2842537485
  + 31-Jan-86 677.00167350 54060  2712026940
  + 14-Feb-86 680.25157985 37955  2542512530
  + 28-Feb-86 691.75162775 49760  1603033730
  + 14-Mar-86 706.50163495 54120  2799526125
  + 31-Mar-86 709.75164120 54715  3039024325
  + 
   tisFromCsv(textConnection(Lines), dateFormat = %d-%b-%y, dateCol = 
   Date, sep = )
  [[1]]
 [,1]
  19860119 673.25
  19860202 677.00
  19860216 680.25
  19860302 691.75
  19860316 706.50
  19860330 709.75
  class: tis
 
  Warning message:
  number of items to replace is not a multiple of replacement length in:
  x[i] - value
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 

 --
 Jeff

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


Re: [R] Help with Dates

2007-07-26 Thread Gabor Grothendieck
On 26 Jul 2007 09:59:31 -0400, Jeffrey J. Hallman [EMAIL PROTECTED] wrote:
 zoo is nice.  'tisFromCsv()' in the fame package is nicer.

 Jeff


1. What am I doing wrong here?  I only get one data column.
2. I assume the regularized dates which do not exactly match the input ones
are intended so as to make this a regularly spaced series.  Is that right?
3. What is the cause of the warning message?
4. Why is a list returned with a single component containing the output?
Thanks.

 library(fame)
 Lines -  Date  Price Open.Int. Comm.Long Comm.Short net.comm
+ 15-Jan-86 673.25175645 65910  2842537485
+ 31-Jan-86 677.00167350 54060  2712026940
+ 14-Feb-86 680.25157985 37955  2542512530
+ 28-Feb-86 691.75162775 49760  1603033730
+ 14-Mar-86 706.50163495 54120  2799526125
+ 31-Mar-86 709.75164120 54715  3039024325
+ 
 tisFromCsv(textConnection(Lines), dateFormat = %d-%b-%y, dateCol = Date, 
 sep = )
[[1]]
   [,1]
19860119 673.25
19860202 677.00
19860216 680.25
19860302 691.75
19860316 706.50
19860330 709.75
class: tis

Warning message:
number of items to replace is not a multiple of replacement length in:
x[i] - value

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


Re: [R] Help with Dates

2007-07-26 Thread Jeffrey J. Hallman
zoo is nice.  'tisFromCsv()' in the fame package is nicer.

Jeff

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 in HMM

2007-07-23 Thread Regina Verghis
Hi all,
 I have a time series data.. Data consist of only the counts. I want to
model it using a two or three
state HMM. I am using J K Lindsey's repeated package. I am not very clear
with the arguments like
mu, cmu.. etc.. How can I substitute the value for these
arguments.Howthe initial estimates are calculate...
Thanking You..
With Regards,
Regina

-- 
[EMAIL PROTECTED]

[[alternative HTML version deleted]]

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


[R] Help on looping problem needed!

2007-07-23 Thread Ing. Michal Kneifl, Ph.D.
I am wondering if someone could help me out with following problem:
I have written a for loop which generates a random normal distribution  
let us say 1000 times.
When the restriction is met (mean0.01), the loop stops, prints  
the mean value and plots a histogram.

for(i in 1:1000) {
a-rnorm(1000,0,.2)
b-abs(mean(a))
if(b.01) next else {print(b);hist(a);break}}

How to reshape the loop when I want to find at least 5 distibutions  
that meet my restriction and save them (assign) under
names R1R5.
Could you help me please?

Michael

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


Re: [R] Help on looping problem needed!

2007-07-23 Thread Dimitris Rizopoulos
try this:

tol - 0.01
mat - matrix(as.numeric(NA), 1000, 5)
k - 1
while(any(is.na(mat))){
x - rnorm(1000, sd = 0.02)
if (abs(mean(x))  tol) {
mat[, k] - x
k - k + 1
}
}

abs(colMeans(mat))
par(mfrow = c(2, 3))
apply(mat, 2, hist)


I hope it helps.

Best,
Dimitris


Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm


- Original Message - 
From: Ing. Michal Kneifl, Ph.D. [EMAIL PROTECTED]
To: Rhelp r-help@stat.math.ethz.ch
Sent: Monday, July 23, 2007 4:40 PM
Subject: [R] Help on looping problem needed!


I am wondering if someone could help me out with following problem:
 I have written a for loop which generates a random normal 
 distribution
 let us say 1000 times.
 When the restriction is met (mean0.01), the loop stops, prints
 the mean value and plots a histogram.

 for(i in 1:1000) {
 a-rnorm(1000,0,.2)
 b-abs(mean(a))
 if(b.01) next else {print(b);hist(a);break}}

 How to reshape the loop when I want to find at least 5 distibutions
 that meet my restriction and save them (assign) under
 names R1R5.
 Could you help me please?

 Michael

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


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

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


Re: [R] Help with Dates

2007-07-23 Thread Hans-Peter
 I am taking an excel dataset and reading it into R using read.table.
 (actually I am dumping the data into a .txt file first and then reading data
 in to R).

If you are on *windows* you could also try my xlsReadWrite package
which contains some datetime functions. Exceldates (e.g. formatted as
dd-mmm-yy) can be read as COleDateTime (floating point) values or as
character strings.  The first one is preferable imo as it avoids a
typecast and it is the type commonly used in OLE automation.

 But how can I subset for multiple periods e.g 00- 05?

Floating point numbers dates can be converted to year-strings with
dateTimeToStr( value, yy ) and then subset as shown in a previous
post. The (paid) pro version contains many more date functions, e.g.
yearOf. Details see
http://treetron.googlepages.com/xls.oledatetimeex.html.

-- 
Regards,
Hans-Peter

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


Re: [R] Help with Dates

2007-07-20 Thread Achim Zeileis
Alex:

 I am taking an excel dataset and reading it into R using read.table.

This sets up a data.frame object. The data you have are probably more
conveniently represented as a time series, storing the date in an
appropriate format, e.g., in class Date.

 (actually I am dumping the data into a .txt file first and then reading data
 in to R).

Then you can do both steps (calling read.table() and transformation to a
time series) in one go using the function read.zoo() from package zoo.

If your text file looks like

 Date  Price Open.Int. Comm.Long Comm.Short net.comm
15-Jan-86 673.25175645 65910  2842537485
31-Jan-86 677.00167350 54060  2712026940
14-Feb-86 680.25157985 37955  2542512530
28-Feb-86 691.75162775 49760  1603033730
14-Mar-86 706.50163495 54120  2799526125
31-Mar-86 709.75164120 54715  3039024325

then you can read it in via
  z - read.zoo(mydata.txt, format = %d-%b-%y, header = TRUE)

Then you can do all sorts of standard things for time series, such as
  plot(z)
or...

 The dataset runs from 1986 to 2007.

 I want to be able to take subsets of my data based on date e.g. data between
 2000 - 2005.

...subsetting

  z2 - window(z, start = as.Date(2000-01-01), end = as.Date(2005-12-31))

etc. Look at the zoo package vignettes for more information
  vignette(zoo-quickref, package = zoo)
  vignette(zoo, package = zoo)

hth,
Z

 As it stands, I can't work with the dates as they are not in correct format.

 I tried successfully converting the dates to just the year using:

 transform(data, Yr = format(as.Date(as.character(Date),format = '%d-%b-%y'),
 %y)))

 This gives the following format:

Date  Price Open.Int. Comm.Long Comm.Short net.comm Yr
 1 15-Jan-86 673.25175645 65910  2842537485 86
 2 31-Jan-86 677.00167350 54060  2712026940 86
 3 14-Feb-86 680.25157985 37955  2542512530 86
 4 28-Feb-86 691.75162775 49760  1603033730 86
 5 14-Mar-86 706.50163495 54120  2799526125 86
 6 31-Mar-86 709.75164120 54715  3039024325 86

 I can subset for a single year e.g:

 head(subset(df, Yr ==00)

 But how can I subset for multiple periods e.g 00- 05? The following won't
 work:

 head(subset(df, Yr ==00  Yr==01)

 or

 head(subset(df, Yr = c(00,01,02,03)

 I can't help but feeling that I am missing something and there is a simpler
 route.

 I leafed through R newletter 4.1 which deals with dates and times but it
 seemed that strptime and POSIXct / POSIXlt are not what I need either.

 Can anybody help me?

 Regards


 Alex

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


Re: [R] help with heatmap - how to remove annoying X before numeric values?

2007-07-19 Thread Suzanne Matthews
Sorry, I just realized I didn't send this to the list! (See below)

Thanks for all the help! All is working fine now.

If anyone knows of a more straightforward way to change the Value string
for the Key, please let me know (just to satisfy my curiosity).  I got it to
work by modifying the source code (specifically, heatmap.2.R  in the
gplots package).

However, before, I didn't make the call
source(heatmap.2.R)

before I called
source(mysillyheatmap.R)

Making the additional call to  heatmap.2.R fixed everything.

Thanks again for all your help!



On 7/19/07, Suzanne Matthews [EMAIL PROTECTED] wrote:

 Thank you all for your prompt replies! The check.names=FALSE parameter
 fixed things entirely.

 One more question:

 Is there a straightforward way to modify the the Values string that
 labels the key to a user-defined value? For example, let's say I want to
 change Values to Silly Values. So far, what I have found that I need to
 do is actually go and change a static string in the source code. Is there a
 more direct way?

 Also, after I make the source code change (in gplots package, file:
 heatmap.2.R), how do I have R build from that? If I remember correctly, if
 I put the new heatmap.2.R in my directory, R is supposed to check for
 functions and such there before it goes and builds it from the main source
 code base (located at /usr/bin/R). I am a touch confused on which directory
 is my directory, where R will check first. I tried putting the modified
 heatmap.2.R file in the directory that my script is, and where I initially
 run R. But that didn't work!

 Is there anything that I should add to my R script that will force it to
 read from that from my directory? If not, which directory should I place
 this in?

 My OS is OS X, so I think Unix-based instructions will work.

 Thank you once again for your time and patience!

 Sincerely,
 Suzanne

 On 7/18/07, Moshe Olshansky [EMAIL PROTECTED] wrote:
 
  I was right saying that my solution was not the best
  possible!
 
  --- Prof Brian Ripley [EMAIL PROTECTED] wrote:
 
   read.table('temp.txt', check.names = FALSE)
  
   would be easier (and more general, since make.names
   can do more than
   prepend an 'X').
  
   On Wed, 18 Jul 2007, Moshe Olshansky wrote:
  
Hi Suzanne,
   
My solution (which I am sure is not the best)
   would
be:
   
heat - read.table('temp.txt')
heat
 X1905 X1910 X1950 X1992 X2011 X2020
Gnat   0.08  0.29  0.29  0.37  0.39  0.43
Snake  0.16  0.34  0.32  0.40  0.41  0.53
Bat0.40  0.54  0.52  0.60  0.60  0.63
Cat0.16  0.27  0.29  0.39  0.37  0.41
Dog0.43  0.54  0.52  0.61  0.60  0.62
Lynx   0.50  0.57  0.54  0.59  0.50  0.59
a-names(heat)
b-strsplit(a,split=X)
w-unlist(b)
w
[1]  1905  1910  1950 
1992  2011  2020
z - w[seq(2,length(w),by=2)]
z
[1] 1905 1910 1950 1992 2011 2020
names(heat) - z
heat
 1905 1910 1950 1992 2011 2020
Gnat  0.08 0.29 0.29 0.37 0.39 0.43
Snake 0.16 0.34 0.32 0.40 0.41 0.53
Bat   0.40 0.54 0.52 0.60 0.60 0.63
Cat   0.16 0.27 0.29 0.39 0.37 0.41
Dog   0.43 0.54 0.52 0.61 0.60 0.62
Lynx  0.50 0.57 0.54 0.59 0.50 0.59
   
   
Regards,
   
Moshe.
   
--- Suzanne Matthews
   [EMAIL PROTECTED]
wrote:
   
Hello All,
   
I have a simple question based on how things are
labeled on my heat map;
particularly, there is this annoying X that
appears before the numeric
value of all the labels of my columns.
   
Let's say I have the following silly data, stored
   in
temp.txt
19051910195019922011
   2020
Gnat0.080.290.290.370.39
   0.43
Snake   0.160.340.320.400.41
   0.53
Bat 0.400.540.520.60 0.60
   0.63
Cat 0.160.270.290.390.37
   0.41
Dog 0.430.540.520.610.60
   0.62
Lynx0.500.570.540.59 0.5
   0.59
   
I use the following commands to generate my
   heatmap:
heat - read.table('temp.txt')
x - as.matrix(heat)
   
heatmap.2(x, keysize=1.2, dendrogram=none,
trace=none, Colv = FALSE,
main = Silly Data, labCol=
NULL, margin=c(7,8))
   
This generates a very nice heatmap, but there is
   one
thing I have an issue
with: How do I get rid of the 'X' that seems to
   come
automatically before my
numeric column values? I just want those columns
   to
be labeled 1905, 1910,
1950, and so on. I cannot find anything in the
heatmap.2 documentation that
suggests how I should do this.
   
Thank you very much for your time, and patience
   in
reading this!
   
Sincerely,
Suzanne
   
   [[alternative HTML version deleted]]
   
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read

Re: [R] help with heatmap - how to remove annoying X before numeric values?

2007-07-19 Thread Gabor Grothendieck
 - read.table('temp.txt')
 x - as.matrix(heat)

 heatmap.2(x, keysize=1.2, dendrogram=none,
 trace=none, Colv = FALSE,
 main = Silly Data, labCol=
 NULL, margin=c(7,8))

 This generates a very nice heatmap, but there is
one
 thing I have an issue
 with: How do I get rid of the 'X' that seems to
come
 automatically before my
 numeric column values? I just want those columns
to
 be labeled 1905, 1910,
 1950, and so on. I cannot find anything in the
 heatmap.2 documentation that
 suggests how I should do this.

 Thank you very much for your time, and patience
in
 reading this!

 Sincerely,
 Suzanne

[[alternative HTML version deleted]]

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

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

[[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 with Dates

2007-07-19 Thread Alex Park
R 

I am taking an excel dataset and reading it into R using read.table.
(actually I am dumping the data into a .txt file first and then reading data
in to R).

Here is snippet:

 head(data); 
   Date  Price Open.Int. Comm.Long Comm.Short net.comm
1 15-Jan-86 673.25175645 65910  2842537485
2 31-Jan-86 677.00167350 54060  2712026940
3 14-Feb-86 680.25157985 37955  2542512530
4 28-Feb-86 691.75162775 49760  1603033730
5 14-Mar-86 706.50163495 54120  2799526125
6 31-Mar-86 709.75164120 54715  3039024325

The dataset runs from 1986 to 2007.

I want to be able to take subsets of my data based on date e.g. data between
2000 - 2005.

As it stands, I can't work with the dates as they are not in correct format.

I tried successfully converting the dates to just the year using:

transform(data, Yr = format(as.Date(as.character(Date),format = '%d-%b-%y'),
%y)))

This gives the following format:

   Date  Price Open.Int. Comm.Long Comm.Short net.comm Yr
1 15-Jan-86 673.25175645 65910  2842537485 86
2 31-Jan-86 677.00167350 54060  2712026940 86
3 14-Feb-86 680.25157985 37955  2542512530 86
4 28-Feb-86 691.75162775 49760  1603033730 86
5 14-Mar-86 706.50163495 54120  2799526125 86
6 31-Mar-86 709.75164120 54715  3039024325 86

I can subset for a single year e.g:

head(subset(df, Yr ==00)

But how can I subset for multiple periods e.g 00- 05? The following won't
work:

head(subset(df, Yr ==00  Yr==01)

or

head(subset(df, Yr = c(00,01,02,03)

I can't help but feeling that I am missing something and there is a simpler
route.

I leafed through R newletter 4.1 which deals with dates and times but it
seemed that strptime and POSIXct / POSIXlt are not what I need either.

Can anybody help me?

Regards


Alex

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


Re: [R] Help with Dates

2007-07-19 Thread jim holtman
Try some of the following:

head(subset(df, Yr %in% c(00,01,02,03)))

subset(df, (Yr = '00')  (Yr = '03'))  # same as above

subset(df, (Yr == '00') | (Yr == '01') | (Yr == '02') |(Yr == '03'))  # same


On 7/19/07, Alex Park [EMAIL PROTECTED] wrote:
 R

 I am taking an excel dataset and reading it into R using read.table.
 (actually I am dumping the data into a .txt file first and then reading data
 in to R).

 Here is snippet:

  head(data);
   Date  Price Open.Int. Comm.Long Comm.Short net.comm
 1 15-Jan-86 673.25175645 65910  2842537485
 2 31-Jan-86 677.00167350 54060  2712026940
 3 14-Feb-86 680.25157985 37955  2542512530
 4 28-Feb-86 691.75162775 49760  1603033730
 5 14-Mar-86 706.50163495 54120  2799526125
 6 31-Mar-86 709.75164120 54715  3039024325

 The dataset runs from 1986 to 2007.

 I want to be able to take subsets of my data based on date e.g. data between
 2000 - 2005.

 As it stands, I can't work with the dates as they are not in correct format.

 I tried successfully converting the dates to just the year using:

 transform(data, Yr = format(as.Date(as.character(Date),format = '%d-%b-%y'),
 %y)))

 This gives the following format:

   Date  Price Open.Int. Comm.Long Comm.Short net.comm Yr
 1 15-Jan-86 673.25175645 65910  2842537485 86
 2 31-Jan-86 677.00167350 54060  2712026940 86
 3 14-Feb-86 680.25157985 37955  2542512530 86
 4 28-Feb-86 691.75162775 49760  1603033730 86
 5 14-Mar-86 706.50163495 54120  2799526125 86
 6 31-Mar-86 709.75164120 54715  3039024325 86

 I can subset for a single year e.g:

 head(subset(df, Yr ==00)

 But how can I subset for multiple periods e.g 00- 05? The following won't
 work:

 head(subset(df, Yr ==00  Yr==01)

 or

 head(subset(df, Yr = c(00,01,02,03)

 I can't help but feeling that I am missing something and there is a simpler
 route.

 I leafed through R newletter 4.1 which deals with dates and times but it
 seemed that strptime and POSIXct / POSIXlt are not what I need either.

 Can anybody help me?

 Regards


 Alex

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



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

What is the problem you are trying to solve?

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 with heatmap - how to remove annoying X before numeric values?

2007-07-18 Thread Suzanne Matthews
Hello All,

I have a simple question based on how things are labeled on my heat map;
particularly, there is this annoying X that appears before the numeric
value of all the labels of my columns.

Let's say I have the following silly data, stored in temp.txt
190519101950199220112020
Gnat0.080.290.290.370.390.43
Snake   0.160.340.320.400.410.53
Bat 0.400.540.520.600.600.63
Cat 0.160.270.290.390.370.41
Dog 0.430.540.520.610.600.62
Lynx0.500.570.540.590.5 0.59

I use the following commands to generate my heatmap:
heat - read.table('temp.txt')
x - as.matrix(heat)

heatmap.2(x, keysize=1.2, dendrogram=none, trace=none, Colv = FALSE,
main = Silly Data, labCol=
NULL, margin=c(7,8))

This generates a very nice heatmap, but there is one thing I have an issue
with: How do I get rid of the 'X' that seems to come automatically before my
numeric column values? I just want those columns to be labeled 1905, 1910,
1950, and so on. I cannot find anything in the heatmap.2 documentation that
suggests how I should do this.

Thank you very much for your time, and patience in reading this!

Sincerely,
Suzanne

[[alternative HTML version deleted]]

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


Re: [R] help with heatmap - how to remove annoying X before numeric values?

2007-07-18 Thread Gabor Grothendieck
read.table is doing that, not heatmap.2.  Use
   read.table(temp.txt, header = TRUE, check.names = FALSE)

On 7/18/07, Suzanne Matthews [EMAIL PROTECTED] wrote:
 Hello All,

 I have a simple question based on how things are labeled on my heat map;
 particularly, there is this annoying X that appears before the numeric
 value of all the labels of my columns.

 Let's say I have the following silly data, stored in temp.txt
190519101950199220112020
 Gnat0.080.290.290.370.390.43
 Snake   0.160.340.320.400.410.53
 Bat 0.400.540.520.600.600.63
 Cat 0.160.270.290.390.370.41
 Dog 0.430.540.520.610.600.62
 Lynx0.500.570.540.590.5 0.59

 I use the following commands to generate my heatmap:
 heat - read.table('temp.txt')
 x - as.matrix(heat)

 heatmap.2(x, keysize=1.2, dendrogram=none, trace=none, Colv = FALSE,
 main = Silly Data, labCol=
 NULL, margin=c(7,8))

 This generates a very nice heatmap, but there is one thing I have an issue
 with: How do I get rid of the 'X' that seems to come automatically before my
 numeric column values? I just want those columns to be labeled 1905, 1910,
 1950, and so on. I cannot find anything in the heatmap.2 documentation that
 suggests how I should do this.

 Thank you very much for your time, and patience in reading this!

 Sincerely,
 Suzanne

[[alternative HTML version deleted]]

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


Re: [R] help with heatmap - how to remove annoying X before numeric values?

2007-07-18 Thread Moshe Olshansky
Hi Suzanne,

My solution (which I am sure is not the best) would
be:

 heat - read.table('temp.txt')
 heat
  X1905 X1910 X1950 X1992 X2011 X2020
Gnat   0.08  0.29  0.29  0.37  0.39  0.43
Snake  0.16  0.34  0.32  0.40  0.41  0.53
Bat0.40  0.54  0.52  0.60  0.60  0.63
Cat0.16  0.27  0.29  0.39  0.37  0.41
Dog0.43  0.54  0.52  0.61  0.60  0.62
Lynx   0.50  0.57  0.54  0.59  0.50  0.59
 a-names(heat)
 b-strsplit(a,split=X)
 w-unlist(b)
 w
 [1]  1905  1910  1950 
1992  2011  2020
 z - w[seq(2,length(w),by=2)]
 z
[1] 1905 1910 1950 1992 2011 2020
 names(heat) - z
 heat
  1905 1910 1950 1992 2011 2020
Gnat  0.08 0.29 0.29 0.37 0.39 0.43
Snake 0.16 0.34 0.32 0.40 0.41 0.53
Bat   0.40 0.54 0.52 0.60 0.60 0.63
Cat   0.16 0.27 0.29 0.39 0.37 0.41
Dog   0.43 0.54 0.52 0.61 0.60 0.62
Lynx  0.50 0.57 0.54 0.59 0.50 0.59
 

Regards,

Moshe.

--- Suzanne Matthews [EMAIL PROTECTED]
wrote:

 Hello All,
 
 I have a simple question based on how things are
 labeled on my heat map;
 particularly, there is this annoying X that
 appears before the numeric
 value of all the labels of my columns.
 
 Let's say I have the following silly data, stored in
 temp.txt
 190519101950199220112020
 Gnat0.080.290.290.370.390.43
 Snake   0.160.340.320.400.410.53
 Bat 0.400.540.520.600.600.63
 Cat 0.160.270.290.390.370.41
 Dog 0.430.540.520.610.600.62
 Lynx0.500.570.540.590.5 0.59
 
 I use the following commands to generate my heatmap:
 heat - read.table('temp.txt')
 x - as.matrix(heat)
 
 heatmap.2(x, keysize=1.2, dendrogram=none,
 trace=none, Colv = FALSE,
 main = Silly Data, labCol=
 NULL, margin=c(7,8))
 
 This generates a very nice heatmap, but there is one
 thing I have an issue
 with: How do I get rid of the 'X' that seems to come
 automatically before my
 numeric column values? I just want those columns to
 be labeled 1905, 1910,
 1950, and so on. I cannot find anything in the
 heatmap.2 documentation that
 suggests how I should do this.
 
 Thank you very much for your time, and patience in
 reading this!
 
 Sincerely,
 Suzanne
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help with heatmap - how to remove annoying X before numeric values?

2007-07-18 Thread Prof Brian Ripley
read.table('temp.txt', check.names = FALSE)

would be easier (and more general, since make.names can do more than 
prepend an 'X').

On Wed, 18 Jul 2007, Moshe Olshansky wrote:

 Hi Suzanne,

 My solution (which I am sure is not the best) would
 be:

 heat - read.table('temp.txt')
 heat
  X1905 X1910 X1950 X1992 X2011 X2020
 Gnat   0.08  0.29  0.29  0.37  0.39  0.43
 Snake  0.16  0.34  0.32  0.40  0.41  0.53
 Bat0.40  0.54  0.52  0.60  0.60  0.63
 Cat0.16  0.27  0.29  0.39  0.37  0.41
 Dog0.43  0.54  0.52  0.61  0.60  0.62
 Lynx   0.50  0.57  0.54  0.59  0.50  0.59
 a-names(heat)
 b-strsplit(a,split=X)
 w-unlist(b)
 w
 [1]  1905  1910  1950 
 1992  2011  2020
 z - w[seq(2,length(w),by=2)]
 z
 [1] 1905 1910 1950 1992 2011 2020
 names(heat) - z
 heat
  1905 1910 1950 1992 2011 2020
 Gnat  0.08 0.29 0.29 0.37 0.39 0.43
 Snake 0.16 0.34 0.32 0.40 0.41 0.53
 Bat   0.40 0.54 0.52 0.60 0.60 0.63
 Cat   0.16 0.27 0.29 0.39 0.37 0.41
 Dog   0.43 0.54 0.52 0.61 0.60 0.62
 Lynx  0.50 0.57 0.54 0.59 0.50 0.59


 Regards,

 Moshe.

 --- Suzanne Matthews [EMAIL PROTECTED]
 wrote:

 Hello All,

 I have a simple question based on how things are
 labeled on my heat map;
 particularly, there is this annoying X that
 appears before the numeric
 value of all the labels of my columns.

 Let's say I have the following silly data, stored in
 temp.txt
 190519101950199220112020
 Gnat0.080.290.290.370.390.43
 Snake   0.160.340.320.400.410.53
 Bat 0.400.540.520.600.600.63
 Cat 0.160.270.290.390.370.41
 Dog 0.430.540.520.610.600.62
 Lynx0.500.570.540.590.5 0.59

 I use the following commands to generate my heatmap:
 heat - read.table('temp.txt')
 x - as.matrix(heat)

 heatmap.2(x, keysize=1.2, dendrogram=none,
 trace=none, Colv = FALSE,
 main = Silly Data, labCol=
 NULL, margin=c(7,8))

 This generates a very nice heatmap, but there is one
 thing I have an issue
 with: How do I get rid of the 'X' that seems to come
 automatically before my
 numeric column values? I just want those columns to
 be labeled 1905, 1910,
 1950, and so on. I cannot find anything in the
 heatmap.2 documentation that
 suggests how I should do this.

 Thank you very much for your time, and patience in
 reading this!

 Sincerely,
 Suzanne

  [[alternative HTML version deleted]]

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


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

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


Re: [R] help with heatmap - how to remove annoying X before numeric values?

2007-07-18 Thread Moshe Olshansky
I was right saying that my solution was not the best
possible!

--- Prof Brian Ripley [EMAIL PROTECTED] wrote:

 read.table('temp.txt', check.names = FALSE)
 
 would be easier (and more general, since make.names
 can do more than 
 prepend an 'X').
 
 On Wed, 18 Jul 2007, Moshe Olshansky wrote:
 
  Hi Suzanne,
 
  My solution (which I am sure is not the best)
 would
  be:
 
  heat - read.table('temp.txt')
  heat
   X1905 X1910 X1950 X1992 X2011 X2020
  Gnat   0.08  0.29  0.29  0.37  0.39  0.43
  Snake  0.16  0.34  0.32  0.40  0.41  0.53
  Bat0.40  0.54  0.52  0.60  0.60  0.63
  Cat0.16  0.27  0.29  0.39  0.37  0.41
  Dog0.43  0.54  0.52  0.61  0.60  0.62
  Lynx   0.50  0.57  0.54  0.59  0.50  0.59
  a-names(heat)
  b-strsplit(a,split=X)
  w-unlist(b)
  w
  [1]  1905  1910  1950 
  1992  2011  2020
  z - w[seq(2,length(w),by=2)]
  z
  [1] 1905 1910 1950 1992 2011 2020
  names(heat) - z
  heat
   1905 1910 1950 1992 2011 2020
  Gnat  0.08 0.29 0.29 0.37 0.39 0.43
  Snake 0.16 0.34 0.32 0.40 0.41 0.53
  Bat   0.40 0.54 0.52 0.60 0.60 0.63
  Cat   0.16 0.27 0.29 0.39 0.37 0.41
  Dog   0.43 0.54 0.52 0.61 0.60 0.62
  Lynx  0.50 0.57 0.54 0.59 0.50 0.59
 
 
  Regards,
 
  Moshe.
 
  --- Suzanne Matthews
 [EMAIL PROTECTED]
  wrote:
 
  Hello All,
 
  I have a simple question based on how things are
  labeled on my heat map;
  particularly, there is this annoying X that
  appears before the numeric
  value of all the labels of my columns.
 
  Let's say I have the following silly data, stored
 in
  temp.txt
  19051910195019922011   
 2020
  Gnat0.080.290.290.370.39   
 0.43
  Snake   0.160.340.320.400.41   
 0.53
  Bat 0.400.540.520.600.60   
 0.63
  Cat 0.160.270.290.390.37   
 0.41
  Dog 0.430.540.520.610.60   
 0.62
  Lynx0.500.570.540.590.5
 0.59
 
  I use the following commands to generate my
 heatmap:
  heat - read.table('temp.txt')
  x - as.matrix(heat)
 
  heatmap.2(x, keysize=1.2, dendrogram=none,
  trace=none, Colv = FALSE,
  main = Silly Data, labCol=
  NULL, margin=c(7,8))
 
  This generates a very nice heatmap, but there is
 one
  thing I have an issue
  with: How do I get rid of the 'X' that seems to
 come
  automatically before my
  numeric column values? I just want those columns
 to
  be labeled 1905, 1910,
  1950, and so on. I cannot find anything in the
  heatmap.2 documentation that
  suggests how I should do this.
 
  Thank you very much for your time, and patience
 in
  reading this!
 
  Sincerely,
  Suzanne
 
 [[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained,
 reproducible code.
 
 
 -- 
 Brian D. Ripley, 
 [EMAIL PROTECTED]
 Professor of Applied Statistics, 
 http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865
 272861 (self)
 1 South Parks Road, +44 1865
 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865
 272595


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


Re: [R] HELP FOR BUGS

2007-07-15 Thread Mike Meredith


You might find the 'arm' package useful. For a good introduction to
heirarchical modeling, using 'arm' and also WinBUGS and R2WinBUGS, read
Gelman, A; J Hill 2007. Data analysis using regression and
multilevel/hierarchical models. Cambridge University Press.

Cheers,  Mike.


Ali raza-4 wrote:
 
 Hi Sir

   I am very new user of R for the research project on multilevel logistic
 regression.
   There is confusion about bugs() function in R and BUGS software. Is
 there any relation between these two? Is there any comprehensive package
 for  Multilevel Logistic modelling in R?

   Please guide in this regard.

   Thank You

   RAZA
 

 -
 Boardwalk for $500? In 2007? Ha! 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/HELP-FOR-BUGS-tf4078749.html#a11605645
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 FOR BUGS

2007-07-14 Thread Ali raza
Hi Sir
   
  I am very new user of R for the research project on multilevel logistic 
regression.
  There is confusion about bugs() function in R and BUGS software. Is there any 
relation between these two? Is there any comprehensive package for  Multilevel 
Logistic modelling in R?
   
  Please guide in this regard.
   
  Thank You
   
  RAZA

   
-
Boardwalk for $500? In 2007? Ha! 

[[alternative HTML version deleted]]

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


Re: [R] HELP FOR BUGS

2007-07-14 Thread Uwe Ligges


Ali raza wrote:
 Hi Sir
 
 I am very new user of R for the research project on multilevel
 logistic regression. There is confusion about bugs() function in R

Do you mean bugs() from package R2WinBUGS?
Yes, it is related to the software WinBUGS 1.4.x (and OpenBUGS 2.x with 
package BRugs).

Uwe Ligges





 and BUGS software. Is there any relation between these two? Is there
 any comprehensive package for  Multilevel Logistic modelling in R?
 
 Please guide in this regard.
 
 Thank You
 
 RAZA
 
 
 - Boardwalk for $500? In 2007? Ha!
 
 [[alternative HTML version deleted]]
 
 __ 
 R-help@stat.math.ethz.ch mailing list 
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 with handling replicates before reshaping data

2007-07-13 Thread Tom Cohen
Dear list,
  I have a dataset consists of duplicated sequences within day for each patient 
(see below data) and I want to reshape the data with patient as time variable. 
However the reshape function only takes the first sequence of the replicates 
and ignores the second. How can I 1) average the duplicates and 2) give the 
duplicated sequences unique names before reshaping the data ? 
   
   data
 patient day  seq   y
  1   10   1 acdf -0.52416066
  2   10   1 cdsv  0.62551539
  3   10   1 dlfg -1.54668047
  4   10   1 acdf  0.82404978
  5   10   1 cdsv -1.17459914
  6   10   2 acdf  0.47238216
  7   10   2 cdsv -0.92364896
  8   10   2 dlfg  1.19273992
  9   10   2 acdf  0.03759663
  10  10   2 cdsv  1.05106783
  11  12   1 acdf  0.43575105
  12  12   1 cdsv  1.01675547
  13  12   1 dlfg -1.54601413
  14  12   1 acdf  1.03384654
  15  12   1 cdsv  0.32197671
  16  12   2 acdf  0.37355285
  17  12   2 cdsv -0.39780850
  18  12   2 dlfg -0.37693499
  19  12   2 acdf -1.28989165
  20  12   2 cdsv -0.06938098
  21  23   1 acdf -0.68486972
  22  23   1 cdsv -1.08035660
  23  23   1 dlfg  0.93124685
  24  23   1 acdf -0.78737514
  25  23   1 cdsv -1.56315904
  26  23   2 acdf -2.30913270
  27  23   2 cdsv -1.64583577
  28  23   2 dlfg  1.87435485
  29  23   2 acdf -1.99671825
  30  23   2 cdsv  0.62995993
   
   
   
redata-reshape(data,idvar=c(day,seq),timevar=patient,direction=wide)
   
   
   
  The reshaped data has only three sequences for each day and didn't take into 
account the value of the second replicate. 
   
   
   redata
day  seq   y.10   y.12   y.23
  1   1 acdf -0.5241607  0.4357510 -0.6848697
  2   1 cdsv  0.6255154  1.0167555 -1.0803566
  3   1 dlfg -1.5466805 -1.5460141  0.9312469
  6   2 acdf  0.4723822  0.3735529 -2.3091327
  7   2 cdsv -0.9236490 -0.3978085 -1.6458358
  8   2 dlfg  1.1927399 -0.3769350  1.8743548
   
  Another problem I have is that I want to check for duplicates in the dataset. 
If there are duplicates then print out the sequences. I tried with the code 
below but got not so nice output. How can I make the output look nicer or is 
there better way to do this?
   
  pat-subset(data, data$patien==10  data$day==1)
  if(any(duplicated(pat$seq,MARGIN=1)) ==FALSE) 
  cat(“No duplicates”,”\n”, sep=””)  else {cat (”duplicates” ,”\n”,sep=””)  
print(pat$seq[duplicated(pat$seq)]) }
   
  I got this output:
   
  duplicates
  [1] acdf cdsv
  Levels: acdf cdsv dlfg
  [1] NA NA
  Warning message:
   not meaningful for factors in: Ops.factor(cat(duplicates, \n, sep = 
), print(pat$seq[duplicated(pat$seq)]))
   
  But would like the output to be something like:
   
  duplicates
  [1] acdf cdsv
   
  Thanks alot for any help,
  Have a nice weekend !
  Tom

  
-

Jämför pris på flygbiljetter och hotellrum: 
http://shopping.yahoo.se/b/a/c_169901_resor_biljetter.html
[[alternative HTML version deleted]]

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


Re: [R] help with handling replicates before reshaping data

2007-07-13 Thread hadley wickham
Hi Tom,

   I have a dataset consists of duplicated sequences within day for each 
 patient (see below data) and I want to reshape the data with patient as time 
 variable. However the reshape function only takes the first sequence of the 
 replicates and ignores the second. How can I 1) average the duplicates and 2) 
 give the duplicated sequences unique names before reshaping the data ?

data
  patient day  seq   y
   1   10   1 acdf -0.52416066
   2   10   1 cdsv  0.62551539
   3   10   1 dlfg -1.54668047
   4   10   1 acdf  0.82404978
   5   10   1 cdsv -1.17459914
   6   10   2 acdf  0.47238216

You mind find that the functions in the reshape package give you a bit
more flexibility.

# The reshape package expects data like to have
# the value variable named value
d2 - rename(data, c(y = value))

# I think this is the format you want, which will average over the reps
cast(d2, day + seq ~ patient, mean)


Hadley

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 Needed!!

2007-07-10 Thread deepa gupta
Hi,
   
  Can anyone help me with repeated meausres MANOVA in R ? For repeated measures 
ANOVA I used function aov. Is there something like this exists for MANOVA? 
   
  Thanks,
  Deepa

   
-

[[alternative HTML version deleted]]

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


Re: [R] Help Needed!!

2007-07-10 Thread Henrique Dallazuanna
See

?summary.manova

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

On 10/07/07, deepa gupta [EMAIL PROTECTED] wrote:

 Hi,

   Can anyone help me with repeated meausres MANOVA in R ? For repeated
 measures ANOVA I used function aov. Is there something like this exists
 for MANOVA?

   Thanks,
   Deepa


 -

 [[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 with write.foreign (exporting data to Stata)

2007-07-10 Thread kdestler

Hi.  I'm trying to export a dataframe from R into Stata to use a statistical
function I have there.  I attached library write.foreign and renamed my
variables to get them to match Stata's required format, and now have the
following error:  file /tmp/Rtmps7rmrM/file1c06dac8.raw not found  Other
than typing write.foreign, do I need to do something in R to get it to save
the file on my hard drive?  When I search for the file name on my computer
nothing comes up.  I'm using a Mac in case that makes a difference.

Thanks,
Kate
-- 
View this message in context: 
http://www.nabble.com/Help-with-write.foreign-%28exporting-data-to-Stata%29-tf4057346.html#a11525796
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Help with write.foreign (exporting data to Stata)

2007-07-10 Thread Stefan Grosse
I am not sure what you are doing there but what you need is
library(foreign)
and
write.dta()

see
?write.dta once you have loaded the foreign package

Stefan

 Original Message  
Subject: [R] Help with write.foreign (exporting data to Stata)
From: kdestler [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Date: Tue Jul 10 2007 19:37:54 GMT+0200
 Hi.  I'm trying to export a dataframe from R into Stata to use a statistical
 function I have there.  I attached library write.foreign and renamed my
 variables to get them to match Stata's required format, and now have the
 following error:  file /tmp/Rtmps7rmrM/file1c06dac8.raw not found  Other
 than typing write.foreign, do I need to do something in R to get it to save
 the file on my hard drive?  When I search for the file name on my computer
 nothing comes up.  I'm using a Mac in case that makes a difference.

 Thanks,
 Kate


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


Re: [R] Help with write.foreign (exporting data to Stata)

2007-07-10 Thread Thomas Lumley
On Tue, 10 Jul 2007, Stefan Grosse wrote:

 I am not sure what you are doing there but what you need is
 library(foreign)
 and
 write.dta()


write.foreign should also work, though.

My guess is that Kate used tempfile() to specify the filenames, and that the 
data file would then have been deleted on leaving R.  This is only a guess, of 
course.

The syntax for write.dta is
   write.dta(the.data.set, file=dataset.dta)
and for write.foreign is
   write.foreign(the.data.set,codefile=dataset.do, datafile=dataset.raw,
package=Stata)

 -thomas


 see
 ?write.dta once you have loaded the foreign package

 Stefan

  Original Message  
 Subject: [R] Help with write.foreign (exporting data to Stata)
 From: kdestler [EMAIL PROTECTED]
 To: r-help@stat.math.ethz.ch
 Date: Tue Jul 10 2007 19:37:54 GMT+0200
 Hi.  I'm trying to export a dataframe from R into Stata to use a statistical
 function I have there.  I attached library write.foreign and renamed my
 variables to get them to match Stata's required format, and now have the
 following error:  file /tmp/Rtmps7rmrM/file1c06dac8.raw not found  Other
 than typing write.foreign, do I need to do something in R to get it to save
 the file on my hard drive?  When I search for the file name on my computer
 nothing comes up.  I'm using a Mac in case that makes a difference.

 Thanks,
 Kate


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


Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

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


[R] help on fisher.test(stats)?

2007-07-09 Thread zhijie zhang
Dear friends,
  My dataset have many zeros, so i must use fisher exact test .
Unfortunately, the fisher.test(stats) function fail to do it.
  Anybody knows how to do the fisher exact test with many zeros in the
dataset?
My dataset is:
a-matrix(c(0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,1,1,0,2,1,5,1,1,6,4,4,1,17,2,8,5,7,1,1,24,3,6,1,1,3,2,16,7,4,0,2,4,0,17,0,1,0,0,0,1,2),nrow=8,byrow=TRUE)
data.frame(a)
b-a[,-7]
as.matrix(b)
c-as.matrix(b)

 c
 [,1] [,2] [,3] [,4] [,5] [,6]
[1,]010000
[2,]010000
[3,]011021
[4,]116441
[5,]285711
[6,]361132
[7,]740240
[8,]010001
 fisher.test(c,workspace=20)
´íÎóÓÚfisher.test(c, workspace = 2e+17) :
Íâ½Óº¯Êýµ÷ÓÃʱ²»ÄÜÓÐNA(arg10)
´ËÍâ: Warning message:
Ç¿ÖƸıä¹ý³ÌÖвúÉúÁËNA

Any suggestion or help are greatly appreciated.
-- 
With Kind Regards,

oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:
[***]
Zhi Jie,Zhang ,PHD
Tel:86-21-54237149
Dept. of Epidemiology,School of Public Health,Fudan University
Address:No. 138 Yi Xue Yuan Road,Shanghai,China
Postcode:200032
Email:[EMAIL PROTECTED]
Website: www.statABC.com
[***]
oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:

[[alternative HTML version deleted]]

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


Re: [R] help on fisher.test(stats)?

2007-07-09 Thread Stefan Grosse
 Original Message  
Subject: [R] help on fisher.test(stats)?
From: zhijie zhang [EMAIL PROTECTED]
To: R-help@stat.math.ethz.ch
Date: 09.07.2007 09:03
 Dear friends,
   My dataset have many zeros, so i must use fisher exact test .
 Unfortunately, the fisher.test(stats) function fail to do it.
   Anybody knows how to do the fisher exact test with many zeros in the
 dataset?
 My dataset is:
 a-matrix(c(0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,1,1,0,2,1,5,1,1,6,4,4,1,17,2,8,5,7,1,1,24,3,6,1,1,3,2,16,7,4,0,2,4,0,17,0,1,0,0,0,1,2),nrow=8,byrow=TRUE)
 data.frame(a)
 b-a[,-7]
 as.matrix(b)
 c-as.matrix(b)

   
 c
 
  [,1] [,2] [,3] [,4] [,5] [,6]
 [1,]010000
 [2,]010000
 [3,]011021
 [4,]116441
 [5,]285711
 [6,]361132
 [7,]740240
 [8,]010001
   
 fisher.test(c,workspace=20)
 
 ŽíÎóÓÚfisher.test(c, workspace = 2e+17) :
 ÍâœÓº¯Êýµ÷ÓÃʱ²»ÄÜÓÐNA(arg10)
 ŽËÍâ: Warning message:
 Ç¿Öƞıä¹ý³ÌÖвúÉúÁËNA

 Any suggestion or help are greatly appreciated.
   
Your workspace is by far to large. I have done it with
 fisher.test(c,workspace=4000)

Fisher's Exact Test for Count Data

data:  c
p-value = 0.01548
alternative hypothesis: two.sided

(btw. it took half an hour...)

Simulation would also be an alternative approach:

 fisher.test(c,simulate=T)

Fisher's Exact Test for Count Data with simulated p-value (based
on 2000 replicates)

data:  c
p-value = 0.01349
alternative hypothesis: two.sided

As you see the p-value is not that different, you could use more
replications:

 fisher.test(c,simulate=T,B=100)

Fisher's Exact Test for Count Data with simulated p-value (based
on 1e+06 replicates)

data:  c
p-value = 0.01514
alternative hypothesis: two.sided

and it is still much faster...

Stefan
-=-=-
... The most incomprehensible thing about the world is that it is
comprehensible. (A. Einstein)

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


Re: [R] Help in installing rggobi in ubuntu linux

2007-07-09 Thread Michael Lawrence
Looks like rggobi can't find GGobi. Make sure that PKG_CONFIG_PATH contains
the path to your ggobi.pc file. For example:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

I would have assumed, however, that the ggobi package would have installed
to the /usr prefix, in which case pkg-config should have no problem finding
GGobi.

On 7/8/07, Kenneth Cabrera [EMAIL PROTECTED] wrote:

 Hi R users.

 I am experimenting with ubuntu 7.04 Feisty.

 I install the ggobi package with apt-get.

 I got almost all the packages, but
 when I try to obtain rggobi, I got
 this message:


 -
 install.packages(rggobi)
 Aviso en install.packages(rggobi) : argument 'lib' is missing: using
 '/usr/local/lib/R/site-library'
 --- Please select a CRAN mirror for use in this session ---
 Loading Tcl/Tk interface ... done
 probando la URL
 'http://cran.at.r-project.org/src/contrib/rggobi_2.1.4-4.tar.gz'
 Content type 'application/x-gzip' length 401451 bytes
 URL abierta
 ==
 downloaded 392Kb

 * Installing *source* package 'rggobi' ...
 checking for pkg-config... /usr/bin/pkg-config
 checking pkg-config is at least version 0.9.0... yes
 checking for GGOBI... configure: creating ./config.status
 config.status: creating src/Makevars
 ** libs
 gcc -std=gnu99 -I/usr/share/R/include -I/usr/share/R/include -g
 -DUSE_EXT_PTR=1 -D_R_=1  -fpic  -g -O2 -c brush.c -o brush.o
 En el fichero incluído de brush.c:1:
 RSGGobi.h:5:22: error: GGobiAPI.h: No existe el fichero ó directorio
 In file included from RSGGobi.h:6,
   from brush.c:1:
 conversion.h:174: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
 ‘__attribute__’ before ‘asCLogical’
 conversion.h:176: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
 ‘__attribute__’ before ‘asCRaw’

 --- snip ---

 brush.c:124: error: ‘t’ no se declaró aquí (primer uso en esta
 función)
 brush.c:124: error: ‘s’ no se declaró aquí (primer uso en esta
 función)
 brush.c:124: error: el objeto ‘GGOBI(erroneous-expression)’ llamado
 no es una función
 brush.c: En el nivel principal:
 brush.c:135: error: expected ‘)’ before ‘cid’
 make: *** [brush.o] Error 1
 chmod: no se puede acceder a
 `/usr/local/lib/R/site-library/rggobi/libs/*': No existe el fichero ó
 directorio
 ERROR: compilation failed for package 'rggobi'
 ** Removing '/usr/local/lib/R/site-library/rggobi'

 The downloaded packages are in
  /tmp/RtmpVCacJd/downloaded_packages
 Warning message:
 installation of package 'rggobi' had non-zero exit status in:
 install.packages(rggobi)

 ---

 What am I doing wrong?

 Thank you for your help.
 --
 Kenneth Roy Cabrera Torres
 Cel 315 504 9339

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


Re: [R] Help in installing rggobi in ubuntu linux

2007-07-09 Thread Dirk Eddelbuettel

On 9 July 2007 at 22:38, Michael Lawrence wrote:
| Looks like rggobi can't find GGobi. Make sure that PKG_CONFIG_PATH contains
| the path to your ggobi.pc file. For example:
| 
| export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
| 
| I would have assumed, however, that the ggobi package would have installed
| to the /usr prefix, in which case pkg-config should have no problem finding
| GGobi.
| 
| On 7/8/07, Kenneth Cabrera [EMAIL PROTECTED] wrote:
| 
|  Hi R users.
| 
|  I am experimenting with ubuntu 7.04 Feisty.
| 
|  I install the ggobi package with apt-get.
| 
|  I got almost all the packages, but
|  when I try to obtain rggobi, I got
|  this message:

Why don;t you install the Rggobi that is provided via Ubuntu?  It is version
2.1.4-4-1 and it corresponds to the 2.1.4-2 version of Ggobi you just
installed. Just do 'sudo apt-get install r-omegahat-ggobi'

On Debian, we are now at 2.1.5-* for both (and we renamed it r-cran-rggobi as
it now resides on CRAN).

Hth, Dirk

-- 
Hell, there are no rules here - we're trying to accomplish something. 
  -- Thomas A. Edison

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 in installing rggobi in ubuntu linux

2007-07-08 Thread Kenneth Cabrera
Hi R users.

I am experimenting with ubuntu 7.04 Feisty.

I install the ggobi package with apt-get.

I got almost all the packages, but
when I try to obtain rggobi, I got
this message:

-
install.packages(rggobi)
Aviso en install.packages(rggobi) : argument 'lib' is missing: using  
'/usr/local/lib/R/site-library'
--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
probando la URL  
'http://cran.at.r-project.org/src/contrib/rggobi_2.1.4-4.tar.gz'
Content type 'application/x-gzip' length 401451 bytes
URL abierta
==
downloaded 392Kb

* Installing *source* package 'rggobi' ...
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for GGOBI... configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/share/R/include -I/usr/share/R/include -g  
-DUSE_EXT_PTR=1 -D_R_=1  -fpic  -g -O2 -c brush.c -o brush.o
En el fichero incluído de brush.c:1:
RSGGobi.h:5:22: error: GGobiAPI.h: No existe el fichero ó directorio
In file included from RSGGobi.h:6,
  from brush.c:1:
conversion.h:174: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or  
‘__attribute__’ before ‘asCLogical’
conversion.h:176: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or  
‘__attribute__’ before ‘asCRaw’

--- snip ---

brush.c:124: error: ‘t’ no se declaró aquí (primer uso en esta  
función)
brush.c:124: error: ‘s’ no se declaró aquí (primer uso en esta  
función)
brush.c:124: error: el objeto ‘GGOBI(erroneous-expression)’ llamado  
no es una función
brush.c: En el nivel principal:
brush.c:135: error: expected ‘)’ before ‘cid’
make: *** [brush.o] Error 1
chmod: no se puede acceder a  
`/usr/local/lib/R/site-library/rggobi/libs/*': No existe el fichero ó  
directorio
ERROR: compilation failed for package 'rggobi'
** Removing '/usr/local/lib/R/site-library/rggobi'

The downloaded packages are in
 /tmp/RtmpVCacJd/downloaded_packages
Warning message:
installation of package 'rggobi' had non-zero exit status in:  
install.packages(rggobi)
---

What am I doing wrong?

Thank you for your help.
-- 
Kenneth Roy Cabrera Torres
Cel 315 504 9339

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 with vector construction

2007-07-05 Thread Juan Pablo Fededa
Hi all,

I want to make a vector with the third column of a matrix, but only for the
2+3n rows of the matrix, with n being an entire number from 0 to a million.
How can I do that in an easy way?
Thanks in advance,

Juan Pablo

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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   3   4   5   6   7   8   9   10   >