[R] Accessing methods and extending S4 classes of existing packages

2008-06-29 Thread Johannes Huesing
Dear all,
I am trying to understand how to access S4 methods after loading a 
package, using the online documentation of getMethod and friends.

This is what I have been trying:
 library(coin)
 findMethods(ApproxNullDistribution)
list()
Warning message:
In findMethods(ApproxNullDistribution) :
  nicht-generische Funktion an findMethods() übergeben

whereas in the source of coin I can see the lines: 

setGeneric(ApproxNullDistribution, function(object, ...)
standardGeneric(ApproxNullDistribution))

It seems that I am not getting what is going on here. Could anybody
give me a hint?

Greetings


Johannes
-- 
Johannes Hüsing   There is something fascinating about science. 
  One gets such wholesale returns of conjecture 
mailto:[EMAIL PROTECTED]  from such a trifling investment of fact.  
  
http://derwisch.wikidot.com (Mark Twain, Life on the Mississippi)

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


Re: [R] Parallel R

2008-06-29 Thread Martin Morgan
Juan Pablo Romero Méndez [EMAIL PROTECTED] writes:

 Hello,

 The problem I'm working now requires to operate on big matrices.

 I've noticed that there are some packages that allows to run some
 commands in parallel. I've tried snow and NetWorkSpaces, without much
 success (they are far more slower that the normal functions)

Do you mean like this?

 library(Rmpi)
 mpi.spawn.Rslaves(nsl=2) # dual core on my laptop
 m - matrix(0, 1, 1000)
 system.time(x1 - apply(m, 2, sum), gcFirst=TRUE)
   user  system elapsed
  0.644   0.148   1.017
 system.time(x2 - mpi.parApply(m, 2, sum), gcFirst=TRUE)
   user  system elapsed
  5.188   2.844  10.693
  
? (This is with Rmpi, a third alternative you did not mention;
'elapsed' time seems to be relevant here.)

The basic problem is that the overhead of dividing the matrix up and
communicating between processes outweighs the already-efficient
computation being performed.

One solution is to organize your code into 'coarse' grains, so the FUN
in apply does (considerably) more work.

A second approach is to develop a better algorithm / use an
appropriate R paradigm, e.g.,

 system.time(x3 - colSums(m), gcFirst=TRUE)
   user  system elapsed
  0.060   0.000   0.088
 
(or even faster, x4 - rep(0, ncol(m)) ;)

A third approach, if your calculations make heavy use of linear
algebra, is to build R with a vectorized BLAS library; see the R
Installation and Administration guide.

A fourth possibility is to use Tierney's 'pnmath' library mentioned in
this thread

https://stat.ethz.ch/pipermail/r-help/2007-December/148756.html

The README file needs to be consulted for the not-exactly-trivial (on
my system) task of installing the package. Specific functions are
parallelized, provided the length of the calculation makes it seem
worth-while.

 system.time(exp(m), gcFirst=TRUE)
   user  system elapsed
  0.108   0.000   0.106
 library(pnmath)
 system.time(exp(m), gcFirst=TRUE)
   user  system elapsed
  0.096   0.004   0.052

(elapsed time about 2x faster). Both BLAS and pnmath make much better
use of resources, since they do not require multiple R instances.

None of these approaches would make a colSums faster -- the work is
just too small for the overhead.

Martin

 My problem is very simple, it doesn't require any communication
 between parallel tasks; only that it divides simetricaly the task
 between the available cores. Also, I don't want to run the code in a
 cluster, just my multicore machine (4 cores).

 What solution would you propose, given your experience?

 Regards,

   Juan Pablo

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

-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M2 B169
Phone: (206) 667-2793

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Calculating quarterly statistics for time series object

2008-06-29 Thread Megh Dal
I have time series observation on daily frequencies :

library(zoo)
SD=1
date1 = seq(as.Date(01/01/01, format = %m/%d/%y), as.Date(12/31/02, 
format = %m/%d/%y), by = 1)
len1 = length(date1); data1 = zoo(matrix(rnorm(len1, mean=0, sd=SD*0.5), nrow = 
len1),  date1)
plot(data1)


Now I want to calculate 1. Quarterly statistics like mean, variance etc and 2. 
Weekly statistics, where as per my definition week starts from Wednesday and 
ends on Tuesday.

I can define some 'for' loop for doing those. However it takes considerably 
amount of time. Is there any advance methods in R to do the same?

Regards,





  
[[alternative HTML version deleted]]

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


Re: [R] Calculating quarterly statistics for time series object

2008-06-29 Thread Gabor Grothendieck
See ?aggregate.zoo, ?as.yearqtr and vignette(zoo-quickref) and
the other zoo vignettes.

library(zoo)

SD - 1
date1 - seq(as.Date(2001-01-01), as.Date(2002-12-1), by = day)
len1 - length(date1)
set.seed(1) # to make it reproducible
data1 - zoo(rnorm(len1), date1)
plot(data1)

# quarterly summary

