Re: [R] Bug in R 2.4.1 ?

2007-04-24 Thread Sebastian Weber
Hi!

Replying to my own post: Thanks Duncan for your hint to try the newest
version! I did not think of this in the first place as I'm using the
newest Ubuntu feisty fawn release which got released a couple of days
ago. Nevertheless, the r-cran-hdf5 package is outdated and the newest
one available at cran works again as I want it to.

So cancel this R bug and and account it for a user bug :-).

Greetings,

Sebastian

On Mon, 2007-04-23 at 11:20 -0400, Duncan Murdoch wrote:
 On 4/23/2007 10:56 AM, Sebastian Weber wrote:
  Hello everybody,
  
  I'm using hdf5 files to store results from intermediate calculations.
  These are usually part of a list, called res. As I want the hdf-files
  to contain all the members of res in its top directory, I used to do
  
  attach(res)
  do.call(hdf5save, args=c(fileout=file.path(dir, ofile),  
  as.list(names(res
  detach(res)
  
  which did what I wanted (R version 2.3.1 under ubuntu edgy). Since the
  upgrade to ubuntu feisty fawn which ships with R 2.4.1, the code above
  causes a crash:
  
   *** caught segfault ***
  address 0x11, cause 'memory not mapped'
  
  Traceback:
   1: .External(do_hdf5save, call, sys.frame(sys.parent()),
  fileout, ..., PACKAGE = hdf5)
   2: hdf5save(fileout =
  tex/ABpattern_pub/data/knnTest/gTest_annAB.1.statsAll.hdf5,
  newman, hist, graphProp, graphBins)
   3: do.call(hdf5save, args = c(fileout = file.path(dir, ofile),
  as.list(names(res
   4: avgGraphData(dir = tex/ABpattern_pub/data/knnTest)
  
  Any ideas on how to fix this or what is wrong? To me it seems to be a
  bug introduced in R 2.4.1.
 
 hdf5save is a function in the hdf5 contributed package, so you should 
 start with its maintainer, Marcus G. Daniels [EMAIL PROTECTED].  But 
 before you bother him, make sure you're using the latest release of it. 
   If you still have problems, give him the usual details requested in
 the posting guide.
 
 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.


[R] inner loop problem!?

2007-04-24 Thread Christian Schulz
Hi,

i have  656 attributes ind INTERVALL_VAR  119 in GROUP
and this morning i'm little confused why the inner loop hang if it 
arrive 656th  column.
My Task is a t-test and correlation with all columns in INTERVALL_VAR 
for all attributes in GROUP.

many thanks  regards,
christian

  for( k in 
1:length(GROUP)){   
 

for(i in 
1:length(INTERVALL_VAR)){   
 

calc - t.test(INTERVALL_VAR[,i] ~ 
GROUP[,k])  
 

korrel[i] - 
round(cor(INTERVALL_VAR[,i],GROUP[,k]),3)   
   

name1[i] -   
colnames(INTERVALL_VAR[i])  


name2[i] -   
colnames(GROUP[k])  
 

sig[i] - 
round(calc$p.value,4)   
   

estimate0[i] - 
round(calc$estimate[1],2)   
 

estimate1[i] - 
round(calc$estimate[2],2)   
 

}   
 

}   
 




result - 
as.data.frame(cbind(name1,name2,korrel,sig,estimate0,estimate1),row.names=F)

__
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] read.table

2007-04-24 Thread elyakhlifi mustapha
sorry,
I don't undersatnd what happens

Annee_O;Id_Essai;Id_Rep;Id_Geno;Id_Cult;Lib_Geno;St_Cult;Id_Par;X_Par;Y_Par;Id_Cara;Surf_O;Val_O;Ori_O;Stade_O;Date_O;Id_Bloc;Id_TrT1
2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;137;;9.4;P;;09/09/2004;1;0
2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;193;;189;P;;01/01/2004;1;0
2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;103;14.95;85;P;;09/09/2004;1;0
2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;177;;55.1;P;;05/10/2004;1;0
2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;138;14.95;6.3;P;;09/09/2004;1;0
2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;308;;140;P;;05/08/2004;1;0
2004;1006003;1;55096;1012999;Dally/1;;2;2;1;137;;8.9;P;;09/09/2004;1;0
2004;1006003;1;55096;1012999;Dally/1;;2;2;1;193;;192;P;;01/01/2004;1;0
2004;1006003;1;55096;1012999;Dally/1;;2;2;1;103;14.95;87;P;;09/09/2004;1;0



that's the begining of my table and I'm trying to read it from R but I can't 
actually to read it I write this script

 donAP - read.table(C:/Documents and Settings/melyakhlifi/Mes 
 documents/feuilles 
 excel/copi_donnees3.csv,header=TRUE,sep=;,quote=,dec=.)
Erreur dans scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  
: 
la ligne 656 n'avait pas 18 éléments

there's some errors and I don't understand why?


  
___





[[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] Changing working directory

2007-04-24 Thread Martin Maechler
 Petr == Petr Klasterecky [EMAIL PROTECTED]
 on Mon, 23 Apr 2007 14:27:03 +0200 writes:

Petr Hi,
Petr you seem to have mixed 2 different things:
Petr 1) changing a working directory - see ?setwd, ?getwd
Petr However, this will NOT load another .Rdata file.

Petr 2) loading data - see ?load and ?save, ?save.image - loading new data 
Petr image will erase all currently stored objects.

Huuuh??? Not if you use the standard R function  load()!

Nothing is erased.  If you load objects for which you have
objects in the same name in your workspace, then and only then,
those in the workspace will be replaced by the newly loaded
ones.

For that reason,

   attach(some_file.rda)

is sometimes preferred.
But, as Uwe Ligges has already said:
Working with .Rdata files is not recommended: You should work
with script files (foo.R), source() and possibly even own packages
and only save() {and load()/attach()} things that are expensive to rebuild.
And for those, I strongly recommend to use a filename different
from .Rdata.

Martin Maechler, ETH Zurich

Petr Petr


Petr Walter Paczkowski napsal(a):
 Good morning,
 
 I keep copies my .RData file in different directories for different 
projects on Windows XP.  There is an icon on my desktop for each project so all 
I have to do is click on the icon to open R for a specific project, i.e. a 
specific .RData file.  How do I change to another .RData file from within R 
without first closing R?
 
 Thanks,
 
 Walt Paczkowski

__
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] importing excel-file#caveat clipboard

2007-04-24 Thread christian.ritter
Just a little caveat concerning the use of the clipboard to transfer data from 
excel to R:

If I remember right, at least up to Excel 2003, copying data from a worksheet 
(Edit/Copy) to the windows clipboard, copies the data in the number format in 
which they are seen in Excel. That is, if you formatted your data to be easy to 
read (for example, you formated 12.3456 to 12.3), the 12.3 (and not the 
original number) will be copied to the clipboard. When you then get the data 
into R (via read.delim or delim2), 12.3 will be the number which will be 
transferred. This is a little peculiar, since if you paste what you copied into 
a different worksheet (instead of R) you recover all decimals ... but this uses 
the office clipboard ...

So, if you wish to use the clipboard trick, first remove all number formats, 
then copy ... 

Have a nice day,

Chris. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Peter Dalgaard
Sent: Thursday, 19 April, 2007 2:39 PM
To: John Field
Cc: Schmitt, Corinna; r-help@stat.math.ethz.ch
Subject: Re: [R] importing excel-file


John Field wrote:
 Corinna,

 I find the easiest way to read simple Excel files (under Windows) is 
 to highlight the section of the worksheet I want to read, copy it to 
 the clipboard, and then use

 data - read.delim(clipboard)

 You will also need  the parameter dec=, to set the decimal point.
   
Or use read.delim2, which is what it is for.
 Regards,
 John Field
 Adelaide, SA



 Message: 23
 Date: Wed, 18 Apr 2007 16:10:51 +0200
 From: Schmitt, Corinna [EMAIL PROTECTED]
 Subject: [R] importing excel-file
 To: r-help@stat.math.ethz.ch
 Message-ID:
  [EMAIL PROTECTED]
 Content-Type: text/plain; charset=us-ascii
 Dear R-experts,
 It is a quite stupid question but please help me. I am very confuced. I
 am able to import normal txt ant mat-files to R but unable to import
 .xls-file
 I do not understand the online help. Can please anyone send me the
 corresponding command lines? The .xls-file is attached. In my file we
 use commas for the decimal format (example: 0,712), changes might be
 needed.
 Thanks, Corinna


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


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
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] inner loop problem!?

2007-04-24 Thread Christian Schulz
Hi,

i understand my problem , because i overwrite my result's from previous 
loop's again and agian, really stupid :-]
regards, christian

 Hi,

 i have  656 attributes ind INTERVALL_VAR  119 in GROUP
 and this morning i'm little confused why the inner loop hang if it 
 arrive 656th  column.
 My Task is a t-test and correlation with all columns in INTERVALL_VAR 
 for all attributes in GROUP.

 many thanks  regards,
 christian

   for( k in 
 1:length(GROUP)){ 


 for(i in 
 1:length(INTERVALL_VAR)){ 


 calc - t.test(INTERVALL_VAR[,i] ~ 
 GROUP[,k])


 korrel[i] - 
 round(cor(INTERVALL_VAR[,i],GROUP[,k]),3) 
  

 name1[i] -   
 colnames(INTERVALL_VAR[i])
   

 name2[i] -   
 colnames(GROUP[k])


 sig[i] - 
 round(calc$p.value,4) 
  

 estimate0[i] - 
 round(calc$estimate[1],2) 


 estimate1[i] - 
 round(calc$estimate[2],2) 


 } 


 } 


   
   

 result - 
 as.data.frame(cbind(name1,name2,korrel,sig,estimate0,estimate1),row.names=F)

 __
 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] high resolution plot tick problems

2007-04-24 Thread Prof Brian Ripley
You will do better to use e.g. bitmap() and bitmap the output at 
600 dpi, if that is what you are aiming at.  The default line width 
will be 1/96.

You haven't told us what OS 'my PC' is running, but people who say that 
usually mean Windows.  On the Windows' png device the default line width 
is one pixel.

On Mon, 23 Apr 2007, Brian O'Connor wrote:

 R-Masters,

 I need to produce high resolution line plots, with two or more plots
 per page. The commands I'm using cause the tick labels to appear on
 the x-axis line itself rather than below it. And the tick marks are
 so tiny they are invisible. These commands produce the problem on my
 PC:

 png(trial.png, width=3000, height=4800, res = 600 ) # width 
 height purposely set for 5 x 8 inches

 par(ann=F, font.main=2, font.lab=2, font.axis=1,
 cex=1, cex.main=7, cex.lab=7, cex.axis=7,
 lwd=12, las=1, mai=c(6, 6, 5, 3) )

 x = seq(-2.5, 2.5, length=100)

 split.screen(c(2,1))
 screen(1)
 plot(x,sin(x),type=l,xlim=c(-3,3))
 title(main=Plot 1,xlab=x,ylab=y,line=16)
 screen(2)
 plot(x,cos(x),type=l,xlim=c(-3,3))
 title(main=Plot 2,xlab=x,ylab=y,line=16)

 close.screen(all = TRUE)
 dev.off()


 If cex.axis is lowered to 1, the problem disappears, but the tick and
 tick labels are way too small. I've spent a lot of time struggling
 with this, but can't find a way out.

 Thanks for your time.



-- 
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] read.table

2007-04-24 Thread Peter Dalgaard
elyakhlifi mustapha wrote:
 sorry,
 I don't undersatnd what happens

 Annee_O;Id_Essai;Id_Rep;Id_Geno;Id_Cult;Lib_Geno;St_Cult;Id_Par;X_Par;Y_Par;Id_Cara;Surf_O;Val_O;Ori_O;Stade_O;Date_O;Id_Bloc;Id_TrT1
 2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;137;;9.4;P;;09/09/2004;1;0
 2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;193;;189;P;;01/01/2004;1;0
 2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;103;14.95;85;P;;09/09/2004;1;0
 2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;177;;55.1;P;;05/10/2004;1;0
 2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;138;14.95;6.3;P;;09/09/2004;1;0
 2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;308;;140;P;;05/08/2004;1;0
 2004;1006003;1;55096;1012999;Dally/1;;2;2;1;137;;8.9;P;;09/09/2004;1;0
 2004;1006003;1;55096;1012999;Dally/1;;2;2;1;193;;192;P;;01/01/2004;1;0
 2004;1006003;1;55096;1012999;Dally/1;;2;2;1;103;14.95;87;P;;09/09/2004;1;0



 that's the begining of my table and I'm trying to read it from R but I can't 
 actually to read it I write this script

   
 donAP - read.table(C:/Documents and Settings/melyakhlifi/Mes 
 documents/feuilles 
 excel/copi_donnees3.csv,header=TRUE,sep=;,quote=,dec=.)
 
 Erreur dans scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, 
  : 
 la ligne 656 n'avait pas 18 �l�ments

 there's some errors and I don't understand why?

   
The obvious question is what line 656 (+/- a couple of lines) actually
contains...

x - readLines(C:/Documents and Settings/melyakhlifi/Mes
documents/feuilles  excel/copi_donnees3.csv)
length(x)
x[656]
x[653:658] # (if long enough)

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
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] information extraction

2007-04-24 Thread Schmitt, Corinna
Dear R-experts,

I imported successful a workspace from Matlab. The information is stored
in the variable data. If I use the command length(data) I get back a
number which corresponds to the number of variables which were imported.
Here it is 82. Now I only want to know the names of the imported
variables to modify my program. Can anyone help me?

My knowledge which I tested yet to archive the goal:

1. I know that I can extract the information of a variable with the
command data$staine for example. Here I need to know the variable name
staine coming from Matlab. But what if I do not know it?

2. The command data[10] just gives me back the information stored in
the variable no. 10  but I do not know the name.

3. I am not allowed to make changes in the Matlab code because it just a
lizenced program so I need to do it in R. In Matlab I just need to add
the code line names=evalin('base','who') and than store the workspace.
I could use the variable name in and extract the names with data$names.


Has anyone an idea?

Thanks, Corinna

__
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] Question about SAMR

2007-04-24 Thread Isabelle Rivals
I have a question regarding the samr package.

For a 2 class unpaired problem, with sample 1 of size N1 and sample 2 
of size N2,  samr computes at most  (N1+N2)! permutations of the two 
samples (if the user-supplied parameter nperms allows it). However, 
there are only (N1+N2)/(N1!*N2!) DISTINCT permutations of the two 
samples, so it seems to me that only these distinct permutations should 
be taken into consideration. Of course, working with the (N1+N2)! 
permutations and working with the (N1+N2)/(N1!*N2!) distinct 
permutations will lead to the same correct result, but for a number of 
permutations smaller than (N1+N2)/(N1!*N2!), the result will generally 
be different.

I would be very  grateful if someone could provide me an explanation 
for the samr choice of the permutations.

Thanks for your help,
Isabelle



Dr. Isabelle Rivals - Maître de Conférences
Équipe de Statistique Appliquée - ESPCI
10 rue Vauquelin - 75231 PARIS Cedex 05
Tél : (00 33 1) 40 79 45 45
Fax : (00 33 1) 40 79 44 20

__
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] information extraction

2007-04-24 Thread Schmitt, Corinna
Hallo Peter,

