Re: [R] [friday topic]: what exactly is statistical computing

2007-03-02 Thread Roger D. Peng
This is indeed a Friday topic.  I think I understand the difficulty that 
Wensui has.  I teach two classes, each with the phrase statistical computing 
in the title, and yet they cover completely different topics.

-roger

Wensui Liu wrote:
 Thanks for your insight, Roger.
 
 Actually, my question is not related to R only.
 
 statistical computing is a popular topic recently. However, when I
 check its meaning on wikipedia/google, I couldn't find it.
 
 another reason why I asked is related to myself. I am very interested
 in this area and maintaining a blog in this topic. however, when asked
 what 'statistical computing' is, I am not able to give a
 well-verbalized answer.
 
 
 On 3/2/07, Bos, Roger [EMAIL PROTECTED] wrote:
 This means it comes with substantial statistical routines built-in.  You
 could just as well use VBA or Java for your programming language, but
 with those you would have to write pretty much any stat routine you
 need.  With R, since it is a 'statistical computing' language, you know
 that most of what you need has already been programmed, tested(?), and
 is ready to use.

 I have seen you on this list for a while.  You already know all this.  I
 am not sure why you are asking this question.

 Roger

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Wensui Liu
 Sent: Friday, March 02, 2007 9:43 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] [friday topic]: what exactly is statistical computing

 Dear List,
 on www.r-project.org, the title says 'The R Project for Statistical
 Computing'.

 but what exactly is the definition of statistical computing?

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

 ** *
 This message is for the named person's use only. It may
 contain confidential, proprietary or legally privileged
 information. No right to confidential or privileged treatment
 of this message is waived or lost by any error in
 transmission. If you have received this message in error,
 please immediately notify the sender by e-mail,
 delete the message and all copies from your system and destroy
 any hard copies. You must not, directly or indirectly, use,
 disclose, distribute, print or copy any part of this message
 if you are not the intended recipient.
 **

 
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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

2007-03-01 Thread Roger D. Peng
A 27MB .RData file is relatively big, in may experience.  What do you think is 
slow?  Maybe it's your computer that is slow?

-roger

ramzi abboud wrote:
 Is R file IO slow in general or am I missing
 something?  It takes me 5 minutes to do a load(MYFILE)
 where MYFILE is a 27 MB Rdata file.  Is there any way
 to speed this up?  
 
 The one idea I have is having R call a C or Perl
 routine, reading the file in that language, converting
 the data in to R objects, then sending them back into
 R.  This is more work that I want to do, however, in
 loading Rdata files.
 
 Any ideas would be appreciated.
 Ramzi Aboud
 University of Rochester
 
 
 
 
 
  
 
 Need Mail bonding?
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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

2006-11-17 Thread Roger D. Peng
For a CSV file I would use 'read.csv()'.  I've compiled some notes on reading 
in 
large data frames into R at 
http://www.biostat.jhsph.edu/~rpeng/docs/R-large-tables.html.

-roger

Sumanta Basak wrote:
 Hi R-Experts,
 
  
 
 I'm having a problem with reading a large data file which is
 in .csv format and size is 120 MB (app.). I was trying to use RODBC
 package but I found RODBCconnectExcel function only. And can I convert
 this file to .dbf format?  How can I read this file? And also let me
 know if this was a file in .sas7bdat format, what should I do? Thanks in
 advance.
 
  
 
   
 
 Sumanta.
 
 
   [[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.
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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

2006-11-08 Thread Roger D. Peng
Try

\usepackage[noae]{Sweave}

-roger

Mark Wardle wrote:
 Dear All,
 
 Having now successfully started using Sweave, I have just noticed an odd
 side effect with fonts.
 
 Using plain LaTeX, I have had no problems using \usepackage{palatino} or
 \usepackage{times} and the font correctly changes.
 
 However, once I convert the tex document into Snw, and run it through R
 CMD SWEAVE, LaTeX seems to ignore this package directive. The LaTeX log
 suggests the font package is successfully loaded.
 
 In fact, invetigating the problem in more detail, the mere addition of
 \usepackage{Sweave} is enough to cause the  \usepackage{times} or
 \usepackage{palatino} to be ignored.
 
 I suspect it is not Sweave itself, as I have seen examples in Sweave
 using Times or Palatino; it may be an issue with my local LaTeX
 installation (but that doesn't show up without using Sweave), or some
 odd interaction? Certainly, Sweave generates the correct .tex file, but
 bizarrely, the package directive is ignored.
 
 Has anyone had similar problems, or am I alone...?
 
 pdfeTeX 3.141592-1.21a-2.2 (Web2C 7.5.4)
 Installed via darwinports (macports as it is now).
 
 Mark
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Reading bzip2 and tar files in R

2006-11-08 Thread Roger D. Peng
bzip2-ped files can be read via the bzfile() connection function.  I don't 
think 
there's a way to read from tar files though.

-roger

DrakeGis wrote:
 Is there any way to read and decompress inside R tar and bzip2 files ?
 
 Thanks
 
   D
 
 
 -
 Stay ahead of the information curve.
 Receive EDA news and jobs on your desktop daily.
 Subscribe today to the EDA CafeNews newsletter.
 [ http://www10.edacafe.com/nl/newsletter_subscribe.php ]
 It's informative and essential.
 This message was sent to you from a machine at 141.211.76.26
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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

2006-10-19 Thread Roger D. Peng
How about

x[-c(2, 3)]

-roger

Yanqin Yang wrote:
 Hello,

   Would anyone kindly tell me how to remove the empty element in the vector 
 object?
   For example, 
x
 [1] a c c c d
 unique(x)
 [1] a   c d
 How could I get the output like: a,c,d? 

   Thanks,

   Yanqin

 
   
 -
 Get your email and more, right on the  new Yahoo.com 
   [[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.
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] levels of factor when subsetting the factor

2006-09-12 Thread Roger D. Peng
I think you want 'fact[1:6, drop = TRUE]'

-roger

Afshartous, David wrote:
  
 All,
 
 When I take a subset of a factor the reduced factor still maintains all
 the original levels of the factor when say forming the key in a plot.
 The data is correct, but the variable still remembers the original
 levels.  See below for reproducible code.  Does anyone know how to fix
 this?
 cheers,
 dave
 
 fact = as.factor(c(rep(A, 3),rep(B, 3), rep(C, 3)))
 new.fact = fact[1:6]
 new.fact
 [1] A A A B B B
 Levels: A B C## should only show A B
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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

2006-08-28 Thread Roger D. Peng
You might want to try 'glob2rx()', as in

grep(glob2rx(*.tab), x)

where 'x' is a vector of strings.

-roger

Jon Minton wrote:
 Hi, apologies if this is too simple but I've been stuck on the following for
 a while:
 
  
 
 I have a vector of strings: filenames with a name before the extension and a
 variety of possible extensions
 
  
 
 I want to select only those files with:
 
  1) a .tab extension
 
 AND 
 
 2) the character sequence lad anywhere in the name of the file before the
 extension.
 
  
 
 Surely this won't take long to do, I thought. (But I was wrong.)
 
  
 
 What's the regexp pattern to specify here?
 
  
 
 Thanks,
 
  
 
 Jon Minton
 
  
 
  
 
 
   [[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.
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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

2006-08-25 Thread Roger D. Peng
Take a look at ?plot.stepfun.

'ecdf()' returns an object of class ecdf inheriting from class stepfun and 
'plot.ecdf()' calls 'plot.stepfun'.

-roger

Catherine Carter wrote:
 Hi everyone,
 
 I have what may appear to be a newbie question, but I have looked 
 everywhere I can think to look and I cannot find an answer. On page 35 
 of An Introduction to R the following command appears: 
 plot(ecdf(eruptions), do.points=FALSE, verticals=TRUE). What is the 
 do.points argument? I know what it does (suppresses printing of the 
 points) but where can I find help on it? I want to be able to explain it 
 fully to my students.
 
 Thanks for your help,
 Cathy
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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

2006-08-22 Thread Roger D. Peng
The 'gmp' package may be of use here, but I'm not sure.

-roger

Robin Hankin wrote:
 Hi
 
 Can I get R to handle really big numbers?I am not interested
 in more than (say) 10 sig figs, but I would like to deal with numbers
 up to, say, 10^1.
 
 If
 
 a - 10^1
 b - pi* a
 
 I would like  a+b to return 3.1415926e1.
 
 
 Toy example, illustrating why I can't deal with log(a) and log(b),   
 follows.
 
 
 
 f - function(a,n=100){
out - rep(0,n)
out[1] - a
for(i in 2:n){
  out[i] - sum(exp(out[1:i])) + rexp(1)
}
return(log(out))
 }
 
 
 then f(1,10)  has infinities in it, even though the values should be  
 moderate size.
 
 What are my options here?
 
 --
 Robin Hankin
 Uncertainty Analyst
 National Oceanography Centre, Southampton
 European Way, Southampton SO14 3ZH, UK
   tel  023-8059-7743
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Floating point imprecision in sum() under R-2.3.1?

2006-08-18 Thread Roger D. Peng
I think you want to look at

sum(x)/2066.758 - 1

which on my Linux box is 2.2e-16.

-roger

Brahm, David wrote:
 After upgrading to R-2.3.1 on Linux Redhat, I was suprised by this:
 
 R x - c(721.077, 592.291, 372.208, 381.182)
 R sum(x) - 2066.758
[1] 4.547474e-13
 
 Now I understand that floating point arithmetic is not precise, but
 1) the result is exactly 0 in R-2.2.1 (patched) on the same machine,
 2) .Machine$double.eps = 2.2e-16, so the error seems quite large.
 
 Also note I get the same result on R-2.3.1 under Windows, and that
 R (721.077 + 592.291 + 372.208 + 381.182) - 2066.758
[1] 0
 
 Is this related to the (2.3.0) NEWS item:
   sum(), prod(), mean(), rowSums() and friends use a long double
   accumulator where available and so may be more accurate. 
 and should I be concerned?  Thanks.
 
 -- David Brahm ([EMAIL PROTECTED])
 
 
 Version:
  platform = i686-pc-linux-gnu
  arch = i686
  os = linux-gnu
  system = i686, linux-gnu
  status = 
  major = 2
  minor = 3.1
  year = 2006
  month = 06
  day = 01
  svn rev = 38247
  language = R
  version.string = Version 2.3.1 (2006-06-01)
 
 Locale:
 C
 
 Search Path:
  .GlobalEnv, package:methods, package:stats, package:graphics,
 package:grDevices, package:utils, package:datasets, Autoloads,
 package:base
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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

2006-07-18 Thread Roger D. Peng
In my experience, the OS's use of virtual memory is only relevant in the rough 
sense that the OS can store *other* running applications in virtual memory so 
that R can use as much of the physical memory as possible.  Once R itself 
overflows into virtual memory it quickly becomes unusable.

I'm not sure I understand your second question.  As R is available in source 
code form, it can be compiled for many 64-bit operating systems.

-roger

Marshall Feldman wrote:
 Hi,
 
 I have two further comments/questions about large datasets in R.
  
 1. Does R's ability to handle large datasets depend on the operating
 system's use of virtual memory? In theory, at least, VM should make the
 difference between installed RAM and virtual memory on a hard drive
 primarily a determinant of how fast R will calculate rather than whether or
 not it can do the calculations. However, if R has some low-level routines
 that have to be memory resident and use more memory as the amount of data
 increases, this may not hold. Can someone shed light on this?
 
 2. Is What 64-bit versions of R are available at present?
 
   Marsh Feldman
   The University of Rhode Island
 
 -Original Message-
 From: Thomas Lumley [mailto:[EMAIL PROTECTED] 
 Sent: Monday, July 17, 2006 3:21 PM
 To: Deepankar Basu
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Large datasets in R
 
 On Mon, 17 Jul 2006, Deepankar Basu wrote:
 
 Hi!

 I am a student of economics and currently do most of my statistical work
 using STATA. For various reasons (not least of which is an aversion for
 proprietary software), I am thinking of shifting to R. At the current
 juncture my concern is the following: would I be able to work on
 relatively large data-sets using R? For instance, I am currently working
 on a data-set which is about 350MB in size. Would be possible to work
 data-sets of such sizes using R?
 
 
 The answer depends on a lot of things, but most importantly
 1) What you are going to do with the data
 2) Whether you have a 32-bit or 64-bit version of R
 3) How much memory your computer has.
 
 In a 32-bit version of R (where R will not be allowed to address more than 
 2-3Gb of memory) an object of size 350Mb is large enough to cause problems 
 (see eg the R Installation and Adminstration Guide).
 
 If your 350Mb data set has lots of variables and you only use a few at a 
 time then you may not have any trouble even on a 32-bit system once you 
 have read in the data.
 
 If you have a 64-bit version of R and a few Gb of memory then there should 
 be no real difficulty in working with that size of data set for most 
 analyses.  You might come across some analyses (eg some cluster analysis 
 functions) that use n^2 memory for n observations and so break down.
 
 
   -thomas
 
 Thomas Lumley Assoc. Professor, Biostatistics
 [EMAIL PROTECTED] University of Washington, Seattle
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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

2006-07-11 Thread Roger D. Peng
Try

structure(11328, class = Date)

or just

class(datetest) - Date

-roger

pierre clauss wrote:
 Hi everybody,
 I need your precious help for, I think, a simple request, but I do not manage 
 to solve this.
  
 When I use a table function with dates in the rows, the rows are coerced to 
 number after the table function.
  
 So I need to transform the row names into date format. But I do not manage.
  
 Therefore, for an example, I manage to write this :
  
 datetest-06/01/2001
 datetest-as.Date(datetest,%d/%m/%Y)
 datetest-as.numeric(datetest)
  
 to get 11328.
  
 But I do not obtain the inverse tranformation :
  
 datetest-as.Date(datetest,%d/%m/%Y)
  
 How do we get this please ?
  
 Thanks a lot for your solution.
 Pierre.
  
  
  
   [[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
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] Possible to get a definition of a function from a package to use without invoking the package?

2006-06-27 Thread Roger D. Peng
You should be able to download the source package from CRAN and copy the code 
for the 'instring()' function into your own source file.

-roger

Waichler, Scott R wrote:
 Hi,
 
 I often use the mod() and instring() functions that are available in the
 clim.pact package.  This package has a lot of dependencies, including
 installation of netCDF, and I haven't yet been able to get
 library(clim.pact) to work on a Mac OS 10.4.6.  A previous request for
 help with the Mac problem yielded no results, so now I wonder if I could
 just extract the definitions for the couple of functions that I need and
 save them in my own file of R functions.  I'm pretty sure that mod() and
 instring() are very basic and don't have any exotic dependencies.  I did
 find an alternative mod() in the new matlab package, and that's fine.
 Now I just need another way to get the instring() functionality.
 
 Thanks,
 Scott Waichler
 Pacific Northwest National Laboratory
 scott.waichler _at_ pnl.gov
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] MLE maximum number of parameters

2006-06-19 Thread Roger D. Peng
It really depends on how well-behaved your objective function is, but I've been 
able to fit a few models with 10--15 parameters.  But I felt like I was 
stretching the limit there.

-roger

Federico Calboli wrote:
 Hi All,
 
 I would like to know, is there a *ballpark* figure for how many  
 parameters the minimisation routines can cope with?
 
 I'm asking because I was asked if I knew.
 
 Cheers,
 
 Federico
 
 --
 Federico C. F. Calboli
 Department of Epidemiology and Public Health
 Imperial College, St. Mary's Campus
 Norfolk Place, London W2 1PG
 
 Tel +44 (0)20 75941602   Fax +44 (0)20 75943193
 
 f.calboli [.a.t] imperial.ac.uk
 f.calboli [.a.t] gmail.com
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] How add degree character in axis?