data1q.mean - aggregate(data1, as.yearqtr, mean)
data1q.sd - aggregate(data1, as.yearqtr, sd)
plot(cbind(mean = data1q.mean, sd = data1q.sd), main = Quarterly)

# weekly summary - week ends on tuesday

# Given a date find the next Tuesday.
# Based on formula in Prices and Returns section of zoo-quickref vignette.
nexttue - function(x) 7 * ceiling(as.numeric(x - 2 + 4)/7) + as.Date(2 - 4)

data1w - cbind(
mean = aggregate(data1, nexttue, mean),
sd = aggregate(data1, nexttue, sd)
)
head(data1w)
plot(data1w, main = Weekly)

### ALTERNATIVE ###

# Create function ag like aggregate but takes vector of
# function names.

FUNs - c(mean, sd)
ag - function(z, by, FUNs) {
f - function(f) aggregate(z, by, f)
do.call(cbind, sapply(FUNs, f, simplify = FALSE))
}

data1q - ag(data1, as.yearqtr, c(mean, sd))
data1w - ag(data1, nexttue, c(mean, sd))


On Sun, Jun 29, 2008 at 3:17 AM, Megh Dal [EMAIL PROTECTED] wrote:
 I have time series observation on daily frequencies :

 library(zoo)
 SD=1
 date1 = seq(as.Date(01/01/01, format = %m/%d/%y), as.Date(12/31/02, 
 format = %m/%d/%y), by = 1)
 len1 = length(date1); data1 = zoo(matrix(rnorm(len1, mean=0, sd=SD*0.5), nrow 
 = len1),  date1)
 plot(data1)


 Now I want to calculate 1. Quarterly statistics like mean, variance etc and 
 2. Weekly statistics, where as per my definition week starts from Wednesday 
 and ends on Tuesday.

 I can define some 'for' loop for doing those. However it takes considerably 
 amount of time. Is there any advance methods in R to do the same?

 Regards,






[[alternative HTML version deleted]]


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



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


[R] How to get an argument dynamically from a list?

2008-06-29 Thread Stephane Bourgeois
Hi,

I'd like to get an argument (I think it's the right term) dynamically from a 
list, but cannot manage to do it.

Here is the code I use:

#output given by database

BOB - c('A/A', 'C/C', '15/27')
MARY - c('A/A', NA, '13/12')
JOHN - c('A/A', 'C/A', '154/35')
CLIFF - c('A/C', 'C/C', '15/12')
PAM - c('A/C', 'C/A', '13/12')
sampleList - c(BOB, MARY, JOHN, CLIFF, PAM)
polyList - c(rs123, rs124, rs555)

#make dataframe with data