thank you. It is exact what I wanted. Now I can modify my program.

Corinna
  



Von: Peter Konings [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 24. April 2007 10:55
An: Schmitt, Corinna
Betreff: Re: [R] information extraction



Hi Corinna,

names() is what you are looking for, e.g.

names(data)
names(data)[10]
names(data) - a.vector.of.my.own.names

BTW, data() is a function in R, so it's better to avoid it as the name
of a dataframe. 
for more information, see the documentation installed with R or one of
the contributed documents at 

http://cran.r-project.org/other-docs.html

in particular the R and octave document will be relevant to you as a
matlab user. 

HTH
Peter.

On 4/24/07, Schmitt, Corinna [EMAIL PROTECTED] wrote: 

Dear R-experts,

I imported successful a workspace from Matlab. The information is stored
in the variable data. If I use the command length(data) I get back a
number which corresponds to the number of variables which were imported.

Here it is 82. Now I only want to know the names of the imported
variables to modify my program. Can anyone help me?

My knowledge which I tested yet to archive the goal:

1. I know that I can extract the information of a variable with the 
command data$staine for example. Here I need to know the variable name
staine coming from Matlab. But what if I do not know it?

2. The command data[10] just gives me back the information stored in 
the variable no. 10  but I do not know the name.

3. I am not allowed to make changes in the Matlab code because it just a
lizenced program so I need to do it in R. In Matlab I just need to add
the code line names=evalin('base','who') and than store the workspace.

I could use the variable name in and extract the names with data$names.


Has anyone an idea?

Thanks, Corinna

__
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] [R-pkgs] new version of seqinR

2007-04-24 Thread Simon Penel
Dear useRs,

The seqinR package  is a library of utilities to retrieve and analyse 
biological sequences.

A new version of seqinR, seqinR 1.0-7,  has been released on CRAN.

Here is a summary of changes:

o A new *experimental* function extractseqs() to download
  sequences thru zlib compressed sockets from an ACNUC server is released.
  Preliminary tests suggest that working with about 100,000 CDS is 
possible with
  a home ADSL connection. See the manual chapter 3 page 44 at
  http://pbil.univ-lyon1.fr/software/SeqinR/seqinr_1_0-7.pdf
  for some system.time() examples.

o As pointed by Emmanuel Prestat the URL used in dia.bactgensize() was no
  more available, this has been fixed in the current version.

o As pointed by Guy Perriere, the function oriloc() was no more compatible
  with glimmer 3.0 outputs. The function has gained a new argument
  glimmer.version defaulting to 3, but the value 2 is still functional for
  backward compatibility with old glimmer outputs.

o As pointed by Lionel Guy there was no default value for the as.string
  argument in the getSequence.SeqFastadna(). A default FALSE value is now
  present for backward compatibility with older code.

o New utility vectorized function stresc() to escape LaTeX special 
characters
  present in a string.

o New low level function readsmj() available.

o A new function readfirstrec() to get the record count of the specified 
ACNUC
  index file is now available.

o Function getType() called without arguments will now use the default 
ACNUC
  database to return available subsequence types.

o Function read.alignment() now also accepts file in addition to File as
  argument.

o A new function rearranged.oriloc() is available. This method, based on
  oriloc(), can be used to detect the effect of the replication 
mechanism on
  DNA base composition asymmetry, in prokaryotic chromosomes.

o New function extract.breakpoints(), used to extract breakpoints in 
rearranged
  nucleotide skews. This function uses the segmented package to define the
  position of the breakpoints.

o New function draw.rearranged.oriloc() available, to plot nucleotide skews
  on artificially rearranged prokaryotic chromosomes.

o New function gbk2g2.euk() available. Similarly to gbk2g2(), this function
  extracts the coding sequence annotations from a GenBank format file. This
  function is specifically designed for eukaryotic sequences, i.e. with 
introns.
  The output file will contain the coordinates of the exons, along with the
  name of the CDS to which they belong.

o After an e-mail by Marcelo Bertalan on 26 Mar 2007, a bug in oriloc() 
when
  the gbk argument was NULL was found and fixed by Anamaria Necsulea.

o Functions translate() and getTrans() have gained a new argument 
NAstring to
  represent untranslatable amino-acids, defaulting to character X.

o There was a typo for the total number of printed bases in the ACNUC 
books:
  474,439 should be 526,506.

o Function invers() has been deleted.

o Functions translate(), getTrans() and comp() have gained a new argument
  ambiguous defaulting to FALSE allowing to handle ambiguous bases. If 
TRUE,
  ambiguous bases are taken into account so that for instance GGN is 
translated
  to Gly in the standard genetic code.

o New function amb() to return the list of nucleotide matching a given 
IUPAC
  nucleotide symbol.

o Function count() has gained a new argument alphabet so that oligopeptides
  counts are now possible. Thanks to Gabriel Valiente for this suggestion.
  The functions zscore(), rho() and summary.SeqFastadna() have also an 
argument
  alphabet which is forwarded to count().

Best,

the seqinR team

http://pbil.univ-lyon1.fr/software/SeqinR/seqinr_accueil.php


-- 
Simon Penel
Laboratoire de Biometrie et Biologie Evolutive   
Bat 711  -   CNRS UMR 5558  -Universite Lyon 1  
43 bd du 11 novembre 1918 69622 Villeurbanne Cedex   
Tel:   04 72 43 29 04  Fax:  04 72 43 13 88
http://pbil.univ-lyon1.fr/members/penel

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

__
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] statistical modelling skill

2007-04-24 Thread justin bem
Dears helpers,

I have a question not specially about R, but about statistical modelling. This 
is the problem, I want to conduct a regression analysis to explain the causes 
of students fail in an exam. I have two variables the score obtain at the exam 
and the categorical variable coding 0 in case of fail and 1 in case of success, 
on a panel data. I am interest to know what made a student who usually succeed 
start to fail. So I have two possibilty : linear regression analysis with the 
score or a probit model with the fail indicator. 

In my view, the result will be similary. but is there any difference? what the 
advantage off choosing one the two approaches ? 

Sincerly

 
Justin BEM
Elève Ingénieur Statisticien Economiste
BP 294 Yaoundé.
Tél (00237)9597295.


  
___





