[R] Determining whether a function's return value is assigned

2007-06-30 Thread Paul Laub
Dear all,

Does R offer a means by which a function can determine
whether its return value is assigned? I am using R
2.4.1 for Windows.

Suppose what I am looking for is called
return.value.assigned. Then one might use it like
this

myfunction - function () {
# Create bigobject here

if (return.value.assigned()) {
bigobject
} else {
summary(bigobject)
}
}

and

x - myfunction()  # bigobject is assigned

myfunction()   # summary of bigobject is printed

Octave and MATLAB have the nargout function that does
what I want, and Perl has the wantarray function
detecting the context in which a function is called.
Perhaps match.call() can be made to do what I want,
but, if so, I don't see it in reading the
documentation.

Sincerely,

Paul Laub

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Importing Excel file with merged cells

2007-06-30 Thread stefan lhachimi
Dear all,

I have a problem with importing an excel file into R. I can open the
file easily (either saving it as a CSV or using RODBC). But the
original file is using merged cell in its first column, which gives
the name of the observation. (I am dealing with repeated measurements
for the same observation)
So when I open the dataframe in R it looks like this

Col1Col2 Col3
name1 val1 val2
  val3 val4

name2  val5  val6
val7  val8

Everything is fine, except that the name of the observation is on the
first line and the following are empty. Until a new observation
starts, where a new name appears in the respective row and the
following rows are empty and so on.

The number of rows is fixed for each observation. How can I fill the
column with the proper name (eg take the first string in this column
until you hit a row with a new string, then take this string and go on
until the next string).

Or read the excel file in such a way, that when cells are merged that
when importing it to R all cells created from this merged cell should
have the same content.

Unfortunately, I cannot change the lay-out of the original excel file
as it comes from an commercial data-base and I will have to use it
quite often.

I have the gut feeling that there might be an easy solution out there
as it does not seem to be an uncommon problem.

So if you have  hint or a solution I greatly appreciated it.
Thanks and a nice weekend,
Stefan

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

2007-06-30 Thread Christoph Krammer
Software zur Erkennung von Spam auf dem Rechner

hypatia.math.ethz.ch

hat die eingegangene E-mail als mögliche Spam-Nachricht identifiziert.
Die ursprüngliche Nachricht wurde an diesen Bericht angehängt, so dass
Sie sie anschauen können (falls es doch eine legitime E-Mail ist) oder
ähnliche unerwünschte Nachrichten in Zukunft markieren können.
Bei Fragen zu diesem Vorgang wenden Sie sich bitte an

the administrator of that system

Vorschau: Hello everybody, I want to use R to generate plots from categorial
   data. The data contains results from OCR scans over images with are 
preprocessed
   by different image filtering techniques. A small sample data set looks as
   following: [...] 

Inhaltsanalyse im Detail:   (5.5 Punkte, 5.0 benötigt)

Pkte Regelname  Beschreibung
 -- --
 0.0 DKIM_POLICY_SIGNSOME   Domain Keys Identified Mail: policy says domain
signs some mails
 1.0 BAYES_60   BODY: Spamwahrscheinlichkeit nach Bayes-Test: 60-80%
[score: 0.7481]
 4.5 AWLAWL: From: address is in the auto white-list


---BeginMessage---
Hello everybody,

I want to use R to generate plots from categorial data. The data contains
results from OCR scans over images with are preprocessed by different image
filtering techniques. A small sample data set looks as following:

 data - read.csv(d:/tmp_da/sql_data/filter_d_tool.csv, header=T) 
 data
  ocrtool filter_setting avg.hit.
1  FineReader2x10.383
2  FineReader2x20.488
3  FineReader3x20.268
4  FineReader3x30.198
5  FineReader4x30.081
6  FineReader4x40.056
7gocr2x10.153
8gocr2x20.102
9gocr3x20.047
10   gocr3x30.052
11   gocr4x30.014
12   gocr4x40.002
13  ocrad2x10.085
14  ocrad2x20.094
15  ocrad3x20.045
16  ocrad3x30.050
17  ocrad4x30.025
18  ocrad4x40.009


I now want to draw a plot with the categories (filter_setting) as X axis,
and the avg_hit as Y axis. There should be lines for each ocrtool.

But when I draw a plot, the resulting plot always contains bars, even if I
specify type=n.
 plot(data$filter_setting, data$avg.hit., type=n)

When I only plot the categories, without data, there appear strange grey
(but empty) boxes. 
 plot(data$filter_setting, type=n)