data.raw - data.frame(t(do.call(data.frame, lapply(sampleList, get
names(data.raw) - polyList
row.names(data.raw) - sampleList

I want to get, for example, data.raw$rs124 using polyList.

I tried

 get(paste(data.raw$, polyList[2], sep=))
Error in get(paste(data.raw$, polyList[2], sep = )) : 
  variable data.raw$rs124 was not found
  
but it's obviously not the right way, data.raw$rs124 not being a variable per 
se.

Any idea about how I could do that?

Thanks,

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


Re: [R] Interactive plot

2008-06-29 Thread Gabor Grothendieck
Install the GTK runtime:

http://www.ggobi.org/rgtk2/

On Sun, Jun 29, 2008 at 9:06 AM, Ron Michael [EMAIL PROTECTED] wrote:
 whenever I try to load playwith package I get following error :

 library(playwith)
 Loading required package: lattice
 Loading required package: grid
 Error in inDL(x, as.logical(local), as.logical(now), ...) :
   unable to load shared library 
 'C:/PROGRA~1/R/R-27~1.1/library/RGtk2/libs/RGtk2.dll':
   LoadLibrary failure:  The specified module could not be found.

 Error: package/namespace load failed for 'playwith'

 What to do?

 --- On Sun, 29/6/08, Liviu Andronic [EMAIL PROTECTED] wrote:

 From: Liviu Andronic [EMAIL PROTECTED]
 Subject: Re: [R] Interactive plot
 To: Ron Michael [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Date: Sunday, 29 June, 2008, 7:46 PM

 On 6/29/08, Ron Michael [EMAIL PROTECTED] wrote:
  Now I want to present the plot in some interactive manner. I want to put
 a slider in the plot where user move the slider for the 1st element of the
 vector vary and automatically this result will be reflected at the
 plot window.

 playwith: A GUI for interactive plots using GTK+ ? [1]

 [1] http://cran.at.r-project.org/web/packages/playwith/index.html

 Send instant messages to your online friends http://uk.messenger.yahoo.com
[[alternative HTML version deleted]]


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



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

2008-06-29 Thread Kobby Essien

Hi,

I have created a couple of plots in R and would like text in the plots 
to be size 12 Arial or Helvetica font. Is this possible?


Thanks.

Kobby

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


Re: [R] How to get an argument dynamically from a list?

2008-06-29 Thread jim holtman
Is this what you want:

you have to use data.raw[[polyList[2]]] to access the data.  (see ?[[)

 lapply(polyList, function(x) as.character(data.raw[[x]]))
[[1]]
[1] A/A A/A A/A A/C A/C

[[2]]
[1] C/C NAC/A C/C C/A

[[3]]
[1] 15/27  13/12  154/35 15/12  13/12



On Sun, Jun 29, 2008 at 3:24 PM, Stephane Bourgeois [EMAIL PROTECTED] wrote:
 Hi,

 I'd like to get an argument (I think it's the right term) dynamically from a 
 list, but cannot manage to do it.

 Here is the code I use:

 #output given by database

 BOB - c('A/A', 'C/C', '15/27')
 MARY - c('A/A', NA, '13/12')
 JOHN - c('A/A', 'C/A', '154/35')
 CLIFF - c('A/C', 'C/C', '15/12')
 PAM - c('A/C', 'C/A', '13/12')
 sampleList - c(BOB, MARY, JOHN, CLIFF, PAM)
 polyList - c(rs123, rs124, rs555)

 #make dataframe with data

 data.raw - data.frame(t(do.call(data.frame, lapply(sampleList, get
 names(data.raw) - polyList
 row.names(data.raw) - sampleList

 I want to get, for example, data.raw$rs124 using polyList.

 I tried

 get(paste(data.raw$, polyList[2], sep=))
 Error in get(paste(data.raw$, polyList[2], sep = )) :
  variable data.raw$rs124 was not found

 but it's obviously not the right way, data.raw$rs124 not being a variable per 
 se.

 Any idea about how I could do that?

 Thanks,

 Stephane

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


Re: [R] Accessing methods and extending S4 classes of existing packages

2008-06-29 Thread Johannes Huesing
Johannes Huesing [EMAIL PROTECTED] [Sun, Jun 29, 2008 at 08:13:27AM CEST]:
 Dear all,
 I am trying to understand how to access S4 methods after loading a 
 package, using the online documentation of getMethod and friends.
 

I am just realizing that the lack of online documentation on S4 methods,
which was lamented so long, has apparently been filled by How S4 Methods
Work by John Chambers. So please hang on until I have read this piece 
and will be able to ask more educated questions about that matter.


-- 
Johannes Hüsing   There is something fascinating about science. 
  One gets such wholesale returns of conjecture 
mailto:[EMAIL PROTECTED]  from such a trifling investment of fact.  
  
http://derwisch.wikidot.com (Mark Twain, Life on the Mississippi)

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


Re: [R] Interactive plot

2008-06-29 Thread Ron Michael
Hi, whenever I try to load the playwith package I am getting following warning :
 
 library(playwith)
Loading required package: lattice
Loading required package: grid
Warning message:
In namespaceImportFrom(self, asNamespace(ns)) :
  replacing previous import: addhandler

Can anyone please tell me why I am getting that warning?

--- On Sun, 29/6/08, Gabor Grothendieck [EMAIL PROTECTED] wrote:

From: Gabor Grothendieck [EMAIL PROTECTED]
Subject: Re: [R] Interactive plot
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Date: Sunday, 29 June, 2008, 8:18 PM

Install the GTK runtime:

http://www.ggobi.org/rgtk2/

On Sun, Jun 29, 2008 at 9:06 AM, Ron Michael [EMAIL PROTECTED]
wrote:
 whenever I try to load playwith package I get following error
:

 library(playwith)
 Loading required package: lattice
 Loading required package: grid
 Error in inDL(x, as.logical(local), as.logical(now), ...) :
   unable to load shared library
'C:/PROGRA~1/R/R-27~1.1/library/RGtk2/libs/RGtk2.dll':
   LoadLibrary failure:  The specified module could not be found.

 Error: package/namespace load failed for 'playwith'

 What to do?

 --- On Sun, 29/6/08, Liviu Andronic [EMAIL PROTECTED] wrote:

 From: Liviu Andronic [EMAIL PROTECTED]
 Subject: Re: [R] Interactive plot
 To: Ron Michael [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Date: Sunday, 29 June, 2008, 7:46 PM

 On 6/29/08, Ron Michael [EMAIL PROTECTED] wrote:
  Now I want to present the plot in some interactive manner. I want to
put
 a slider in the plot where user move the slider for the 1st element of the
 vector vary and automatically this result will be reflected at
the
 plot window.

 playwith: A GUI for interactive plots using GTK+ ? [1]

 [1] http://cran.at.r-project.org/web/packages/playwith/index.html

 Send instant messages to your online friends http://uk.messenger.yahoo.com
[[alternative HTML version deleted]]


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



Send instant messages to your online friends http://uk.messenger.yahoo.com 
[[alternative HTML version deleted]]

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


Re: [R] Interactive plot

2008-06-29 Thread Ron Michael
Hi all R users. I already done through some of the examples given with playwith 
packages and feel nowhere they are matching with my requirement. Can amyone 
please suggest me how to create my desired interactive plot with tkrplot ?
 
I want following. Let look at following codes :
 
mat = cbind(c(0.59710430,0.23057380), c(0.23057380, 0.5971089)) 
set.seed = 1000 vary = runif(dim(mat)[1], 2000, 3000) calc = function(mat, vary)
{
result = vector(length = (length(vary)+1))
result[1] = sqrt(t(vary) %*% vary)
for (i in 1 : length(vary))
{
result[(i+1)] = sum(vary)*sum(vary*mat[,i])
}
barplot(result)
return(result)
}
 
Now I want to put a slider in the plot where user move the slider for the 1st 
element of the vector vary and automatically this result will be reflected at 
the plot window. Can anyone please tell me how to do that with tkrplot or 
TeachingDemos ?
 
 


--- On Sun, 29/6/08, Ron Michael [EMAIL PROTECTED] wrote:

From: Ron Michael [EMAIL PROTECTED]
Subject: Re: [R] Interactive plot
To: Gabor Grothendieck [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Date: Sunday, 29 June, 2008, 11:48 PM

Hi, whenever I try to load the playwith package I am getting following warning :
 
 library(playwith)
Loading required package: lattice
Loading required package: grid
Warning message:
In namespaceImportFrom(self, asNamespace(ns)) :
  replacing previous import: addhandler

Can anyone please tell me why I am getting that warning?

--- On Sun, 29/6/08, Gabor Grothendieck [EMAIL PROTECTED] wrote:

From: Gabor Grothendieck [EMAIL PROTECTED]
Subject: Re: [R] Interactive plot
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Date: Sunday, 29 June, 2008, 8:18 PM

Install the GTK runtime:

http://www.ggobi.org/rgtk2/

On Sun, Jun 29, 2008 at 9:06 AM, Ron Michael [EMAIL PROTECTED]
wrote:
 whenever I try to load playwith package I get following error
:

 library(playwith)
 Loading required package: lattice
 Loading required package: grid
 Error in inDL(x, as.logical(local), as.logical(now), ...) :
   unable to load shared library
'C:/PROGRA~1/R/R-27~1.1/library/RGtk2/libs/RGtk2.dll':
   LoadLibrary failure:  The specified module could not be found.

 Error: package/namespace load failed for 'playwith'

 What to do?

 --- On Sun, 29/6/08, Liviu Andronic [EMAIL PROTECTED] wrote:

 From: Liviu Andronic [EMAIL PROTECTED]
 Subject: Re: [R] Interactive plot
 To: Ron Michael [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Date: Sunday, 29 June, 2008, 7:46 PM

 On 6/29/08, Ron Michael [EMAIL PROTECTED] wrote:
  Now I want to present the plot in some interactive manner. I want to
put
 a slider in the plot where user move the slider for the 1st element of the
 vector vary and automatically this result will be reflected at
the
 plot window.

 playwith: A GUI for interactive plots using GTK+ ? [1]

 [1] http://cran.at.r-project.org/web/packages/playwith/index.html

 Send instant messages to your online friends http://uk.messenger.yahoo.com
[[alternative HTML version deleted]]


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



Send instant messages to your online friends http://uk.messenger.yahoo.com 
[[alternative HTML version 
deleted]]__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Send instant messages to your online friends http://uk.messenger.yahoo.com 
[[alternative HTML version deleted]]

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


Re: [R] Interactive plot

2008-06-29 Thread Gabor Grothendieck
In ?playwith the third example seems pretty close to what you
want.  Here it is changed to correspond to your setup.

Remove the barplot line from calc since we don't want calc to do
any plotting and then try this:

library(lattice)
playwith(barchart(seq_along(result) ~ result,
data = data.frame(result = calc(mat, c(alpha, vary[2],
parameters = list(alpha = seq(2000, 3000, by = 10)))



On Sun, Jun 29, 2008 at 1:07 PM, Ron Michael [EMAIL PROTECTED] wrote:
 Hi all R users. I already done through some of the examples given with 
 playwith packages and feel nowhere they are matching with my requirement. Can 
 amyone please suggest me how to create my desired interactive plot with 
 tkrplot ?

 I want following. Let look at following codes :

 mat = cbind(c(0.59710430,0.23057380), c(0.23057380, 
 0.5971089)) set.seed = 1000 vary = runif(dim(mat)[1], 2000, 3000) calc = 
 function(mat, vary)
 {
 result = vector(length = (length(vary)+1))
 result[1] = sqrt(t(vary) %*% vary)
 for (i in 1 : length(vary))
 {
 result[(i+1)] = sum(vary)*sum(vary*mat[,i])
 }
 barplot(result)
 return(result)
 }

 Now I want to put a slider in the plot where user move the slider for the 1st 
 element of the vector vary and automatically this result will be reflected 
 at the plot window. Can anyone please tell me how to do that with tkrplot or 
 TeachingDemos ?




 --- On Sun, 29/6/08, Ron Michael [EMAIL PROTECTED] wrote:

 From: Ron Michael [EMAIL PROTECTED]
 Subject: Re: [R] Interactive plot
 To: Gabor Grothendieck [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Date: Sunday, 29 June, 2008, 11:48 PM

 Hi, whenever I try to load the playwith package I am getting following 
 warning :

 library(playwith)
 Loading required package: lattice
 Loading required package: grid
 Warning message:
 In namespaceImportFrom(self, asNamespace(ns)) :
   replacing previous import: addhandler

 Can anyone please tell me why I am getting that warning?

 --- On Sun, 29/6/08, Gabor Grothendieck [EMAIL PROTECTED] wrote:

 From: Gabor Grothendieck [EMAIL PROTECTED]
 Subject: Re: [R] Interactive plot
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Date: Sunday, 29 June, 2008, 8:18 PM

 Install the GTK runtime:

 http://www.ggobi.org/rgtk2/

 On Sun, Jun 29, 2008 at 9:06 AM, Ron Michael [EMAIL PROTECTED]
 wrote:
 whenever I try to load playwith package I get following error
 :

 library(playwith)
 Loading required package: lattice
 Loading required package: grid
 Error in inDL(x, as.logical(local), as.logical(now), ...) :
   unable to load shared library
 'C:/PROGRA~1/R/R-27~1.1/library/RGtk2/libs/RGtk2.dll':
   LoadLibrary failure:  The specified module could not be found.

 Error: package/namespace load failed for 'playwith'

 What to do?

 --- On Sun, 29/6/08, Liviu Andronic [EMAIL PROTECTED] wrote:

 From: Liviu Andronic [EMAIL PROTECTED]
 Subject: Re: [R] Interactive plot
 To: Ron Michael [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Date: Sunday, 29 June, 2008, 7:46 PM

 On 6/29/08, Ron Michael [EMAIL PROTECTED] wrote:
  Now I want to present the plot in some interactive manner. I want to
 put
 a slider in the plot where user move the slider for the 1st element of the
 vector vary and automatically this result will be reflected at
 the
 plot window.

 playwith: A GUI for interactive plots using GTK+ ? [1]

 [1] http://cran.at.r-project.org/web/packages/playwith/index.html

 Send instant messages to your online friends http://uk.messenger.yahoo.com
[[alternative HTML version deleted]]


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



 Send instant messages to your online friends http://uk.messenger.yahoo.com
[[alternative HTML version 
 deleted]]__
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

 Send instant messages to your online friends http://uk.messenger.yahoo.com
[[alternative HTML version deleted]]


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



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


Re: [R] Arial font in R

2008-06-29 Thread Ben Bolker
Kobby Essien kobby at seas.upenn.edu writes:

 
 Hi,
 
 I have created a couple of plots in R and would like text in the plots 
 to be size 12 Arial or Helvetica font. Is this possible?
 
 Thanks.
 
 Kobby

  Well, 12 point Helvetica is actually the default for PDF and PostScript
files (see ?pdf and ?postscript, especially the family
and pointsize arguments).  Can you be more specific about
what you need if the default is not working for you?

  Ben Bolker

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Survival Analysis with two different events

2008-06-29 Thread sickboyedd

Hello all,

I am hoping to use survival analysis to examine whether parasite attack
increases nest death in a species of social wasp. I therefore have data for

1. Whether the nest died in the 6 week census period (Status, where
1=died, 0=survived)
2. The day number of death/last recorded day it was observed alive.
3. Whether the nest was attacked by the parasite (0/1 as with 1.)
4. The day number of attack/ last recorded day the nest was observed without
a parasite.

i.e. example dataset:

status   death   para   paraday
0   42   0   42
1   32   0   42
1   25   1   13
0   42   1   25 ...

I've looked over r-help, as well as in Crawley etc., but I have yet to find
a solution. Can anyone point me in the right direction or literature?

Many thanks,

Edd Almond
-- 
View this message in context: 
http://www.nabble.com/Survival-Analysis-with-two-different-events-tp18183526p18183526.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Interactive plot

2008-06-29 Thread Ron Michael
It is not working here. I am getting following errors [big list :( ] :
 
 library(playwith)
Loading required package: grid
Warning message:
In namespaceImportFrom(self, asNamespace(ns)) :
  replacing previous import: addhandler
 library(lattice)
 playwith(barchart(seq_along(result) ~ result,
+ data = data.frame(result = calc(mat, c(alpha, vary[2],
+ parameters = list(alpha = seq(2000, 3000, by = 10)))
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Go back to previous 
plot call) : 
  Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin, 
GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Go forward to next 
plot call) : 
  Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin, 
GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Redraw the current 
plot (hold Shift for full reload)) : 
  Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin, 
GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Show help page for 
this plot function) : 
  Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin, 
GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
Loading required package: RGtk2
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Always show this 
window) : 
  Cannot find 'tooltip-text' to set in GtkToggleToolButton, GtkToolButton, 
GtkToolItem, GtkBin, GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, 
GObject, RGtkObject
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Keep this window, do 
not replace it (open next plot in a new window)) : 
  Cannot find 'tooltip-text' to set in GtkToggleToolButton, GtkToolButton, 
GtkToolItem, GtkBin, GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, 
GObject, RGtkObject
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Copy this plot to the 
clipboard (as a bitmap)) : 
  Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin, 
GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = View and edit 
attached data objects) : 
  Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin, 
GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Change the plot type 
and settings) : 
  Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin, 
GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Choose Lattice 
theme) : 
  Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin, 
GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Time mode: scroll 
along the x-axis) : 
  Cannot find 'tooltip-text' to set in GtkToggleToolButton, GtkToolButton, 
GtkToolItem, GtkBin, GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, 
GObject, RGtkObject
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Choose a panel to 
expand and focus (for further interaction)) : 
  Cannot find 'tooltip-text' to set in GtkToggleToolButton, GtkToolButton, 
GtkToolItem, GtkBin, GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, 
GObject, RGtkObject
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Identify data points 
by clicking on them) : 
  Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin, 
GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Add your own labels 
to the plot) : 
  Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin, 
GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Add an arrow to the 
plot) : 
  Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin, 
GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Edit annotations 
(including arrows)) : 
  Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin, 
GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Remove labels and 
annotations) : 
  Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin, 
GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Select a new plot 
region with the mouse) : 
  Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin, 
GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, 

Re: [R] Survival Analysis with two different events

2008-06-29 Thread Ben Bolker
sickboyedd sickboyedd at gmail.com writes:

 
 
 Hello all,
 
 I am hoping to use survival analysis to examine whether parasite attack
 increases nest death in a species of social wasp. I therefore have data for
 
 1. Whether the nest died in the 6 week census period (Status, where
 1=died, 0=survived)
 2. The day number of death/last recorded day it was observed alive.
 3. Whether the nest was attacked by the parasite (0/1 as with 1.)
 4. The day number of attack/ last recorded day the nest was observed without
 a parasite.
 
 i.e. example dataset:
 
 status   death   para   paraday
 0   42   0   42
 1   32   0   42
 1   25   1   13
 0   42   1   25 ...
 
 I've looked over r-help, as well as in Crawley etc., but I have yet to find
 a solution. Can anyone point me in the right direction or literature?
 

   You might want to send this to r-sig-ecology if you need further
discussion.  In the meantime, the very simplest
thing (conditioning on whether the nest was
attacked or not) would be

library(survival)
c1 = coxph(Surv(death,status)~para,data=mydata)

(you should definitely read up a bit on survival analysis,
Cox proportional hazards, etc..  I think there's a chapter
in the book by Scheiner and Gurevitch, geared towards
ecologists).

Dealing with parasite attack in a more fine-grained
way (i.e. assessing mortality before and after parasitism)
would be a little trickier, but I wouldn't worry about
it until after you've understood the first stage of
the analysis.

  Ben Bolker

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


Re: [R] Accessing methods and extending S4 classes of existing packages

2008-06-29 Thread Johannes Huesing
Johannes Huesing [EMAIL PROTECTED] [Sun, Jun 29, 2008 at 08:13:27AM CEST]:
 Dear all,
 I am trying to understand how to access S4 methods after loading a 
 package, using the online documentation of getMethod and friends.
 
 This is what I have been trying:
  library(coin)
  findMethods(ApproxNullDistribution)
 list()
 Warning message:
 In findMethods(ApproxNullDistribution) :
   nicht-generische Funktion an findMethods() übergeben
 
 whereas in the source of coin I can see the lines: 
 
 setGeneric(ApproxNullDistribution, function(object, ...)
 standardGeneric(ApproxNullDistribution))
 
 It seems that I am not getting what is going on here. Could anybody
 give me a hint?

It seems like the package authors chose not to export the ApproxNullDistribution
generic method from the package, as seen in the NAMESPACE file of the 
package.

Does it mean that if I want to write personal extensions to the package,
the correct approach is to take the whole package and modify it?
-- 
Johannes Hüsing   There is something fascinating about science. 
  One gets such wholesale returns of conjecture 
mailto:[EMAIL PROTECTED]  from such a trifling investment of fact.  
  
http://derwisch.wikidot.com (Mark Twain, Life on the Mississippi)

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


Re: [R] Interactive plot

2008-06-29 Thread Gabor Grothendieck
I get those errors too but it works anyways.

On Sun, Jun 29, 2008 at 2:09 PM, Ron Michael [EMAIL PROTECTED] wrote:
 It is not working here. I am getting following errors [big list :( ] :



 library(playwith)

 Loading required package: grid
 Warning message:
 In namespaceImportFrom(self, asNamespace(ns)) :
   replacing previous import: addhandler
 library(lattice)
 playwith(barchart(seq_along(result) ~ result,
 + data = data.frame(result = calc(mat, c(alpha, vary[2],
 + parameters = list(alpha = seq(2000, 3000, by = 10)))
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Go back to
 previous plot call) :
   Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin,
 GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Go forward to next
 plot call) :
   Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin,
 GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Redraw the current
 plot (hold Shift for full reload)) :
   Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin,
 GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Show help page for
 this plot function) :
   Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin,
 GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
 Loading required package: RGtk2
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Always show this
 window) :
   Cannot find 'tooltip-text' to set in GtkToggleToolButton, GtkToolButton,
 GtkToolItem, GtkBin, GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned,
 GObject, RGtkObject
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Keep this window,
 do not replace it (open next plot in a new window)) :
   Cannot find 'tooltip-text' to set in GtkToggleToolButton, GtkToolButton,
 GtkToolItem, GtkBin, GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned,
 GObject, RGtkObject
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Copy this plot to
 the clipboard (as a bitmap)) :
   Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin,
 GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = View and edit
 attached data objects) :
   Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin,
 GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Change the plot
 type and settings) :
   Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin,
 GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Choose Lattice
 theme) :
   Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin,
 GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Time mode: scroll
 along the x-axis) :
   Cannot find 'tooltip-text' to set in GtkToggleToolButton, GtkToolButton,
 GtkToolItem, GtkBin, GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned,
 GObject, RGtkObject
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Choose a panel to
 expand and focus (for further interaction)) :
   Cannot find 'tooltip-text' to set in GtkToggleToolButton, GtkToolButton,
 GtkToolItem, GtkBin, GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned,
 GObject, RGtkObject
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Identify data
 points by clicking on them) :
   Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin,
 GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Add your own
 labels to the plot) :
   Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin,
 GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Add an arrow to
 the plot) :
   Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin,
 GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Edit annotations
 (including arrows)) :
   Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin,
 GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Remove labels and
 annotations) :
   Cannot find 'tooltip-text' to set in GtkToolButton, GtkToolItem, GtkBin,
 GtkContainer, GtkWidget, GtkObject, GInitiallyUnowned, GObject, RGtkObject
 Error in `[[-.GObject`(`*tmp*`, tooltip-text, value = Select a new plot
 region with the mouse) :
   Cannot find 

