Re: [R] Opening SAS file using read.sas7bdat() function in sas7bdat library.

2012-10-30 Thread Matt Shotwell
Thanks for the helpful comments from others. The KNOWNHOST variable lists the types of file that are known to work with the read.sas7bdat function. It's likely that most files written on Windows platforms will work, even if not listed in KNOWNHOST. If you're feeling experimental, you might just

Re: [R] Any good R server-with connection examples

2012-10-23 Thread Matt Shotwell
I want to connect R with HTML/PHP pages to take input from user,do some statistical processing on it show results to HTML page again. I search on net,i got Rserve package,but examples are mainly for java langaure not for PHP i am wondering how to connect it to PHP-Apache-MySQL Is there

Re: [R] Nested brew call yields Error in .brew.cat(26, 28) : unused argument(s) (26, 28)

2012-03-29 Thread Matt Shotwell
On Wed, 2012-03-28 at 11:40 +0100, Chris Beeley wrote: I am writing several webpages using the brew package and R2HTML. I would like to work off one script so I am using nested brew calls. The documentation for brew states that: NOTE: brew calls can be nested and rely on placing a function

[R] Help with Matrix code optimization

2012-02-23 Thread Matt Shotwell
The chol and solve methods for dpoMatrix (Matrix package) are much faster than the default methods. But, the time required to coerce a regular matrix to dpoMatrix swamps the advantage. Hence, I have the following problem, where use of dpoMatrix is worse than a regular matrix. library(Matrix) x

Re: [R] function restrictedparts

2012-01-25 Thread Matt Shotwell
That's because the number of partitions of 281 items of order 10 is quite large: R library('partitions') R R(10,281) [1] 1218681472 Without thinking about this too hard, the result of restrictedparts(281,10) should require around R 1218681472 * 10 * 4 / 10^9 [1] 48.74726 gigabytes of storage

Re: [R] Bayesian data analysis recommendations

2012-01-20 Thread Matt Shotwell
On Thu, 2012-01-19 at 19:23 -0500, C W wrote: Thanks, Rich, I will look at the book. I agree, there are many nice packages, but what if the package changes in a few years? I would have no idea what is going on! I've heard from predecessor in the industry who emphasize the learning, not

Re: [R] R logo in eps formt

2011-12-01 Thread Matt Shotwell
See this earlier post for SVG logos: http://tolstoy.newcastle.edu.au/R/e12/devel/10/10/0112.html Using Image Magick, do something like convert logo.svg logo.eps On Thu, 2011-12-01 at 10:56 +0700, Ben Madin wrote: G'day all, Sorry if this message has been posted before, but searching for

Re: [R] contact person for UseR 2012, please?

2011-10-18 Thread Matt Shotwell
The contact person is: Stephania McNeal-Goddard email: stephania.mcneal-godd...@vanderbilt.edu phone: (615)322-2768 Vanderbilt University School of Medicine Department of Biostatistics S-2323 Medical Center North Nashville, TN 37232-2158 On Tue, 2011-10-18 at 12:41 -0400, David Winsemius wrote:

Re: [R] [Related Topic] need help on read.spss

2011-10-13 Thread Matt Shotwell
Would it be worthwhile to update the read.spss implementation using the more recent discoveries from the PSPP group? I don't mean to copy their code; but to use the ideas in their code. Is anyone working on this? I wouldn't want the effort to be duplicated. On Thu, 2011-10-13 at 16:22 +0200, Uwe

Re: [R] Rweb and setting up R on a server

2011-09-08 Thread Matt Shotwell
Erin, I haven't used Rweb recently. The URL is http://www.math.montana.edu/Rweb/ . If you have a server, you could set up the server version of RStudio: http://rstudio.org/download/server . It worked well when I tried it. Best, Matt On Tue, 2011-09-06 at 17:07 -0500, Erin Hodgess wrote:

Re: [R] readBin fails to read large files

2011-09-01 Thread Matt Shotwell
On Thu, 2011-09-01 at 17:36 +0100, Prof Brian Ripley wrote: readBin is intended to read a few items at a time, not 10^9. You are probably getting 32-bit integer overflow inside your OS, since the number of bytes you are trying to read in one go exceeds 2GB. Don't do that: read say a

Re: [R] Bootstrap