2006-06-09 Thread Roger D. Peng
Take a look at ?plotmath.

-roger

fernando espindola wrote:
 Hi user R,
 
 I am try to put degree character in axis x, but don't make this.  I have 
 the next code:
 
 plot(mot[,5], 
 time1,xlim=c(-45,-10),type=l,yaxt=n,ylab=,col=1,lwd=2,xlab=,xaxt=n)
 
 The range of value in axis-x  is  -45 to -10, this values represents the 
 longitudes positions in space. I try to put 45°S for real value (-45) in 
 the axis-x, and for all elements . Anybody can give an advance in this 
 problems.
 
 Thank for all
 
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] function environment

2006-06-02 Thread Roger D. Peng
Try

save(A, B, file = myfun.r)
attach(myfun.r)

Your functions will be on the search list.

-roger

Matthias Braeunig wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hi,
 
 how can I automatically access the functions that I loaded into a
 separate environment?
 
 save(A,B,file=myfun.r)
 load(myfun.r,envir=(ENV-new.env()))
 ls(ENV)
 [1] A B
 
 ?[ turned up that I can access the functions via
 
 ENV$A
 function ()
 {
 }
 ENV$A()
 NULL
 
 Now, how can they be included in the search() path??
 attach() as for data.frames does not work...
 
 Furthermore, if I change a functions environment to ENV, why is it not
 listed with ls(ENV)?? Instead it still lives in .GlobalEnv
 
 C-function(){}
 environment(C)-ENV
 ls(ENV)
 [1] A B
 C
 function(){}
 environment: 0x9cbbb58
 ENV
 environment: 0x9cbbb58
 
 Thanks folks!
 I enjoy reading and learning from r-help list!
 
 M
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.2.2 (GNU/Linux)
 
 iD8DBQFEgFw2XjamRUP82DkRAooRAJ9sxwERwfXF3l7pssZ081sMC1+nigCgqAPM
 OkA1tNJg6MN3l0PQFrwBlIE=
 =tGFq
 -END PGP SIGNATURE-
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] speed?

2006-06-02 Thread Roger D. Peng
Running on 64-bit per se does not make things faster.  In fact, from my 
experience it sometimes makes things slower.  The advantage with 64-bit is the 
extra address space for storing things in memory.

Of course, today's 64-bit chips are all faster than recent 32-bit chips, so you 
will get a speed improvement, but only because you're getting a better chip.

-roger

Kerpel, John wrote:
 The benchmark report is good stuff - I've been wondering about these
 speed issues recently myself.
 
 Has anyone tried something similar on 64-bit Linux or other OS?  I'm
 contemplating switching to 64-bit Linux if I'll get some dramatic cycle
 time improvements.  Anyone have any experience with this?
 
 Best,
 
 John
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Liaw, Andy
 Sent: Friday, June 02, 2006 10:01 AM
 To: ivo welch; r-help@stat.math.ethz.ch
 Subject: Re: [R] speed?
 
 You (and your colleague) might want to have a look at
 http://www.sciviews.org/benchmark/.  It's a bit dated,
 but still may be a good starting point.
 
 Some months ago some one asked about working on getting
 R to use the GPU for computation on the R-devel list.
 Don't know if anything came of it.
 
 Cheers,
 Andy 
 
 From: ivo welch
 dear R wizards:

 while extolling the virtues of R, one of my young 
 econometrics colleagues told me that he still wants to run ox 
 because [a] his code is written in it (good reason); [b] 
 because ox seems to be faster than R in most benchmarks (huh?).

 this got me to wonder.  language speed can't matter much, so 
 it must be mostly the underlying matrix algebra by now.  I 
 presume that nowadays most of the plain matrix operation 
 speed depends primarily on which hardware features the 
 library accesses.  (The basic algorithms aren't so different, 
 so even though the algorithm may have mattered a long time 
 ago, they are probably pretty similar nowadays. hmmm...maybe 
 matrix inversion still is different, but multiplication and 
 adding should not be.)

 On x86 architecture, I believe there is a hierarchy in terms 
 of raw processing power:  FPU  SSE*  GPU.

 is it even possible to use the GPU now for math processing 
 (linux or windows), and specifically in R?

 assuming I compile everything with the proper SSE flags and atlas, is
 SSE* fully taken advantage of?

 regards,

 /ivo

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


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

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] timeSeq and TimeDate analog in R ?

2006-05-31 Thread Roger D. Peng
I think the 'fCalendar' package might be of help.

-roger

[EMAIL PROTECTED] wrote:
 Hi All : I am attempting tomove a large amount of code from Splus to R and I 
 was hoping that there was an equivalent in R of the Splus functions timeSeq 
 and timeDate ?
 
 I did an RSiteSearch but nothing came up ? 
 If the equivalent functions are part of some package, that's fine.
 Thanks a lot.
 
Mark
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] iraq statistics - OT

2006-05-19 Thread Roger D. Peng
I guess it all depends on what you include in the category of violent death. 
This study is the only one I'm aware of to attempt to address this:

http://www.thelancet.com/journals/lancet/article/PIIS0140673604174412/fulltext

(there's a registration but I think it's free, can't remember).

-roger

Gabor Grothendieck wrote:
 I came across this one:
 
 http://www.nysun.com/article/32787
 
 which says that the violent death rate in Iraq (which presumably
 includes violent deaths from the war) is lower than the violent
 death rate in major American cities.
 
 Does anyone have any insights from statistics on how to
 interpret this?
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


Re: [R] Large database help

2006-05-16 Thread Roger D. Peng
You can read fixed-width-files with read.fwf().  But my rough calculation says 
that your dataset will require 40GB of RAM.  I don't think you'll be able to 
read the entire thing into R.  Maybe look at a subset?

-roger

Rogerio Porto wrote:
 Hello all.
 
 I have a large .txt file whose variables are fixed-columns, 
 ie, variable V1 goes from columns 1 to 7, V2 from 8 to 23 etc.
 This is a 60GB file with 90 variables and 60 million observations.
 
 I'm working with a Pentium 4, 1GB RAM, Windows XP Pro.
 I tried the following code just to see if I could work with 2 variables
 but it seems not possible: 
 R : Copyright 2005, The R Foundation for Statistical Computing
 Version 2.2.1  (2005-12-20 r36812)
 ISBN 3-900051-07-0
 gc()
  used (Mb) gc trigger (Mb) max used (Mb)
 Ncells 169011  4.6 35  9.4   35  9.4
 Vcells  62418  0.5 786432  6.0   289957  2.3
 memory.limit(size=4090)
 NULL
 memory.limit()
 [1] 4288675840
 system.time(a-matrix(runif(1e6),nrow=1))
 [1] 0.28 0.02 2.42   NA   NA
 gc()
   used (Mb) gc trigger (Mb) max used (Mb)
 Ncells  171344  4.6 35  9.4   35  9.4
 Vcells 1063212  8.23454398 26.4  4063230 31.0
 rm(a)
 ls()
 character(0)
 system.time(a-matrix(runif(60e6),nrow=1))
 Error: not possible to alocate vector of size 468750 Kb
 Timing stopped at: 7.32 1.95 83.55 NA NA 
 memory.limit(size=5000)
 Erro em memory.size(size) : .4GB
 
 So my questions are:
 1) (newbie) how can I read fixed-columns text files like this?
 2) is there a way I can analyze (statistics like correlations, cluster etc)
 such a large database neither increasing RAM nor changing to 64bit
 machine but still using R and not using a sample? How? 
 
 Thanks in advance.
 
 Rogerio.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


Re: [R] kernel smoothing of disease rates at locations

2006-05-10 Thread Roger D. Peng
It is certainly possible to get negative values when smoothing, especially on 
the edges.  But we cannot reproduce your problem because you did not provide 
any 
code.

-roger

Oarabile Molaodi wrote:
 I want to do kernel smoothing on the standardised mortality rates at 
 specified location(x-y coordinates) and be able to produce contour map. 
 I've tried to use the package called fields in R (function smooth.2d) 
 but the problem is I get negative results after smoothing and I do not 
 understand why? Your contributions will be highly appreciated or if 
 there is any package that can do this I will be happy to know about it.  
 Thanks in advance for your comments.
 Oarabile
 
 Below is how my data in R looks like
   XcoordYcoord   smr
 1  383894.70  653202.8 1.5816327
 2  339053.00  631770.9 1.0003473
 3  369164.50  609973.2 1.2943872
 4  313477.70  640382.8 0.9443508
 5  290748.80  695088.8 1.1662125
 6  287547.50  679829.6 0.9433962
 7  259031.90  704478.3 1.0184905
 8  329107.60  585753.3 1.0445860
 9  292170.20  578978.2 1.1287758
 10 268330.90  564281.7 0.9805996
 11 227395.50  561524.6 1.1947431
 12 310130.70  689395.0 1.0991957
 13 325756.00  696565.6 1.1734694
 14 339427.20  713217.2 0.8724100
 15 391752.10  805661.5 1.2483221
 16 385935.90  851044.5 1.0558140
 17 372471.20  826373.7 1.4220183
 18 354901.70  791107.2 0.9175084
 19 324944.10  842040.8 1.0447080
 20 275672.50  802570.4 0.9899329
 21 320750.00  954769.7 1.0866834
 22 243489.20  832748.8 1.0995658
 23 166559.70  786365.3 1.0401267
 24 288160.80  846054.4 1.0299003
 25 220347.00  869181.0 0.9529435
 26 175863.63  822593.9 0.9902252
 27 246114.40  938419.3 0.8909370
 28 359070.60  669738.3 0.9883721
 29 320614.70  670434.2 1.1288534
 30 331414.80  659972.3 0.9070866
 31 299336.90  666122.9 0.7969349
 32 156965.25  708047.7 1.1410460
 33 253867.30  674916.5 0.9256710
 34 249188.40  674272.8 1.0869565
 35 272463.00  679495.3 0.8576698
 36 252643.80  611378.4 0.8615611
 37 212637.35  643725.0 0.8596604
 38 234751.95  691803.4 0.9706546
 39 264856.20  644684.8 0.8468395
 40 253949.30  653042.5 0.8106169
 41 260412.35  663552.2 0.9253686
 42 270807.60  657454.0 0.9002826
 43 228477.30  670443.2 1.0782502
 44 248215.30  641897.3 0.9240407
 45 229797.50  596059.0 1.1579197
 46 291725.00  635771.8 0.8908766
 47 278012.80  667982.0 1.024
 48 279490.80  659761.6 0.9828301
 49 242791.70  662651.8 1.0230584
 50 263217.20  675295.2 0.9759817
 51 341138.80  754471.3 0.9505541
 52 334963.00  735075.4 0.9264498
 53 286139.70  733611.6 0.9052453
 54 354015.60 1025696.8 0.8905506
 55 455775.60 1201636.0 1.0862620
 56  88429.32  854994.4 0.9577015
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