[R] function to export data

2008-06-29 Thread Daniel Pires
 

Hi,

 

I’m trying to built a simple  function that allows me to export
automatically some results to a text file. I’ve tried the two following
approaches but none worked. 

 

 exportdata-function(x) {

+ dataexp-summary(x)

+  export(dataexp,type=ascii,file=dataexp.txt)

+  }

 exportdata(glm.poisson0)

Error in eval(expr, envir, enclos) : object dataexp not found

 

 

 

exportdata2-function(x) {

sink(exportdata2.txt) 

summary(x)  

sink() 

}

 

 exportdata2(glm.poisson0) # the file is created but with no data in it.

 

 

Can anyone give me some hints on what I’m missing here? I would be very
grateful for that.

 

Thanks.

 

 

Daniel Pires

 

 

Daniel Pires

Faculdade de Ciências da Universidade de Lisboa

Dep. Biologia Animal

Ed. C2, piso 2

Campo Grande 1749-016 Lisboa

Portugal

 http://ffishgul.fc.ul.pt/ http://ffishgul.fc.ul.pt/

 


[[alternative HTML version deleted]]

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


[R] help

2008-06-29 Thread 王春萍
Dear :
   I am a college student, one R beginner, now i am doing one exercise with 
mclust
package.
   I want to try one hierarchy cluster ananlysis on my data and my aim is to 