2011-07-21 Thread Matt Shotwell
In order to apply the bootstrap, you must resample, uniformly at random from the independent units of measurement in your data. Assuming that these represent the rows of 'data', consider the following: est - function(y, x, obeta = c(1,1), verbose=FALSE) { n - length(x) X - cbind(rep(1,

Re: [R] How to capture console output in a numeric format

2011-06-24 Thread Matt Shotwell
Ravi, Consider using an environment (i.e. a 'reference' object) to store the results, avoiding string manipulation, and the potential for loss of precision: fr - function(x, env) { ## Rosenbrock Banana function x1 - x[1] x2 - x[2] f - 100 * (x2 - x1 * x1)^2 + (1 - x1)^2

Re: [R] How to capture console output in a numeric format

2011-06-24 Thread Matt Shotwell
On Fri, 2011-06-24 at 12:09 -0400, David Winsemius wrote: On Jun 24, 2011, at 11:27 AM, Matt Shotwell wrote: Ravi, Consider using an environment (i.e. a 'reference' object) to store the results, avoiding string manipulation, and the potential for loss of precision: fr - function(x

Re: [R] Elbow criterion

2011-06-20 Thread Matt Shotwell
On Mon, 2011-06-20 at 13:38 +0200, Dominik P.H. Kalisch wrote: Hi, I would like to cluster a dataset with the ward algorithm. I'm assuming that this refers to the agglomerative partitioning method [1]. That is, the number of clusters is selected according to the data partition that is

Re: [R] Can we prepare a questionaire in R

2011-06-08 Thread Matt Shotwell
As Mike had written, there are frameworks for web-development with R. RApache http://www.rapache.net is one. Also, see the R package Rook: http://cran.r-project.org/web/packages/Rook/index.html . On Wed, 2011-06-08 at 17:26 +0530, amrita gs wrote: How can we create HTML forms in R Wouldn't

Re: [R] Question about curve function

2011-06-07 Thread Matt Shotwell
On Tue, 2011-06-07 at 16:17 +0200, Uwe Ligges wrote: On 07.06.2011 11:57, peter dalgaard wrote: On Jun 6, 2011, at 11:22 , Prof Brian Ripley wrote: As a further example of the trickiness, the function method of plot() relies on curve(x, ...) being a request to plot the function x(x)

Re: [R] Question about curve function

2011-06-05 Thread Matt Shotwell
I think there is trouble because expr in curve(expr) may be the name of a function, and it's ambiguous whether 'x' should be interpreted as a mathematical expression involving x, or the name of a function. Here are some examples that work: curve(I(x)) curve(1*x) On Sun, 2011-06-05 at 12:07

Re: [R] creating a vector from a file

2011-05-31 Thread Matt Shotwell
On Tue, 2011-05-31 at 15:36 +0200, heimat los wrote: Hello all, I am new to R and my question should be trivial. I need to create a word cloud from a txt file containing the words and their occurrence number. For that purposes I am using the snippets package [1]. As it can be seen at the

Re: [R] creating a vector from a file

2011-05-31 Thread Matt Shotwell
On Tue, 2011-05-31 at 16:19 +0200, heimat los wrote: On Tue, May 31, 2011 at 4:12 PM, Matt Shotwell m...@biostatmatt.com wrote: On Tue, 2011-05-31 at 15:36 +0200, heimat los wrote: Hello all, I am new to R and my question should be trivial. I need to create

Re: [R] blank space escape sequence in R?

2011-04-25 Thread Matt Shotwell
You can embed hex escapes in strings (except \x00). The value(s) that you embed will depend on the character encoding used on you platform. If this is UTF-8, or some other ASCII compatible encoding, \x20 will work: foo\x20bar [1] foo bar For other locales, you might try charToRaw( ) to see the

Re: [R] blank space escape sequence in R?

2011-04-25 Thread Matt Shotwell
be read into memory, and printed like this: a\\x20b That is, not with a space character substituted for \x20. So, now I'm not sure this is a solution. On Mon, 2011-04-25 at 12:24 -0500, Matt Shotwell wrote: You can embed hex escapes in strings (except \x00). The value(s) that you embed will depend

Re: [R] Converting 16-bit to 8-bit encoding?

2011-04-21 Thread Matt Shotwell
On 04/21/2011 10:36 AM, Brian Buma wrote: Hello all- I have a question related to encoding. I'm using a seperate program which takes either 16 bit or 8 bit (flat binary files) as inputs (they are raster satellite imagery and the associated quality files), but can't handle both at the same

Re: [R] Converting 16-bit to 8-bit encoding?

2011-04-21 Thread Matt Shotwell
21, 2011 at 9:50 AM, Matt Shotwell matt.shotw...@vanderbilt.edu mailto:matt.shotw...@vanderbilt.edu wrote: On 04/21/2011 10:36 AM, Brian Buma wrote: Hello all- I have a question related to encoding. I'm using a seperate program which takes either 16 bit or 8

Re: [R] print.raw - but convert ASCII?

2011-04-19 Thread Matt Shotwell
On Tue, 2011-04-19 at 03:14 -0400, Duncan Murdoch wrote: On 11-04-18 9:51 PM, Matt Shotwell wrote: Does anyone know if there is a simple way to print raw vectors, such that ASCII characters are printed for bytes in the ASCII range, and their hex representation otherwise? rawToChar doesn't

[R] print.raw - but convert ASCII?

2011-04-18 Thread Matt Shotwell
Does anyone know if there is a simple way to print raw vectors, such that ASCII characters are printed for bytes in the ASCII range, and their hex representation otherwise? rawToChar doesn't work when we have something like c(0x00, 0x00, 0x44, 0x00). -Matt

Re: [R] integer and floating-point storage

2011-04-14 Thread Matt Shotwell
Hi Mike, There are some facilities for storing and manipulating small (2 bit) integers. See here: http://cran.r-project.org/web/packages/ff/index.html -Matt On 04/14/2011 01:20 PM, Mike Miller wrote: I note that current implementations of R use 32-bit integers for integer vectors, but I am

[R] understanding dump.frames; typo;

2011-04-12 Thread Matt Shotwell
When a function I have stop()s, I'd like it to return its evaluation frame, but not halt execution of the script. In experimenting with this, I became confused with dump.frames. From ?dump.frames: If ‘dump.frames’ is installed as the error handler, execution will continue even in

Re: [R] Examples of web-based Sweave use?

2011-04-06 Thread Matt Shotwell
That's an interesting idea. I had written a long email describing a proof-of-concept, but decided to post is to the website below instead. http://biostatmatt.com/archives/1184 Matt On 04/04/2011 07:31 AM, carslaw wrote: I appreciate that this is OT, but I'd be grateful for pointers to

Re: [R] library(foreign) read.spss warning

2011-03-26 Thread Matt Shotwell
There is some information about this subtype in the PSPP source code, and for other subtypes not yet implemented by read.spss. The PSPP source code indicates that this subtype consists of Value labels for long strings, which isn't very illuminating to me (probably because I don't use PSPP, or

Re: [R] Venn Diagram corresponding to size in R

2011-03-09 Thread Matt Shotwell
Try here: https://stat.ethz.ch/pipermail/r-help/2003-February/029393.html On Tue, 2011-03-08 at 20:25 -0500, Shira Rockowitz wrote: I was wondering if anyone could help me figure out how to make a Venn diagram in R where the circles are scaled to the size of each dataset. I have looked at

Re: [R] assignment by value or reference

2011-03-08 Thread Matt Shotwell
On 03/08/2011 07:20 AM, Xiaobo Gu wrote: On Wed, Sep 15, 2010 at 5:05 PM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: See the R Language Definition manual. Since R knows about lazy evaluation, it is sometimes neither by reference nor by value. If you want to think binary, then by value

Re: [R] Rapache ( was Developing a web crawler )

2011-03-06 Thread Matt Shotwell
On Sun, 2011-03-06 at 08:06 -0500, Mike Marchywka wrote: Date: Thu, 3 Mar 2011 13:04:11 -0600 From: matt.shotw...@vanderbilt.edu To: r-help@r-project.org Subject: Re: [R] Developing a web crawler / R webkit or something similar? [off

Re: [R] Developing a web crawler / R webkit or something similar? [off topic]

2011-03-03 Thread Matt Shotwell
On 03/03/2011 08:07 AM, Mike Marchywka wrote: Date: Thu, 3 Mar 2011 01:22:44 -0800 From: antuj...@gmail.com To: r-help@r-project.org Subject: [R] Developing a web crawler Hi, I wish to develop a web crawler in R. I have been using the functionalities available under the RCurl package.

Re: [R] Robust variance estimation with rq (failure of the bootstrap?)

2011-03-01 Thread Matt Shotwell
On Mon, Feb 28, 2011 at 8:59 PM, Matt Shotwell m...@biostatmatt.com wrote: Jim, If repeated measurements on patients are correlated, then resampling all measurements independently induces an incorrect sampling distribution (= incorrect variance) on a statistic of these data. One solution

Re: [R] Robust variance estimation with rq (failure of the bootstrap?)

2011-02-28 Thread Matt Shotwell
Jim, If repeated measurements on patients are correlated, then resampling all measurements independently induces an incorrect sampling distribution (= incorrect variance) on a statistic of these data. One solution, as you mention, is the block or cluster bootstrap, which preserves the

Re: [R] Visualizing Points on a Sphere

2011-02-25 Thread Matt Shotwell
That's interesting. You might also like: http://en.wikipedia.org/wiki/Von_Mises%E2%80%93Fisher_distribution I'm not sure how to plot the wireframe sphere, but you can visualize the points by transforming to Cartesian coordinates like so: u - runif(1000,0,1) v - runif(1000,0,1) theta - 2 * pi * u

Re: [R] Problem with writing a file in UTF-8

2011-02-21 Thread Matt Shotwell
Thomas, I wasn't able to reproduce your finding. The last two characters in my 'out.txt' file were just as expected. But, I'm in an UTF-8 locale. Your locale affects the encoding of characters on your platform. If you're not in a UTF-8 locale, then characters are converted from your native

[R] non-ascii characters in R output

2011-02-18 Thread Matt Shotwell
All, I'd like to automatically output text from R to HTML. In doing this I've run into trouble with non-ascii characters, as my browser (and presumably others) does not render such characters correctly. For example, the 'fancy' single quotes associated with summary.lm are multi-byte

Re: [R] non-ascii characters in R output

2011-02-18 Thread Matt Shotwell
OK, looks like my web browser does render non-ascii characters output by R when it's given the encoding explicitly. This works for me: meta http-equiv=Content-Type content=text/html; charset=UTF-8/. So that's another solution, but not a general one. -Matt On Fri, 2011-02-18 at 12:47 -0600, Matt

Re: [R] non-ascii characters in R output

2011-02-18 Thread Matt Shotwell
On Fri, 2011-02-18 at 19:50 -0500, Duncan Murdoch wrote: On 18/02/2011 5:58 PM, Matt Shotwell wrote: OK, looks like my web browser does render non-ascii characters output by R when it's given the encoding explicitly. This works for me:meta http-equiv=Content-Type content=text/html

Re: [R] Revolution Analytics reading SAS datasets

2011-02-10 Thread Matt Shotwell
On Thu, 2011-02-10 at 10:44 -0800, David Smith wrote: The SAS import/export feature of Revolution R Enterprise 4.2 isn't open-source, so we can't release it in open-source Revolution R Community, or to CRAN as we do with the ParallelR packages (foreach, doMC, etc.). Judging by the language of

Re: [R] clustering with finite mixture model

2011-02-02 Thread Matt Shotwell
There are quite a few packages that work with finite mixtures, as evidenced by the descriptions here: http://cran.r-project.org/web/packages/index.html These might be useful: http://cran.r-project.org/web/packages/flexmix/index.html http://cran.r-project.org/web/packages/mclust/index.html

Re: [R] User input in R program

2011-01-21 Thread Matt Shotwell
Martyn Plummer's 'coda' package has some nice interactive menus. The package appears to be written entirely in R. You could start with the codamenu() function in the package source: http://cran.r-project.org/web/packages/coda/index.html -Matt On Fri, 2011-01-21 at 14:26 +0200, christiaan pauw

Re: [R] Encoding problem - I fails to read Hebrew text from online

2010-12-09 Thread Matt Shotwell
Tal, It looks like the data you received has HTML special hex characters. That is, '#x5E9;' is just an ASCII HTML representation of a hex character. It's not encoded in a special manner. The trick is to substitute the HTML encoded hex character for its binary representation, or decode the

Re: [R] Encoding problem - I fails to read Hebrew text from online

2010-12-09 Thread Matt Shotwell
-statistics.com (English) -- On Thu, Dec 9, 2010 at 8:38 PM, Matt Shotwell shotw...@musc.edu wrote: Tal, It looks like the data you received has HTML special hex

Re: [R] statistical test for comparison of two classifications (nominal)

2010-11-22 Thread Matt Shotwell
a look at profdpm, that did not pop-up in my searches. Indeed, the interpretation is going to be critical... Could you please elaborate on what you mean by the bootstrap process? Thanks a lot for your helps, Martin On 11/17/2010 3:50 PM, Matt Shotwell wrote: There are several statistics

Re: [R] Fatal Error R

2010-11-17 Thread Matt Shotwell
Please see below. On Wed, 2010-11-17 at 04:41 -0500, Ted Harding wrote: On 17-Nov-10 00:02:39, José Fernando Zea Castro wrote: Hello. First, I'm thankful about your wonderful project. However, I have serious worries about the reliability of R. I found the next bug which I consider

Re: [R] statistical test for comparison of two classifications (nominal)

2010-11-17 Thread Matt Shotwell
There are several statistics used to compare nominal classifications, or _partitions_ of a data set. A partition isn't quite the same in this context because partitioned data are not restricted to a fixed number of classes. However, the statistics used to compare partitions should also work for

Re: [R] log-transformed linear regression

2010-11-11 Thread Matt Shotwell
Servet, These data do look linear in log space. Fortunately, the model log(y) = a + b * log(x) does have intercept zero in linear space. To see this, consider log(y) = a + b * log(x) y = 10^(a + b * log(x)) y = 10^a * 10^(b * log(x)) y = 10^a * 10^(log(x^b)) y = 10^a * x^b

Re: [R] data acquisition with R?

2010-11-05 Thread Matt Shotwell
R implements (almost) all IO through its 'connections'. Unfortunately, there is no API (public or private) for adding connections, and therefore no packages that implement connections. You will find more discussion of connections and hardware (serial, USB) interface in the R-devel list archives.

Re: [R] Lattice plots for images

2010-11-03 Thread Matt Shotwell
Have you tried using the 'mai' argument to par()? Something like: par(mfrow=c(3,3), mai=c(0,0,0,0)) I've used this in conjunction with image() to plot raster data in a tight grid. http://biostatmatt.com/archives/727 -Matt On Wed, 2010-11-03 at 11:13 -0400, Neba Funwi-Gabga wrote: Hello UseRs,

Re: [R] ForestPlot or similar

2010-10-30 Thread Matt Shotwell
Here is a small function for forest plots in R, with an example: http://biostatmatt.com/wiki/r-credplot -Matt On Sat, 2010-10-30 at 11:40 -0400, Mestat wrote: Here is one example: I have three vectors (mean,lower interval, upper interval) mean-c(2,4,6,8) l-c(1,2,3,4) u-c(4,8,12,16) How

Re: [R] Regular expression to find value between brackets

2010-10-13 Thread Matt Shotwell
Here's a shorter (but more cryptic) one: gsub(^([^\\(]+)(\\((.+)\\))?, \\2, tests) [1] (%) (%) (mg/ml) gsub(^([^\\(]+)(\\((.+)\\))?, \\3, tests) [1] % % mg/ml -Matt On Wed, 2010-10-13 at 14:34 -0400, Henrique Dallazuanna wrote: Try this:

Re: [R] puzzle with integrate over infinite range

2010-09-21 Thread Matt Shotwell
You could try pnorm also: shiftedGaussR - function(x0 = 500) { sd - 100/sqrt(2) int - pnorm(0, x0, sd, lower.tail=FALSE, log.p=TRUE) exp(int + log(sd) + 0.5 * log(2*pi)) } shiftedGaussR(500) [1] 177.2454 shiftedGauss(500) [1] 177.2454 -Matt On Tue, 2010-09-21 at 09:38 -0400,

Re: [R] Is there a bisection method in R?

2010-09-20 Thread Matt Shotwell
I was just reading about the merge sort algorithm last night (BTW, here is a fun link http://www.youtube.com/watch?v=t8g-iYGHpEA). There are some interesting similarities in this context. Here's a recursive method for bisection: bisectMatt - function(fn, lo, hi, tol = 1e-7, ...) { flo -

Re: [R] R Founding

2010-09-16 Thread Matt Shotwell
On Thu, 2010-09-16 at 17:30 -0400, Tal Galili wrote: Hello dear Jaroslaw, I strongly agree with you that the R foundation should have an easier method of enabling people to give donations. At the same time, I feel there is a (friendly) disagreement between us on how such money should be used.

Re: [R] Which language is faster for numerical computation?

2010-09-09 Thread Matt Shotwell
For the compiled languages, it depends heavily on the compiler. This sort of comparison is rendered moot by the huge variety of compiler and hardware specific optimizations. My suggestion is to use C, or possibly C++ in conjunction with Rcpp, as these are most compatible with R. Also, C and C++

Re: [R] Reproducible research

2010-09-09 Thread Matt Shotwell
I have a little package I've been using to write template blog posts (in HTML) with embedded R code. It's quite small but very flexible and extensible, and aims to do something similar to Sweave and brew. In fact, the package is heavily influenced by the brew package, though implemented quite

Re: [R] Reproducible research

2010-09-09 Thread Matt Shotwell
Well, the attachment was a dud. Try this: http://biostatmatt.com/R/markup_0.0.tar.gz -Matt On Thu, 2010-09-09 at 10:54 -0400, Matt Shotwell wrote: I have a little package I've been using to write template blog posts (in HTML) with embedded R code. It's quite small but very flexible

Re: [R] Uncompressing data from read.socket

2010-09-08 Thread Matt Shotwell
Have a look at gzcon, for decompressing data as they arrive. From the help file: ‘gzcon’ provides a modified connection that wraps an existing connection, and decompresses reads or compresses writes through that connection. Standard ‘gzip’ headers are assumed. There is no

Re: [R] remove accents in strings

2010-09-07 Thread Matt Shotwell
If you know the encoding of the string, or if its encoding is the current locale encoding, then you can use the iconv function to convert the string to ASCII. Something like: iconv(accented.string, to=ASCII//TRANSLIT) While 7-bit ASCII does not permit accented characters, extended (8-bit) ASCII

Re: [R] remove accents in strings

2010-09-07 Thread Matt Shotwell
to remind anyone interested that R still has trouble with embedded zeros in character strings. I may be abusing terminology, but I think that makes R 8-bit dirty. -Matt On Tue, 2010-09-07 at 14:01 -0400, David Winsemius wrote: On Sep 7, 2010, at 1:35 PM, Matt Shotwell wrote: If you know

Re: [R] Why is vector assignment in R recreates the entire vector ?

2010-09-01 Thread Matt Shotwell
Tal, For your first example, x is not duplicated in memory. If you compile R with --enable-memory-profiling, you have access to the tracemem() function, which will report whether x is duplicate()d: x - rep(1,100) tracemem(x) [1] 0x8f71c38 x[10] - NA This does not result in duplication of x,

Re: [R] documentation to upgrade R-package from 32 to 64bit

2010-09-01 Thread Matt Shotwell
Try this: http://www.stats.ox.ac.uk/~ripley/Win64/W64porting.html -Matt On Wed, 2010-09-01 at 07:40 -0400, Hayes, Daniel wrote: Dear all, I am working with the an R-package named GAMLSS (www.gamlss.comhttp://www.gamlss.com) it is currently only functional under the 32-bit version of R

Re: [R] [semi-OT] Using fortune() in an email signature

2010-09-01 Thread Matt Shotwell
Or using R GNU tools: m...@max:~$ R -e fortunes::fortune() | gawk '/^[^]/ {print}' It's not a question of trying variations, rather of following instructions. -- Brian D. Ripley (about using 'Writing R Extensions') R-help (January 2006) -Matt On Wed, 2010-09-01 at 16:49 -0400, Stuart

Re: [R] Sweave.sty

2010-08-24 Thread Matt Shotwell
Here is one: http://svn.r-project.org/R/trunk/share/texmf/tex/latex/Sweave.sty -Matt On Tue, 2010-08-24 at 15:40 -0400, r.ookie wrote: Does anyone know where I can download the latest version of Sweave.sty? I have looked all over the site http://www.stat.umn.edu/~charlie/Sweave/ with no

Re: [R] on abort error, always show call stack?

2010-08-22 Thread Matt Shotwell
On Sun, 2010-08-22 at 11:41 -0400, ivo welch wrote: Dear R Wizards---is it possible to get R to show its current call stack (sys.calls()) upon an error abort? I don't use ESS for execution, and it is often not obvious how to locate how I triggered an error in an R internal function. Seeing

Re: [R] on abort error, always show call stack?

2010-08-22 Thread Matt Shotwell
abort? /iaw On Sun, Aug 22, 2010 at 11:50 AM, Matt Shotwell shotw...@musc.edu wrote: On Sun, 2010-08-22 at 11:41 -0400, ivo welch wrote: Dear R Wizards---is it possible to get R to show its current call stack (sys.calls()) upon an error abort? I don't use ESS for execution

Re: [R] Does R always insist on sending plot output to a file?

2010-08-19 Thread Matt Shotwell
$ R postscript(file=Rfifo) plot(0) dev.off() -Matt On Wed, 2010-08-18 at 23:21 -0400, Matt Shotwell wrote: Donald, At least for the PDF device (I know you asked about png, but I believe they are similar), the answer no. Ultimately, this device calls the standard C function fopen

Re: [R] Pass By Value Questions

2010-08-19 Thread Matt Shotwell
On Thu, 2010-08-19 at 14:27 -0400, Duncan Murdoch wrote: On 19/08/2010 12:57 PM, li...@jdadesign.net wrote: I understand R is a Pass-By-Value language. I have a few practical questions, however. I'm dealing with a large dataset (~1GB) and so my understanding of the nuances of memory

Re: [R] Delete rpart/mvpart cross-validation output

2010-08-18 Thread Matt Shotwell
Or, if using GNU Linux or other UNIX-like system: sink(/dev/null) # Issue commands sink() -Matt On Wed, 2010-08-18 at 09:14 -0400, Gabor Grothendieck wrote: On Fri, Aug 13, 2010 at 1:52 PM, Marie-Hélène Ouellette mariehele...@gmail.com wrote: Dear all, I was wondering if there is a

Re: [R] Does R always insist on sending plot output to a file?

2010-08-18 Thread Matt Shotwell
Donald, At least for the PDF device (I know you asked about png, but I believe they are similar), the answer no. Ultimately, this device calls the standard C function fopen, and writes its data to the resulting file stream. If you're using GNU Linux, you might trick R into writing to a fifo (a

Re: [R] when to use textConnection ??

2010-08-16 Thread Matt Shotwell
Also, many R functions are designed to operate on R connections, to input and output text. Alternatively, we may wish to provide the input text as an R character vector, or output text to a character vector. The textConnection makes a character vector look like a connection, so R routines that

Re: [R] band pass filter

2010-08-15 Thread Matt Shotwell
nuncio, If you already have a filter kernel, you can use the filter function. Of course, convolution filters can be applied directly using the discrete Fourier transform via the fft function. For an example of filtering (lowpass) with R, see http://biostatmatt.com/archives/78 , and the associated

Re: [R] reading a text file, one line at a time

2010-08-15 Thread Matt Shotwell
Walt, Something like: con - file(your-large-file.txt, rt) readLines(con, 1) # Read one line -Matt On Sun, 2010-08-15 at 10:58 -0400, Data Analytics Corp. wrote: Hi, I have an upcoming project that will involve a large text file. I want to 1. read the file into R one line at a time

Re: [R] ASCI characters

2010-08-15 Thread Matt Shotwell
How about: rawToChar(as.raw(82)) [1] R -Matt On Sun, 2010-08-15 at 19:50 -0400, Orvalho Augusto wrote: Hello guys! Is there any function that permits me to get an ASCI character from its code? Eg. ascifunction(34) would give me ' or ascifunction(92) gives \ Thanks Caveman

Re: [R] Numerical Methods Course

2010-08-10 Thread Matt Shotwell
TGS, Given that you have to pay an outrageous $155.86 for that book, it seems reasonable to look for a free environment for numerical computing (like R!). If your instructor says that such a variety of programming languages would work, you could probably make a good argument to use R. But why not

Re: [R] Good Book To Work Through This Summer

2010-08-09 Thread Matt Shotwell
There are some book-length documents (downloadable for free) at the contributed documentation section of the R project website here: http://cran.r-project.org/other-docs.html In particular, the book “Practical Regression and Anova using R” by Julian Faraway looks to have the content you want,

Re: [R] Changing downloaded source code into a package

2010-08-09 Thread Matt Shotwell
See comments below. On Mon, 2010-08-09 at 10:22 -0400, JH wrote: I am wanting to change some lines of code in the R package named nlme http://cran.r-project.org/web/packages/nlme/index.html To do this I have downloaded the Package source named nlme_3.1-96.tar.gz, opened up the file and

Re: [R] grep with search terms defined by a variable

2010-08-02 Thread Matt Shotwell
Daniel, If you want to search for each term at the beginning of a sting, using the regular expression construct '^', you might use the following search.terms - c(Emil, Meryl) names - c(Emil Jannings, +Charles Chaplin, +Katherine Hepburn, +Meryl Streep)

Re: [R] Meaning of following function

2010-08-01 Thread Matt Shotwell
Ron, In arithmetic, '-' and '+' are binary _and_ unary operators. That is, both -1 and 1-1 are valid arithmetic expressions, the former negates its argument, and the latter subtracts the second from the first. Since much of R is designed do arithmetic, R honors the unary _and_ binary versions of

Re: [R] how to code it??

2010-07-28 Thread Matt Shotwell
If I take your meaning correctly, you want something like this. x - c(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, + 1) easy - function(x) { + state - 0 + for (i in 1:length(x)) { + if (x[i] == 0) + x[i] - state + state - 0 + if (x[i] ==

Re: [R] what is a vignette?

2010-07-26 Thread Matt Shotwell
Alex, Vignettes are optional supplemental documentation. That is, they are in addition to the required boilerplate documentation for R functions and datasets. Vignettes are written in the spirit of sharing knowledge, and assisting new users in learning the purpose and use of a package. Maybe

Re: [R] sink function

2010-07-23 Thread Matt Shotwell
I had addressed a problem similar to this only a few days ago. Please see the following URL: http://tolstoy.newcastle.edu.au/R/e11/help/10/07/1677.html On Fri, 2010-07-23 at 08:45 -0400, nuncio m wrote: I have the following code to write the output from auto.arima function. The issue is not

Re: [R] Help with Sink Function

2010-07-16 Thread Matt Shotwell
Your code between calls to sink() does not generate any output. Hence, nothing will be diverted to the file. To illustrate this point, consider for(i in 1:10) i This produces no output. However, for(i in 1:10) print(i) produces output as expected. -Matt On Fri, 2010-07-16 at 13:34 -0400,

Re: [R] calling a c function from R

2010-07-14 Thread Matt Shotwell
Fahim, Please see the Writing R Extensions manual http://cran.r-project.org/doc/manuals/R-exts.pdf There are simple instructions in this document under the heading System and foreign language interfaces. -Matt On Wed, 2010-07-14 at 01:21 -0400, Fahim Md wrote: Hi, I am trying to call a C

Re: [R] Fast string comparison

2010-07-13 Thread Matt Shotwell
On Tue, 2010-07-13 at 01:42 -0400, Hadley Wickham wrote: strings - replicate(1e5, paste(sample(letters, 100, rep = T), collapse = )) system.time(strings[-1] == strings[-1e5]) # user system elapsed # 0.016 0.000 0.017 So it takes ~1/100 of a second to do ~100,000 string

Re: [R] Fast string comparison

2010-07-13 Thread Matt Shotwell
système écoulé 0.002 0.000 0.002 utilisateur système écoulé 0.004 0.000 0.005 utilisateur système écoulé 0.003 0.000 0.003 Romain Le 13/07/10 15:24, Matt Shotwell a écrit : On Tue, 2010-07-13 at 01:42 -0400

Re: [R] Compress string memCompress/Decompress

2010-07-11 Thread Matt Shotwell
9, 2010, at 3:21 PM, Matt Shotwell wrote: Erik, Can you store the data as a blob? For example: #create string, compress with gzip, convert to SQLite blob string string - gzip this string, store as blob in SQLite database string.gz - memCompress(string, type=gzip) string.sqlite

Re: [R] Compress string memCompress/Decompress

2010-07-09 Thread Matt Shotwell
Erik, Can you store the data as a blob? For example: #create string, compress with gzip, convert to SQLite blob string string - gzip this string, store as blob in SQLite database string.gz - memCompress(string, type=gzip) string.sqlite - paste(x',paste(string.gz,collapse=),',sep=) #create

Re: [R] Calling Gnuplot from R

2010-07-08 Thread Matt Shotwell
I recently wrote a small R function to draw simple ASCII scatterplots. http://biostatmatt.com/archives/491 Bill Harris commented that the plots reminded him of the dumb terminal of Gnuplot. I think it would be really neat to have an R graphics driver to Gnuplot in order to generate more complete

Re: [R] Plot with whispers

2010-07-05 Thread Matt Shotwell
It looks like read.table is reading the first line as a data value, which is the default for read.table. Try using read.table with the argument header=TRUE. Also, consider using a box and whiskers plot for these data (?boxplot, ?lattice::bwplot). -Matt On Mon, 2010-07-05 at 12:08 -0400, Ian

Re: [R] Function to compute the multinomial beta function?

2010-07-05 Thread Matt Shotwell
How about this? mbeta - function(...) { exp(sum(lgamma(c(...)))-lgamma(sum(c(... } gamma(5)*gamma(6)*gamma(7)/gamma(18) [1] 5.829838e-09 mbeta(5,6,7) [1] 5.829838e-09 On Mon, 2010-07-05 at 17:10 -0400, Gregory Gentlemen wrote: Dear R-users, Is there an R function to compute

Re: [R] left end or right end

2010-07-01 Thread Matt Shotwell
Suku, It looks like you might want to consult with a [bio]statistician, but I'm interested in what these distances represent. Can you give some additional context for your problem? How were these distances collected? Is it a collection of pairs of intervals, like this: P

Re: [R] left end or right end

2010-07-01 Thread Matt Shotwell
Suku, Just to clarify, in your table and each of your images, it appears that the start position of P (start1) is _after_ or at the start position of Q (start2), and the end position of P (end1) is _before_ or at the end position of Q (end2). If these positions represent increasing integers,

Re: [R] how to display the clock time in the loop

2010-07-01 Thread Matt Shotwell
Try to flush output after printing: cat(paste(Sys.time()),\n); flush(stdout()) On Thu, 2010-07-01 at 16:17 -0400, Jack Luo wrote: Hi, I am doing some computation which is pretty time consuming, I want R to display CPU time after each iteration using the command Sys.time(). However, I found

Re: [R] is there a way to do dense rank in R

2010-07-01 Thread Matt Shotwell
x - c(5,7,7,9) rank(unique(x))[match(x, unique(x))] [1] 1 2 2 3 On Thu, 2010-07-01 at 21:30 -0400, Suresh Singh wrote: I have not been able to find a way to do dense rank in R Here is an example of what I need rank() gives the following 5 rank 1 7 rank 2 7 rank 2 9 *rank 4* but

Re: [R] integration of two normal density

2010-06-28 Thread Matt Shotwell
Isn't it equally trivial to demonstrate that the product of two pdfs _may_ be a normalized pdf? For example, the uniform (0,1) pdf: f(x) = 1 for x in (0, 1), and 0 otherwise Hence, g(x) = f(x)*f(x) = 1 for x in (0, 1), and 0 otherwise _is_ a normalized pdf. But this is a little silly. Rather

Re: [R] advice on package devel with external libs

2010-06-28 Thread Matt Shotwell
Some ideas, 1. Wrap the library as an R package, as you said, and check for the library at configure time (i.e. with autoconf or custom script). But if you do, it would be great to provide an R-level API so that we can all use it. This is the strategy of the 'cairo', 'RGtk', 'rgl', and 'gsl'

  1   2   >