Re: [R] the 'copula' package

2006-04-24 Thread Roger D. Peng
What is the error message that you get?

-roger

Casey Quinn wrote:
 Is anybody using the Copula package in R? The particular problem I'm 
 facing is that R is not acknowledging the fitCopula command/function 
 when I load the package and (try to) run something very simple:
 
 fit1 - fitCopula(x1 = list(u11,u12,u13,u14,u15,u16,u17,u18), tCopula, 
 optim.control = list(NULL), method = BFGS)
 
 Anybody also using it, successfully or unsuccessfully? I'd appreciate a 
 tip or two.
 
 Casey Quinn
 Centre for Health Economics
 University of York
 York YO10 5DD
 England
 
 Phone: +44 01904 32 1411
 Fax:+44 01904 32 1402
 Email:   [EMAIL PROTECTED]
 Web:   http://www.york.ac.uk/inst/che/staff/quinn.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
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] finding method file?

2006-04-03 Thread Roger D. Peng
The `summary' function (i.e. the generic) is defined in the base package, the 
source code of which is in src/library/base/R in the R source tree (try the 
file 
summary.R).  There are also a number of methods defined there.

The source code is not in the R *installation*, since the code for the 
base/recommended packages is loaded via lazy-loaded databases.  When looking 
for 
source code, it's good to check the sources, not the installation.

The latest release source is at 
http://cran.us.r-project.org/src/base/R-2/R-2.2.1.tar.gz

-roger

ivo welch wrote:
 dear R wizards:
 
 I am trying to determine how to determine (no further recursion) where
 a built-in function is defined.  In particular, I have decided I am
 going to add sd() to the existing basic summary function, rather than
 try to rewrite my own summary() function from scratch.
 
 So, I just installed R-2.2.1 (via gentoo; eventually I will figure out
 how to get atlas/sse/sse2 working on amd64, too!  PS: [a] how can I
 determine whether a running S installation uses sse2, sse, and atlas? 
 [b] does atlas use sse2; [c] are there now modern graphics processor
 routines that might speed up R, too?  ok, all of these are irrelevant
 sidequestions).
 
 then, I did a
 
 summary
 [not informative about which file it is defined in]
 
 ok, easy.  Just grep.  back on the unix line,
 
# grep -r '1st Qu' /usr/lib/R
 
 which should look for this fairly unique string.  to my surprise, it
 was only found in R-intro.html.
 
 so, how would I go about looking for where R defines functions?  or
 has this becomes so deeply wired into fortran/C in later versions that
 it can no longer be changed?
 
 help/advice as always appreciated.
 
 sincerely,
 
 /ivo welch
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] boot problem

2005-12-21 Thread Roger D. Peng
Your 'resample' function is not written according to the help page.  Try

resample - function(x, index) { x[index, ] }

-roger

david v wrote:
 Hello,
 This is the code that is giving me problems
 
 
library(boot)
data-read.table(test,header=FALSE,sep=\t,row.names=1)
data
 
   V2 V3 V4
 A  5  8  9
 B 12 54 89
 C   65 89 23
 D   32 69 44
 E   21 84 97
 F   33 59 71
 G   16 45 93
 H2 46 55
 I   22 33 88
 
 
resample - function(x,index) {
 
 sample(data,replace=TRUE)
 }
 dist-boot(data,resample,R=1000)
 Erreur : nombre d'indices incorrect sur la matrice (french)
 Error: number of indices wrong in the matrix (moreless)
 
 Can anybody help???
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] 32 vs 64 bit

2005-12-15 Thread Roger D. Peng
When we first moved to 64 bit I found that certain things were slower.  I 
believe it is because of the increased overhead for memory management.

-roger

Paul Gilbert wrote:
 I ran  R on an AMD Athlon 64 with a 32 bit Linux (by accident, I moved 
 the hard disk from another machine). Now, after install 64 bit Linux and 
 64 bit R, I am finding some of my R tests are quite a bit slower, I 
 think because memory demands cause a lot of swap. Does anyone know if 
 extra memory usage would be mainly because of R itself, or is there a 
 lot of extra memory demand because of the OS, windowing system, and 
 other apps?
 
 Paul Gilbert
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] memory tops out at 1.84gb on OS X 10.4 machine w/ 5GB ram

2005-12-15 Thread Roger D. Peng
I'm not completely sure, but I don't think OS X is at the point yet where it 
can 
access  2GB of memory (like, for example, Linux on Opteron).  More 
specifically, I'm not sure a single process image can access  2GB of memory, 
but I'd welcome any corrections to that statement.  To be sure, this problem is 
not an issue with R because R has regularly been reported to access u 4GB of 
memory when the OS allows it.

-roger

Ken Termiso wrote:
 Hi all,
 
 Sorry if this is a dumb question, but I am on 10.4 with R2.2, and when 
 loading a big text file (~500MB) with scan(file, what=character) I am 
 throwing malloc errors that say I am out of memory...I have 5GB on this 
 machine, and Activity Monitor tells me R is only up to ~1.84GB both times 
 this has happened (running from terminal)...
 
 I am wondering why this is happening when I still have 2GB of free memory 
 waiting to be used...?
 
 Any advice would be much obliged,
 Ken
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] save to ascii

2005-11-16 Thread Roger D. Peng
You could try using functions like 'dput()' or 'dump()'.  These may or may not 
be equivalent to 'save()' depending on how complex the object to be saved is.

-roger

P.S. Asking people to respond to a different email address is not a good way to 
get responses!

Afshartous, David wrote:
 All,
 
 Usually when I save a variable I have ascii = FALSE since I usually
 load the variable via the load(variable) command and do not need to
 view the variable outside of R.
 
 When I set ascii = TRUE and view the variable outside of R in a text editor,
 I notice additional characters (starting w/ RDA2 ...) before the first actual 
 value
 in the vector.
 
 Is there are way to save to ascii such that this does not happen?
 I checked the help under save and didn't see anything.  I apologize
 in advance for this overly simplistic question.
 
 Cheers,
 Dave
 ps - please reply directly to [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
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] how to plot the circles in matrix form

2005-11-09 Thread Roger D. Peng
Would 'symbols()' be of use?

-roger

shanmuha boopathy wrote:
 Could you help me 
 to plot the circles in the form of matrix like
  
 O  O  O  O
 O  O  O  O
 O  O  O  O
 
 thank you..
  
 with regards,
 boopathy.
 
 
 Thirumalai Shanmuha Boopathy, 
 Zimmer no : 07-15,
 Rütscher strasse 165, 
 52072  Aachen . 
 Germany.
  
 Home zone   :  0049 - 241 - 9813409
 Mobile zone :  0049 - 176 - 23567867
 
 
 
 
   
 -
 
   [[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

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] RSQLite problems

2005-10-27 Thread Roger D. Peng
I encountered this too, and my limited investigation (both on the web and in R) 
was unable to find a work around.

-roger

Na Li wrote:
 Hi, I'm experimenting with using (R)SQLite to do data management.  Here are
 two little problems that I've encountered:
 
 1. The presence of ',' in string values causes trouble since ',' is also the
delimiter used in the SQL statement. 
 
 2. A newline '\n' line attached to the last string value of each row. 
 
 Some examples:
 
 
library (RSQLite)
 
 Loading required package: DBI
 
sqlite - dbDriver (SQLite)
db - dbConnect (sqlite, dbname = test.dbms)
data (barley)
dbWriteTable (db, barley, barley, overwrite = TRUE)
 
 [1] TRUE
 
barley[1:3,]
 
  yield   variety yearsite
 1 27.0 Manchuria 1931 University Farm
 2 48.86667 Manchuria 1931  Waseca
 3 27.43334 Manchuria 1931  Morris
 
dbReadTable (db, barley)[1:3,]
 
  yield   variety year__1  site
 1 27.0 Manchuria1931 University Farm\n
 2 48.86667 Manchuria1931  Waseca\n
 3 27.43334 Manchuria1931  Morris\n
 
 
barley$site - as.character (barley$site)
barley$site[1] - University, Farm
dbWriteTable (db, barley, barley, overwrite = TRUE)
 
 Error in sqliteWriteTable(conn, name, value, ...) : 
   RS-DBI driver: (RS_sqlite_import: /tmp/RtmpgSNaLn/rsdbi6a5d128c line 1
 expected 5 columns of data but found 6)
 
 I'm using RSQLite 0.4.0 with R 2.1.1 on Mac OS X.
 
 Cheers,
 
 Michael
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] encrypted RData file?

2005-10-27 Thread Roger D. Peng
I would be interested in that, particularly with certain kinds of confidential 
data.

What was the approach you had in mind (if you in fact had one in mind)?

-roger

Na Li wrote:
 Hi, I wonder if there is interest/intention to allow for encrypted .RData
 files?  One can certainly do that outside R manually but that will leave a
 decrypted RData file somewhere which one has to remember to delete.
 
 Cheers,
 
 Michael
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] Finding code for R functions

2005-10-19 Thread Roger D. Peng
If you're really interested in reading the source for functions and aren't 
interested in tracking down various methods (possibly hidden in namespaces) at 
the R prompt, I think it's much easier to download the R source code from CRAN 
and go through the original source files.

-roger

Wolfrum, Ed wrote:
 Greetings,
 
 I am trying to figure out how to find the source code for R functions. I
 am specifically interested in finding the code for the prcomp
 function. I know that typing the function name without parenthesis will
 lead to the code (or to a .Internal or .FORTRAN or .C  call). However, I
 don't really understand what is going on. For example, typing mean
 gives a UseMethod response, while typing mean.default give the
 actual code:
 
 
mean
 
 function (x, ...) 
 UseMethod(mean)
 environment: namespace:base
 
mean.default
 
 function (x, trim = 0, na.rm = FALSE, ...) 
 ---SNIP---
 }
 environment: namespace:base
 
 Why is this? What does mean.default mean? I tried the same thing with
 prcomp. With the stats package loaded, I cannot get to the source code
 for prcomp.
 
 
require(stats)
 
 [1] TRUE
 
prcomp
 
 function (x, ...) 
 UseMethod(prcomp)
 environment: namespace:stats
 
prcomp.default
 
 Error: object prcomp.default not found
  
 How do I find the prcomp code? Are there general rules for finding the
 source code for functions that I should know?
 
 Thanks in Advance,
 
 Edward J. Wolfrum, Ph.D.
 National Renewable Energy Laboratory
 Golden, Colorado
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] Questions about readBin function (Was: dec2bin?)

2005-10-12 Thread Roger D. Peng
I think you can use 'seek()' here, but it may not be completely reliable on all 
platforms.

-roger

Tuszynski, Jaroslaw W. wrote:
 Hi,
 
 The latest version of R had some changes to functions readbin() and
 writeBin() [which] now support raw vectors as well as filenames and
 connections.. As a result I am working on retiring raw2bin and bin2raw
 functions from caTools package which do exactly the same. Thanks to Prof.
 Ripley for bringing this change to my attention.
 
 Which brings me to my question: how to use readBin function to read the
 whole file or vector con and not just requested number of elements (n)
 from it? In other words what to do if I do not know what to set argument n
 to (The (maximal) number of records to be read), and want to read all
 records?  
 
 So far the simplest solution I found is to measure vector length (or file
 size) of con and set n to length()%/%size. Which gets quite messy if
 size is not provided and have to be deduced from what (see code below).
 Am I missing something? Is there an easier way to read the whole file or
 vector? Shouldn't that be the default?
 
 readBin(con, what, n = 1, size = NA, signed = TRUE, endian =
 .Platform$endian)
 
 bin2raw = function(x, ...) writeBin(x, raw(), ...) # old bin2raw can be
 easily written using curent writeBin
 
 raw2bin = function(r, what, size=NA, ...)
 {
   TypeList = c(logical, integer, double, complex, character,
 raw, 
numeric, int)
   if (!is.character(what) || length(what) != 1 || !(what %in% TypeList)) 
 what - typeof(what)
   if (!is.vector(r) || mode(r) == list) 
 stop(raw2bin: 'r' has to be vector of type 'raw')
   if (what==raw) return(r)
   if (!is.na(size)) nBits=size 
   else nBits = switch(match(typeof(x), TypeList), 4, 4, 8, 16, 2, 1, 8, 4) 
   n = length(r)
   if (n%%nBits) 
 stop(raw2bin: number of elements in 'r' is not multiple of 'size')
   x = readBin(r, what, n = n%/%nBits, size=size, ...)
   return (x)
 }
 
  Jarek 
 \ 
  Jarek Tuszynski, PhD.   o / \ 
  Science Applications International Corporation  \__,|  
  (703) 676-4192 \ 
  [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
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] wildcards and removing variables

2005-10-10 Thread Roger D. Peng
In R 2.2.0, there is the function 'glob2rx()' which can be used for this 
purpose.  As in

rm(list = ls(pattern = glob2rx(results*)))

-roger

Afshartous, David wrote:
   All,
 
   Is there are a wildcard in R for varible names as in unix?  For example,
 
   rm(results*)
 
   to remove all variable or function names that begin w/ results?  
 
   cheers,
   Dave
   ps - please respond directly to [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
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] Dummy quesion about environment

2005-09-27 Thread Roger D. Peng
Try 'get(x, env = environment(h))'

-roger

Ron Ophir wrote:
 Hi,
 I'm trying to understand environment object in R.
 I used the example:
   f - function(x) {
  y - 10
  g - function(x) x + y
  return(g)
  }
  h - f()
  h(3)
 then i saw that f return an environment
 
h
 
 function(x) x + y
 environment: 01B28570
 but I coudn't access to x and y object in that environment:
 I tried 
 get(x,env=h)
 I tried
 h$y
 can I access y and x?
 how can I see an environment tree? oes search does it?
 Thanks,
 Ron
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] warning.expression?

2005-09-22 Thread Roger D. Peng
You might be interested in 'tryCatch' to catch warnings.

-roger

Thomas Friedrichsmeier wrote:
 Hi!
 
 I'm trying to catch all warning-messages for special handling. It seems 
 options (warning.expression=myfunc ()) can be used for that. However, the 
 question is: How can I get at the actual warning in myfunc ()? Apparently in 
 S, you can use .C(get_last_message) for that. Is there a similar mechanism 
 in R?
 
 Thanks for your help!
 Thomas
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] toLatex

2005-09-19 Thread Roger D. Peng
Try 'methods(toLatex)'.

-roger

Simone Vantini wrote:
 hallo!
 does everybody know which kind of objects the function toLatex can manage?
 thanks
 simone vantini
 
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] Packages

2005-08-24 Thread Roger D. Peng
What version of R are you using?  'modreg' no longer exists---its 
functions have been moved to the 'stats' package.

-roger

Amir Safari wrote:
  
 Hi Dear All,
 I want to instal some packages, but I can not find them in both lists of  
 Package Index in internet ( 
 http://www.maths.lth.se/help/R/.R/doc/html/packages.html ) and of Instalation 
 of Packages window in the softwar. For example  modreg. Are they  included 
 in larger packages ?
 Thanks for your help.
 Best Regards,
 Amir Safari
 
 __
 
 
 
   [[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
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] problems when installing R in Fedora core 4

2005-08-18 Thread Roger D. Peng
You are probably missing the 'devel' package for x11 which 
includes header files.

-roger

Peter Yang wrote:
 Hi, I got a problem when installing R in Fedora core 4. When I ran
 .configure, it gave the following error message:
 
 configure: error: --with-x=yes (default) and X11 headers/libs are not 
 available
 
 Could anyone tell me what's wrong? Am I missing some package in Fedora?
 
 Thanks a lot for your help.
 
 Peter
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] Fwd: Documenting data sets with many variables

2005-08-16 Thread Roger D. Peng
Have you tried using 'promptData()' on the data frame and then 
just using the resulting documentation file?

-roger

Arne Henningsen wrote:
 Hi, 
 
 since nobody answered to my first message, I try to explain my problem more 
 clearly and more general this time:
 
 I have a data set in my R package micEcon, which has many variables (82). 
 Therefore, I would like to avoid to describe all variables in the \format 
 section of the documentation (.Rd file). However, doing this lets R CMD 
 check complain about data codoc mismatches (details see below).
 Is there a way to avoid the description of all variables without getting a
 complaint from R CMD check?
 
 Thanks,
 Arne
 
 
 --  Forwarded Message  --
 
 Subject: Documenting data sets with many variables
 Date: Friday 05 August 2005 14:03
 From: Arne Henningsen [EMAIL PROTECTED]
 To: R-help@stat.math.ethz.ch
 
 Hi,
 
 I extended the data set Blanciforti86 that is included in my R package
 micEcon. For instance, I added consumer prices, annual consumption
 expenditures and expenditure shares of eleven aggregate commodity groups.
 The corresponding variables in the data frame are called pAgg1,
 pAgg2, ..., pAgg11, xAgg1, xAgg2, ..., xAgg11, wAgg1,
 wAgg2, ..., wAgg11. To avoid to describe all 33 items in the \format
 section of the documentation (.Rd file) I wrote something like
 
 \format{
This data frame contains the following columns:
\describe{
   [ . . . ]
   \item{xAggX}{Expenditure on the aggregate commodity group X
  (in Millions of US-Dollars).}
   \item{pAggX}{Price index for the aggregate commodity group X
  (1972 = 100).}
   \item{wAggX}{Expenditure share of the aggregate commodity group X.}
   [ . . . ]
}
 }
 
 and explained the 11 aggregate commodity groups only once in a different
 section (1=food, 2=clothing, ... ). However, R CMD check now complains
 about data codoc mismatches, e.g.
   Code: [...] pAgg1pAgg2 pAgg3  [...]
   Docs: [...] pAggX [...]
 
 Is there a way to avoid the description of all 33 items without getting a
 complaint from R CMD check?
 
 Thanks,
 Arne
 
 ---
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] use of NA's

2005-08-05 Thread Roger D. Peng
To test for 'NA' you shouldn't use '=='.  Use 'is.na()' instead.

-roger

tom wright wrote:
 Can someone please explain why this works: 
 
 
d-c(0,2,3,2,0,3,4,0,0,0,0,0)
d.mat-matrix(data=d,nrow=4,ncol=3,byrow=TRUE)
for(i in 1:length(d.mat[1,])){

+ d.mat[,i][d.mat[,i]==0]-mean(d.mat[,i][d.mat[,i]0])
+ }
 
 
 Whereas: 
 
 
d-c(0,2,3,2,0,3,4,0,0,0,0,0)
d.mat-matrix(data=d,nrow=4,ncol=3,byrow=TRUE)
d.mat[d.mat==0]-NA
for(i in 1:length(d.mat[1,])){
 
 + d.mat[,i][d.mat[,i]==NA]-mean(d.mat[,i],na.rm=TRUE)
 + }
 dosnt
 
 Thanks
 Tom
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] Modifying the parameters for a function

2005-08-04 Thread Roger D. Peng
What exactly do you mean by compile?  What compile works fine?

-roger

Philip Bermingham wrote:
 I have modified the parameters for a function (for my own use) in the
 stats package, but I assume I need to update the parameter set in
 another file as I'm getting the following error when I  run R:
 
  
 
 The compile works fine so I assume there is a configuration file in the
 base package of R that needs modification.
 
  
 
 Error in parse(file, n, text, prompt) : syntax error on line 11102
 
 Error: unable to load R code in package 'stats'
 
 During startup - Warning message:
 
 package stats in options(defaultPackages) was not found
 
  
 
 Philip.
 
 
   [[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
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] Help: how to stop the process when there is a mishandling

2005-08-04 Thread Roger D. Peng
On Unix you can send one of the 'USR' signals to 'kill'.  See 
?Signals.

-roger

Shengzhe Wu wrote:
 Hello,
 
 How to stop the process when there is a mishandling making R system
 frozen? If there is a way other than quitting the system when frozen
 occurs?
 
 Thank you,
 Shengzhe
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] hash code for arbitrary object

2005-08-03 Thread Roger D. Peng
You can compute MD5 and SHA1 digests with the 'digest' package.

-roger

Adrian Baddeley wrote:
 Can anyone suggest a simple way to calculate a 'hash code'
 from an arbitrary R object?
 
 hash(x) should return an integer or string 
 with the property that 
  if hash(x) != hash(y) then x and y are not identical
 and the time to compute hash(x) should be quite short.
 
 Any suggestions welcome
 thanks
 Adrian Baddeley
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] Plotting greek symbols in plot titles, labels, etc.

2005-07-14 Thread Roger D. Peng
Take a look at '?plotmath'.

-roger

Roy Werkman wrote:
 Hi,
 
 Can anyone please tell me how to use the escape sequences (e.g. \\*a for
 alfa) for plotting Greek symbols in for example plot titles? I have read
 the reference manual, but can't seem to get it to work.
 
 Thanx!
 
 Roy
 
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] help: how to change the size of a window after it has been created

2005-07-14 Thread Roger D. Peng
Not sure you can do this.  You might have to launch separate 
graphics windows.

-roger

wu sz wrote:
 Hello,
 
 I wish to plot some figures in a window in turn, but the size of these
 figures is different, so how can I change the size of the window by
 resetting the parameters before each plotting?
 
 Thank you,
 Shengzhe
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] tcltk package

2005-07-07 Thread Roger D. Peng
How do you know that it has disappeared?

-roger

Kurt Sys wrote:
 Hi all,
 
 I have a package depending on the tcltk-package. However, I see that 
 this package has been disappeared... Is there a reason why package 
 'tcltk' is not available anymore? Or is it replaced by another one?
 
 thx,
 Kurt.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] Data Parsing

2005-06-20 Thread Roger D. Peng
You can use 'subset()' if you have a data frame.

d - read.table(...)
subset(d, Score %in% c(Passed, Borderline))

-roger

Bernard L. Dillard wrote:
 Hello.  I have looked at R Site Search for this problem, and it didn't
 give me exactly what I needed.
 
 Consider this dataset called results.  It has the following information:
 
 Student  DaySubjectScore
 
 Mary  1  Math  Failed
 David 2  Science   Passed
 Bob   4  Reading   Passed
 Marie 4  Reading   Failed
 Jesse 3  Spelling  Borderline
 Et cetera
 
 
 My goal is to only do analysis of the data having to do those who passed
 or who are borderline.  I want to ignore all of the data having to do with
 those who failed.  I think part of the syntax is something like
 results[-c(Failed)], but I'm not getting anywhere with it.
 
 How do I create a separate data set containing all information on students
 who either passed or were borderline?
 
 Thanks.
 
 Bernard
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] ccf

2005-06-16 Thread Roger D. Peng
You might try passing 'na.contiguous' to the 'na.action' argument.

-roger

Laura De Vendictis wrote:
 Hello group,
 
 For my research I should calculate the cross-correlation  between two 
 time series.
 I don't know if the function ccf can calculate this with series that 
 have NA values.
 e.g. temperature:
 
 15.5
 NA
 12.3
 10.0
 NA
 14.2
 15,3
 
 
 Can you help me?
 Thank you very much!
 
 Laura
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


Re: [R] load ing and saving R objects

2005-06-14 Thread Roger D. Peng
I would suggest saving each object to an individual file with 
some sort of systematic file name.  That way, you can implement a 
  rudimentary key-value database and load only the objects you 
want.  You might be interested in the 'serialize()' and 
'unserialize()' functions for this purpose.

If having ~15000 files is not desirable, then you need a database 
like GDBM.  If you can live with something simpler, you might 
take a look at my 'filehash' package at 
http://sandybox.typepad.com/software/.  It hasn't been tested 
much but it may suit your needs.

-roger

Richard Mott wrote:
 Does anyone know a way to do the following:
 
 Save a large number of R objects to a file (like load() does) but then 
 read back only a small named subset of them . As far as I can see, 
 load() reads back everything.
 
 The context is:
 
 I have an application which will generate a large number of large 
 matrices (approx 15000 matrices each of dimension 2000*30). I can 
 generate these matrices using an R-package I wrote, but it requires a 
 large amouint of memory and is slow so I want to do this only once.  
 However, I then want to do some subsequent processing, comprising a very 
 large number of runs in which small  (~ 10) random selection of matrices 
 from the previously computed set are used for linear modeling.  So I 
 need a way to load back named objects previously saved in a call to 
 save(). I can;t see anyway of doing this. Any ideas?
 
 Thanks
 
 Richard Mott
  
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] ordinary polynomial coefficients from orthogonal polynomials?

2005-06-14 Thread Roger D. Peng
I think this is covered in the FAQ:

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Models

-roger

James Salsman wrote:
 How can ordinary polynomial coefficients be calculated
 from an orthogonal polynomial fit?
 
 I'm trying to do something like find a,b,c,d from
   lm(billions ~ a+b*decade+c*decade^2+d*decade^3)
 but that gives:  Error in eval(expr, envir, enclos) :
 Object a not found
 
   decade - c(1950, 1960, 1970, 1980, 1990)
   billions - c(3.5, 5, 7.5, 13, 40)
   # source: http://www.ipcc.ch/present/graphics/2001syr/large/08.17.jpg
  
   pm - lm(billions ~ poly(decade, 3))
  
   plot(decade, billions, xlim=c(1950,2050), ylim=c(0,1000), 
 main=average yearly inflation-adjusted dollar cost of extreme weather 
 events worldwide)
   curve(predict(pm, data.frame(decade=x)), add=TRUE)
   # output: http://www.bovik.org/storms.gif
  
   summary(pm)
 
 Call:
 lm(formula = billions ~ poly(decade, 3))
 
 Residuals:
1   2   3   4   5
   0.2357 -0.9429  1.4143 -0.9429  0.2357
 
 Coefficients:
   Estimate Std. Error t value Pr(|t|)
 (Intercept)13.800  0.882  15.647   0.0406 *
 poly(decade, 3)1   25.614  1.972  12.988   0.0489 *
 poly(decade, 3)2   14.432  1.972   7.318   0.0865 .
 poly(decade, 3)36.483  1.972   3.287   0.1880
 ---
 Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
 
 Residual standard error: 1.972 on 1 degrees of freedom
 Multiple R-Squared: 0.9957, Adjusted R-squared: 0.9829
 F-statistic: 77.68 on 3 and 1 DF,  p-value: 0.08317
 
   pm
 
 Call:
 lm(formula = billions ~ poly(decade, 3))
 
 Coefficients:
   (Intercept)  poly(decade, 3)1  poly(decade, 3)2  poly(decade, 3)3
13.80025.61414.432 6.483
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] Default Format for Dates?

2005-06-10 Thread Roger D. Peng
Is something like this what you want?

x - as.Date(2003-06-24)
format(x, %B %d %Y)

or perhaps

as.character(x, %B %d %Y)

-roger

[EMAIL PROTECTED] wrote:
 
 
 
 Is there anyway to preset date formats?  I have a date from a cover.dbf
 that is shown as this:
 
cover$FINALREPOR
 
 [1] 2003-06-24
 
 The numeric value in cover$FINALREPOR is 12227.  I'd rather not create
 another vector to hold the properly formatted date.
 
 When I put this in a WordPerfect merge, I want the date to be June 24,
 2003.   I could take care of the problem in a WordPerfect macro but I'd
 rather do it as an R default date format if possible.
 
 I researched some of this in the archives, FAQ's and manuals but didn't
 find anything that met my need.  I would imagine that this type of question
 is probably an FAQ but I didn't find it.
 
 mailto:[EMAIL PROTECTED]
 Kenneth Ray Hobson, P.E.
 Oklahoma DOT - QA  IAS Manager
 200 N.E. 21st Street
 Oklahoma City, OK  73105-3204
 (405) 522-4985, (405) 522-0552 fax
 
 Visit our website at:
 http://www.okladot.state.ok.us/materials/materials.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
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] install package snow

2005-06-08 Thread Roger D. Peng
I think for 'snow' you need to download the source and build it 
yourself.  I assume you are on Windows (you didn't say!).  'snow' 
depends on external programs so it would seem unwise to have a 
binary package on CRAN.


-roger

Steve Adams wrote:

Hi,

I have difficulty in installing package snow from
CRAN. Somehow, this package is not shown up in the
available package list when I tried to use the GUI
interface. So I have to go to CRAN to download the
source file: snow_0.2-1.tar.gz. Then I tried to
install it using the following command:



install.packages(repos=NULL, pkgs='C:\Documents and


Settings\Desktop\snow_0.2-1.tar.gz', type='source',
lib = 'c:/program files/r/rw2010/library/')

Warning message:
installation of package 'C:Documents and
Settingsyzhang24Desktopsnow_0.2-1.tar.gz' had non-zero
exit status in: install.packages(repos = NULL, pkgs =
C:Documents and
Settingsyzhang24Desktopsnow_0.2-1.tar.gz,  


What's the problem here, and how should I handle it?

Thanks

Steve

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



--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] Strange characters in 2.1.0?

2005-06-06 Thread Roger D. Peng

What is your operating system?

-roger

Dan Bolser wrote:
Signif. codes:  0 *** 0.001 ** 0.01 * 0.05 . 0.1   1 


Signif. codes:  0 8098***8099 0.001 8098**8099 0.01
8098*8099 0.05 8098.8099 0.1 8098 8099 1

Signif. codes:  0 *** 0.001 ** 0.01 * 0.05 . 0.1   1 


hmm... they go away when I paste them in...

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



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


Re: [R] Strange characters in 2.1.0?

2005-06-06 Thread Roger D. Peng
It may be a problem with your terminal program.  Which one are 
you using?  Does it work if you try a different terminal program?


-roger

Dan Bolser wrote:

On Mon, 6 Jun 2005, Roger D. Peng wrote:



What is your operating system?



Very sorry for lack of details...

I am RH 9, unix pc i386.





-roger

Dan Bolser wrote:

Signif. codes:  0 *** 0.001 ** 0.01 * 0.05 . 0.1   1 


Signif. codes:  0 8098***8099 0.001 8098**8099 0.01
8098*8099 0.05 8098.8099 0.1 8098 8099 1

Signif. codes:  0 *** 0.001 ** 0.01 * 0.05 . 0.1   1 


hmm... they go away when I paste them in...

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







--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] rbind wastes memory

2005-05-30 Thread Roger D. Peng
Rather than 'rbind' in a loop, try putting your dataframes in a list and 
then doing something like 'do.call(rbind, list.of.data.frames)'.


-roger

[EMAIL PROTECTED] wrote:

Hello everybody,

if I try to (r)bind a number of large dataframes I run out of memory because R
wastes memory and seems to forget to release memory. 

For example I have 10 files. Each file contains a large dataframe ds (3500 cols 
by 800 rows) which needs ~20 MB RAM if it is loaded as the only object.

Now I try to bind all data frames to a large one and need more than 1165MB (!)
RAM (To simplify the R code, I use the same file ten times):

 start example 1 __
load(myFile)
ds.tmp  - ds
for (Cycle in 1:10) {
ds.tmp  - rbind(ds.tmp, ds)
}
 end example 1 __



Stepping into details I found the following (comment shows RAM usage after this line 
was executed):

load(myFile)# 40MB (19MB for R itself)
ds.tmp  - ds# 40MB; = only a pointer seems to be 
copied
x-rbind(ds.tmp, ds) # 198MB
x-rbind(ds.tmp, ds)		# 233MB; the same instruction a second time leads to  
# 35MB more RAM usage - why?



Now I played around, but I couldn't find a solution. For example I bound each dataframe 
step by step and removed the variables and cleared memory, but I still need 1140MB(!) 
RAM:


 start example 2 __
tmpFile- paste(myFile,'.tmp',sep=)
load(myFile)
ds.tmp   - ds
save(ds.tmp, file=tmpFile, compress=T)

for (Cycle in 1:10) {
ds  - NULL
ds.tmp - NULL
rm(ds, ds.tmp)
gc()
load(tmpFile)
load(myFile)
ds.tmp  - rbind(ds.tmp, ds)
save(ds.tmp,file=tmpFile, compress=T)
cat(Cycle,': ',object.size(ds),object.size(ds.tmp),'\n')
}
 end example 1 __


platform i386-pc-solaris2.8
arch i386  
os   solaris2.8
system   i386, solaris2.8  
status 
major1 
minor9.1   
year 2004  
month06
day  21
language R   





How can I avoid to run in that memory problem? Any ideas are very appreciated. 
Thank you in advance  kind regards,




Lutz Thieme
AMD Saxony/ Product Engineering AMD Saxony Limited Liability Company  Co. KG
phone:  + 49-351-277-4269   M/S E22-PE, Wilschdorfer Landstr. 101
fax:+ 49-351-277-9-4269 D-01109 Dresden, Germany

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



--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] .libPaths()

2005-04-26 Thread Roger D. Peng
Did you check to make sure the new path exists?
-roger
Sebastian Leuzinger wrote:
Hello
I use the function .libPaths() 


.libPaths()
[1] /usr/local/lib/R/library
.libPaths(c(/usr/local/lib/myRlib,/usr/local/lib/library))
.libPaths()
[1] /usr/local/lib/R/library
but it simply does not pick up the new path. Can anybody help?
(The problem originates from the inability to install packages 
into /usr/local/lib/R/library, running R under linux suse 9.3)


Sebastian Leuzinger
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] installing R-2.1.0 from source on Fedora Core 3 with tcltk

2005-04-24 Thread Roger D. Peng
I haven't had a problem building R 2.1.0 on FC3 and I've got the 
tcl, tcl-devl, tk, and tk-devel rpms installed (and I don't use 
the --with-tcltk configure switch).  I've never downloaded the 
R_Tcl.zip file.

Does 'configure' find the tcl/tk setup and then it fails to 
compile or does 'configure' just not find tcl/tk to begin with?

Also, is this a 64-bit system?  We've had trouble building R with 
tcl/tk support on some of our 64-bit Red Hat installations.

-roger
Jonathan Baron wrote:
I installed from source on Fedora Core 3 starting with the
command
./configure --prefix=/usr --with-tcltk
(The --with-tcltk may not be necessary, but there seems to be
some correlation between using it and getting it to work.)
It would not compile with tcltk, even though I had both tcl and
tk rpms installed.
Various fooling around let me to get
http://www.murdoch-sutherland.com/Rtools/R_Tcl.zip
(even though it is supposedly for Windows), unzip it in the
R-2.0.0/ directory (where the tar file put itself), and also
install rpms for tcl-devel and tk-devel, which I did not have.
When I did both of these things, it worked.  Either one of them
alone (the ..devel rpms or the R_Tcl.zip) did not suffice.
(However, it isn't clear that a single trial experiment is
sufficient to determine what works.)
My own problem is solved for the moment.  But others may benefit
from this report, and it may be that the installation
documentation needs minor tweaking.  (Or it may be that I did
something else wrong, but right now I doubt that.)
Jon
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Problem with R-2.1.0: install.packages() doesn't work

2005-04-22 Thread Roger D. Peng
What happens if you don't set the 'CRAN' option via 'options()' 
first and just run 'install.packages()'?

-roger
Waichler, Scott R wrote:
I installed R-2.1.0 from source on a Linux box running Red Hat
Enterprise Linux WS release 4 but install.packages() wouldn't work (see
below).  When I install R-2.0.1 from RPM on the same system, everything
is fine.
Version 2.1.0  (2005-04-18), ISBN 3-900051-07-0
. . . 

options(CRAN = http://cran.fhcrc.org/;)
install.packages(rgenoud)
--- Please select a CRAN mirror for use in this session ---
Error in inherits(x, factor) : Object res not found
Scott Waichler
Pacific Northwest National Laboratory
[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
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Suggestion for the posting guide

2005-04-21 Thread Roger D. Peng
You can use 'dput()' or 'dump()' to create a text representation and 
paste that into an email if it's small enough.  Another possiblity, if 
you have access to a webserver, is to save a workspace file via 
'save()' or 'save.image()' and post it on the web.  Given the URL, 
users with Internet access can 'load()' it directly off the web into 
R.  I guess one downside of that method is the example data do not get 
stored in the mailing list archives.

-roger
Bock, Michael wrote:
I was preparing an e-mail for the help list and ran across a quandary.
When asking for help it is useful to include the code/data so others can
run your code and test it. I was running code on a data frame and wanted
to include a small version of the data frame. The data frame was based
on experimental data. What is the best way to do this? I didn't want to
send an attachment so a wrote code to generate the data frame but it was
a bit cumbersome. Everything worked as planned but then I saw my error
and never had to send to e-mail (perhaps there is hope for me yet). Is
there an easier way to export a SMALL data frame so you can recreate it
using the example code that can be placed in the posting guide? Is it
really a good idea to show people how to do this as we run the risk of
someone sending a huge e-mail? Perhaps the manual method is really the
best way to go, submitted for your consideration.
Michael J. Bock, PhD.
ARCADIS
24 Preble St. Suite 100
Portland, ME 04101
207.828.0046
fax 207.828.0062

[[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
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] function corresponding to map of perl

2005-04-15 Thread Roger D. Peng
I think you want 'sapply()'.
-roger
Wolfram Fischer wrote:
Is there a function in R that corresponds to the
function ``map'' of perl?
It could be called like:
vector.a - map( vector.b, FUN, args.for.FUN )
It should execute for each element ele.b of vector.b:
FUN( vector.b, args.for.FUN)
It should return a vector (or data.frame) of the results
of the calls of FUN.
It nearly works using:
 apply( data.frame( vector.b ), 1, FUN, args.for.FUN )
But when FUN is called ele.b from vector.b is no known.
Thanks - Wolfram
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Define local function

2005-04-15 Thread Roger D. Peng
This came up just a few days ago on the mailing list!  Check the 
archives here:

https://stat.ethz.ch/pipermail/r-help/2005-April/067639.html
-roger
Fernando Saldanha wrote:
I discovered a bug in a program I am writing which was due to the
program using a global variable within a function.
For example,
myfunc - function(x) { y}
That is, I made a mistake when defining the function and wrote y
when I should have written x.
However, there was a variable y in the global environment and the
function worked but gave the wrong answer.
I would like to avoid this problem by defining a local function.
That would mean a function that only accepts as variables those that
were defined within its body or were passed as parameters, and would
generate an error when I try to define it if I am using an external
variable. Something like:

myfunc - function(x, type = 'local') { y}
Error: using external variable
 
I read the documentation about environments (I still do not understand
a lot of it, have been working with R for four days now), and searched
the newsgroups, but I could not find the way to do this.

Thanks for any suggestions.
FS
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Is a .R script file name available inside the script?

2005-04-07 Thread Roger D. Peng
I think you might want 'commandArgs()' which gives you the original 
command line call.

-roger
Darren Weber wrote:
Hi,
if we have a file called Rscript.R that contains the following, for example:
x - 1:100
outfile = Rscript.Rout
sink(outfile)
print(x)
and then we run

source(Rscript.R)

we get an output file called Rscript.Rout - great!
Is there an internal variable, something like .Platform, that holds
the script name when it is being executed?  I would like to use that
variable to define the output file name.
Best, Darren
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Introduce a new function in a package?

2005-04-06 Thread Roger D. Peng
I think the usual way is to create an R package for yourself and load 
it when you need it for whatever project.

-roger
Luis Ridao Cruz wrote:
R-help,
Sometimes I define functions I wish to have in any R session.
The obvious thing to do is copy-paste the code 
The thing is that sometimes I don't know where I have the function
code.

My question is if somehow I could define a function and introduce it
(let's say 'base' package ) so that 
could be used anytime I run a different R project.

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


Re: [R] bootstrap vs. resampleing

2005-04-06 Thread Roger D. Peng
What you're describing sounds like subsampling, about which John 
Hartigan has written a few papers.

-roger
array chip wrote:
Hi,
I understand bootstrap can be used to estimate 95%
confidence interval for some statistics, e.g.
variance, median, etc. I have someone suggesting that
by resampling certain proportion of the total samples
(e.g. 80%) without replacement, we can also get the
estimate of confidence intervals. Here we have an
example of 1000 obsevations, we would like to estimate
95% confidence intervals for odds ratio for a
diagnostic test, can I use resampling 80% of the
observations without replacement, instead of
bootstrap, to do this? If not, why is it wrong to do
it this way?
Thanks
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to split a single vector into a multiple-column and multiple-row matrix

2005-03-25 Thread Roger D. Peng
You can use 'matrix()', as in
x - 1:2000
matrix(x, nrow = 200, ncol = 10)
-roger
R_xprt_wannabe wrote:
Dear List,
I have, say, a 2000x1 numeric vector and would like to
split it into, say, a 200x10 matrix.  Any help is
appreciated.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Will R work on this 64 bit machine?...

2005-03-23 Thread Roger D. Peng
I believe R will run out of the box on your setup.  I personally 
haven't tried the RPMs but you can always build R from the sources 
(fairly straightforward on a Linux box).

-roger
dsandif wrote:
Hello,
Will R work on this 64 bit machine?, Here are the specs.
of our linux box:
*Red Hat Enterprise Linux WS (v.3 Standard for AMD64 and Intel EM64T)
*OS: redhat-release
Release: 3WS
CPU Arch: ia32e-redhat-linux

(4) GenuineIntel Intel(R) Xeon(TM) CPU 3.40GHz 3399 MHZ
 Arch:  EM64T   Cache:  1024 KB
 Vendor:GenuineIntelMemory: 2000 MB
 Stepping:  1
 Family:15  Swap:   4000 MB
I see that you have it for Unix machines and that you have it for the 
following linux platforms:

Red Hat i3868/9/Fedora1/Fedora2/Fedora3 Martyn Plummer
x86_64  Fedora1 James Henstridge
x86_64  Fedora3 Brian Ripley
i386Enterprise LinuxMatthew P. Cox
Could I use the Fedore 3 x86_64 version?
Thanks for you attention and help.
D-
[[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
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Maximum amount of memory

2005-03-21 Thread Roger D. Peng
The amount of memory you can access depends on many things, most of 
which are not related to R.  With a 64-bit processor and suitable OS 
we've used R on a machines with 16GB of RAM (and accessed most of it). 
 Of course, the memory does get very expensive after a certain point

-roger
[EMAIL PROTECTED] wrote:
Hi, 
I have a problem:I need to use the maximum amount of memory in order to
perform a very tough analysis. By purchasing the suitable computer, what's
the maximum amount of memory obtainable in R?
Thanks, 

  Marco
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] newbie question about beta distribution

2005-03-19 Thread Roger D. Peng
A probability density must integrate to 1.  The specific values of the density 
can be either more or less than 1.

-roger
[EMAIL PROTECTED] wrote:
hi everyone,
I'm still a newbie in statistics,
I have a question about beta distribution, that is,
On the ref/tutorials I've found on the net, why beta distribution always
have value p(x) more than 1?
As I know, any probability density function always have value not more
than 1?
is there any one who can explain to me, I'm not statistics people, but I
need to code that needing some of this distribution function.
thx before
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] removing message: [Previously saved workspace restored]

2005-03-08 Thread Roger D. Peng
R saves the workspace in a file called '.RData'.  Simply remove this 
file from your working directory.  Or if you startup R and get the 
message, try

unlink(.RData)
-roger
Federico Calboli wrote:
Dear All, 

I saved by mistake the environment I was working in after typing q(),
and now I get the annoying message:
[Previously saved workspace restored]
I have already deleted all the objects in the environment, saving it as
an empty environment, so it's just a matter of nitpicking I suppose. The
message does not appear if I start R from any other place in the
directory tree.
I am reading ?Startup and related docs, but I am utterly failing to
understand how to remove [Previously saved workspace restored] when I
call R from the offending dir...
I am using R on Debian Sarge x86
Cheers,
Federico Calboli
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] orientation of eps files

2005-03-02 Thread Roger D. Peng
This is ghostscript feature, I believe.  See here:
https://www.stat.math.ethz.ch/pipermail/r-devel/2003-October/027759.html
I usually do
setenv GS_OPTIONS -dAutoRotatePages=/None
in tcsh.
-roger
Andrew Collier wrote:
hello,
i have a problem with the orientation of eps files produced with the 
postscript() command. i have generated some eps files with R using:
postscript(file = filename, horizontal = FALSE, paper = special, onefile = F
ALSE, height = height, width = width, pointsize = pointsize)
now, when i include these eps files into a standard paper document (ie. a4 
paper, portrait orientation) everything is fine.
however, i am now wanting to incorporate the same images into a presentation. i 
am making a pdf file, which for presentation purposes is in landscape 
orientation. i am using latex with the prosper package. images are included 
with \includegraphics{} and a pdf file is generated with dvipdf. however, in 
this case, when i include the eps figures the whole page suddenly gets rotated 
around into portrait. eps files from other packages seem to work fine.
there is an example of the problem at ftp://chinstrap.nu.ac.za/orientation.pdf.
if you have any ideas as to what might be causing this problem, i would be 
extremely happy to hear them.
best regards,
andrew.
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] using 'nice' with R

2005-02-22 Thread Roger D. Peng
On a Unix like system you can do `nice +19 R' or perhaps `nice +19 R 
CMD BATCH commands.R'.