find
out the clusters from the result and what are the members for each cluster?
   So can you give me some advices
   thanks in advance!
   
 
   chunping wang

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

2008-06-29 Thread Xiaohui Chen
mclust is not doing the hierarchicial clustering, if I understand your 
question correctly. Presumably you define certain distance measure, 
hclust and cut funtions should do the job. On the other hand, if the 
purpose is to extract the classification labels from mclust package, it 
should be straightforward based on its documentation.


X

王春萍 写道:

Dear :
   I am a college student, one R beginner, now i am doing one exercise with 
mclust
package.
   I want to try one hierarchy cluster ananlysis on my data and my aim is to 
find
out the clusters from the result and what are the members for each cluster?
   So can you give me some advices
   thanks in advance!
   
 
   chunping wang


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




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


[R] Fwd: cannot install the package RMySQL

2008-06-29 Thread Peng Jiang
Hi,

I first report the installing error to the r-sig-mac mailing list but  
it seems
nobody ever encounter this annoying problem and I got no replies. so I
am trying to forward it to this list, hope it never bothers.

Anyone had the same problem, or what does the warning message mean ?

Thank you in advance !

Begin forwarded message:

 From: Peng Jiang [EMAIL PROTECTED]
 Date: 2008年6月29日 下午11时06分22秒
 To: [EMAIL PROTECTED]
 Subject: cannot install the package RMySQL

 Hi,

 I am writing to report the error when installed the package RMySQL.
 I tried installing for like 5 times and it gives the following error  
 every time.

 gzip: stdin: unexpected end of file
 tar: Unexpected EOF in archive
 tar: Unexpected EOF in archive
 tar: Error is not recoverable: exiting now

 is it because all the downloading error or something else ?

 I am running Mac OS X 10.5.3 with R 2.7.1.

 thanks in advance.

 best regards

 ---
 Peng Jiang (江鹏), Ph.D. Candidate
 Antai College of Economics  Management 安泰经济管理学院
 Department of Mathematics 数学系
 Shanghai Jiaotong University (Minhang Campus)
 800 Dongchuan Road
 200240 Shanghai
 P. R. China