[[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] (no subject)

2007-04-24 Thread elyakhlifi mustapha
I wanna display some data which there are subsets of a dataframe called don 
but there are errors like this

 L=as.numeric(levels(factor(don$Id_Cara)))
 for(i in L){
+ donC(i)=subset(don, Id_Cara == i, select = c( Id_TrT1, Id_Geno, Id_Rep, 
Val_O))
+ donC(i)
+ }
Erreur dans donC(i) = subset(don, Id_Cara == i, select = c(Id_TrT1, Id_Geno,  : 
impossible de trouver la fonction donC-

I understand that the problem comes from the third line 

it doesn't reconize donC(i) but  it's very important to make one boucle (in 
french) on the L's elements.

to tell more about L :

 L
[1] 103 137 138 177 193 308


  
___





[[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] Odp: (no subject)

2007-04-24 Thread Petr PIKAL
Hi

you shall:

use appropriate subject e.g. how to subset data
use [ ] brackets
initialize object donC before using it for assignment

and maybe try to look to some docummentation how to manipulate R objects 
(Paul Johnsons R tips are easily found by Google and they help me a lot 
during my first steps)

BTW split(don[, some.columns], don$Id_Cara) could maybe do what you want 
without using for cycle

Regards

Petr Pikal
[EMAIL PROTECTED]

[EMAIL PROTECTED] napsal dne 24.04.2007 11:48:48:

 I wanna display some data which there are subsets of a dataframe called 
don 
 but there are errors like this
 
  L=as.numeric(levels(factor(don$Id_Cara)))
  for(i in L){
 + donC(i)=subset(don, Id_Cara == i, select = c( Id_TrT1, Id_Geno, 
Id_Rep, Val_O))
 + donC(i)
 + }
 Erreur dans donC(i) = subset(don, Id_Cara == i, select = c(Id_TrT1, 
Id_Geno,  : 
 impossible de trouver la fonction donC-
 
 I understand that the problem comes from the third line 
 
 it doesn't reconize donC(i) but  it's very important to make one 
boucle 
 (in french) on the L's elements.
 
 to tell more about L :
 
  L
 [1] 103 137 138 177 193 308
 
 
 
 
___
 
 
 
 
 
[[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] (no subject)

2007-04-24 Thread jim holtman
Are you trying to create a 'list' of the subsets?  If so, try:

L=as.numeric(levels(factor(don$Id_Cara)))
donC - list()
for(i in L){
   donC[[i]] - subset(don, Id_Cara == i, select = c( Id_TrT1,
Id_Geno, Id_Rep, Val_O))
   print(donC[[i]])
}


Or better using the 'names' of the factors

L - levels(factor(don$Id_Cara))
donC - list()
for(i in L){
   donC[[i]] - subset(don, Id_Cara == i, select = c( Id_TrT1,
Id_Geno, Id_Rep, Val_O))
   print(donC[[i]])
}



On 4/24/07, elyakhlifi mustapha [EMAIL PROTECTED] wrote:
 I wanna display some data which there are subsets of a dataframe called don 
 but there are errors like this

  L=as.numeric(levels(factor(don$Id_Cara)))
  for(i in L){
 + donC(i)=subset(don, Id_Cara == i, select = c( Id_TrT1, Id_Geno, Id_Rep, 
 Val_O))
 + donC(i)
 + }
 Erreur dans donC(i) = subset(don, Id_Cara == i, select = c(Id_TrT1, Id_Geno,  
 :
impossible de trouver la fonction donC-

 I understand that the problem comes from the third line

 it doesn't reconize donC(i) but  it's very important to make one boucle 
 (in french) on the L's elements.

 to tell more about L :

  L
 [1] 103 137 138 177 193 308



 ___





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



-- 
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] problem in tapply command

2007-04-24 Thread temiz
hello

when I entered following command, I got NA values for some catagories.

  tapply(slp_jeo2$slp,slp_jeo2$jeo,mean )
  999   Ca  Cka  DCy   Jh  JKi   Kk
14.06665   NA 14.60445   NA   NA   NA   NA   NA
 KTa KTac   Ku  Kua  Kus   Ky  Kyk  ODe
  NA   NA   NA   NA   NA   NA   NA 17.87489
PTRc   Qa   TcTkisd
  NA   NA   NA 19.64067


how can I correct this problem ?

regards

-- 
Ahmet Temiz


-- 
This message has been scanned for viruses and\ dangerous con...{{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] R 2.5.0 is released

2007-04-24 Thread Peter Dalgaard
I've rolled up R-2.5.0.tar.gz a short while ago. This is a development 
release which contains a number of new features. In particular:

  - Object name completion by integration of package 'rcompletion' by 
Deepayan Sarkar
  - New recommended package 'codetools' by Luke Tierney
  - New Rscript front-end, which enables shell-like R scripting

also, a number of mostly minor bugs have been fixed. See the full list
of changes below.

You can get it (some time this evening) from

http://cran.r-project.org/src/base/R-2/R-2.5.0.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you. In case of 
impatience, try http://www.biostat.ku.dk/~pd/R-release

Binaries for various platforms will appear in due course.
 
For the R Core Team

Peter Dalgaard

These are the md5sums for the freshly created files, in case you wish
to check that they are uncorrupted:
a8efde35b940278de19730d326f58449  AUTHORS
eb723b61539feef013de476e68b5c50a  COPYING
a6f89e2100d9b6cdffcea4f398e37343  COPYING.LIB
aa6d06dd154bbde39b4d35f26068675d  FAQ
70447ae7f2c35233d3065b004aa4f331  INSTALL
b12ff4c900a49f0d7786d80e249934c9  NEWS
88bbd6781faedc788a1cbd434194480c  ONEWS
4f004de59e24a52d0f500063b4603bcb  OONEWS
b9088663fc539c059acfaf19d6d90a69  R-2.5.0.tar.gz
b9088663fc539c059acfaf19d6d90a69  R-latest.tar.gz
433182754c05c2cf7a04ad0da474a1d0  README
020479f381d5f9038dcb18708997f5da  RESOURCES
4eaf8a3e428694523edc16feb0140206  THANKS

This is the relevant part of the NEWS file:


CHANGES IN R VERSION 2.5.0


USER-VISIBLE CHANGES

o   apropos(x) and find(x) now both only work for character 'x',
and hence drop all non-standard evaluation behaviour.

o   Data frames can have 'automatic' row names which are not
converted to dimnames by as.matrix().  (Consequently, e.g.,
t(.)  for such data frames has NULL column names.)  This
change leads to memory reductions in several places, but can
break code which assumes character dimnames for data frames
derived from matrices.

No existing R object is regarded as having 'automatic' row
names, and it may be beneficial to recreate such objects via
read.table() or data.frame().

o   Using $ on an atomic vector now raises a warning, as does use
on an S4 class for which a method has not been defined.

o   The Unix-alike readline terminal interface now does
command-completion for R objects, incorporating the
functionality formerly in package 'rcompletion' by Deepayan
Sarkar.  This can be disabled by setting the environment
variable R_COMPLETION=FALSE when starting R (e.g. in
~/.Renviron).  (Note that when this is enabled, filename
completion no longer works for file paths containing R
operators such as '+' and '-'.)


NEW FEATURES

o   abbreviate() no longer has an 8191 byte limit on the size of
strings it can handle.

o   abs(x) now returns integer for integer or logical arguments.

o   apropos() has a new argument 'ignore.case' which defaults to
TRUE, potentially matching more than previously, thanks to a
suggestion by Seth Falcon.

o   args(), str() and print() now give the argument lists of primitive
functions.

o   as.matrix() gains the '...' argument that several packages have
assumed it always had (and S-PLUS has).

o   Manipulation of integers as roman numerals via as.roman() in
package utils.

o   attr() no longer treats name = NA_character_ as meaning
name = NA.

o   binom.test() now allows a 'fuzz' for calculated integer values
in its x and n arguments.

o   boxplot(*, notch = TRUE) now warns when notches are outside
hinges; related to PR#7690.

o   New function callCC() providing a downward-only version of
Scheme's call with current continuation.

o   capabilities() now has a profmem entry indicating whether
R has been compiled with memory profiling.

o   colnames-() and rownames-() now handle data frames explicitly,
so calling colnames- on a data frame no longer alters the
representation of the row names.

o   commandArgs() has a new 'trailingOnly' argument to be used in
conjunction with --args.

o   contour() now passes graphical parameters in '...' to axis()
and box().

o   New data set 'crimtab' on Student(1908)'s 3000 criminals.

o   cut.default() has a new argument 'ordered_result'.

o   .deparseOpts() has two new options: keepNA to ensure that
different types (logical, integer, double, character and
complex) of NAs are distinguished, and S_compatible to
suppress the use of R-specific features such as 123L and to
deparse integer values of a double vector with a trailing
decimal point.

The 'keepInteger' option now uses the suffix 'L' rather than
as.integer() where 

Re: [R] problem in tapply command

2007-04-24 Thread Riley, Steve
Ahmet,

Try the following syntax: tapply(slp_jeo2$slp,slp_jeo2$jeo,mean, na.rm =
T)

Steve

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of temiz
Sent: Tuesday, April 24, 2007 1:22 PM
To: r-help@stat.math.ethz.ch
Subject: [R] problem in tapply command

hello

when I entered following command, I got NA values for some catagories.

  tapply(slp_jeo2$slp,slp_jeo2$jeo,mean )
  999   Ca  Cka  DCy   Jh  JKi   Kk
14.06665   NA 14.60445   NA   NA   NA   NA   NA
 KTa KTac   Ku  Kua  Kus   Ky  Kyk  ODe
  NA   NA   NA   NA   NA   NA   NA 17.87489
PTRc   Qa   TcTkisd
  NA   NA   NA 19.64067


how can I correct this problem ?

regards

-- 
Ahmet Temiz


-- 
This message has been scanned for viruses and\ dangerous\ co...{{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] problem in tapply command

2007-04-24 Thread Dimitris Rizopoulos
probably you're looking for

tapply(slp_jeo2$slp, slp_jeo2$jeo, mean, na.rm = TRUE)


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: temiz [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Tuesday, April 24, 2007 7:21 PM
Subject: [R] problem in tapply command


 hello

 when I entered following command, I got NA values for some 
 catagories.

  tapply(slp_jeo2$slp,slp_jeo2$jeo,mean )
  999   Ca  Cka  DCy   Jh  JKi 
 Kk
 14.06665   NA 14.60445   NA   NA   NA   NA 
 NA
 KTa KTac   Ku  Kua  Kus   Ky  Kyk 
 ODe
  NA   NA   NA   NA   NA   NA   NA 
 17.87489
PTRc   Qa   TcTkisd
  NA   NA   NA 19.64067


 how can I correct this problem ?

 regards

 -- 
 Ahmet Temiz


 -- 
 This message has been scanned for viruses and\ dangerous 
 con...{{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.
 


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] How to get LSMEANS from linear mixed model?

2007-04-24 Thread Chuck Cleland
Yannan Jiang wrote:
 Hi there,
 
  
 
 I am trying to run simulations using R with linear mixed model (lme). There
 are two factors in my fixed effect model, educ (treatment and control) and
 mth (visit 1, 2, and 3). What I want to obtain is the estimated treatment
 difference (treatment - control) at visit 3, plus the standard error and
 p-value. This can be easily obtained in SAS using lsmeans or estimate
 statements, but I am not sure how to do this in R. 
 
  
 
 The fixed effects I obtained are as follows:
 
  
 
 Fixed effects: ymth ~ educ * mth - 1 
 
 Value   Std.Error
 DFt-value   p-value
 
 educcont   0.14814308   0.006232419  93
 23.769758 0.
 
 eductreat   0.13696952   0.006255672  93
 21.895254 0.
 
 mthymth2  0.3759   0.006333043  165
 0.005936   0.9953
 
 mthymth3  0.01075489   0.006251328  165
 1.720416   0.0872
 
 eductreat:mthymth2   0.00323847   0.008947291  165
 0.361950   0.7179
 
 eductreat:mthymth3   -0.01246565  0.008941306  165
 -1.394164  0.1651
 
  
 
  
 
 The estimated treatment difference I am interested are:
 
  
 
  a-0.14814308+0.01075489 
 
  b-0.13696952+0.01075489-0.01246565
 
 b-a
 
 [1] -0.02363921   (treatment effect at visit 3, same as SAS lsmean output)
 
  
 
 But I don't know how to get the standard error and corresponding p-value for
 this estimate. Any of your helps on that would be greatly appreciated! 

  How about fitting the model this way?

df$mth - relevel(df$mth, ref = ymth3)
lme(ymth ~ educ * mth, random = ~ 1 | id, data = df)

  The coefficient for educ will contain the simple effect of educ at
mth=ymth3, along with a standard error and p-value.

 Thanks,
 
 Yannan
 
  
 
 
   [[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. 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
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] Re : statistical modelling skill

2007-04-24 Thread justin bem
Thank, Jim to look to my post . I dont explain pass/fail by the exam score but 
I want to explain both of them by a set of explanotory variables. 
y_{i}=a_{0}+\sum_{i}a_{i}x_{i}
   or P(z_{i}=k)=F(a_{0}+\sum_{i}a_{i}x_{i}) z_{i}=1(c_{k}yc_{k+1}

I want to know if there is a great difference? which are the advantage for the 
each other compared to another.   
 
Justin BEM
Elève Ingénieur Statisticien Economiste
BP 294 Yaoundé.
Tél (00237)9597295.



- Message d'origine 
De : Jim Lemon [EMAIL PROTECTED]
À : justin bem [EMAIL PROTECTED]
Envoyé le : Mardi, 24 Avril 2007, 11h10mn 01s
Objet : Re: [R] statistical modelling skill


justin bem wrote:
 Dears helpers,
 
 I have a question not specially about R, but about statistical modelling. 
 This is the problem, I want to conduct a regression analysis to explain the 
 causes of students fail in an exam. I have two variables the score obtain at 
 the exam and the categorical variable coding 0 in case of fail and 1 in case 
 of success, on a panel data. I am interest to know what made a student who 
 usually succeed start to fail. So I have two possibilty : linear regression 
 analysis with the score or a probit model with the fail indicator. 
 
 In my view, the result will be similary. but is there any difference? what 
 the advantage off choosing one the two approaches ? 

Hi Justin,
I'm probably missing something, but I can't see how predicting pass/fail 
with the exam score will reveal anything other than the minimum passing 
grade. There is an awful lot of work in this field, typically measuring 
everything from the student's birth weight to the number of bars they 
visit while at college. However, the generalized linear model is your 
tool, using the binomial link function.

Jim


  
___





[[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] Re : (no subject)

2007-04-24 Thread justin bem
Mustapha,

donC is not a function if it is a list write donC[[i]] or donC[i] for indexing
 
Justin BEM
Elève Ingénieur Statisticien Economiste
BP 294 Yaoundé.
Tél (00237)9597295.



- Message d'origine 
De : elyakhlifi mustapha [EMAIL PROTECTED]
À : R-help@stat.math.ethz.ch
Envoyé le : Mardi, 24 Avril 2007, 10h48mn 48s
Objet : [R] (no subject)


I wanna display some data which there are subsets of a dataframe called don 
but there are errors like this

 L=as.numeric(levels(factor(don$Id_Cara)))
 for(i in L){
+ donC(i)=subset(don, Id_Cara == i, select = c( Id_TrT1, Id_Geno, Id_Rep, 
Val_O))
+ donC(i)
+ }
Erreur dans donC(i) = subset(don, Id_Cara == i, select = c(Id_TrT1, Id_Geno,  : 
impossible de trouver la fonction donC-

I understand that the problem comes from the third line 

it doesn't reconize donC(i) but  it's very important to make one boucle (in 
french) on the L's elements.

to tell more about L :

 L
[1] 103 137 138 177 193 308


  
___





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


  


ls.. et vos réactions !

[[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] from R to html

2007-04-24 Thread elyakhlifi mustapha
hello,
If I wanna export data.frame from R to html have you got some ideas to do this?


  
___





[[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] from R to html

2007-04-24 Thread Henrique Dallazuanna
Use the package R2HTML.

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22
Ohttp://maps.google.com/maps?f=qhl=enq=Curitiba,+Brazillayer=ie=UTF8z=18ll=-25.448315,-49.276916spn=0.002054,0.005407t=kom=1

On 4/24/07, elyakhlifi mustapha [EMAIL PROTECTED] wrote:

 hello,
 If I wanna export data.frame from R to html have you got some ideas to do
 this?




 ___





 [[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] Calculating means in a new table

2007-04-24 Thread Dieter Wirz
Dear all -
I imported (on a Mac) a big table with 2000 lines:
 mydata - read.table(file(/Users/didiw/Desktop/R/all.txt), header = TRUE) 
 mydata[1:15,]
   location Spezies Spec E.MPa.   Phi No Trial  
1LC   PJ  13.27  7.51  1 1  
2LC   PJ  14.24  6.68  1 1  
3LC   PJ  14.28  7.01  2 1  
4LC   PJ  16.65  6.30  1 2  


Now i want to crate a new table mymeans where all means and Stdev 
of E.MPa and Phi when location, Spezies, No, and Trial are the same, 
something like this:

   location Spezies Spec No Trial mean.Estddev.Emean.Phi
std.Phi
1LC   PJ 1 1  xxxx  xx  
xx
2LC   PJ 2 1  xxxx  xx  
xx  
3LC   PJ 1 2  xxxx  xx  
xx 


Because I we did ca 8 repetition of each measurement, the new table should
have only 2000/8 lines.

Thanks for any help!

-didi

__
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] Handling of arrays

2007-04-24 Thread laptopcss
Dear R-Experts,

I just imported a workspace from Matlab. I know that I can get the names of the 
imported variables with names(). It works. The variable ca consists of 
several elements. I want to get the names of the elements to handle my output 
better. But names(ca) doesn't work. Why? I did the following commands:

 class(ca)
[1] array
 mode(ca)
[1] list
 dim(ca)
[1] 66  1  1
 length(ca)
[1] 66

How can I now get the names which are stored in ca? When I use the command 
ca[18] I receive the content which stands there but not the name collables 
which I wanted to extract. 

Any ideas?

Thanks, Corinna 
-- 
Feel free - 10 GB Mailbox, 100 FreeSMS/Monat ...

__
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] Kernel

2007-04-24 Thread Oriana Caldera
I'm a new user of R-packages.
  I'm in need of information with regard to Stochastic Kernel.
  I would like to know if I can use R to compute stochastic Kernels according 
to Quah methodology.
  Best wishes,
  Oriana

   
-

-

[[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] Calculating means in a new table

2007-04-24 Thread Petr PIKAL
Hi

look at aggregate

something like 

mymean-aggregate(mydata[,4:5], list( location, Spezies), mean)
mysd-aggregate(mydata[,4:5], list( location, Spezies), sd)

and then cbind(appropriate columns of resulting data frames)

Petr Pikal
[EMAIL PROTECTED]

[EMAIL PROTECTED] napsal dne 24.04.2007 14:04:30:

 Dear all -
 I imported (on a Mac) a big table with 2000 lines:
  mydata - read.table(file(/Users/didiw/Desktop/R/all.txt), header = 
TRUE) 
  mydata[1:15,]
location Spezies Spec E.MPa.   Phi No Trial 
 1LC   PJ  13.27  7.51  1 1 
 2LC   PJ  14.24  6.68  1 1 
 3LC   PJ  14.28  7.01  2 1 
 4LC   PJ  16.65  6.30  1 2 
 
 
 Now i want to crate a new table mymeans where all means and Stdev 
 of E.MPa and Phi when location, Spezies, No, and Trial are the same, 
 something like this:
 
location Spezies Spec No Trial mean.E   stddev.E   mean.Phi   std.Phi
 1LC   PJ 1 1  xx  xx  xx  xx
 2LC   PJ 2 1  xx  xx  xx  xx 
 3LC   PJ 1 2  xx  xx  xx  xx 
 
 
 Because I we did ca 8 repetition of each measurement, the new table 
should
 have only 2000/8 lines.
 
 Thanks for any help!
 
 -didi
 
 __
 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] Problem with length of array while calling C from R

2007-04-24 Thread Sven Knüppel
Hello,

my problem is that I don't know how long must be an array of double while 
calling C from R.

R-Code:
 array - c(1,1,1)
 save - .C ( Ctest , a = array )

C-Code:
void Ctest ( double *array )
{ ...
  array = (double*) realloc ( array , new_number * sizeof(double) ) ;
  ...
}

The length of array will be compute in C.

At the end save$a has a length of 3 and not the length of the allocated array 
in C.

What can I do?

Thank you in advance.

Sven Knüppel

__
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] from R to html

2007-04-24 Thread Jeffrey Horner
Henrique Dallazuanna wrote:
 Use the package R2HTML.

Or xtable.

Jeff
-- 
http://biostat.mc.vanderbilt.edu/JeffreyHorner

__
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] from R to html

2007-04-24 Thread Stefan Grosse
Is it so much effort to use the search on r-project.org?

elyakhlifi mustapha wrote:
 hello,
 If I wanna export data.frame from R to html have you got some ideas to do 
 this?


   
 ___





   [[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] Datasets' data license ?

2007-04-24 Thread David Cournapeau
Hi,

I would like to know if someone could clarify a question regarding 
license for redistribution of raw data in the datasets package. If 
possible, I would like to reuse those data in a package for scipy 
(http://www.scipy.org), which is under a BSD license. The package 
datasets itself is under GPL, but I don't know if this covers the actual 
data too ?

cheers,

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

2007-04-24 Thread elyakhlifi mustapha
ok,
I have problems with write function

 F
   Id_TrT1 Id_Geno Id_Rep Val_O
30   55094  185
90   55096  187
15   0   55098  192
21   0   55079  176
27   0   55095  192
33   0   55099  198
39   0   55092  192
45   0   55090  172
51   0   55101  193
57   0   55106  190

and  to write F I obtain like this:

 write(F, , sep=  )
Erreur dans cat(list(...), file, sep, fill, labels, append) : 
argument 1 (type 'list') pas encore traité par cat


I know that the problem it's that f is a list but when I change it in matrix or 
something else the consol display it but badly
I obtain just one column


  
___





[[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] Problem with length of array while calling C from R

2007-04-24 Thread Martin Maechler
 Sven == Sven Knüppel [EMAIL PROTECTED]
 on Tue, 24 Apr 2007 13:53:09 +0200 writes:

Sven Hello,
Sven my problem is that I don't know how long must be an array of double 
while calling C from R.

Sven R-Code:
 array - c(1,1,1)
 save - .C ( Ctest , a = array )

Sven C-Code: void Ctest ( double *array ) { ...  array =
Sven (double*) realloc ( array , new_number *
Sven sizeof(double) ) ; ...  }

Sven The length of array will be compute in C.

Sven At the end save$a has a length of 3 and not the length of the 
allocated array in C.

Sven What can I do?

Either you learn to use  .Call()  where you pass whole R
objects, and can use  length(.) on them in your C code,

or, simpler in this case, but much less powerful in general,
you change your R code to

   ss - .C(Ctest, a = myarray, n = length(myarray))

and the C code to

void Ctest (double *array, int *n) { 
 .
}

and then make use of  *n  inside the C code.

Martin Maechler, ETH Zurich

__
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] write

2007-04-24 Thread Conny Schmitt
Hallo,

just try it like a data frame, as I mailed you last time. Here an example:

dat - data.frame(Class=I(Id_TrT1), Levels=I(1), Values=I(2)) 
new.info - c(Class=Id_Geno, Levels=7 , Values=64208   64209  64210  64211 
 64212  64213  64214)
dat - rbind(dat, new.info)
dat
new.info - c(Class= Id_Rep , Levels=2 , Values=12) dat - rbind(dat, 
new.info) dat

Just hack it in the console and look at the output. you can change it for your 
now needs.

CU, Corinna




 Original-Nachricht 
Datum: Tue, 24 Apr 2007 13:21:05 + (GMT)
Von: elyakhlifi mustapha [EMAIL PROTECTED]
An: R-help@stat.math.ethz.ch
Betreff: [R] write

 ok,
 I have problems with write function
 
  F
Id_TrT1 Id_Geno Id_Rep Val_O
 30   55094  185
 90   55096  187
 15   0   55098  192
 21   0   55079  176
 27   0   55095  192
 33   0   55099  198
 39   0   55092  192
 45   0   55090  172
 51   0   55101  193
 57   0   55106  190
 
 and  to write F I obtain like this:
 
  write(F, , sep=  )
 Erreur dans cat(list(...), file, sep, fill, labels, append) : 
 argument 1 (type 'list') pas encore traité par cat
 
 
 I know that the problem it's that f is a list but when I change it in
 matrix or something else the consol display it but badly
 I obtain just one column
 
 
   
 ___
 
 
 
 
 
   [[alternative HTML version deleted]]
 

-- 
Feel free - 10 GB Mailbox, 100 FreeSMS/Monat ...

__
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] xyplot source file only work with echo=TRUE

2007-04-24 Thread Ronaldo Reis Junior
Hi,

I write several xyplot graphics on a source file. When I try to use 
source(graphics.R) the source don't work, but if I use 
source(graphics.R,echo=T) it work. Generally some commands work without 
echo=T, but xyplot dont work. Why it dont work without echo=T? It is possible 
to write a source that dont need echo=T on source command?

Thanks
Ronaldo
-- 
Aluno de Informática não cola, faz transferência de dados.
--
 Prof. Ronaldo Reis Júnior
|  .''`. UNIMONTES/Depto. Biologia Geral/Lab. Ecologia Evolutiva
| : :'  : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia
| `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil
|   `- Fone: (38) 3229-8190 | [EMAIL PROTECTED] | [EMAIL PROTECTED]
| ICQ#: 5692561 | LinuxUser#: 205366

__
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] regarding 3d Bar Plot

2007-04-24 Thread rolf

[EMAIL PROTECTED] wrote:

 I have data in a two dimensional table. each row of the data adds
 upto 100 ( hence they are percentages ).  it can be interpreted as
 like this A - I are the matches and  P - X are the players. Thus
 Player P scored 20% of the runs during this season in Match C, 60% in
 Match D and remaining 20% in Match G.
 
 I want to plot 3-d bar plot, where X axis have players, Y axis have
 Matches and Z axis as the percentage(0 - 100%) Please help me in this
 regards.
 
 snip

Many years ago I picked up from the snews mailing list a
suite of functions for plotting 2D barplots (barplots with 2D
bases) written by a chap named Colin Goodall, from (at that
time) the University of Bristol and/or from Penn State.

I never actually did anything with this suite until
recently.  Seeing no replies to the enquiry about 3D
histograms,  I thought I'd try to get Goodal's code running
in R to see if it might solve guarav's problem.

The trouble is, all the guts of the procedure, *including*
the plotting are done from within Fortran.  The actual
plotting seems to be done through a call to a subroutine
``segmtz'' which is a piece of Splus software that does not
exist in R.

Is there an equivalent subroutine in R that could be called?
I dug around a bit but couldn't figure out what was going
on.  The function segments() simply calls
.Internal(segments(

I looked around a bit for corresponding C or Fortran code but
obviously didn't know how to look properly.

I think that the Fortran code could be translated into raw R
and the call to segmtz changed to a call to segments() ---
but this would seem to be a lot of work.

Can anyone suggest a reasonably simple way of replacing the
call to segmtz in the Fortran?

cheers,

Rolf Turner
[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] write

2007-04-24 Thread Conny Schmitt
Hallo,

it might be a problem with the underscore in the names. Look up the syntax 
conventions. Here is a example for the write function in my programs perhaps it 
might help you:

helpLetters=
cat(\nThe workspace is now imported!, helpLetters ,\n\n)
cat(The names of the variables are the same as they were in Matlab., 
helpLetters ,\n)


CU, Corinna



 Original-Nachricht 
Datum: Tue, 24 Apr 2007 15:29:47 +0200
Von: Conny Schmitt [EMAIL PROTECTED]
An: elyakhlifi mustapha [EMAIL PROTECTED]
CC: R-help@stat.math.ethz.ch
Betreff: Re: [R] write

 Hallo,
 
 just try it like a data frame, as I mailed you last time. Here an example:
 
 dat - data.frame(Class=I(Id_TrT1), Levels=I(1), Values=I(2)) 
 new.info - c(Class=Id_Geno, Levels=7 , Values=64208   64209  64210 
 64211  64212  64213  64214)
 dat - rbind(dat, new.info)
 dat
 new.info - c(Class= Id_Rep , Levels=2 , Values=12) dat -
 rbind(dat, new.info) dat
 
 Just hack it in the console and look at the output. you can change it for
 your now needs.
 
 CU, Corinna
 
 
 
 
  Original-Nachricht 
 Datum: Tue, 24 Apr 2007 13:21:05 + (GMT)
 Von: elyakhlifi mustapha [EMAIL PROTECTED]
 An: R-help@stat.math.ethz.ch
 Betreff: [R] write
 
  ok,
  I have problems with write function
  
   F
 Id_TrT1 Id_Geno Id_Rep Val_O
  30   55094  185
  90   55096  187
  15   0   55098  192
  21   0   55079  176
  27   0   55095  192
  33   0   55099  198
  39   0   55092  192
  45   0   55090  172
  51   0   55101  193
  57   0   55106  190
  
  and  to write F I obtain like this:
  
   write(F, , sep=  )
  Erreur dans cat(list(...), file, sep, fill, labels, append) : 
  argument 1 (type 'list') pas encore traité par cat
  
  
  I know that the problem it's that f is a list but when I change it in
  matrix or something else the consol display it but badly
  I obtain just one column
  
  

 
 ___
  
  
  
  
  
  [[alternative HTML version deleted]]
  
 
 -- 
 Feel free - 10 GB Mailbox, 100 FreeSMS/Monat ...
 
 __
 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.

-- 
Feel free - 10 GB Mailbox, 100 FreeSMS/Monat ...

__
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] write

2007-04-24 Thread Petr PIKAL
Hi

had you consider to look at help page? How do you expect your written file 
to be named? 

From help page

write is a wrapper for cat, which gives further details on the format used
cat is useful for producing output in user-defined functions. It converts 
its arguments to character strings, concatenates them, separating them by 
the given sep= string, and then outputs them
save for writing any R objects, write.table for data frames, and scan for 
reading data
 ^^
write.table(F, some.file.name, sep= \t)

can maybe do what you want.

Help provided with your installation is probably the quickiest way how to 
evaluate things about commands without waiting for usually delayed and 
sometimes ironical answer.

Regards
Petr

BTW, F can state for FALSE so if you stick with such names you can be 
somtimes quite confused however smart is R in evaluating functions and 
objects.



[EMAIL PROTECTED] napsal dne 24.04.2007 15:21:05:

 ok,
 I have problems with write function
 
  F
Id_TrT1 Id_Geno Id_Rep Val_O
 30   55094  185
 90   55096  187
 15   0   55098  192
 21   0   55079  176
 27   0   55095  192
 33   0   55099  198
 39   0   55092  192
 45   0   55090  172
 51   0   55101  193
 57   0   55106  190
 
 and  to write F I obtain like this:
 
  write(F, , sep=  )
 Erreur dans cat(list(...), file, sep, fill, labels, append) : 
 argument 1 (type 'list') pas encore traité par cat
 
 
 I know that the problem it's that f is a list but when I change it in 
matrix 
 or something else the consol display it but badly
 I obtain just one column
 
 
 
 
___
 
 
 
 
 
[[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] regarding 3d Bar Plot --- correction.

2007-04-24 Thread rolf

I mis-spoke.  It seems I had two collections of functions in the same
directory.  One by Colin Goodall, and one by David Scott (I have no
record of where he is/was located).  It is the *latter* collection
that does all its work from within Fortran.

I'll have another look at what Colin Goodall actually wrote to see if
it could be useful to guarav.

cheers,

Rolf Turner
[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] xyplot source file only work with echo=TRUE

2007-04-24 Thread Sundar Dorai-Raj
Read FAQ 7.22

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f

--sundar

Ronaldo Reis Junior said the following on 4/24/2007 6:38 AM:
 Hi,
 
 I write several xyplot graphics on a source file. When I try to use 
 source(graphics.R) the source don't work, but if I use 
 source(graphics.R,echo=T) it work. Generally some commands work without 
 echo=T, but xyplot dont work. Why it dont work without echo=T? It is possible 
 to write a source that dont need echo=T on source command?
 
 Thanks
 Ronaldo

__
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] xyplot source file only work with echo=TRUE

2007-04-24 Thread Dieter Menne
Ronaldo Reis Junior chrysopa at gmail.com writes:

 I write several xyplot graphics on a source file. When I try to use 
 source(graphics.R) the source don't work, but if I use 
 source(graphics.R,echo=T) it work. Generally some commands work without 
 echo=T, but xyplot dont work. Why it dont work without echo=T? It is possible 
 to write a source that dont need echo=T on source command?
 

Most likely another variant of 

http://post.gmane.org/post.php?group=gmane.comp.lang.r.generalfollowup=83924

See: Why do lattice/trellis graphics not work?

Dieter Menne

__
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] LimmaGUI

2007-04-24 Thread J . delasHeras
Quoting [EMAIL PROTECTED]:

 Hi everyone,

 I have a question about limmaGUI.I've just started to use the program
 for microarray analysis.My problem is after loading data into Limma
 (with GAl file and RNA targets file),I'm not able to create an M box
 plot and everytime I'm trying to do that, some error appear:
 Error in .find.package(pkg): there is no package called 'tkrplot'
 Error in try(expr,TRUE): could not find function tkrplot
 Error in .Tcl.args.objv(...):object img not found
 I would also like to know if it's necessary to have a spot type file.
 I'm using R in windows xp,version 2.3.1 and limmaGUI version 1.8.1
 using limma version 2.7.10.
 Could the problem be the version of LimmaGUI I'm using?
 I appreciate your help.

The spots file is not necessary. It is used, however, to define  
individual spots or classes of spots of interests, either to remove  
from normalisation, as control spots, or just to highlight in  
different colours on your plots.

In windows I recommend you install limmaGUI from:

http://bioinf.wehi.edu.au/limmaGUI/

go to section 2.3.1, for a binary that will install R 2.1.1 and  
limmaGUI with all dependent packages.

I hope this helps

Jose

PS: remember the BioConductor forum, you're more likely to get useful  
answers about limmaGUI over there.
http://www.bioconductor.org/docs/mailList.html

-- 
Dr. Jose I. de las Heras  Email: [EMAIL PROTECTED]
The Wellcome Trust Centre for Cell BiologyPhone: +44 (0)131 6513374
Institute for Cell  Molecular BiologyFax:   +44 (0)131 6507360
Swann Building, Mayfield Road
University of Edinburgh
Edinburgh EH9 3JR
UK

__
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] Bug in xYplot() with method = 'filled bands'

2007-04-24 Thread Michael Kubovy
Dear r-helpers,

I have been bitten by a cryptic comment in the help page for xYplot().

Here is some code from Madeline Bauer, one of the authors, which is  
essentailly the code on the help page for xYplot():

# This example uses the summarize function in Hmisc to
# compute the median and outer quartiles.  The outer quartiles are
# displayed using filled bands

set.seed(111)
dfr - expand.grid(month=1:12, year=c(1997,1998), reps=1:100)
month - dfr$month; year - dfr$year
y - abs(month-6.5) + 2*runif(length(month)) + year-1997
s - summarize(y, llist(month,year), smedian.hilow, conf.int=.5)

# filled bands: default fill = pastel colors matching solid colors
# in superpose.line (this works differently in R)
xYplot ( Cbind ( y, Lower, Upper ) ~ month, groups=year,
  method=filled bands , data=s, type=l)

The comment this works differently in R should be ammended to a  
more explicit danger sign (otherwise users like myself might find  
themselves wasting a great deal of time). There appear to be two  
differences between S+ and R here: (1) the default colors of the  
bands are not as expected (but they can be changed at will, so that's  
not a serious problem); (2) I have not been able get rid of the  
outline around the filled bands or change their colors to match the  
fill.

I would have thought that ...

xYplot ( Cbind ( y, Lower, Upper ) ~ month, groups=year,
  method=filled bands , data=s, type=l, lwd.bands = 0,
  lty.bands = 0, col.bands = 'white')

... would do the trick.

I even tried to fix the problem in the code of xYplot:

  panel.XYplot

function (x, y, subscripts, groups = NULL, type = if (is.function 
(method) ||
...
if (method == filled bands) {
if (.R.)
grid.polygon(x = c(x, rev(x)), y = c(lower, rev(upper)),
gp = gpar(fill = col.fill, col = col.bands,
lty = lty.bands, lwd = lwd.bands),
default.units = native)
else polygon(x = c(x, rev(x)), y = c(lower, rev(upper)),
col = col.fill)
}
...
}

Obviously I don't know grid well enough to fix the problem. Help  
would be much appreciated, as well as a more explicit warning on the  
xYplot() help page.

There is, of course, the possibility that there's something wrong  
with my version of R or my OS or my machine. In that case a  
replication or non-replication of this problem on a different OS  
might alert me to this.

R version 2.5.0 RC (2007-04-21 r41269)
i386-apple-darwin8.9.1

locale:
C

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

other attached packages:
 coda lme4   Matrix  car   
cacheSweave   stashR
 0.10-7  0.9975-13  0.9975-11  1.2-1 
0.3  0.2-1
 filehash   digest circular boot  gmodels  
multcompView
  0.9-4  0.2.3  0.3-6 1.2-27  
2.13.2  0.1-0
  reshape  vcd   colorspace  effects 
Hmisc  acepack
  0.7.2  1.0-3   0.95 1.0-10  3.3-1 
1.3-2.2
   HH multcomp  mvtnorm  JGR
iplots   JavaGD
 1.18-30.991-9  0.7-5 1.4-15   
1.0-7  0.3-6
 MASS gridBase  lattice latticeExtra 
rJava   xtable
 7.2-33  0.4-3 0.15-4  0.1-6  
0.4-15  1.4-3

Thanks,
Michael Kubovy

__
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] Values greater than 1 or lower than -1 in ARMAacf

2007-04-24 Thread Cyril

Dear all,

I need to compute the ACF (autocorrel) of an AR6 process, given the values
of its parameters (w1,w2,w3,w4,w5,w6).
First, I notice that there is an error as soon as the sum of the wi equals 1
:

Error in drop(.Call(La_dgesv, a, as.matrix(b), tol, PACKAGE = base)) : 
system is computationally singular: reciprocal condition number =
1.00757e-18

Secondly, when the sum is greater than 1, some elements in the returned ACF
vector do not belong to interval [-1,1], which looks a bit weird for
autocorrelation (!)
E.g. :
 w-c(0.9,0.7,0.1,0.1,0.19,0.01)
 ARMAacf(w, lag.max = 6)
0 1 2 3 4 5 6 
 1.00 -1.624285 -1.735076 -3.121879 -4.412638 -6.318869 -9.560138 

Does someone have a clue about it ?

It would be very helpful.

Thanks a lot

Regards
Cyril


-- 
View this message in context: 
http://www.nabble.com/Values-greater-than-1-or-lower-than--1-in-ARMAacf-tf3638973.html#a10161936
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] Problem installing Rmpi with lam on SGI SLES9

2007-04-24 Thread Hendrik Fuß
Hi,

I've been trying here to install Rmpi on an SGI IA-64 machine with 64
processors, running SuSE Linux Enterprise Server 9, R 2.4.0 and
lam-mpi 7.1.3. While I've read of similar problems on this list, I
think I've got an entirely new set of error messages to contribute
(see below). I'm not sure what the actual error is and what the @gprel
relocation message is about. Any help greatly appreciated.

thanks
Hendrik


behemoth:~/Rmpi # R CMD INSTALL /home/hfuss/build/Rmpi_0.5-3.tar.gz
--configure-args=--with-mpi=/usr/local/lam-mpi
* Installing *source* package 'Rmpi' ...
Try to find mpi.h ...
Found in /usr/local/lam-mpi/include
Try to find libmpi or libmpich ...
Found libmpi in /usr/local/lam-mpi/lib
Try to find liblam ...
Found liblam in /usr/local/lam-mpi/lib
checking for openpty in -lutil... no
checking for main in -lpthread... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -I/usr/local/lib/R/include -I/usr/local/lib/R/include
-DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\
-DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\
-I/usr/local/lam-mpi/include -DMPI2 -I/usr/local/include-fpic  -g
-O2 -std=gnu99 -c RegQuery.c -o RegQuery.o
gcc -I/usr/local/lib/R/include -I/usr/local/lib/R/include
-DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\
-DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\
-I/usr/local/lam-mpi/include -DMPI2 -I/usr/local/include-fpic  -g
-O2 -std=gnu99 -c Rmpi.c -o Rmpi.o
gcc -I/usr/local/lib/R/include -I/usr/local/lib/R/include
-DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\
-DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\
-I/usr/local/lam-mpi/include -DMPI2 -I/usr/local/include-fpic  -g
-O2 -std=gnu99 -c conversion.c -o conversion.o
gcc -I/usr/local/lib/R/include -I/usr/local/lib/R/include
-DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\
-DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\
-I/usr/local/lam-mpi/include -DMPI2 -I/usr/local/include-fpic  -g
-O2 -std=gnu99 -c internal.c -o internal.o
gcc -shared -L/usr/local/lib -o Rmpi.so RegQuery.o Rmpi.o conversion.o
internal.o -L/usr/local/lam-mpi/lib -lmpi -llam
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_comms
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_argv0
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_mpi_ao
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_ger
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_c2c
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_appnum
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_universe_size
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_jobid
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_jobid
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_mpi_ao
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_ger
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_c2c
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_appnum
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_universe_size
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_mpi_ao
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_clockskew
collect2: ld returned 1 exit status
make: *** [Rmpi.so] Error 1
chmod: cannot access `/usr/local/lib/R/library/Rmpi/libs/*': 

Re: [R] Values greater than 1 or lower than -1 in ARMAacf

2007-04-24 Thread Prof Brian Ripley
You do need to specify a stationary ARMA process for it to have an acf: 
your example is not valid since

 Mod(polyroot(c(1, -w)))
[1]  0.6726057  1.6256859  1.6256859  1.7448484  1.7448484 18.4778223

Have you actually looked at the reference on the help page?  It is there 
to be help-ful.

Like quite a few such things in R, we could 'nanny' you and tell you that 
this is not valid, but quite often invalid primary uses do have secondary 
uses.

On Tue, 24 Apr 2007, Cyril wrote:


 Dear all,

 I need to compute the ACF (autocorrel) of an AR6 process, given the values
 of its parameters (w1,w2,w3,w4,w5,w6).
 First, I notice that there is an error as soon as the sum of the wi equals 1
 :

 Error in drop(.Call(La_dgesv, a, as.matrix(b), tol, PACKAGE = base)) :
system is computationally singular: reciprocal condition number =
 1.00757e-18

 Secondly, when the sum is greater than 1, some elements in the returned ACF
 vector do not belong to interval [-1,1], which looks a bit weird for
 autocorrelation (!)
 E.g. :
 w-c(0.9,0.7,0.1,0.1,0.19,0.01)
 ARMAacf(w, lag.max = 6)
0 1 2 3 4 5 6
 1.00 -1.624285 -1.735076 -3.121879 -4.412638 -6.318869 -9.560138

 Does someone have a clue about it ?

 It would be very helpful.

 Thanks a lot

 Regards
 Cyril




-- 
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] Problem installing Rmpi with lam on SGI SLES9

2007-04-24 Thread Prof Brian Ripley

On Tue, 24 Apr 2007, Hendrik Fuß wrote:


Hi,

I've been trying here to install Rmpi on an SGI IA-64 machine with 64
processors, running SuSE Linux Enterprise Server 9, R 2.4.0 and
lam-mpi 7.1.3. While I've read of similar problems on this list, I
think I've got an entirely new set of error messages to contribute
(see below). I'm not sure what the actual error is and what the @gprel
relocation message is about. Any help greatly appreciated.


I don't know for sure, but on many 64-bit OSes you cannot link code from 
static libraries into dynamic shared libraries, and that seems to be the 
case with ia64 Linux.  Almost certainly you need to re-compile LAM with 
-fPIC flags.





thanks
Hendrik


behemoth:~/Rmpi # R CMD INSTALL /home/hfuss/build/Rmpi_0.5-3.tar.gz
--configure-args=--with-mpi=/usr/local/lam-mpi
* Installing *source* package 'Rmpi' ...
Try to find mpi.h ...
Found in /usr/local/lam-mpi/include
Try to find libmpi or libmpich ...
Found libmpi in /usr/local/lam-mpi/lib
Try to find liblam ...
Found liblam in /usr/local/lam-mpi/lib
checking for openpty in -lutil... no
checking for main in -lpthread... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -I/usr/local/lib/R/include -I/usr/local/lib/R/include
-DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\
-DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\
-I/usr/local/lam-mpi/include -DMPI2 -I/usr/local/include-fpic  -g
-O2 -std=gnu99 -c RegQuery.c -o RegQuery.o
gcc -I/usr/local/lib/R/include -I/usr/local/lib/R/include
-DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\
-DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\
-I/usr/local/lam-mpi/include -DMPI2 -I/usr/local/include-fpic  -g
-O2 -std=gnu99 -c Rmpi.c -o Rmpi.o
gcc -I/usr/local/lib/R/include -I/usr/local/lib/R/include
-DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\
-DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\
-I/usr/local/lam-mpi/include -DMPI2 -I/usr/local/include-fpic  -g
-O2 -std=gnu99 -c conversion.c -o conversion.o
gcc -I/usr/local/lib/R/include -I/usr/local/lib/R/include
-DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\
-DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\
-I/usr/local/lam-mpi/include -DMPI2 -I/usr/local/include-fpic  -g
-O2 -std=gnu99 -c internal.c -o internal.o
gcc -shared -L/usr/local/lib -o Rmpi.so RegQuery.o Rmpi.o conversion.o
internal.o -L/usr/local/lam-mpi/lib -lmpi -llam
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_comms
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_argv0
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_mpi_ao
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_ger
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_c2c
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_appnum
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_universe_size
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_jobid
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_jobid
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_mpi_ao
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_ger
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_c2c
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_appnum
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_universe_size
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_mpi_ao

[R] Size of an object in workspace

2007-04-24 Thread Horace Tso
Hi folks,

Is there a function to show the size of an R object? eg. in Kbytes?

Couple months ago Bendix Carstensen posted this marvelous little function 
lls(), which shows all objects in the current workspace by mode, class and 
'size'. This is a wonderful enhancement to the build-in ls() already and I now 
have it sourced in my Rprofile.site at startup. 

The only drawback is, 'size' is just the length/dim of an object. For matrices 
and data frames this is good enough. But for a list, knowing how many elements 
in there doesn't help much. I need to know the totality of the content in a 
common unit, eg. byte. 

Thanks in advance. 

Horace

__
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] aovlmer.fnc, lmer and binomial response

2007-04-24 Thread Daniel E. Bunker
Dear R-users,

I have recently discovered the languageR package and its aovlmer.fnc 
which offers a very slick way to test fixed effects hypotheses in lmer 
models using mcmc.

However, the R help page for aovlmer.fnc states that the lmer object 
must be based a continuous response variable. I take it this means that 
it will not work with family=binomial? If so, how can I modify it to 
assess binomial response data?

Any advice or guidance would be greatly appreciated!

-Dan




-- 
Daniel E. Bunker
BioMERGE Associate Director
Post-Doctoral Research Scientist
Columbia University
Department of Ecology, Evolution and Environmental Biology
1200 Amsterdam Avenue
New York, NY 10027-5557

deb37ATcolumbiaDOTedu
917-843-5076 phone
212-854-8188 fax

__
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] Error in clusterApply(): recursive default argument reference

2007-04-24 Thread Martin Morgan
Hi Nicolas --

I think your code is assuming that all nodes have access to the same
set of variables. One solution is to write in a more completely
'functional' style

parNullDistribIntersection - function(g1, g2, perm=1000, cl=cl) {
n1 = nodes(g1)  
parSapply(cl, 1:perm,
  function(i, g1, g2, n1) {
  nodes(g1) - sample(n1)
  numEdges(intersection(g1,g2))
  },
  g1, g2, n1)
}  

Another possibility is to ensure that the relevant variables are
exported to the cluster before parSapply. With both of these you'll
want to pay some attention to the costs of communicating the data to
the nodes, which could easily be overwhelming (Rmpi's version of
parSapply is smarter at doing the data transfer -- log n time rather
than linear time, where n is the number of nodes -- and more flexible
in distributing the work).

Hope that helps,

Martin


nicolas bertin [EMAIL PROTECTED] writes:

 Hi,

 I want to compute a distribution of the intersection of a graph and
 'randomized' graphs induced by the permutations of node labels (to
 preserve the graph topology).
 Since I ll have many permutations to perform, I was thinking of using
 the snow package and in particular parSapply to divide the work
 between my 4 CPUs.
 But I get the following error message :

 Error in clusterApply(cl, splitList(x, length(cl)), lapply, fun, ...) : 
 recursive default argument reference

 What am i doing wrong ?

 Some details about my platform and R version :
 ---
 $platform
 [1] x86_64-redhat-linux-gnu
 $version.string
 [1] R version 2.4.1 (2006-12-18)


 Below is the snippet of code generating the error message :
 ---
 ### libraries ###
 library(graph)
 library(snow)

 ### functions ###
 nullDistribIntersection - function(g1, g2, perm=1000)
 {
   n1 - nodes(g1)
   sapply(1:perm,
 function(i)
 {
 nodes(g1) - sample(n1)
   numEdges(intersection(g1,g2))
 }
)
 }


 parNullDistribIntersection - function(g1, g2, perm=1000, cl=cl)
 {
   n1 - nodes(g1)
   parSapply(cl, 1:perm,
 function(i)
 {
 nodes(g1) - sample(n1)
   numEdges(intersection(g1,g2))
 }
)
 }


 ## initialize the graph and the rand seed
 set.seed(123)
 g - randomEGraph(LETTERS[1:15], edges = 100)

 ## compute a distribution of the intersection of the graph 
 ## and a 'randomized' graph induced by the permutations of
 ## node labels (to preserve the graph topology)
 cat(1CPU sys time:,
 system.time(
  dist - nullDistribIntersection(g,g)
),
 \n
 )

 cl - makeCluster(c(localhost, localhost), type = SOCK)
 cat(Cluster sys time:,
 system.time(
  dist - parNullDistribIntersection(g,g)
),
 \n
 )
 

 Thanks in advance.

 Nicolas Bertin 
 GSC / RIKEN Yokohama

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

-- 
Martin Morgan
Bioconductor / Computational Biology
http://bioconductor.org

__
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] Size of an object in workspace

2007-04-24 Thread Horace Tso
Aaaah, wonderful. Thanks Ben. lls appears below. Should these functions be a 
permanent part of R? Just a thought.

H.

 lls
function (pos = 1, pat = ) {
dimx - function(dd) if (is.null(dim(dd)))
length(dd)
else dim(dd)
lll - ls(pos = pos, pat = pat)
cat(formatC(mode, 1, 15), formatC(class, 1, 18), formatC(name,
1, max(nchar(lll)) + 1), 
size\n-\n)
if (length(lll)  0) {
for (i in 1:length(lll)) {
cat(formatC(eval(parse(t = paste(mode(, lll[i],
, 1, 15), formatC(paste(eval(parse(t = paste(class(,
lll[i], , collapse =  ), 1, 18), formatC(lll[i],
1, max(nchar(lll)) + 1),  , eval(parse(t = paste(dimx(,
lll[i], , \n)
}
}
}


 Ben Fairbank [EMAIL PROTECTED] 4/24/2007 9:10:20 AM 
Here is a copy of a correspondence I had with Jim Holtman -- his
function, which I now use almost daily, does exactly what I think you
need.  Could you send me a copy of Bendix Carstensen's function

Thanks,

Ben Fairbank

From: jim holtman [EMAIL PROTECTED] 
To: Ben Fairbank [EMAIL PROTECTED] 
Date: Sep 27 2006 - 4:42pm 

 

Thanks for the suggestion. I did.

On 9/27/06, Ben Fairbank [EMAIL PROTECTED] wrote:
 Nicely done. May I suggest you post it to the list? Others probably
 would benefit also. Or maybe I am the only user dense enough not to
see
 how to write it.

 Ben

 -Original Message-
 From: jim holtman [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, September 27, 2006 4:36 PM
 To: Ben Fairbank
 Subject: Re: [R] Space required by object?

 That was a function I wrote when I needed a similar thing.

 On 9/27/06, Ben Fairbank [EMAIL PROTECTED] wrote:
  Thank you! Exactly what I needed!
 
  Is that something you wrote?
 
  Ben Fairbank
 
  -Original Message-
  From: jim holtman [mailto:[EMAIL PROTECTED] 
  Sent: Wednesday, September 27, 2006 4:23 PM
  To: Ben Fairbank
  Subject: Re: [R] Space required by object?
 
  try this one:
 

Note --  Horace, the function starts here -- 

my.ls - function(pos=1, sorted=F){
.result - sapply(ls(pos=pos, all.names=TRUE),
function(..x)object.size(eval(as.symbol(..x
if (sorted){
.result - rev(sort(.result))
}
.ls -
as.data.frame(rbind(as.matrix(.result),**Total=sum(.result)))
names(.ls) - Size
.ls$Size - formatC(.ls$Size, big.mark=',', digits=0, format='f')
.ls$Mode - c(unlist(lapply(rownames(.ls)[-nrow(.ls)],
 function(x)mode(eval(as.symbol(x), '---')
.ls
}

And ends there

 
 
  On 9/27/06, Ben Fairbank [EMAIL PROTECTED] wrote:
   Does R provide a function analogous to LS() or str() that reports
 the
   storage space, on disk or in memory, required by objects?
  
   Ben Fairbank
  
   __
   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?
 


-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Horace Tso
Sent: Tuesday, April 24, 2007 10:59 AM
To: r-help@stat.math.ethz.ch 
Subject: [R] Size of an object in workspace

Hi folks,

Is there a function to show the size of an R object? eg. in Kbytes?

Couple months ago Bendix Carstensen posted this marvelous little
function lls(), which shows all objects in the current workspace by
mode, class and 'size'. This is a wonderful enhancement to the build-in
ls() already and I now have it sourced in my Rprofile.site at startup. 

The only drawback is, 'size' is just the length/dim of an object. For
matrices and data frames this is good enough. But for a list, knowing
how many elements in there doesn't help much. I need to know the
totality of the content in a common unit, eg. byte. 

Thanks in advance. 

Horace

__
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] Size of an object in workspace

2007-04-24 Thread MORNEAU François
Hi,

Is 'object.size()' the function your are looking for ?

Best,

François

-Message d'origine-
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Horace Tso
Envoyé : mardi 24 avril 2007 17:59
À : r-help@stat.math.ethz.ch
Objet : [R] Size of an object in workspace

Hi folks,

Is there a function to show the size of an R object? eg. in Kbytes?

Couple months ago Bendix Carstensen posted this marvelous little function 
lls(), which shows all objects in the current workspace by mode, class and 
'size'. This is a wonderful enhancement to the build-in ls() already and I now 
have it sourced in my Rprofile.site at startup. 

The only drawback is, 'size' is just the length/dim of an object. For matrices 
and data frames this is good enough. But for a list, knowing how many elements 
in there doesn't help much. I need to know the totality of the content in a 
common unit, eg. byte. 

Thanks in advance. 

Horace

__
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] Handling of arrays

2007-04-24 Thread Tony Plate
Try the following and look at what they return:

str(ca)
dimnames(ca)

-- Tony Plate

[EMAIL PROTECTED] wrote:
 Dear R-Experts,
 
 I just imported a workspace from Matlab. I know that I can get the names of 
 the imported variables with names(). It works. The variable ca consists of 
 several elements. I want to get the names of the elements to handle my output 
 better. But names(ca) doesn't work. Why? I did the following commands:
 
 class(ca)
 [1] array
 mode(ca)
 [1] list
 dim(ca)
 [1] 66  1  1
 length(ca)
 [1] 66
 
 How can I now get the names which are stored in ca? When I use the command 
 ca[18] I receive the content which stands there but not the name collables 
 which I wanted to extract. 
 
 Any ideas?
 
 Thanks, Corinna

__
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 interpreting the output of functions - any sources of information

2007-04-24 Thread Y G
Hi,

I am looking for documentation, reference guides, etc. that explain the
output of functions... For example using cor.test(, method=pearson)
with Pearson's corr coeff the output is:


Pearson's product-moment correlation

data:  a and b
t = 0.2878, df = 14, p-value = 0.
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.4355690  0.5514366
sample estimates:
   cor
0.07669612


What are all these? Apologies but I am new in R and statistics in
general but a textbook I was looking at, regarding SPSS, explains only
the r coeff and the conf interval Any help with sources I can refer to?
Particularly in a broader context as it would not be nice to post all the
time such questions...

Thanks in advance,
GM

[[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] specify xlim for each panel

2007-04-24 Thread Aimin Yan
I draw dotplot using the following code:

sd.dotplot-dotplot(data.47.nmr$om_sd ~ as.factor(data.47.nmr$position) 
|as.factor(data.47.nmr$pr), data = data.47.nmr,layout=c(1,1),
xlab=Position, xlim=range(data.47.nmr$position),ylab=Sd, main=Changes 
of omega angle in different positions,
scales = list(x = list(rot = 45)))

However I get same xlim for each panel,
Actually xlim is different for each panel, it is based on data.47.nmr$position.

How can I modify this code so I can deal with the different xlim for each panel

thanks,

Aimin

__
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] Size of an object in workspace

2007-04-24 Thread Henrik Bengtsson
See ll() in R.oo (that is two L:s), e.g.

 ll()
  member data.class dimension objectSize
1 author  character 1120
2 myfunc   function  NULL512
3  x matrix   c(3,11)248
4  y  array  c(5,7,1)264

ll() is quite flexible so you can create your on functions to query
objects for whatever properties you want.  It can also be passed to
subset():

 subset(ll(), objectSize  250)
  member data.class dimension objectSize
2 myfunc   function  NULL512
4  y  array  c(5,7,1)264

Hope this help

Henrik


On 4/24/07, Horace Tso [EMAIL PROTECTED] wrote:
 Hi folks,

 Is there a function to show the size of an R object? eg. in Kbytes?

 Couple months ago Bendix Carstensen posted this marvelous little function 
 lls(), which shows all objects in the current workspace by mode, class and 
 'size'. This is a wonderful enhancement to the build-in ls() already and I 
 now have it sourced in my Rprofile.site at startup.

 The only drawback is, 'size' is just the length/dim of an object. For 
 matrices and data frames this is good enough. But for a list, knowing how 
 many elements in there doesn't help much. I need to know the totality of the 
 content in a common unit, eg. byte.

 Thanks in advance.

 Horace

 __
 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] Matrix: how to re-use the symbolic Cholesky factorization?

2007-04-24 Thread Gardar Johannesson
I have been playing around with sparse matrices in the Matrix 
package, in particularly with the Cholesky factorization of matrices 
of class dsCMatrix. And BTW, what a fantastic package.

My problem is that I have to carry out repeated Cholesky 
factorization of a spares symmetric matrices, say Q_1, Q_2, ...,Q_n, 
where the Q's have the same non-zero pattern. I know in this case one 
does only need to carry out the symbolic factorization _once_ and 
then follow that up with a numerical factorization for each of the 
Q_i's (re-using the general symbolic factorization each time). Does 
anybody know if this is possible using the Matrix package?

Thanks,
Gardar Johannesson
Lawrence Livermore National Laboratory

__
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] intersect more than two sets

2007-04-24 Thread Weiwei Shi
Hi,
I searched the archives and did not find a good solution to that.

assume I have 10 sets and I want to have the common character elements of them.

how could i do that?

-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

Did you always know?
No, I did not. But I believed...
---Matrix III

__
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 interpreting the output of functions - any sources of information

2007-04-24 Thread Sarah Goslee
Hi,

If you look at the documentation for the function you are interested
in, in this case ?cor.test, it will generally give you an explanation
of the return values (often brief, and not too helpful if you aren't
already familiar with the test), but also one or more references
that you can turn to for further information.

Most likely, though, you'll want to absorb a general
introductory stats book before you delve into the
gory details of many of those references.

Sarah

On 4/24/07, Y G [EMAIL PROTECTED] wrote:
 Hi,

 I am looking for documentation, reference guides, etc. that explain the
 output of functions... For example using cor.test(, method=pearson)
 with Pearson's corr coeff the output is:


 Pearson's product-moment correlation

 data:  a and b
 t = 0.2878, df = 14, p-value = 0.
 alternative hypothesis: true correlation is not equal to 0
 95 percent confidence interval:
  -0.4355690  0.5514366
 sample estimates:
cor
 0.07669612


 What are all these? Apologies but I am new in R and statistics in
 general but a textbook I was looking at, regarding SPSS, explains only
 the r coeff and the conf interval Any help with sources I can refer to?
 Particularly in a broader context as it would not be nice to post all the
 time such questions...

 Thanks in advance,
 GM


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

__
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 interpreting the output of functions - any sources of information

2007-04-24 Thread Y G
On 24/04/07, Sarah Goslee [EMAIL PROTECTED] wrote:

 Hi,

 If you look at the documentation for the function you are interested
 in, in this case ?cor.test, it will generally give you an explanation
 of the return values (often brief, and not too helpful if you aren't
 already familiar with the test), but also one or more references
 that you can turn to for further information.

 Most likely, though, you'll want to absorb a general
 introductory stats book before you delve into the
 gory details of many of those references.

 Sarah


Thanks for the hint, that will do...

On 4/24/07, Y G [EMAIL PROTECTED] wrote:
  Hi,
 
  I am looking for documentation, reference guides, etc. that explain the
  output of functions... For example using cor.test(,
 method=pearson)
  with Pearson's corr coeff the output is:
 
 
  Pearson's product-moment correlation
 
  data:  a and b
  t = 0.2878, df = 14, p-value = 0.
  alternative hypothesis: true correlation is not equal to 0
  95 percent confidence interval:
   -0.4355690  0.5514366
  sample estimates:
 cor
  0.07669612
 
 
  What are all these? Apologies but I am new in R and statistics in
  general but a textbook I was looking at, regarding SPSS, explains
 only
  the r coeff and the conf interval Any help with sources I can refer
 to?
  Particularly in a broader context as it would not be nice to post all
 the
  time such questions...
 
  Thanks in advance,
  GM
 

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


[[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] R as a server on Linux

2007-04-24 Thread Markus Loecher
Hi,
I am trying to avid the somewhat costly startup overhead of launching 
a separate R executable for each client request on Linux.
My current architecture is such that My Java client explicitly calls 
R in batch mode and passes it certain parameters. The initital 
startup takes almost 10 seconds because R has to load a bunch of 
libraries as well as a moderately large, previously created workspace.
I am thinking that it would be so much more eficient to instead have 
R act as a server and fork off a thread for each client query. Is 
that possible at all ?

Thanks!
Markus

__
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] NA and NaN randomForest

2007-04-24 Thread clayton . springer
Dear R-help,

This is about randomForest's handling of NA and NaNs in test set data.
Currently, if the test set data contains an NA or NaN then 
predict.randomForest will skip that row in the output.

I would like to change that behavior to outputting an NA.

Can this be done with flags to randomForest?
If not can some sort of wrapper be built to put the NAs back in?

thanks,

Clayton
_

CONFIDENTIALITY NOTICE\ \ The information contained in this ...{{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 as a server on Linux

2007-04-24 Thread Dirk Eddelbuettel
On Tue, Apr 24, 2007 at 02:15:43PM -0400, Markus Loecher wrote:
 Hi,
 I am trying to avid the somewhat costly startup overhead of launching 
 a separate R executable for each client request on Linux.
 My current architecture is such that My Java client explicitly calls 
 R in batch mode and passes it certain parameters. The initital 
 startup takes almost 10 seconds because R has to load a bunch of 
 libraries as well as a moderately large, previously created workspace.
 I am thinking that it would be so much more eficient to instead have 
 R act as a server and fork off a thread for each client query. Is 
 that possible at all ?

Yes. Google for 

   RServe   -- headless R server, has Java interface
   RApache  -- R added to Apache
   
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.


Re: [R] R as a server on Linux

2007-04-24 Thread Gregory Warnes

Hi Markus,

Take a look at RSOAP (http://rsoap.sf.net).  It was designed for  
handling concurrent client connections to R, and minimizes the per- 
connection startup time by pre-starting R and forking of processes as  
requests come in.  Each client can maintain a stateful connection, if  
desired.

-G



On Apr 24, 2007, at 2:15PM , Markus Loecher wrote:

 Hi,
 I am trying to avid the somewhat costly startup overhead of launching
 a separate R executable for each client request on Linux.
 My current architecture is such that My Java client explicitly calls
 R in batch mode and passes it certain parameters. The initital
 startup takes almost 10 seconds because R has to load a bunch of
 libraries as well as a moderately large, previously created workspace.
 I am thinking that it would be so much more eficient to instead have
 R act as a server and fork off a thread for each client query. Is
 that possible at all ?

 Thanks!
 Markus

 __
 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] intersect more than two sets

2007-04-24 Thread Weiwei Shi
assume t2 is a list of size 11 and each element is a vector of characters.

the following codes can get what I wanted but I assume there might be
a one-line code for that:

t3 - t2[[1]]
for ( i in 2:11){
t3 - intersect(t2[[i]], t3)
}

or there is no such apply?

On 4/24/07, Weiwei Shi [EMAIL PROTECTED] wrote:
 Hi,
 I searched the archives and did not find a good solution to that.

 assume I have 10 sets and I want to have the common character elements of 
 them.

 how could i do that?

 --
 Weiwei Shi, Ph.D
 Research Scientist
 GeneGO, Inc.

 Did you always know?
 No, I did not. But I believed...
 ---Matrix III



-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

Did you always know?
No, I did not. But I believed...
---Matrix III

__
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 as a server on Linux

2007-04-24 Thread Martin Morgan
RWebServices

http://wiki.fhcrc.org/caBioc/

offers a more structured approach to this -- map R functions and data
classes to their Java representation, expose Java as a web service,
service requests using persistent R workers.

Martin

Markus Loecher [EMAIL PROTECTED] writes:

 Hi,
 I am trying to avid the somewhat costly startup overhead of launching 
 a separate R executable for each client request on Linux.
 My current architecture is such that My Java client explicitly calls 
 R in batch mode and passes it certain parameters. The initital 
 startup takes almost 10 seconds because R has to load a bunch of 
 libraries as well as a moderately large, previously created workspace.
 I am thinking that it would be so much more eficient to instead have 
 R act as a server and fork off a thread for each client query. Is 
 that possible at all ?

 Thanks!
 Markus

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

-- 
Martin Morgan
Bioconductor / Computational Biology
http://bioconductor.org

__
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] intersect more than two sets

2007-04-24 Thread Charles C. Berry
On Tue, 24 Apr 2007, Weiwei Shi wrote:

 Hi,
 I searched the archives and did not find a good solution to that.

 assume I have 10 sets and I want to have the common character elements of 
 them.

 how could i do that?

  list.of.sets - lapply(1:10,function(x) sample(letters,20)) # for example

  names( which( table( unlist( lapply( list.of.sets, unique ) ) ) ==10 ) )

or

  int.rec - function(x) {
if (length(x) == 1 )
  {
x
   } else {
x -
c(list(intersect(x[[1]],x[[2]])),x[-(1:2)]);Recall(x)}
}

   int.rec(list.of.sets)


 -- 
 Weiwei Shi, Ph.D
 Research Scientist
 GeneGO, Inc.

 Did you always know?
 No, I did not. But I believed...
 ---Matrix III

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


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

__
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] intersect more than two sets

2007-04-24 Thread John Fox
Dear Weiwei Shi,

How about using recursion?

 intersection - function(x, y, ...){
+ if (missing(...)) intersect(x, y)
+ else intersect(x, intersection(y, ...))
+ }
 
 a - letters[1:4]
 b - letters[2:5]
 c - letters[3:6]
 d - letters[4:7]
 e - letters[5:8]
 
 intersection(a, b)
[1] b c d
 intersection(a, b, c)
[1] c d
 intersection(a, b, c, d)
[1] d
 intersection(a, b, c, d, e)
character(0)
 
 do.call(intersection, list(a, b, c))
[1] c d

I hope this helps,
 John


John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Weiwei Shi
 Sent: Tuesday, April 24, 2007 2:59 PM
 To: R Help
 Subject: Re: [R] intersect more than two sets
 
 assume t2 is a list of size 11 and each element is a vector 
 of characters.
 
 the following codes can get what I wanted but I assume there 
 might be a one-line code for that:
 
 t3 - t2[[1]]
 for ( i in 2:11){
   t3 - intersect(t2[[i]], t3)
 }
 
 or there is no such apply?
 
 On 4/24/07, Weiwei Shi [EMAIL PROTECTED] wrote:
  Hi,
  I searched the archives and did not find a good solution to that.
 
  assume I have 10 sets and I want to have the common 
 character elements of them.
 
  how could i do that?
 
  --
  Weiwei Shi, Ph.D
  Research Scientist
  GeneGO, Inc.
 
  Did you always know?
  No, I did not. But I believed...
  ---Matrix III
 
 
 
 --
 Weiwei Shi, Ph.D
 Research Scientist
 GeneGO, Inc.
 
 Did you always know?
 No, I did not. But I believed...
 ---Matrix III
 
 __
 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] intersect more than two sets

2007-04-24 Thread Tony Plate
I don't think there's that sort of apply-reduce function in R, but for 
this problem, the last line below happens to be a one-liner:

  set.seed(1)
  x - lapply(1:10, function(i) sample(letters, 20))
  table(unlist(x))

  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x 
  y  z
  6  8  7  8  9  9 10  9  8 10  6  7  9  7  6  8  8  6  9  6  9  6  9  7 
  6  7
  which(table(unlist(x))==10)
  g  j
  7 10
  names(which(table(unlist(x))==10))
[1] g j
 


Weiwei Shi wrote:
 assume t2 is a list of size 11 and each element is a vector of characters.
 
 the following codes can get what I wanted but I assume there might be
 a one-line code for that:
 
 t3 - t2[[1]]
 for ( i in 2:11){
   t3 - intersect(t2[[i]], t3)
 }
 
 or there is no such apply?
 
 On 4/24/07, Weiwei Shi [EMAIL PROTECTED] wrote:
 Hi,
 I searched the archives and did not find a good solution to that.

 assume I have 10 sets and I want to have the common character elements of 
 them.

 how could i do that?

 --
 Weiwei Shi, Ph.D
 Research Scientist
 GeneGO, Inc.

 Did you always know?
 No, I did not. But I believed...
 ---Matrix III

 


__
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] specify xlim for each panel

2007-04-24 Thread Deepayan Sarkar
On 4/24/07, Aimin Yan [EMAIL PROTECTED] wrote:
 I draw dotplot using the following code:

 sd.dotplot-dotplot(data.47.nmr$om_sd ~ as.factor(data.47.nmr$position)
 |as.factor(data.47.nmr$pr), data = data.47.nmr,layout=c(1,1),
 xlab=Position, xlim=range(data.47.nmr$position),ylab=Sd, main=Changes
 of omega angle in different positions,
 scales = list(x = list(rot = 45)))

 However I get same xlim for each panel,
 Actually xlim is different for each panel, it is based on 
 data.47.nmr$position.

 How can I modify this code so I can deal with the different xlim for each 
 panel

The simplest answer to that depends on your data, so please give a
reproducible example. Hints: try scales = list(x = list(relation =
free, rot = 45)), and if that doesn't work as intended, consider
reordering the levels of your factor (see ?reorder.factor). Something
like

dotplot(om_sd ~ reorder(as.factor(position), pr) | as.factor(pr),
data = ...

should work.

By the way, you are missing the whole point of having a formula
interface; you can simply do:

sd.dotplot -
dotplot(om_sd ~ as.factor(position) | as.factor(pr),
data = data.47.nmr,
...

__
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] intersect more than two sets

2007-04-24 Thread hadley wickham
On 4/24/07, Weiwei Shi [EMAIL PROTECTED] wrote:
 assume t2 is a list of size 11 and each element is a vector of characters.

 the following codes can get what I wanted but I assume there might be
 a one-line code for that:

 t3 - t2[[1]]
 for ( i in 2:11){
 t3 - intersect(t2[[i]], t3)
 }

 or there is no such apply?

The operation you want is called a fold
(http://en.wikipedia.org/wiki/Fold_%28higher-order_function%29), and
if it was available in R, you'd be able to do:

fold(t2, intersect)

Unfortunately, it's not, but you could implement it as follows:

fold - function(x, fun) {
if (length(x) == 1) return(fun(x))

accumulator - fun(x[[1]], x[[2]])
if (length(x) == 2) return(accumulator)

for(i in 3:length(x)) {
accumulator - fun(accumulator, x[[i]])
}
accumulator
}

a - list(c(1,3,5), c(1,3), c(1, 2, 5, 6))
fold(a, intersect)

Which is just a trivial generalisation of your code above

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.


Re: [R] intersect more than two sets

2007-04-24 Thread Weiwei Shi
I had a similar solution by using frequency but having more codes :(

I also like the recursive idea : I initially tried to use rapply,
however, which can only take one-arg function.

thanks, everyone.

-w

On 4/24/07, hadley wickham [EMAIL PROTECTED] wrote:
 On 4/24/07, Tony Plate [EMAIL PROTECTED] wrote:
  I don't think there's that sort of apply-reduce function in R, but for
  this problem, the last line below happens to be a one-liner:

 Only if you have character data though:

  x - lapply(1:10, function(i) sample(20, 15))
  names(which(table(unlist(x))==10))
 [1] 14

 (not that it's hard to turn that back into a number)

 Hadley



-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

Did you always know?
No, I did not. But I believed...
---Matrix III

__
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] intersect more than two sets

2007-04-24 Thread hadley wickham
On 4/24/07, Tony Plate [EMAIL PROTECTED] wrote:
 I don't think there's that sort of apply-reduce function in R, but for
 this problem, the last line below happens to be a one-liner:

Only if you have character data though:

 x - lapply(1:10, function(i) sample(20, 15))
 names(which(table(unlist(x))==10))
[1] 14

(not that it's hard to turn that back into a number)

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] Problem opening connections to removable hard drive

2007-04-24 Thread Elizabeth Purdom
Hi,

I have my files and R session on a portable hard drive to be able to 
work across computers since I have some extremely large files. I have 
just started doing this and generally it works as I expect. But after a 
while of using my R session, certain types of calls to open connections 
on the hard drive don't work. But I experience no problems 
opening/saving files on the portable hard drive using other programs.

In particular, if I explicitly call the entire folder path to the hard 
drive, I can save an object to file, for example. But if I just want to 
save it in the current working directory, without explicitly naming the 
entire path, then I have problems (I show an example below). I am using 
a package that assumes a certain file structure from the current working 
directory in order to find/write output, which is why I want to be able 
to rely on not explicitly calling the whole path. Furthermore, I was 
experimenting just now, and when I changed the current directory to 
another one, and then back to the removable hard drive, everything gets 
'reset' somehow and opening connections works again, just like when I 
first started up my session.

I am on Windows XP, R 2.4.0.

Thanks,
Elizabeth Purdom

example:
  getwd()
[1] I:/ICBP/Exon Array/Data
#explicit call to hard drive works...
  save(x,file=I:/ICBP/Exon Array/Data/tmp.rdata)
#unexplicit call relying on knowing working directory doesn't...
  save(x,file=tmp.rdata)
Error in gzfile(file, wb) : unable to open connection
In addition: Warning message:
cannot open compressed file 'tmp.rdata'

__
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] intersect more than two sets

2007-04-24 Thread Dimitris Rizopoulos
you could try something like the following:

t2 - lapply(1:11, function(i) c(a, sample(letters[1:5],
sample(10, 1), TRUE), b))

unq.vals - unique(unlist(t2))
ind - rowSums(sapply(t2, %in%, x = unq.vals)) == length(t2)
unq.vals[ind]


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


Quoting Weiwei Shi [EMAIL PROTECTED]:

 assume t2 is a list of size 11 and each element is a vector of characters.

 the following codes can get what I wanted but I assume there might be
 a one-line code for that:

 t3 - t2[[1]]
 for ( i in 2:11){
   t3 - intersect(t2[[i]], t3)
 }

 or there is no such apply?

 On 4/24/07, Weiwei Shi [EMAIL PROTECTED] wrote:
 Hi,
 I searched the archives and did not find a good solution to that.

 assume I have 10 sets and I want to have the common character   
 elements of them.

 how could i do that?

 --
 Weiwei Shi, Ph.D
 Research Scientist
 GeneGO, Inc.

 Did you always know?
 No, I did not. But I believed...
 ---Matrix III



 --
 Weiwei Shi, Ph.D
 Research Scientist
 GeneGO, Inc.

 Did you always know?
 No, I did not. But I believed...
 ---Matrix III

 __
 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] intersect more than two sets

2007-04-24 Thread Peter Dalgaard
hadley wickham wrote:
 On 4/24/07, Weiwei Shi [EMAIL PROTECTED] wrote:
   
 assume t2 is a list of size 11 and each element is a vector of characters.

 the following codes can get what I wanted but I assume there might be
 a one-line code for that:

 t3 - t2[[1]]
 for ( i in 2:11){
 t3 - intersect(t2[[i]], t3)
 }

 or there is no such apply?
 

 The operation you want is called a fold
 (http://en.wikipedia.org/wiki/Fold_%28higher-order_function%29), and
 if it was available in R, you'd be able to do:

 fold(t2, intersect)

 Unfortunately, it's not, but you could implement it as follows:

 fold - function(x, fun) {
   if (length(x) == 1) return(fun(x))
   
   accumulator - fun(x[[1]], x[[2]])
   if (length(x) == 2) return(accumulator)

   for(i in 3:length(x)) {
   accumulator - fun(accumulator, x[[i]])
   }
   accumulator
 }

 a - list(c(1,3,5), c(1,3), c(1, 2, 5, 6))
 fold(a, intersect)

   

It's come up before. Gabor G posted this rather more succinct version:

  Fold - function(f, x, L) (for(e in L) x - f(x, e))
  Fold(intersect,a[[1]],a[-1])
[1] 1

or maybe prettier:

  (E - Fold(union, NULL, a))
[1] 1 3 5 2 6
  Fold(intersect, E, a)
[1] 1


 Which is just a trivial generalisation of your code above


__
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] How to write a function?

2007-04-24 Thread Keti Cuko
Hi,
My name is Katie and I was wondering if you could help me with my problem. I
am trying to write a function in R that computes the statistics (mean,
standard error, confidence intervals) for stratified samples. I am not that
familiar with R and I am having dificulties setting this function up. Any
help or tips on where/how to do this?

Best,
Katie

[[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] Repeated Measures design using lme

2007-04-24 Thread Martin Henry H. Stevens
Have you seen Pinheiro and Bates (2000) that lays out the nlme  
package? It is very helpful.
Hank
On Apr 14, 2007, at 8:02 PM, Kyle. wrote:

 You probably can do this with lme function, but I don't know that for
 sure.  aov (included in the stats package), with a call to the
 Error function how I generally analyze data obtained from a
 repeated measure design.  For a very good description of how Error
 and aov work together, you should read Baron's “Notes on the use of R
 for psychology experiments and questionnaires” (follow the link
 below)  The section beginning on page 36 addresses your question.
 Generally speaking, the aov function expects you to describe your
 model formula similarly to how you would with a call to the lm
 function.  For example, Y~X1*X2 describes a two way ANOVA--your
 dependent variable Y modeled as explanatory variables X1 and X2,
 including the interaction term:
   model.aov-aov(Y~X1*X2, data=DataFile)

 If X1 and X2 are within-subject variables, then the above formula
 would be written as follows:

   model.aov-aov(Y~X1*X2+Error(Subject/X1*X2),data=DataFile)

 The call summary(model.aov) will display a summary of the model.
 Depending on your experience working with model formulae in R, there
 are several steps in the repeated-measure ANOVA procedure that can
 come back to haunt you, if you're not careful (e.g., checking the
 assumption of sphericity, normally distributed errors, homogeneity of
 variance, etc., etc.), so make sure you're covered on these before
 you believe your results.

 Here's a link to the document I referred to: http://cran.r-
 project.org/doc/contrib/Baron-rpsych.pdf




 Kyle H. Ambert
 Graduate Student, Dept. Behavioral Neuroscience
 Oregon Health  Science University
 [EMAIL PROTECTED]






 On Apr 8, 2007, at 7:55 PM, Scott Norton wrote:

 Hi,
 I have what I believe is a repeated-measures dataset that I'm
 trying to analyze using lme().  This is *not* homework, but an
 exercise in my trying to self-teach myself repeated-measure ANOVA
 for other *real* datasets that I have and that are extremely
 similar to the following design.

 I'm fairly sure the dataset described below would work with lme()
 -- but it'd be great if anybody can confirm that after I describe  
 the dataset below)

 The study involves measuring the effect of a drug on blood
 pressure. There were 16 patients in all and 6 replicate measures
 per patient of their blood pressure on one week (one measure per
 day). Two weeks later, a drug was introduced to 8 randomly selected
 patients in such a way that I had equal representation of the 4 age
 groups among the two treatment groups. Then, another two weeks
 later, 6 replicate measures per patient (per day) of blood pressure
 was retaken.  So each patient had 12 total measures whether they
 were in the treatment group or in the control group (6 reads (R1-
 R6) in the baseline-week and another 6 reads (R1-R6) in the post-
 treatment week).

 So,
 Background: 16 patients
 Response measure: Blood pressure
 Fixed Factor: 4 Age groups
 Fixed Factor: Drug vs. NoDrug
 Random factor: Day of the read (i.e. 6 replicate reads (R1-R6) at
 the baseline time, and 6 replicate reads (R1-R6) after the drug has
 had time to take effect)
 Random Factor: Subjects 1-16

 PatientAgeGroupBP(Blood Pressure)Read (replicate
 reads)Pre/PostTreatmentWeekGroup
 120-2983
 R1
 preTreat
 220-2981
 R1
 preControl
 320-2974
 R1
 preTreat
 420-2985
 R1
 preControl
 530-3982
 R1
 preTreat







 320-2974
 R2
 preTreat







 120-2983
 R1
 post   Treat
 220-2982
 R1
 post   Control
 320-2986
 R1
 post   Treat
 420-2984
 R1
 post   Control








 I'm trying to do an analysis of variance to decide whether there is
 a measurable change in blood pressure between the Treat and Control
 groups.

 Another issue is that some of the 16 patients didn't get all 6
 replicate reads in their pre/post treatment weeks, so I need to
 include the na.omit function.

 What I think I'm having the most trouble with is the repeated reads
 (R1 through R6) in the pre/post treatment weeks.  I'm fairly sure
 this is a random variable -- their order or identify (R1 in pre-
 treatment week has no relation to R1 in the post-treatment week,
 etc).  By placing Read as a random variable, am I covering myself
 there?
 If I execute:

 summary(lme(BP 

Re: [R] Matrix: how to re-use the symbolic Cholesky factorization?

2007-04-24 Thread Douglas Bates
On 4/24/07, Gardar Johannesson [EMAIL PROTECTED] wrote:
 I have been playing around with sparse matrices in the Matrix
 package, in particularly with the Cholesky factorization of matrices
 of class dsCMatrix. And BTW, what a fantastic package.

 My problem is that I have to carry out repeated Cholesky
 factorization of a spares symmetric matrices, say Q_1, Q_2, ...,Q_n,
 where the Q's have the same non-zero pattern. I know in this case one
 does only need to carry out the symbolic factorization _once_ and
 then follow that up with a numerical factorization for each of the
 Q_i's (re-using the general symbolic factorization each time). Does
 anybody know if this is possible using the Matrix package?

At present that is not possible without writing your own C code that
calls functions in the CHOLMOD library of C functions directly.  We'll
add that to the ToDo list.  The easiest interface I can picture is
to pass a Cholesky factorization object along with the dsCMatrix
object that contains the new values with the old pattern.

__
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] intersect more than two sets

2007-04-24 Thread Ron Michael
have u seen ?merge  ?

- Original Message 
From: Weiwei Shi [EMAIL PROTECTED]
To: R Help R-help@stat.math.ethz.ch
Sent: Tuesday, April 24, 2007 10:55:51 PM
Subject: [R] intersect more than two sets

Hi,
I searched the archives and did not find a good solution to that.

assume I have 10 sets and I want to have the common character elements of them.

how could i do that?

-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

Did you always know?
No, I did not. But I believed...
---Matrix III

__
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] time series problem

2007-04-24 Thread Tomas Mikoviny
Hi everybody,

I work with data with following pattern

  comm

Date  Value
1   4/10/2007   361.2
2   4/11/2007   370.1
3   4/12/2007   357.2
4   4/13/2007   362.3
5   4/16/2007   363.5
6   4/17/2007   368.7
7   4/18/2007   354.7
8   4/19/2007   368.8
9   4/20/2007   367.1
10  ... ...

and trying to convert it to time series using:

  t=strptime(comm[1,1],%m/%d/%Y)
  x=ts(comm, start=as.POSIXct(t))

Error in Math.difftime((end - start) * frequency + 1.01) :
floornot defined for difftime objects

Definitely I do something wrong but I can't find what is it!
Can anyone help me with this?

Thanks.

Tomas

__
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] understanding round() behavior

2007-04-24 Thread Robert Duval
Dear all,

I am a little bit puzzled by the way round() works.
Consider the following code

a-123456.3678
 round(a,digits=10)
[1] 123456.4


I would expect the outcome to be something like 123456.3678 or
123456.368, instead the computer gives me 123456.4 no matter how large
the digits are.

Can anybody help me understand what I'm missing here?

Thanks again for your help.
Robert

__
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] Size of an object in workspace

2007-04-24 Thread Weiwei Shi
library(gdata)
ll()


On 4/24/07, Horace Tso [EMAIL PROTECTED] wrote:
 Hi folks,

 Is there a function to show the size of an R object? eg. in Kbytes?

 Couple months ago Bendix Carstensen posted this marvelous little function 
 lls(), which shows all objects in the current workspace by mode, class and 
 'size'. This is a wonderful enhancement to the build-in ls() already and I 
 now have it sourced in my Rprofile.site at startup.

 The only drawback is, 'size' is just the length/dim of an object. For 
 matrices and data frames this is good enough. But for a list, knowing how 
 many elements in there doesn't help much. I need to know the totality of the 
 content in a common unit, eg. byte.

 Thanks in advance.

 Horace

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



-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

Did you always know?
No, I did not. But I believed...
---Matrix III

__
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] Log-Returns

2007-04-24 Thread Soare Marcian-Alin
Hello,

I have a Problem to make Log-Returns of the dataset EuStockMarkets.
Is there any function which could calculate it for me?

data(EuStockMarkets)

Thanks!

Alin Soare

[[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] Log-Returns

2007-04-24 Thread Horace Tso
diff(log(x))

And this should be made into a function.

H.




 Soare Marcian-Alin [EMAIL PROTECTED] 4/24/2007 2:17 PM 
Hello,

I have a Problem to make Log-Returns of the dataset EuStockMarkets.
Is there any function which could calculate it for me?

data(EuStockMarkets)

Thanks!

Alin Soare

[[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] intersect more than two sets

2007-04-24 Thread John Fox
Dear Peter, Hadley, et al.,

Just to bring it back around, here's a recursive Fold():

 a - letters[1:4]
 b - letters[2:5]
 c - letters[3:6]
 d - letters[4:7]
 e - letters[5:8]

 Fold - function(f, x, y, ...){
+ if (missing(...)) f(x, y)
+ else f(x, Fold(f, y, ...))
+ }

 Fold(intersect, a, b)
[1] b c d
 Fold(intersect, a, b, c)
[1] c d
 Fold(intersect, a, b, c, d)
[1] d
 Fold(intersect, a, b, c, d, e)
character(0)
 
 do.call(Fold, list(intersect, a, b, c, d))
[1] d

Regards,
 John


John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard
 Sent: Tuesday, April 24, 2007 4:03 PM
 To: hadley wickham
 Cc: R Help; Weiwei Shi
 Subject: Re: [R] intersect more than two sets
 
 hadley wickham wrote:
  On 4/24/07, Weiwei Shi [EMAIL PROTECTED] wrote:

  assume t2 is a list of size 11 and each element is a 
 vector of characters.
 
  the following codes can get what I wanted but I assume 
 there might be 
  a one-line code for that:
 
  t3 - t2[[1]]
  for ( i in 2:11){
  t3 - intersect(t2[[i]], t3)
  }
 
  or there is no such apply?
  
 
  The operation you want is called a fold 
  
 (http://en.wikipedia.org/wiki/Fold_%28higher-order_function%29), and 
  if it was available in R, you'd be able to do:
 
  fold(t2, intersect)
 
  Unfortunately, it's not, but you could implement it as follows:
 
  fold - function(x, fun) {
  if (length(x) == 1) return(fun(x))
  
  accumulator - fun(x[[1]], x[[2]])
  if (length(x) == 2) return(accumulator)
 
  for(i in 3:length(x)) {
  accumulator - fun(accumulator, x[[i]])
  }
  accumulator
  }
 
  a - list(c(1,3,5), c(1,3), c(1, 2, 5, 6)) fold(a, intersect)
 

 
 It's come up before. Gabor G posted this rather more succinct version:
 
   Fold - function(f, x, L) (for(e in L) x - f(x, e))   
 Fold(intersect,a[[1]],a[-1]) [1] 1
 
 or maybe prettier:
 
   (E - Fold(union, NULL, a))
 [1] 1 3 5 2 6
   Fold(intersect, E, a)
 [1] 1
 
 
  Which is just a trivial generalisation of your code above
 
 
 __
 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] understanding round() behavior

2007-04-24 Thread jim holtman
'print' by default only prints 7 digits.  See below:

 round(a, digits=10)
[1] 123456.4
 print(round(a, digits=10), digits=10)
[1] 123456.3678



On 4/24/07, Robert Duval [EMAIL PROTECTED] wrote:
 Dear all,

 I am a little bit puzzled by the way round() works.
 Consider the following code

 a-123456.3678
  round(a,digits=10)
 [1] 123456.4


 I would expect the outcome to be something like 123456.3678 or
 123456.368, instead the computer gives me 123456.4 no matter how large
 the digits are.

 Can anybody help me understand what I'm missing here?

 Thanks again for your help.
 Robert

 __
 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] time series problem

2007-04-24 Thread Achim Zeileis
On Tue, 24 Apr 2007, Tomas Mikoviny wrote:

 Hi everybody,

 I work with data with following pattern

   comm

   Date  Value
 1 4/10/2007   361.2
 2 4/11/2007   370.1
 3 4/12/2007   357.2
 4 4/13/2007   362.3
 5 4/16/2007   363.5
 6 4/17/2007   368.7
 7 4/18/2007   354.7
 8 4/19/2007   368.8
 9 4/20/2007   367.1
 10... ...

 and trying to convert it to time series using:

   t=strptime(comm[1,1],%m/%d/%Y)
   x=ts(comm, start=as.POSIXct(t))

 Error in Math.difftime((end - start) * frequency + 1.01) :
   floornot defined for difftime objects

 Definitely I do something wrong but I can't find what is it!

At least things:
  - ts() can only work with numeric time stamps (not POSIXct)
  - you try to create a regular series (although your data is
not: there is not an observation on each day)

I would recommend to create a zoo series with Date index:
  R library(zoo)
  R z - zoo(comm[,2], as.Date(strptime(comm[,1], %m/%d/%Y)))
  R z
  2007-04-10 2007-04-11 2007-04-12 2007-04-13 2007-04-16 2007-04-17
   361.2  370.1  357.2  362.3  363.5  368.7
  2007-04-18 2007-04-19 2007-04-20
   354.7  368.8  367.1

hth,
Z

 Can anyone help me with this?

 Thanks.

 Tomas

 __
 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] Log-Returns

2007-04-24 Thread AA
see
?getReturns in fMultivar package (part of Rmetrics).
the function has an option between continuous(log returns) or discrete 
calculation.
I used it with timeSeries objects. works well.
good luck.
A.
- Original Message - 
From: Soare Marcian-Alin [EMAIL PROTECTED]
To: R-help@stat.math.ethz.ch
Sent: Tuesday, April 24, 2007 5:17 PM
Subject: [R] Log-Returns


 Hello,

 I have a Problem to make Log-Returns of the dataset EuStockMarkets.
 Is there any function which could calculate it for me?

 data(EuStockMarkets)

 Thanks!

 Alin Soare

 [[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] R Anova

2007-04-24 Thread Keizer_61

I am really struggling with this question.

Three students take part of an experiment.

student  smoking  non-smokingcancer
110.5   7.5 6.5
2  9.5   6.5 8.4
3  8.5   7.2 5.5

the proper inferences is .05

we need to conduct Anova and have a inference of .05.

How do you enter this in R?

How do you calculate the F-test using R for this if we have smoking,
non-smoking and cancer all equal.

any suggestions? 

thanks
-- 
View this message in context: 
http://www.nabble.com/R-Anova-tf3641767.html#a10170587
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] How to write a function?

2007-04-24 Thread Robert Duval
Hi Keti

Before reinventing the wheel from scratch you might want to take a
look at the survey package

http://faculty.washington.edu/tlumley/survey/

best
robert

On 4/24/07, Keti Cuko [EMAIL PROTECTED] wrote:
 Hi,
 My name is Katie and I was wondering if you could help me with my problem. I
 am trying to write a function in R that computes the statistics (mean,
 standard error, confidence intervals) for stratified samples. I am not that
 familiar with R and I am having dificulties setting this function up. Any
 help or tips on where/how to do this?

 Best,
 Katie

 [[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] simulate values

2007-04-24 Thread Soare Marcian-Alin
Hello,

I want to simulate 100 values of the ARMA Process with this function:

x[i] = 0.5 * x[i-1] + 0.2 * x[i-2] + x[i] + 0.9 * x[i-1] + 0.2 * x[i-2] +
0.3 * x[i-3]

which possibilities do I have?

Alin Soare

[[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] Analysis of Variance

2007-04-24 Thread CrazyJoe

Hello

Blind  toy_Car toy_truck   toy_boat
1 6.3 7.5 5.4
2 3.4 8.1 6.1
3 2.2 4.4 5.1

How do we calculate the F-statistic in R.

Any help is really appreciated.
-- 
View this message in context: 
http://www.nabble.com/Analysis-of-Variance-tf3641852.html#a10170830
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] exclude the unfit data from the iteration

2007-04-24 Thread Mohammad Ehsanul Karim
Dear List, 

Trying to explain my situation as simply as possible
for me:

I am running a series of iteration on coxph model on
simulated data (newly generated data on each iteration
to run under coxph; in my example below- sim.fr is the
generated data). However, sometimes i get warning
messages like 
Ran out of iterations and did not converge or 
Error in var(x, na.rm = na.rm) : missing observations
in cov/cor 
because in some cases one of my covariate (say, var5
or var6 or both who are binary variables) becomes all
0's!

How do I exclude the unfit data (that does not
fit/converge: that produces warning messages) that may
be generated in any iteration, and still continue by
replacing it by the next iteration data (untill it
generates acceptable data that does not give any
trouble like not converging)? Is there any provision
in R?

sim.result - function(...){
...
fit.gm.em - coxph(Surv(times,censored) ~
var1+var2+var3+var4+var5+var6 +
frailty(id,dist='gamma', method='em'), data= sim.fr)
...
}

I know
options(warn=-1)
can hide warning messages, but I need not hide the
problem, all i need to do is to tell the program to
continue untill fixed number of times (say, 100) it
iterates with good data.


Thank you for your time.

Mohammad Ehsanul Karim (R - 2.3.1 on windows)
Institute of Statistical Research and Training
University of Dhaka

__
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] negative number to positive number

2007-04-24 Thread H. Paul Benton
Hello all,

I know this is a pretty easy question but I can't find it in S poetry or
R help.

How can I make a negative number positive. Such as
-5 to be +5
I tried +(-5), but that didn't work.

So no, I don't mean taking a -5^2 just to get a positive number.
This is in a function so it's not just -5 it's x. :)

Thanks,

Paul

-- 
Research Technician
Mass Spectrometry
   o The
  /
o Scripps
  \
   o Research
  /
o Institute

__
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] negative number to positive number

2007-04-24 Thread Rajarshi Guha
On Tue, 2007-04-24 at 16:46 -0700, H. Paul Benton wrote:
 Hello all,
 
 I know this is a pretty easy question but I can't find it in S poetry or
 R help.
 
 How can I make a negative number positive. Such as
 -5 to be +5
 I tried +(-5), but that didn't work.
 
 So no, I don't mean taking a -5^2 just to get a positive number.
 This is in a function so it's not just -5 it's x. :)

abs(x)

---
Rajarshi Guha [EMAIL PROTECTED]
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
---
C Code.
C Code Run.
Run, Code, RUN!
PLEASE

__
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] exclude the unfit data from the iteration

2007-04-24 Thread Bert Gunter
?try 
Wrap each iteration in a try() call

Also ?tryCatch if you want to get fancy -- and can understand the rather
arcane docs.

Bert Gunter
Genentech Nonclinical Statistics


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mohammad Ehsanul
Karim
Sent: Tuesday, April 24, 2007 3:33 PM
To: r-help@stat.math.ethz.ch
Subject: [R] exclude the unfit data from the iteration

Dear List, 

Trying to explain my situation as simply as possible
for me:

I am running a series of iteration on coxph model on
simulated data (newly generated data on each iteration
to run under coxph; in my example below- sim.fr is the
generated data). However, sometimes i get warning
messages like 
Ran out of iterations and did not converge or 
Error in var(x, na.rm = na.rm) : missing observations
in cov/cor 
because in some cases one of my covariate (say, var5
or var6 or both who are binary variables) becomes all
0's!

How do I exclude the unfit data (that does not
fit/converge: that produces warning messages) that may
be generated in any iteration, and still continue by
replacing it by the next iteration data (untill it
generates acceptable data that does not give any
trouble like not converging)? Is there any provision
in R?

sim.result - function(...){
...
fit.gm.em - coxph(Surv(times,censored) ~
var1+var2+var3+var4+var5+var6 +
frailty(id,dist='gamma', method='em'), data= sim.fr)
...
}

I know
options(warn=-1)
can hide warning messages, but I need not hide the
problem, all i need to do is to tell the program to
continue untill fixed number of times (say, 100) it
iterates with good data.


Thank you for your time.

Mohammad Ehsanul Karim (R - 2.3.1 on windows)
Institute of Statistical Research and Training
University of Dhaka

__
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] negative number to positive number

2007-04-24 Thread H. Paul Benton

   Thanks
Research Technician
Mass Spectrometry
   o The
  /
o Scripps
  \
   o Research
  /
o Institute 

   Rajarshi Guha wrote:

On Tue, 2007-04-24 at 16:46 -0700, H. Paul Benton wrote:
  

Hello all,

I know this is a pretty easy question but I can't find it in S poetry or
R help.

How can I make a negative number positive. Such as
-5 to be +5
I tried +(-5), but that didn't work.

So no, I don't mean taking a -5^2 just to get a positive number.
This is in a function so it's not just -5 it's x. :)


abs(x)

---
Rajarshi Guha [1][EMAIL PROTECTED]
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
---
C Code.
C Code Run.
Run, Code, RUN!
PLEASE

References

   1. mailto:[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.


  1   2   >