-roger
Robert Burrows wrote:
I would like to use the 'nice' command when running CPU-intensive R 
functions on a server. Will starting R with 'nice R' do the trick?

--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Converting a list to a matrix - I still don't think I have it right

2005-02-17 Thread Roger D. Peng
Does
do.call(rbind, l2)
do what you want?
-roger
michael watson (IAH-C) wrote:
Hi
We have touched on this before, but I don't think I quite got it right.
So I have a list, each element of which is a a vector of 2 numbers:

l2
$cat000_a01
[1] 0.3429944 4.5138244
$cat000_a02
[1] 0.1929336 4.3064944
$cat000_a03
[1] -0.2607796  4.1551591
What I actually want to convert this into is a matrix with the names
(cat000_a01 etc) as row names, the first element of each of the vectors
forming the first column of the new matrix, and the second element of
each of the vectors forming the second column:
cat000_a01  0.3429944   4.5138244
cat000_a02  0.1929336   4.3064944
cat000_a03  -0.2607796  4.1551591
What was suggested on the list last time was
matrix(unlist(mylist),nrow=length(mylist)).  But if I do this I get:

matrix(unlist(l2),nrow=length(l2))
  [,1]   [,2]
[1,] 0.3429944  4.3064944
[2,] 4.5138244 -0.2607796
[3,] 0.1929336  4.1551591
Which is not what I want.  Here, the second element of the first vector
in my list has gone into the first column of the new matrix, and that's
not what I want at all.
Any more help would be appreciated.
Thanks
Mick
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] install RMySQL