---
Peng Jiang 江鹏 ,Ph.D. Candidate
Antai College of Economics  Management
安泰经济管理学院
Department of Mathematics
数学系
Shanghai Jiaotong University (Minhang Campus)
800 Dongchuan Road
200240 Shanghai
P. R. China


[[alternative HTML version deleted]]

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


Re: [R] help

2008-06-29 Thread Daniel Malter
Assuming that you have installed and loaded the mclust library, type ?Mclust
in the R-prompt. An example is provided there with the popular iris dataset.
It seems to be as simple as Mclust(yourdata), where yourdata contains the
dataset (data columns of your dataset) on which you want to perform cluster
analysis; see the documentation for options. By standard, Mclust looks for
1to 9 clusters.

-
cuncta stricte discussurus
-

-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im
Auftrag von ???
Gesendet: Sunday, June 29, 2008 11:10 PM
An: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Betreff: [R] help

Dear :
   I am a college student, one R beginner, now i am doing one exercise with
mclust package.
   I want to try one hierarchy cluster ananlysis on my data and my aim is to
find out the clusters from the result and what are the members for each
cluster?
   So can you give me some advices
   thanks in advance!
   
 
   chunping wang

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

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


Re: [R] Parallel R

2008-06-29 Thread Juan Pablo Romero Méndez
Thanks!