Warning messages:
1: Grafikparameter type ist veraltet in: plot.window(xlim, ylim, log, asp,
..)
2: Grafikparameter type ist veraltet in: axis(side, at,
as.graphicsAnnot(labels), tick, line, pos, outer,
3: Grafikparameter type ist veraltet in: title(main, sub, xlab, ylab,
line, outer, ...)
4: Grafikparameter type ist veraltet in: axis(side, at,
as.graphicsAnnot(labels), tick, line, pos, outer,  

Who do I get a clean white box to draw the different lines in?

Thanks and regards,
 Christoph

---End Message---
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Importing Excel file that has merged cells

2007-06-30 Thread stefan lhachimi
Dear all,

I have a problem with importing an excel file into R. I can open the
file easily (either saving it as a CSV or using RODBC). But the
original file is using merged cell in its first column, which gives
the name of the observation. (I am dealing with repeated measurements
for the same observation)
So when I open the dataframe in R it looks like this

Col1Col2 Col3
name1 val1 val2
 val3 val4

name2  val5  val6
   val7  val8

Everything is fine, except that the name of the observation is on the
first line and the following are empty. Until a new observation
starts, where a new name appears in the respective row and the
following rows are empty and so on.

The number of rows is fixed for each observation. How can I fill the
column with the proper name (eg take the first string in this column
until you hit a row with a new string, then take this string and go on
until the next string).

Or read the excel file in such a way, that when cells are merged that
when importing it to R all cells created from this merged cell should
have the same content.

Unfortunately, I cannot change the lay-out of the original excel file
as it comes from an commercial data-base and I will have to use it
quite often.

I have the gut feeling that there might be an easy solution out there
as it does not seem to be an uncommon problem.

So if you have  hint or a solution I greatly appreciated it.
Thanks and a nice weekend,
Stefan

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

2007-06-30 Thread Andrew Muller

Thanks for the help.  I installed libgtk2.0-dev and RGtk2 is being
installed as I write.

Andrew Muller
McMaster University/Economics

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Importing an Excel file that has merged cells

2007-06-30 Thread Lhachimi, Stefan
Dear all,

I have a problem with importing an excel file into R. I can open the
file easily (either saving it as a CSV or using RODBC). But the
original file is using merged cell in its first column, which gives
the name of the observation. (I am dealing with repeated measurements
for the same observation)
So when I open the dataframe in R it looks like this

Col1Col2 Col3
name1 val1 val2
  val3 val4

name2  val5  val6
   val7  val8

Everything is fine, except that the name of the observation is on the
first line and the following rows are empty. Until a new observation
starts, where a new name appears in the respective row and the
following rows are empty and so on.

The number of rows is fixed for each observation. How can I fill the
column with the proper name (eg take the first string in this column
until you hit a row with a new string, then take this string and go on
until the next string).

Or read the excel file in such a way, that when cells are merged that
when importing it to R all cells created from this merged cell should
have the same content.

Unfortunately, I cannot change the lay-out of the original excel file
as it comes from an commercial data-base and I will have to use it
quite often.

I have the gut feeling that there might be an easy solution out there
as it does not seem to be an uncommon problem.

So if you have  hint or a solution I greatly appreciated it.
Thanks and a nice weekend,

Stefan


--
This mail has been sent through the MPI for Demographic Rese...{{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] Importing an Excel file that has merged cells

2007-06-30 Thread jim holtman
I think this does what you want using the 'na.locf' function is zoo:

x - read.csv('/tote.csv', header=FALSE, skip=4)
# fill blanks in name column with NAs
is.na(x$V2) - x$V2 == 
# load the 'zoo' library for the function na.locf
require(zoo)
x$V1 - na.locf(x$V1)  # key
x$V2 - na.locf(x$V2)  # name
head(x,30)



On 6/30/07, Lhachimi, Stefan [EMAIL PROTECTED] wrote:

 Dear all,

 I have a problem with importing an excel file into R. I can open the
 file easily (either saving it as a CSV or using RODBC). But the
 original file is using merged cell in its first column, which gives
 the name of the observation. (I am dealing with repeated measurements
 for the same observation)
 So when I open the dataframe in R it looks like this

 Col1Col2 Col3
 name1 val1 val2
  val3 val4
 
 name2  val5  val6
   val7  val8

 Everything is fine, except that the name of the observation is on the
 first line and the following rows are empty. Until a new observation
 starts, where a new name appears in the respective row and the
 following rows are empty and so on.

 The number of rows is fixed for each observation. How can I fill the
 column with the proper name (eg take the first string in this column
 until you hit a row with a new string, then take this string and go on
 until the next string).

 Or read the excel file in such a way, that when cells are merged that
 when importing it to R all cells created from this merged cell should
 have the same content.

 Unfortunately, I cannot change the lay-out of the original excel file
 as it comes from an commercial data-base and I will have to use it
 quite often.

 I have the gut feeling that there might be an easy solution out there
 as it does not seem to be an uncommon problem.

 So if you have  hint or a solution I greatly appreciated it.
 Thanks and a nice weekend,

 Stefan


 --
 This mail has been sent through the MPI for Demographic Rese...{{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.




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

What is the problem you are trying to solve?

[[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] Determining whether a function's return value is assigned

2007-06-30 Thread Uwe Ligges


Paul Laub wrote:
 Dear all,
 
 Does R offer a means by which a function can determine
 whether its return value is assigned? I am using R
 2.4.1 for Windows.

Short answer: No.
Long answer: You want to have a class for the object called bigobject 
below and a print/show method that provides the summary for objects of 
that class.

Uwe Ligges





 
 Suppose what I am looking for is called
 return.value.assigned. Then one might use it like
 this
 
 myfunction - function () {
 # Create bigobject here
 
 if (return.value.assigned()) {
 bigobject
 } else {
 summary(bigobject)
 }
 }
 
 and
 
 x - myfunction()  # bigobject is assigned
 
 myfunction()   # summary of bigobject is printed
 
 Octave and MATLAB have the nargout function that does
 what I want, and Perl has the wantarray function
 detecting the context in which a function is called.
 Perhaps match.call() can be made to do what I want,
 but, if so, I don't see it in reading the
 documentation.
 
 Sincerely,
 
 Paul Laub
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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] import data

2007-06-30 Thread eric zoukekang
Hello!
I wonder if you might help me with informations about how to import data with a 
2.4.1 R version without the menu Import data.
Best regards.
 
Eric Duplex ZOUKEKANG
Ingénieur Zootechnicien
Montpellier SupAgro 
Master2 AAA-PARC
tel : +33(0)661432340
[EMAIL PROTECTED]






___





[[alternative HTML version deleted]]

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


Re: [R] Importing an Excel file that has merged cells

2007-06-30 Thread stefan lhachimi
Hi Jim,
it looks perfect!
Thanx a lot!
Have a nice weekend,
Stefan


On 6/30/07, jim holtman [EMAIL PROTECTED] wrote:
 I think this does what you want using the 'na.locf' function is zoo:

 x - read.csv('/tote.csv', header=FALSE, skip=4)
 # fill blanks in name column with NAs
 is.na(x$V2) - x$V2 == 
 # load the 'zoo' library for the function na.locf
 require(zoo)
 x$V1 - na.locf(x$V1)  # key
 x$V2 - na.locf(x$V2)  # name
 head(x,30)



 On 6/30/07, Lhachimi, Stefan [EMAIL PROTECTED] wrote:
 
  Dear all,
 
  I have a problem with importing an excel file into R. I can open the
  file easily (either saving it as a CSV or using RODBC). But the
  original file is using merged cell in its first column, which gives
  the name of the observation. (I am dealing with repeated measurements
  for the same observation)
  So when I open the dataframe in R it looks like this
 
  Col1Col2 Col3
  name1 val1 val2
   val3 val4
  
  name2  val5  val6
val7  val8
 
  Everything is fine, except that the name of the observation is on the
  first line and the following rows are empty. Until a new observation
  starts, where a new name appears in the respective row and the
  following rows are empty and so on.
 
  The number of rows is fixed for each observation. How can I fill the
  column with the proper name (eg take the first string in this column
  until you hit a row with a new string, then take this string and go on
  until the next string).
 
  Or read the excel file in such a way, that when cells are merged that
  when importing it to R all cells created from this merged cell should
  have the same content.
 
  Unfortunately, I cannot change the lay-out of the original excel file
  as it comes from an commercial data-base and I will have to use it
  quite often.
 
  I have the gut feeling that there might be an easy solution out there
  as it does not seem to be an uncommon problem.
 
  So if you have  hint or a solution I greatly appreciated it.
  Thanks and a nice weekend,
 
  Stefan
 
 
  --
  This mail has been sent through the MPI for Demographic Rese...{{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.
 



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

 What is the problem you are trying to solve?

 [[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] Standard Probability Distributions.

2007-06-30 Thread Marcus Vinicius
Dear all,
What are the standard probability distributions available in R?
I need some as Normal-Truncated, Half-Normal, Gamma, Chi-squared, Wishard,
etc.
Thanks.
Marcus Vinicius

[[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] Dominant eigenvector displayed as third (Marco Visser)

2007-06-30 Thread RAVI VARADHAN
Yes, Spencer, your observation is correct, because the characeristic equation 
det(A - \lambda*I) is a sixth degree polynomial: \lambda^6 - 5 = 0.  So the 
eigenvalues are the complex numbers (generally) that are located at equal 
angles on the circle of radius 5^(1/6), at angles 2*pi*k/6, where k runs from 0 
to 5.  Thus, the roots are:

z_k = 5^(1/6) * exp(i * 2*pi*k/6), k= 0, 1, ..., 5.

where i = sqrt(-1).

Ravi.

- Original Message -
From: Spencer Graves [EMAIL PROTECTED]
Date: Friday, June 29, 2007 6:51 pm
Subject: Re: [R] Dominant eigenvector displayed as third (Marco Visser)
To: Marco Visser [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch


   There is no dominant eigenvalue:  The eigenvalues of that matrix 
 
  are the 6 different roots of 5.  All have modulus (or absolute value) 
 = 
  1.307660.  When I raised them all to the 6th power, all 6 were 5+0i. 
 
  
Someone else can tell us why this is, but this should suffice 
 as 
  an initial answer to your question. 
  
Hope this helps. 
Spencer Graves
  
  Marco Visser wrote:
   Dear R users  Experts,
  
   This is just a curiousity, I was wondering why the dominant 
 eigenvetor and eigenvalue 
   of the following matrix is given as the third. I guess this could 
 complicate automatic selection 
   procedures. 
  
   000005
   100000
   010000
   001000
   000100
   000010
  
   Please copy  paste the following into R;
  
   
 a=c(0,0,0,0,0,5,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0)
   mat=matrix(a, ncol=6,byrow=T)
   eigen(mat)
  
   The matrix is a population matrix for a plant pathogen (Powell et 
 al 2005).
  
   Basically I would really like to know why this happens so I will 
 know if it can occur 
   again. 
  
   Thanks for any comments,
  
   Marco Visser
  
  
   Comment: In Matlab the the dominant eigenvetor and eigenvalue 
   of the described matrix are given as the sixth. Again no idea why.
  
   reference
  
   J. A. Powell, I. Slapnicar and W. van der Werf. Epidemic spread of 
 a lesion-forming 
   plant pathogen - analysis of a mechanistic model with infinite age 
 structure. (2005) 
   Linear Algebra and its Applications 298. p 117-140.  
  
  
  
  
  
   
 Ready
  
 for the edge of your seat? 
   Check out tonight's top picks on Yahoo! TV. 
  
  [[alternative HTML version deleted]]
  
   __
   R-help@stat.math.ethz.ch mailing list
   
   PLEASE do read the posting guide 
   and provide commented, minimal, self-contained, reproducible code.
  
  
  __
  R-help@stat.math.ethz.ch mailing list
  
  PLEASE do read the posting guide 
  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] Standard Probability Distributions.

2007-06-30 Thread David Barron
Have a look in the stats package for the distributions that come with
base R.  There is a package called SuppDists that has some others, and
no doubt there are others.  Try RSiteSearch to look for specific
distributions.

On 30/06/07, Marcus Vinicius [EMAIL PROTECTED] wrote:
 Dear all,
 What are the standard probability distributions available in R?
 I need some as Normal-Truncated, Half-Normal, Gamma, Chi-squared, Wishard,
 etc.
 Thanks.
 Marcus Vinicius

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



-- 
=
David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP

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


Re: [R] import data

2007-06-30 Thread Christophe Pallier
ha

On 6/30/07, eric zoukekang [EMAIL PROTECTED] wrote:

 Hello!
 I wonder if you might help me with informations about how to import data
 with a 2.4.1 R version without the menu Import data.
 Best regards.

 Eric Duplex ZOUKEKANG
 Ingénieur Zootechnicien
 Montpellier SupAgro
 Master2 AAA-PARC
 tel : +33(0)661432340
 [EMAIL PROTECTED]







 ___





 [[alternative HTML version deleted]]


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




-- 
Christophe Pallier (http://www.pallier.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.


Re: [R] import data

2007-06-30 Thread Christophe Pallier
Oops, sorry for the previous empty reply.

You do not tell us which Operating System you are using, so I assume it must
be Windows...
You should check the R import/export Data available from the Help/Manuals
menu
(in French: Aide/Manuels...)

Christophe


On 6/30/07, Christophe Pallier [EMAIL PROTECTED] wrote:

 ha

 On 6/30/07, eric zoukekang [EMAIL PROTECTED] wrote:

  Hello!
  I wonder if you might help me with informations about how to import data
  with a 2.4.1 R version without the menu Import data.
  Best regards.
 
  Eric Duplex ZOUKEKANG
  Ingénieur Zootechnicien
  Montpellier SupAgro
  Master2 AAA-PARC
  tel : +33(0)661432340
  [EMAIL PROTECTED]
 
 
 
 
 
 
  ___
 
 
 
 
 
 
  [[alternative HTML version deleted]]
 
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 


 --
 Christophe Pallier (http://www.pallier.org)




-- 
Christophe Pallier (http://www.pallier.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.


Re: [R] import data

2007-06-30 Thread Roland Rau
Hi Eric,

eric zoukekang wrote:
 Hello!
 I wonder if you might help me with informations about how to import data with 
 a 2.4.1 R version without the menu Import data.
 Best regards.

the best information about importing data in R is contained in the 
manual R Data Import/Export which should be part of your distribution 
of R. I don't know if there were substantial changes between 2.4.1 and 
the current version of R (- 2.5.1), but the most up-to-date manual can 
be found here in html:
http://cran.r-project.org/doc/manuals/R-data.html
or here in pdf-format:
http://cran.r-project.org/doc/manuals/R-data.pdf

I hope this helps?

Best,
Roland

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

2007-06-30 Thread Ross Boylan
Although this query was inspired by distributed random number
generation, one of the questions (#2 below) is a single-machine issue.

I call C++ code from R to generate simulated data.  I'm doing this on a
cluster, and use rmpi and rsprng.  While rsprng randomizes R-level
random numbers (e.g., from runif), it has no effect on the C code, which
is completely SPRNG and MPI ignorant.

Currently I generate a seed to pass into the C code, using
as.integer(runif(1, max=.Machine$integer.max)-.Machine$integer.max/2)
It seems to work.

Any comments on this approach?  Here are some issues I see:

1) The much simpler method of using the consecutive integers as seeds
also seemed to work.  This also has the advantage of repeatability.  I
avoided it because I was concerned it wouldn't be random enough.  Would
consecutive integers as in
  parLapply(cluster, seq(nSimulations), function(i) myfunction(seed=i))
be sufficient?

I suppose I could also generate all the random seeds on the master.

2) This got me thinking about how to generate random integers that span
the whole range of 32 bit signed integers.  The method show above only
spans half the range, since .Machine$integer.max = 2^31.  It also makes
some assumptions about the relation between the value in  .Machine
$integer.max and the seed for random numbers.  Interestingly,
integer.max was 2^31 despite running on a 64 bit powerpc, albeit under
the mostly 32 bit OS-X (I think Leopard--not the current one; Darwin
Kernel 7.9.0).

My understanding is that random number generators internally produce 32
bit integers, which then get converted into the desired distribution.
I'm a little surprised there doesn't seem to be a way to get at them.
Or is one supposed to do runif()*2^32-2^31?

3) Vagaries of the underlying C++ random number generator could also
complicate life.

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

2007-06-30 Thread Roland Rau
Dear all,

I just saw for the first time the 'Matlab Programming Contest' at 
http://www.mathworks.com/contest/overview.html

Is there something comparable for R? Is someone interested in organizing 
such a thing?

Of course, one can try to solve the Matlab Problems Sets in R, but I 
think it could be fun to have something like this also for R.

Thanks and have a nice weekend everyone,
Roland

P.S. I have the impression that the R-Help ML is some kind of 
programming contest, when people try to contribute more efficient, 
elegant, smaller, faster, ... solutions to a question than someone 
before. :-D

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


Re: [R] Programming Contests for R?

2007-06-30 Thread Dirk Eddelbuettel

On 30 June 2007 at 15:31, Roland Rau wrote:
| I just saw for the first time the 'Matlab Programming Contest' at 
| http://www.mathworks.com/contest/overview.html
| 
| Is there something comparable for R? Is someone interested in organizing 
| such a thing?

Well, AFAIK there will be some sort of 'R Programming Contest' at UseR in
Ames in August -- see http://www.useR2007.org

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] random numbers

2007-06-30 Thread Dirk Eddelbuettel

On 30 June 2007 at 12:12, Ross Boylan wrote:
| I call C++ code from R to generate simulated data.  I'm doing this on a
| cluster, and use rmpi and rsprng.  While rsprng randomizes R-level
| random numbers (e.g., from runif), it has no effect on the C code, which
| is completely SPRNG and MPI ignorant.
| 
| Currently I generate a seed to pass into the C code, using
| as.integer(runif(1, max=.Machine$integer.max)-.Machine$integer.max/2)
| It seems to work.
| 
| Any comments on this approach?  Here are some issues I see:

I may be missing something but given that rsprng is running on your cluster,
you are bound to also have sprng itself -- so why don't you use that from C
or C++  for this purpose?

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] random numbers

2007-06-30 Thread Ross Boylan
On Sat, 2007-06-30 at 14:50 -0500, Dirk Eddelbuettel wrote:
 On 30 June 2007 at 12:12, Ross Boylan wrote:
 | I call C++ code from R to generate simulated data.  I'm doing this on a
 | cluster, and use rmpi and rsprng.  While rsprng randomizes R-level
 | random numbers (e.g., from runif), it has no effect on the C code, which
 | is completely SPRNG and MPI ignorant.
 | 
 | Currently I generate a seed to pass into the C code, using
 | as.integer(runif(1, max=.Machine$integer.max)-.Machine$integer.max/2)
 | It seems to work.
 | 
 | Any comments on this approach?  Here are some issues I see:
 
 I may be missing something but given that rsprng is running on your cluster,
 you are bound to also have sprng itself -- so why don't you use that from C
 or C++  for this purpose?
 
 Hth, Dirk
Doing so would add considerable complexity, at least as far as I know.

Sometimes I run within an MPI session and sometimes not.  My
understanding is that SPRNG will not work if MPI is absent.  I think
someone on the SPRNG list told me that there wasn't a good way to handle
this at run-time.  Unfortunately, a lot of SPRNG options seem to be
compile-time settings.

Using SPRNG would also complicate my build process, as I'd need autoconf
magic to support it.

Part of the issue is that I want something I can redistribute, not just
something that will work for me on a  one-off basis.

One simple solution would be to build several versions of the library.
A not so simple solution would be to build various random number
generators as separate libraries, and dynamically load the appropriate
one.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 CMD INSTALL in R 2.5.1 (2007-06-27)

2007-06-30 Thread Fredrik Lundgren
Hello,

I'm moving from R 2.2.1 (Winows XP) to R 2.5.1 and have problems with 
installing myfuncs, which worked OK in 2.2.1

R CMD INSTALL myfuns
# gives
installing to ''


-- Making package myfuncs 
  adding build stamp to DESCRIPTION
  installing R files
  installing man source files
  installing indices
  installing help
  Building/Updating help pages for package 'myfuncs'
 Formats: text html latex example chm
  Bland.plottexthtmllatex   example
  Cook.plot texthtmllatex   example
  added.var.plottexthtmllatex   example
  jit.plot  texthtmllatex   example
  waldtest  texthtmllatex   example
  preparing package myfuncs for lazy loading
Warning in list.files(lib, pattern = paste(^, pkg_regexp, sep = ), 
full = TR
UE) :
 list.files: '' is not a readable directory
Error in findpack(package, lib.loc) : there is no package called 
'myfuncs'
Execution halted
make: *** [lazyload] Error 1
*** Installation of myfuncs failed ***

Removing '/myfuncs'
# end

installing to ''  at the start appears to be the problem

I have install Rtools 2.5.1 appropriately ( I hope)
my PATH looks like this:

PATH=C:\Program\Rtools\MinGW\bin;C:\Program\R\Rtools\bin;c:\program\imagemagick-
6.1.8-q16;C:\Program\TeXLive\bin\win32;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS
\system32\WBEM;C:\Program\Aspell\bin;C:\Program\Perl\bin\;C:\Program\HTML 
Help W
orkshop;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program\ATI 
T
echnologies\ATI Control 
Panel;C:\Program\R\R-2.5.1\bin;C:\Program\sp2000\cmd;C:\
Program\XEmacs\XEmacs-21.4.13\i586-pc-win32;C:\Program\gnuplot\bin;C:\Program\Ma
yura;C:\Program files\WinEdt Team\WinEdt;C:\Program\Internet 
Explorer;;C:\Progra
m\WinBUGS;C:\Program\Adobe\Acrobat 
7.0\Reader;C:\Program\QuickTime\QTSystem\

To me looks as if R don't know where to install - any help available?

Sincerely Fredrik Lundgren

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
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 CMD INSTALL in R 2.5.1 (2007-06-27)

2007-06-30 Thread Uwe Ligges


Fredrik Lundgren wrote:
 Hello,
 
 I'm moving from R 2.2.1 (Winows XP) to R 2.5.1 and have problems with 
 installing myfuncs, which worked OK in 2.2.1
 
 R CMD INSTALL myfuns
 # gives
 installing to ''

Have you set an environment variable such as R_LIBS that is  rather 
than a sensible directory? (my guess)

Are all the tools up to date?
Do you have another library (except the standard one) defined anywhere?
Can you source() all the R files in your package separately in R-2.5.1?

Uwe Ligges



 
 
 -- Making package myfuncs 
   adding build stamp to DESCRIPTION
   installing R files
   installing man source files
   installing indices
   installing help
   Building/Updating help pages for package 'myfuncs'
  Formats: text html latex example chm
   Bland.plottexthtmllatex   example
   Cook.plot texthtmllatex   example
   added.var.plottexthtmllatex   example
   jit.plot  texthtmllatex   example
   waldtest  texthtmllatex   example
   preparing package myfuncs for lazy loading
 Warning in list.files(lib, pattern = paste(^, pkg_regexp, sep = ), 
 full = TR
 UE) :
  list.files: '' is not a readable directory
 Error in findpack(package, lib.loc) : there is no package called 
 'myfuncs'
 Execution halted
 make: *** [lazyload] Error 1
 *** Installation of myfuncs failed ***
 
 Removing '/myfuncs'
 # end
 
 installing to ''  at the start appears to be the problem
 
 I have install Rtools 2.5.1 appropriately ( I hope)
 my PATH looks like this:
 
 PATH=C:\Program\Rtools\MinGW\bin;C:\Program\R\Rtools\bin;c:\program\imagemagick-
 6.1.8-q16;C:\Program\TeXLive\bin\win32;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS
 \system32\WBEM;C:\Program\Aspell\bin;C:\Program\Perl\bin\;C:\Program\HTML 
 Help W
 orkshop;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program\ATI
  
 T
 echnologies\ATI Control 
 Panel;C:\Program\R\R-2.5.1\bin;C:\Program\sp2000\cmd;C:\
 Program\XEmacs\XEmacs-21.4.13\i586-pc-win32;C:\Program\gnuplot\bin;C:\Program\Ma
 yura;C:\Program files\WinEdt Team\WinEdt;C:\Program\Internet 
 Explorer;;C:\Progra
 m\WinBUGS;C:\Program\Adobe\Acrobat 
 7.0\Reader;C:\Program\QuickTime\QTSystem\
 
 To me looks as if R don't know where to install - any help available?
 
 Sincerely Fredrik Lundgren
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] R CMD INSTALL in R 2.5.1 (2007-06-27)

2007-06-30 Thread Fredrik Lundgren
Sorry,
my fault!
I had
# install myfuncs

library(myfuncs)

in the RProfile.site

before I had myfuncs installed

# library(myfuncs)

fixed everything. I could now R CMD INSTALL as before - no problems

Thanks for your help

Fredrik









- Original Message - 
From: Uwe Ligges [EMAIL PROTECTED]
To: Fredrik Lundgren [EMAIL PROTECTED]
Cc: R-help r-help@stat.math.ethz.ch
Sent: Saturday, June 30, 2007 11:03 PM
Subject: Re: [R] R CMD INSTALL in R 2.5.1 (2007-06-27)




 Fredrik Lundgren wrote:
 Hello,

 I'm moving from R 2.2.1 (Winows XP) to R 2.5.1 and have problems with 
 installing myfuncs, which worked OK in 2.2.1

 R CMD INSTALL myfuns
 # gives
 installing to ''

 Have you set an environment variable such as R_LIBS that is  rather 
 than a sensible directory? (my guess)

 Are all the tools up to date?
 Do you have another library (except the standard one) defined 
 anywhere?
 Can you source() all the R files in your package separately in 
 R-2.5.1?

 Uwe Ligges





 -- Making package myfuncs 
   adding build stamp to DESCRIPTION
   installing R files
   installing man source files
   installing indices
   installing help
   Building/Updating help pages for package 'myfuncs'
  Formats: text html latex example chm
   Bland.plottexthtmllatex   example
   Cook.plot texthtmllatex   example
   added.var.plottexthtmllatex   example
   jit.plot  texthtmllatex   example
   waldtest  texthtmllatex   example
   preparing package myfuncs for lazy loading
 Warning in list.files(lib, pattern = paste(^, pkg_regexp, sep = 
 ), full = TR
 UE) :
  list.files: '' is not a readable directory
 Error in findpack(package, lib.loc) : there is no package called 
 'myfuncs'
 Execution halted
 make: *** [lazyload] Error 1
 *** Installation of myfuncs failed ***

 Removing '/myfuncs'
 # end

 installing to ''  at the start appears to be the problem

 I have install Rtools 2.5.1 appropriately ( I hope)
 my PATH looks like this:

 PATH=C:\Program\Rtools\MinGW\bin;C:\Program\R\Rtools\bin;c:\program\imagemagick-
 6.1.8-q16;C:\Program\TeXLive\bin\win32;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS
 \system32\WBEM;C:\Program\Aspell\bin;C:\Program\Perl\bin\;C:\Program\HTML 
 Help W
 orkshop;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program\ATI
  
 T
 echnologies\ATI Control 
 Panel;C:\Program\R\R-2.5.1\bin;C:\Program\sp2000\cmd;C:\
 Program\XEmacs\XEmacs-21.4.13\i586-pc-win32;C:\Program\gnuplot\bin;C:\Program\Ma
 yura;C:\Program files\WinEdt Team\WinEdt;C:\Program\Internet 
 Explorer;;C:\Progra
 m\WinBUGS;C:\Program\Adobe\Acrobat 
 7.0\Reader;C:\Program\QuickTime\QTSystem\

 To me looks as if R don't know where to install - any help available?

 Sincerely Fredrik Lundgren

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


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


Re: [R] [R-SIG-Finance] Method dispatch in functions?

2007-06-30 Thread Carlos J. Gil Bellosta
Look at the UseMethod function. The help for the print method, a
heavily overloaded function, can also help.

Regards,

Carlos J. Gil Bellosta
http://www.datanalytics.com

On Thu, 2007-06-28 at 09:05 -0700, John McHenry wrote:
 Hi,
 
 Could someone point me in the right direction for documentation on the 
 following question? 
 
 Let's say I have two objects a and b of classes A and B, respectively.
 Now let's say I write a function foo that does something similar to 
 objects of type A and B. Basically I want to overload the function
 in C++ talk, so if I give foo and object of type A something (and this
 is my question) dispatches the call to, say, foo.A, and if I give foo
 and object of type B something dispatches the call to, say, foo.B.
 
 I want to write foo.A and foo.B. How to I perform the method 
 dispatch? From what I understand there are two ways in R:
 S3 and S4. What is the simple S3 way?
 
 Thanks!
 
 Jack.
 

 -
 
   [[alternative HTML version deleted]]
 
 ___
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-sig-finance
 -- Subscriber-posting only. 
 -- If you want to post, subscribe first.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] speed and looping issues; calculations on big datasets

2007-06-30 Thread martin sikora
dear r users,

i'm a little stuck with the following problem(s), hopefully somebody  
can offer some help:

i have data organized in a binary matrix, which can become quite big  
like 60 rows x 10^5 columns (they represent SNP genotypes, for some  
background info). what i need to do is the following:

let's suppose i have a matrix of size n x m. for each of the m  
columns, i want to know the counts of unique rows extended one by one  
from the core column, for both values at the core separately and  
in both directions. maybe better explained with a little example.

data:

00 0 010
10 1 001
11 1 011
10 0 011
10 0 010

so the extended unique rows  counts taking e.g. column 3 as core are:

col 3 = 0:
right:
patterns / counts
00 / 3
001 / 3
0010, 0011 / 2,1

left:
00 / 3
000,001 / 1,2

and that for the other subset ( col3 = 1) as well, then doing the  
whole thing again for the next core column. the reason i need this  
counts is that i want to calculate frequencies of the different  
extended sequences to calculate the probability of drawing two  
identical sequences from the core up to an extended position from the  
whole set of sequences.

my main problem is speed of the calculations. i tried different ways  
suggested here in the list of getting the counts of the unique rows,  
all of them using the table function. both a combination of table 
( do.call( paste, c( as.data.frame( mymatrix) ) ) ) or table( apply 
( mymatrix , 2 , paste , collapse = ) ) work fine, but are too slow  
for bigger matrices that i want to calculate (at least in my not very  
sophisticated function). then i found a great suggestion here to do a  
matrix multiplication with a vector of 2^(0:ncol-1) to convert each  
row into a decimal number, and do table on those. this speeds up  
things quite nicely, although the problem is that it of course does  
not work as soon as i extended for more than 60 columns, because the  
decimal numbers get to large to accurately distinguish between a 0  
and 1 at the smallest digit:

  2^60+2 == 2^60
[1] TRUE

another thing is that so far i could not come up with an idea on how  
or if it is possible to do this without the loops i am using, one  
large loop for each column in turn as core, and then another loop  
within that extends the rows by growing column numbers. since i am  
not the best of programmers (and still quite new to R), i was hoping  
that somebody has some advice on doing this calculations in a more  
elegant and more importantly, fast way.
just to get the idea, the approach with the matrix multiplication  
takes 20s for a 60 x 220 matrix on my macbook pro, which is obviously  
not perfect, considering i would like to use this function for  
matrices of size 10^2 x 10^5 or even more.

so i would be very thankful for any ideas, suggestions etc to improve  
this

cheers
martin

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] MDS/NMDS: When and Why use or not use?

2007-06-30 Thread Milton Cezar Ribeiro
Dear all,

I would like to know when I use NMDS stead PCA or CA analyses? Up to I know, I 
use PCA (or PCoA) for condense the great part of vaciance on the firsts axis, 
and CA (or DCA) when I would like to identify the structure/composition of data 
inside a matrix. 

But I have seem that nowadays many ecologists are using NMDS to dimension 
reduction on data matrices, and interpret the axis (1, 2 etc) like they do on 
CA or DCA. My question is if I can use the axis of NMDS output on regression 
like I can do when with PCA, PCoA, CA and/or DCA axis. 

What is the stress effect on the usage of NMDS axis on regression?

Another question is if are there a good PDF text about MDS and NMDS available 
on the web. 

I know that on vegan library (Thanks Oksanen!!) there are same fuctions which 
deal with MDS, metaMDS. Are there other packages that also works with 
MDS/NMDS/isoMDS on R? What are the similarity/difference on them?

All comments are very welcome!

Kind regards,

Miltinho
Brazil


   


http://yahoo.com.br/oqueeuganhocomisso 
[[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] How to save results from chisq.test or mantelhaen.test to file

2007-06-30 Thread adschai
Hi,

I am new to these functions. I'm wondering if there is anyway to save the 
entire results (all attributes of the result object) from the chisq.test or 
mantelhaen.test functions? For example, from chisq.test function, you will have 
statistic, parameter, p.value, expected, etc. in the result list. How can I 
save all of them in one shot to, says, a text file or csv file? Thank you.

- adschai

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