2005-02-07 Thread Roger D. Peng
R comes with it's own copy of zlib so even if it is compiled into R, 
there isn't necessarily a system-wide installation of the library. 
You may still need to install it.

-roger
Xander Meadow wrote:
Hi,
I've got a Dual G5 running 10.3.7 and I'm trying to install RMySQL. 
I've already got R up and running.  When I try the command


install.packages(RMySQL)

It downloads a few things and then produces the following error:
---
Configuration error:
   Could not locate the library libz required by MySQL.
 
INSTRUCTIONS:
 
   The libz library is required by the MySQL client library
   in order to compress/uncompress connections between clients
   and the MySQL engine.
 
   Make sure you have libz installed properly and/or included
   in your $LD_LIBRARY_PATH.  Perhaps it is not in any of the
   standard directories (e.g., /usr/lib/, /usr/local/lib)?
 
Aborting the installation of RMySQL.
 
ERROR: configuration failed for package 'RMySQL'


However, if I check for libz I get:

capabilities(libz)
libz
TRUE
I'm not sure what the problem is because R is telling me that it doesn't
know where libz is, but then it's also telling me it does know where
libz is.
Has anyone else seen this problem or know how I can get RMySQL installed
on my machine?
Just as an added note I know that install.packages works because

install.packages(DBI)