It turned out that Rmpi was a good option for this problem after all.

Nevetheless, pnmath seems very promising, although it doesn't load in my system:


 library(pnmath)
Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared library
'/home/jpablo/extra/R-271/lib/R/library/pnmath/libs/pnmath.so':
  libgomp.so.1: shared object cannot be dlopen()ed
Error: package/namespace load failed for 'pnmath'


I find it odd, because  libgomp.so.1 is in /usr/lib, so R should find it.


  Juan Pablo


On Sun, Jun 29, 2008 at 1:36 AM, Martin Morgan [EMAIL PROTECTED] wrote:
 Juan Pablo Romero Méndez [EMAIL PROTECTED] writes:

 Hello,

 The problem I'm working now requires to operate on big matrices.

 I've noticed that there are some packages that allows to run some
 commands in parallel. I've tried snow and NetWorkSpaces, without much
 success (they are far more slower that the normal functions)

 Do you mean like this?

 library(Rmpi)
 mpi.spawn.Rslaves(nsl=2) # dual core on my laptop
 m - matrix(0, 1, 1000)
 system.time(x1 - apply(m, 2, sum), gcFirst=TRUE)
   user  system elapsed
  0.644   0.148   1.017
 system.time(x2 - mpi.parApply(m, 2, sum), gcFirst=TRUE)
   user  system elapsed
  5.188   2.844  10.693

 ? (This is with Rmpi, a third alternative you did not mention;
 'elapsed' time seems to be relevant here.)

 The basic problem is that the overhead of dividing the matrix up and
 communicating between processes outweighs the already-efficient
 computation being performed.

 One solution is to organize your code into 'coarse' grains, so the FUN
 in apply does (considerably) more work.

 A second approach is to develop a better algorithm / use an
 appropriate R paradigm, e.g.,

 system.time(x3 - colSums(m), gcFirst=TRUE)
   user  system elapsed
  0.060   0.000   0.088

 (or even faster, x4 - rep(0, ncol(m)) ;)

 A third approach, if your calculations make heavy use of linear
 algebra, is to build R with a vectorized BLAS library; see the R
 Installation and Administration guide.

 A fourth possibility is to use Tierney's 'pnmath' library mentioned in
 this thread

 https://stat.ethz.ch/pipermail/r-help/2007-December/148756.html

 The README file needs to be consulted for the not-exactly-trivial (on
 my system) task of installing the package. Specific functions are
 parallelized, provided the length of the calculation makes it seem
 worth-while.

 system.time(exp(m), gcFirst=TRUE)
   user  system elapsed
  0.108   0.000   0.106
 library(pnmath)
 system.time(exp(m), gcFirst=TRUE)
   user  system elapsed
  0.096   0.004   0.052

 (elapsed time about 2x faster). Both BLAS and pnmath make much better
 use of resources, since they do not require multiple R instances.

 None of these approaches would make a colSums faster -- the work is
 just too small for the overhead.

 Martin

 My problem is very simple, it doesn't require any communication
 between parallel tasks; only that it divides simetricaly the task
 between the available cores. Also, I don't want to run the code in a
 cluster, just my multicore machine (4 cores).

 What solution would you propose, given your experience?

 Regards,

   Juan Pablo

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

 --
 Martin Morgan
 Computational Biology / Fred Hutchinson Cancer Research Center
 1100 Fairview Ave. N.
 PO Box 19024 Seattle, WA 98109

 Location: Arnold Building M2 B169
 Phone: (206) 667-2793


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