worked without a problem.
Thanks again.
-Xander
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Handling large data sets via scan()

2005-02-04 Thread Roger D. Peng
I can usually read in large tables by very careful usage of 
read.table() without having to resort to scan().  In particular, using 
the `colClasses', `nrows', and `comment.char' arguments correctly can 
greatly reduce memory usage (and increase speed) when reading in data.

Converting from a list to a data frame likely requires at least two 
copies of the data being stored in memory.  Also, are you using a 
64-bit operating system?

-roger
Nawaaz Ahmed wrote:
I'm trying to read in datasets with roughly 150,000 rows and 600
features. I wrote a function using scan() to read it in (I have a 4GB
linux machine) and it works like a charm.  Unfortunately, converting the
scanned list into a datafame using as.data.frame() causes the memory
usage to explode (it can go from 300MB for the scanned list to 1.4GB for
a data.frame of 3 rows) and it fails claiming it cannot allocate
memory (though it is still not close to the 3GB limit per process on my
linux box - the message is unable to allocate vector of size 522K). 

So I have three questions --
1) Why is it failing even though there seems to be enough memory available?
2) Why is converting it into a data.frame causing the memory usage to
explode? Am I using as.data.frame() wrongly? Should I be using some
other command?
3) All the model fitting packages seem to want to use data.frames as
their input. If I cannot convert my list into a data.frame what can I
do? Is there any way of getting around this?
Much thanks!
Nawaaz
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] how to generate a function from a linear model

2005-02-04 Thread Roger D. Peng
I don't think there's an automatic way to do this but you might try 
something like:

model - lm(sat.d~1+sat.n+I(sat.n^2))
f - function(x) { predict(model, data.frame(sat.n = x)) }
-roger
Tony Han Bao wrote:
Hi All,
I am trying to generate a function from a linear model. I think there 
should be build-in function that perform this action but I've had no 
luck finding it.

For example, I have a model created using lm().
model - lm(sat.d~1+sat.n+I(sat.n^2))
What I would like to have is a function (similar to the one generated by 
splinefun()) so that I can use it on different data-sets.

Thanks in advance for the help.
Tony Han Bao
[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

--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] getting package version inside .First.lib

2005-01-27 Thread Roger D. Peng
This is what I use for all my packages, which I believe handles multiple 
versions of the same package being installed:

.First.lib - function(lib, pkg) {
ver - read.dcf(file.path(lib, pkg, DESCRIPTION), Version)
ver - as.character(ver)
...
}
-roger
Adrian Baddeley wrote:
Greetings - 

Is it possible, inside .First.lib,
to find out the version number of the package that is being loaded?
If only one version of the package has been installed,
we could scan the DESCRIPTION file, something like
.First.lib - function(lib, pkg) {
library.dynam(spatstat, pkg, lib)
dfile - system.file(DESCRIPTION, package=spatstat)
ttt - scan(dfile, what=, sep=^M, quiet=TRUE)[2]
vvv - strsplit(ttt, )[[1]][2]
cat(spatstat version number,vvv,\n)
}
but even this does not seem very safe (it makes assumptions about the
format of the DESCRIPTION file).
Is there a better way?
thanks
Adrian Baddeley
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Hardware Suggestions

2005-01-24 Thread Roger D. Peng
We've been running servers with AMD Opterons (both duals and 4-ways) using SuSE
SLES 8 and Fedora Core 2 and 3 (64 bit).  All work well and R can access up to
~15GB of RAM on our 4-way machine (which has 16GB installed).  One of the Red
Hat Enterprise Linux versions comes with a buggy compiler but I can't remember
which version (there is some discussion on the R-devel mailing list archives).
Watch out for that.  I think using gcc 3.4.x solves that problem.
R pretty much compiles out of the box on AMD Opteron/Fedora Core 3 (64-bit) 
Linux.  We've been very happy with our R experience so far.

-roger
Jon Dressel wrote:
We are currently running R under Windows 2000 on a server box running with 2
1.2 GHZ Intel Pentium III Processors.  We would like to run this on a new
computer running Linux and receive a significant speed increase over our
current implementation.   Could anyone provide some suggestions for a fast 64
BIT Intel based processor computer with a  recommendation  for memory and
speed/type/number of processors.  Also which version of R would install
out-of-the-box easily on this computer and what version of Linux should be
used?  Thanks in advance for any help.
Jon Dressel, MCSE MCSA MCP A+?xml:namespace prefix = o ns =
urn:schemas-microsoft-com:office:office /
Applications Supervisor
SurroMed, Inc.
1430 O'Brien Drive
Menlo Park, CA 94025
Phone: 650.470.2322
Fax: 650.470.2400
email:   [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
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] using eval() with pre-built expression inside function

2005-01-24 Thread Roger D. Peng
If you look at the beginning of lm(), you'll see that match.call() is 
used and name of the function (in this case f1) is replaced with 
model.frame.  Does something like this work?

f1 - function(formula, data) {
mf - match.call(expand.dots = FALSE)
mf[[1]] - as.name(model.frame)
eval(mf, parent.frame())
}
-roger
Heather Turner wrote:
I'm trying to evaluate a pre-built expression using eval(), e.g.
dataset - data.frame(y = runif(30, 50,100), x = gl(5, 6))
# one like this
mf - expression(model.frame(y~x))
eval(mf, dataset, parent.frame())
# rather than this
eval(expression(model.frame(y~x)), dataset, parent.frame())
In the example above there is no problem, the problem comes when I try to do a 
similar thing within a function, e.g.
f1 - function(formula, data) {
mt - terms(formula)
mf - as.expression(as.call(c(as.name(model.frame), formula = mt)))
eval(mf, data, parent.frame())
}

f1(formula = y ~ x, data = dataset)
Error in eval(expr, envir, enclos) : Object y not found
I can get round this by building a call to eval using paste, e.g.
f2 - function(formula, data) {
mt - terms(formula)
mf - as.expression(as.call(c(as.name(model.frame), formula = mt)))
direct - parse(text = paste(eval(expression(, mf,
   ), data, parent.frame(
print(direct)
eval(direct)
}

f2(formula = y ~ x, data = dataset)
expression(eval(expression(model.frame(formula = y ~ x)), data, 
parent.frame()))
  y x
1  92.23087 1
2  63.43658 1
3  55.24448 1
4  72.75650 1
5  67.58781 1
...

but this seems rather convoluted. Can anyone explain why f1 doesn't work (when 
f2 does) and/or suggest a neater way of dealing with this?
Thanks
Heather
Mrs H Turner
Research Assistant
Dept. of Statistics
University of Warwick
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] install.packages() for local source file

2005-01-01 Thread Roger D. Peng
By the way, do you get this error in a recent version of R (say = 1.9.1).  I 
believe install.packages() has changed since 1.9.0.  For example, see the thread 
starting here

https://stat.ethz.ch/pipermail/r-help/2004-July/053001.html
-roger
Paul Roebuck wrote:
Wish to install a local source package on Un*x platform from
within R. Same thing as I can accomplish from cmdline as
$ export R_LIBS=~/R/library
$ cd /path/to/pkg
$ R CMD INSTALL -l $R_LIBS pkgname
So, how do you go about this anyway?
And isn't this a bug in 'install.packages'?
---
$ R
R : Copyright 2004, The R Foundation for Statistical Computing
Version 1.9.0  (2004-04-12), ISBN 3-900051-00-3

file.pkg - mypkg_0.1.tar.gz
path.pkg - file.path(path.expand(~), cvknn, file.pkg)
file.exists(path.pkg)
[1] TRUE
uri.pkg - paste(file://, path.pkg, sep = )
install.packages(contriburl = uri.pkg, lib = Sys.getenv(R_LIBS))
Error in file.info(x) : Object tmpd not found
traceback()
4: file.info(x)
3: dirTest(destdir)
2: download.packages(pkgs, destdir = tmpd, available = available,
   contriburl = contriburl, method = method)
1: install.packages(contriburl = uri.pkg, lib = Sys.getenv(R_LIBS))
version
 _
platform sparc-sun-solaris2.9
arch sparc
os   solaris2.9
system   sparc, solaris2.9
status
major1
minor9.0
year 2004
month04
day  12
language R
--
SIGSIG -- signature too long (core dumped)
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Export the R object

2004-12-31 Thread Roger D. Peng
If you want to export data frame, you can use write.table() to write out a CSV 
(comma separated value) file, which you can then read into Excel.

-roger
Ko,Younhee wrote:
Hi, 

I just have a quick question.
If I got some result as the result of R, how can I export 
the result object?

I mean, if I want to use the result object in Excel or other 
program in order to more specific investigation, how can I 
export it?

If I just list the result and copy, 
The result is like this..

[586] BB170029A10B06 BB170029A20E06
First column, automatically show the number of result and 
other result also include the .

If I want to use this result, I have to manipulate the 
result by myself(I mean e.g remove  and remove [586] like 
this way)?

Or there is any good way to export this result object to 
other program?

Please help me. 

Thanks in advance.

Younhee Ko([EMAIL PROTECTED])
http://comedu.korea.ac.kr/~unygo
contact : 217-417-4868
Graduate Student in Dept. of Computer Science
University of Illinois at Urbana-Champaign
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] outer(-x, x, pmin) cannot allocate

2004-12-22 Thread Roger D. Peng
Actually, I believe it's 8 bytes for double precision.
-roger
Berton Gunter wrote:
David:
In general, this is not a good question to ask, as one needs to go into the
bowels of R to find an answer.
But note that 8000 x 8000 x 4 bytes for double precision  = 256 mb. Now look
at the code of outer(). Two vectors of this size are created = 512mb. Then
copies of these must be created to be passed into pmin, I believe, as R
passes by value. That's 1gb.
My guess is that +, as an internal function, avoids the final doubling.
Corrections/clarifications by knowledgeable R experts cheerfully welcomed.
I'm on thin ice here.
-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
The business of the statistician is to catalyze the scientific learning
process.  - George E. P. Box
 
 


-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Brahm, David
Sent: Wednesday, December 22, 2004 12:11 PM
To: [EMAIL PROTECTED]
Subject: [R] outer(-x, x, pmin) cannot allocate

R x - 0. + 1:8000
R y - outer(-x, x, pmin)
Error: cannot allocate vector of size 100 Kb
Why does R need to allocate a gigabyte to create an 8000 x 
8000 matrix?
It doesn't have any trouble with outer(-x, x, +).  Thanks.

-- David Brahm ([EMAIL PROTECTED])
Version:
platform = i686-pc-linux-gnu
arch = i686
os = linux-gnu
system = i686, linux-gnu
status = 
major = 2
minor = 0.1
year = 2004
month = 11
day = 15
language = R

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


__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] reading svm function in e1071

2004-12-16 Thread Roger D. Peng
The predict method for class `svm' is hidden in a namespace.  Try
getS3method(predict, svm)
-roger
Rajdeep Das wrote:
Hi,
If I try to read the codes of functions in e1071 package, it gives me following 
error message.

library(e1071)

svm
function (x, ...)
UseMethod(svm)
environment: namespace:e1071
predict.svm
Error: Object predict.svm not found
Can someone help me on this how to read the codes of the functions in the 
e1071 package?
Thanks.
Raj
[[alternative HTML version deleted]]
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] make check-all failed on SLES8 for x86_64

2004-12-14 Thread Roger D. Peng
Martin Maechler brought this up a while back (and added the regression 
test).  I believe it was a compiler problem and upgrading to gcc 3.4.1 
fixed it.

See the thread starting here:
https://stat.ethz.ch/pipermail/r-devel/2004-July/030260.html
-roger
Liaw, Andy wrote:
Hi all,
I've only now noticed that on our Opteron boxes running Suse Enterprise
Server 8 that R-2.0.1 did not pass make chek-all.  It bombed in
tests/lapack.R at:

eigenok - function(A, E, Eps = 1000 * .Machine$double.eps) {
V - E$vect
lam - E$values
stopifnot(abs(A %*% V - V %*% diag(lam))  Eps,   [TRUNCATED] 


Ceigenok - function(A, E, Eps = 1000 * .Machine$double.eps) {
V - E$vect
lam - E$values
stopifnot(Mod(A %*% V - V %*% diag(lam))  Eps,  [TRUNCATED] 


sm - cbind(1, 3:1, 1:3)

eigenok(sm, eigen(sm))
Error: abs(A %*% V - V %*% diag(lam))  Eps is not TRUE
This is using:
~/R-2.0.1 gcc -v
Reading specs from /opt/gcc33/lib64/gcc-lib/x86_64-suse-linux/3.3/specs
Configured with: ../configure --enable-threads=posix --prefix=/opt/gcc33
--with-local-prefix=/usr/local --infodir=/opt/gcc33/share/info
--mandir=/opt/gcc33/share/man --libdir=/opt/gcc33/lib64
--enable-languages=c,c++,f77,objc,java,ada --disable-checking
--enable-libgcj --with-gxx-include-dir=/opt/gcc33/include/g++
--with-slibdir=/lib64 --with-system-zlib --enable-shared
--enable-__cxa_atexit x86_64-suse-linux
Thread model: posix
gcc version 3.3 20030312 (prerelease) (SuSE Linux)
compiled with the following setting:
R is now configured for x86_64-unknown-linux-gnu
  Source directory:  .
  Installation directory:/usr/local
  C compiler:gcc  -g -O2
  C++ compiler:  g++  -g -O2
  Fortran compiler:  g77  -g -O2
  Interfaces supported:  X11, tcltk
  External libraries:readline
  Additional capabilities:   PNG, JPEG
  Options enabled:   R profiling
  Recommended packages:  yes
Actually, I've only noticed this when the samething happens on a RH-based
box (same hardware), using:
$ gcc -v
Reading specs from /usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--enable-languages=c,c++,objc,java,f77 --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-24)
I'd very much appreciate any pointers!
Best,
Andy
Andy Liaw, PhD
Biometrics Research  PO Box 2000, RY33-300 
Merck Research Labs   Rahway, NJ 07065
andy_liaw at merck.com  732-594-0820

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] non-visible functions in return to methods()

2004-11-29 Thread Roger D. Peng
non-visible functions are hidden in a namespace.  You can view the 
code by using getS3method().

-roger
steve houghton wrote:
Please point me to the documentation explaining why some of the 
functions returned
by calling methods() are marked as non-visible and whether there is 
indeed no way of
viewing the R code of such functions

thanks
Steve
_
Stay in touch with absent friends - get MSN Messenger 
http://www.msn.co.uk/messenger

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

--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to insert one element into a vector?

2004-11-22 Thread Roger D. Peng
?append --- look at the `after' argument.
-roger
jing tang wrote:
suppose I want to insert 5 into the vector (1,2,3,4,6) between 4 and 6.
thx!
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] glm with Newton Raphson

2004-11-19 Thread Roger D. Peng
There are some examples of how to approach this in Modern Applied 
Statistics with S, 4th ed. (chap. 16) by Venebles  Ripley.  It's not 
Newton-Raphson but I think the code can be adapted.

-roger
Valeska Andreozzi wrote:
Hi,
Does anyone know if there is a function to find the maximum likelihood 
estimates of glm using Newton Raphson metodology instead of using IWLS.

Thanks
Valeska Andreozzi

Department of Epidemiology and Quantitative Methods
FIOCRUZ - National School of Public Health
Tel: (55) 21 2598 2872
Rio de Janeiro - Brazil
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Running sum

2004-11-19 Thread Roger D. Peng
You could try using embed(), but I doubt it's faster.
-roger
Sean Davis wrote:
I have vector X of length N that I want to have a running sum for 
(called Y).  I just need max(Y).  I do this with a for loop like so:

Y - vector(length=N)
Y[1] - X[1]
for (i in 2:N) {
  Y[i] - Y[i-1]+X[i]
}
return(max(Y))
Is there a faster way to do this?
Thanks,
Sean
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] hashing using named lists

2004-11-18 Thread Roger D. Peng
You could try using environments:
 e - new.env(hash = TRUE)
 e$new - 1:4
 ls(e)
[1] new
 e$new
[1] 1 2 3 4
 e$ne
NULL
-roger
ulas karaoz wrote:
hi all,
I am trying to use named list to hash a bunch of vector by name, for 
instance:
test = list()
test$name = c(1,2,3)

the problem is that when i try to get the values back by using the name, 
the matching isn't done in an exact way, so
test$na is not NULL.

is there a way around this?
Why by default all.equal.list doesnt require an exact match?
How can I do hashing in R?
thanks.
ulas.
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] deleting a file

2004-11-16 Thread Roger D. Peng
You may be interested in one of dir.create(), file.exists(), or unlink().
-roger
Roger Gill wrote:
Dear all,
I have a very simple question.  Simple, that is, if you know the answer.
I wish to delete a file in a given directory after having first checked its
existence.  I issue the following commands
path-'c:example/R/'
Thus creating the directory.
indicator-length(grep(filename,path))
If indicator is greater than zero then the file exists.  Now I wish to
remove this file.  However, I would like to make the code compatible for
Linux/Windows and Macs.
In Linux I would issue the command
system('rm paste(path,'filename',sep='')')
and this works just fine.  It does not however work for windows, and I have
no idea whether it would work on a mac.
Is there a single command thay escapes me?
Best Wishes
Roger Gill
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Problems installing ncdf package into R

2004-11-12 Thread Roger D. Peng
Did you look at
http://cran.us.r-project.org/bin/windows/contrib/2.0/ReadMe
?
-roger
[EMAIL PROTECTED] wrote:
Hello
Can someone please look into the problem with installing ncdf package into R. 
I get this message when I try install it:


install.packages(ncdf)
trying URL `http://cran.r-project.org/bin/windows/contrib/2.0/PACKAGES'
Content type `text/plain; charset=iso-8859-1' length 22827 bytes
opened URL
downloaded 22Kb
Warning message: 
No package ncdf on CRAN. in: download.packages(pkgs, destdir = tmpd, 
available = available,  

I checked with the homepage cran.r-project.org, and the package is there. I 
have installed packages earlier into R with no problems. 

In advance, thanks for all help!
Best Wishes
Dag Johan Steinskog
Bjerknes Center of Climate Research - University of Bergen, Norway
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R on 64-bit Linux machine

2004-11-12 Thread Roger D. Peng
I've built (and routinely use) 64 bit R on the following platforms:
Red Hat Enterprise Linux AS release 3 (AMD Opteron 848)
Fedora Core 2 x86_64 (AMD Athlon 64 3800+)
SuSE SLES 8 (AMD Opteron 248)
One problem that has come up is that if you want to link R with ATLAS, 
you need to build shared ATLAS libraries (rather than static).  This 
requires some modifications to the configuation files for ATLAS.  But 
my experience shows that R itself builds out of the box on these systems.

-roger
Vadim Ogranovich wrote:
Hi,
 
We are planning to buy a 64-bit Linux machine which will mainly run R.
There was an interesting thread on 64-bits on r-help back in April that
basically confirmed that the 64-bit R is fine as long as the length of
an atomic object is less than 2^31 - 1.
 
My specific question is on which 64-bit Linux distros (SUSE or RedHat)
and processors R is *known* to build out-of-box and run well. Ease of
maintenance is essential here. We have RedHat 7.3 on other (32-bit)
machines and would try not to proliferate the OS-s.
 
 
Your information will be highly appreciated,
 
Thanks,
Vadim

[[alternative HTML version deleted]]
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R works on Fedora Core 3

2004-11-11 Thread Roger D. Peng
I've run into this title bar problem on FC1 and FC2 (not tried FC3 
yet) when I compile from sources.  I figured it was just a weird 
window manager bug.  I find that if I maximize the window (Alt-F10, on 
my system) and then restore the window to its original size (Alt-F5), 
I get the title bar back.

-roger
Gavin Simpson wrote:
Martyn Plummer wrote:
On Wed, 2004-11-10 at 09:19 +0100, Martyn Plummer wrote:
snip
An RPM for Fedora Core 3 should be on a CRAN mirror near you by the
weekend. This fixes the printcmd bug.
The X11() window is the right size for me, but it doesn't have a title
bar, which is a nuisance.
Martyn
I have this problem with both your rpm on FC2 and when compiled from 
sources (1.9.1-patched 2.0.0-patched [now 2.0.1 beta]). The title bar 
comes and goes, seemingly at random (I've not systematically test this 
so I haven't found an underlying cause) when a new X11() device is 
started. Mainly a more complex plot (over several lines and commands) 
will fail to produce the title bar, if I then close that device and open 
another using something simple, say plot(1:10) then I more often than 
not get the title bar. I say more often than not, because sometimes I 
have to run that command a few times, closing the opened faulty device 
window in between to get the title bar to appear. Same result running R 
from within xemacs/ess.

Gav
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Logical and

2004-11-11 Thread Roger D. Peng
Try
setdiff(a, b)
-roger
Alexander Sokol wrote:
Hello,
I have the following very simple problem:
Say I have two vectors,
a-c(1,7,4,5,9,11)
b-c(7,4,9)
I would like to create a vector containing the elements in a which are not in 
b.

Obviously, this is possible by writing
a[a!=b[1]  a!=b[2]  a!=b[3]]
But I would like a solution which is applicable to the situation where the 
number of elements in b is unknown.

I have looked in the R manuals, the FAQ and the mailing lists, but have been 
unable to find a solution.

Thank you for your replies,
 Alexander
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] expressions and paste

2004-11-11 Thread Roger D. Peng
Can you be a bit more specific?  Exactly what kind of symbol are you 
trying to put in the title?

-roger
Emily Baldock wrote:
I have written a function to plot data which will be used for various different chemistries.
A simplified version is:
plot_data - function(risk,levels,chem,sd2,measure){
  plot(risk, levels,main=paste (per, sd2, measure, \n in usual, chem))
}
The problem is with the title.
This works fine if the variable chem is just text, but if it is an expression then obviously it won't work.
I have experimented with various things and I am at a complete loss for how to insert an expression into the middle of 
a title.
If the expression was going in directly I would use main=expression(paste(text , expression,  text)) but again this 
doesn't work.
Can anyone help?
thanks
Emily.

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Basic Q on coercing factors in data frames to numeric

2004-11-10 Thread Roger D. Peng
I believe this is a FAQ.  See 
http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-do-I-convert-factors-to-numeric_003f

-roger
Robert Brown FM CEFAS wrote:
Hi there,
I'm running R 2.0.0 on Windows 95.  I'm trying to coerce a column of factors 
within a data frame to numeric.  This is not a problem with a vector, but I 
can't find a way to index a column within a data frame to achieve this. All the 
examples from 'An introduction to R', 'S-plus 6 programmers guide', etc, use 
simple vectors.  I'm sure I'm missing something obvious but I can't find a way 
to change a single column in data frame. Ive tried several approaches: here is 
one

summary(test)
  ageyrclass   weight  year 
 1  :10   1992   :10   Min.   :0.005333   Min.   :1993  
 2  :10   1989   : 9   1st Qu.:0.221790   1st Qu.:1995  
 3  :10   1990   : 9   Median :0.413411   Median :1997  
 4  :10   1991   : 9   Mean   :0.420119   Mean   :1997  
 5  :10   1988   : 8   3rd Qu.:0.559819   3rd Qu.:2000  
 6  :10   1993   : 8   Max.   :1.189000   Max.   :2002  
 (Other):82   (Other):89

contents(test)

Data frame:test 142 observations and 4 variablesMaximum # NAs:0
Levels Storage
age 23 integer
yrclass 28 integer
weight  double
yeardouble
++-+
|Variable|Levels   |
++-+
| age|0,1,10,11,12,13,14,15,16,18,19,2,20,21,24,25,3,4,5,6,7,8,9   |
++-+
| yrclass|1969,1974,1975,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988|
||1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002|
++-+
is(test$yrclass,factor)
[1] TRUE
is(test$yrclass,numeric)
[1] FALSE
as(test[,2],numeric)
  [1]  1  1  2  3  3  4  5  6  6  6  7  7  8  8  8  8  9  9  9  9 10 10 10 
10 10
 [26] 10 10 11 11 11 11 11 12 12 12 12 12 12 12 13 13 13 13 13 13 13 14 14 14 14
 [51] 14 14 14 14 15 15 15 15 15 15 15 15 15 16 16 16 16 16 16 16 16 16 17 17 17
 [76] 17 17 17 17 17 17 18 18 18 18 18 18 18 18 18 18 19 19 19 19 19 19 19 19 20
[101] 20 20 20 20 20 20 20 21 21 21 21 21 21 21 21 22 22 22 22 22 22 22 23 23 23
[126] 23 23 23 24 24 24 24 24 25 25 25 25 26 26 27 27 28
is(test$yrclass,numeric)
[1] FALSE
Regards,
Robert Brown
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] substitute/paste question for using Greek in plot titles

2004-11-10 Thread Roger D. Peng
This is not a bug.  The object passed to `main' should be either character or an 
expression (documented in ?title).  substitute() returns neither a character 
object nor an expression -- it return a call object.  This is documented in 
?substitute:

 Substituting and quoting often causes confusion when the argument
 is 'expression(...)'. The result is a call to the 'expression'
 constructor function and needs to be evaluated with 'eval' to give
 the actual expression object.
What you want, I think, is
label - substitute(expression(paste(A vaue for ,phi, = ,phival)), 
list(phival=phi.1))
plot(0 ~ 0, main = eval(label))

-roger
Sundar Dorai-Raj wrote:

Peter Dunn wrote:
Hi all
I am having troubles making sense of why code (1)
below fails but code (2) below works.
Code (1):
  phi.1 - 1
  plot(0 ~ 0,
+ main=substitute(paste(A vaue for ,phi, = ,phival), 
list(phival=phi.1)) )

Error in paste(The two deviances for , phi,  = , 2) :
Object phi not found
But this works:
Code (2):
  plot(0,0,
+ main=substitute(paste(A value for ,phi, = ,phival), 
list(phival=phi.1)) )
 

It appears that if the plot command takes the formula style entry,
the substitue/paste fails.
Is this documented as a feature (I couldn't find it if that is the
case), or is it a bug?  If it is a feature, it is a subtle difference
between (1) and (2) that has potential to be quite frustrating!
Perhaps I should just upgrade to version 2.0.0, though I can't see
anything in the Release Notes that might cause this.
Thanks.
P.
  version
 _
platform i686-pc-linux-gnu
arch i686
os   linux-gnu
system   i686, linux-gnu
status
major1
minor9.1
year 2004
month06
day  21
language R

Peter,
Because in the first couple of lines of plot.formula we see this:
dots - m$...
dots - lapply(dots, eval, data, parent.frame())
which for your case is equivalent to:
expr - substitute(paste(A vaue for ,phi, = ,phival), 
list(phival=phi.1))
eval(expr)

which returns an error saying phi cannot be found which is the correct 
behaviour of eval. I'll let others comment on whether or not this is a 
bug in plot.formula but you can always get around it by calling title:

plot(0 ~ 0)
title(main = expr)
which is exactly what your second example is doing in plot.default.
HTH,
--sundar
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Converting strings to date

2004-11-09 Thread Roger D. Peng
You need to be more specific when you say it works =)  strptime() 
returns a POSIXlt object whose printed representation appears to be a 
string (but it is a list).  What you want, I think, is either 
as.POSIXct() or as.Date().  See ?DateTimeClasses.

-roger
João Mendes Moreira wrote:
Hello,
I have the following problem:
test is a data frame with 9 fields. The field test$Date is factorized with 
dates. The format is dd-mm- (using Oracle notation). I want to convert this 
to Date in '%Y-%m-%d format.
What I am doing is:
for (i in 1:nrow(test))
  {
   test[i,]$Data-strptime(substring(test[i,]$Data,1,10),%d-%m-%Y)
  }
test is a data frame. 

The error is:
Error in $-.data.frame(`*tmp*`, Data, value = list(sec = 0, min = 0,  : 
replacement has 9 rows, data has 1

But if I do:
strptime(substring(test[1:nrow(teste),]$Data,1,10),%d-%m-%Y)
it works! Why the assignement does not work?
Thanks
Joao Moreira
[[alternative HTML version deleted]]
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] remove missing values from matrix or data frame

2004-11-09 Thread Roger D. Peng
You might be interested in complete.cases(), as in:
use - complete.cases(a)
a[use, ]
-roger
William Briggs wrote:
Is there any way besides looping to remove complete rows from a matrix 
or data frame where there is at least one NA in any of the columns?

For example
  a
   [,1] [,2]
  [1,] 02.6875
  [2,] 8.37 6.625
  [3,] 15.6 4.375
  [4,] 23.4 6.25
  [5,] 29   5.09375
  [6,] 18   NA
  [7,] 04.15625
  [8,] 9.37 6.25
  [9,] 14.7 5.875
 [10,] 31.26667 6.15625
 [11,] NA   2.357
 [12,] NA   5.4234
 [13,] 03.34375
 [14,] 7.67 2.78125
 [15,] NA   NA
In a, rows 6, 11, 12, and 15 should be removed.
na.omit(a) does nothing, nor does na.omit(as.data.frame(a)).  I can get 
a matrix of which are NA and not by i-!is.na(a), but this doesn't 
seem to help (a[i] isn't the thing I'm after).

I know I am missing something simple and standard, but I haven't been 
able to see it yet (nor on Google).

Thanks.
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] question about R on Linux Cluster

2004-10-29 Thread Roger D. Peng
As far as I know, there are R interfaces to MPI and PVM.  There are 
also the `snow' and `snowFT' packages on CRAN.

-roger
apollo wong wrote:
Hi, I am in trying to get a new Linux Cluster. I am
thinking about putting R on it. Does anyone have any
experience with running R on a distributed Linux
Cluster? Or does R support a cluster environment at
all. Any pitfall I should really watch out for?
Thanks in advance
Apollo
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


  1   2   3   4   >