Re: [R] Derivative of a Function Expression

2007-09-03 Thread Alberto Monteiro
numerical.derivative(sin, pi) = -1# ok numerical.derivative(exp, 0) = 1.5 # close enough numerical.derivative(sqrt, 0) = 100 # should be Inf Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] Excel (off-topic, sort of)

2007-08-29 Thread Alberto Monteiro
is found. Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] It is possible to use a Shell command inside a R script?

2007-08-24 Thread Alberto Monteiro
it was much faster. Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] It is possible to use a Shell command inside a R script?

2007-08-24 Thread Alberto Monteiro
secs t2 - t1 Time difference of 11.969 secs Oops... Alberto Monteiro __ R-help@stat.math.ethz.ch 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

[R] Seasonality

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

[R] Source inside source

2007-07-16 Thread Alberto Monteiro
/, and then I call source(file1.R), it will run correctly. However, if I setwd to /files, then call source(dir1/file1.R), it will give an error when trying to source file2.R Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman

[R] system: Linux vs. Windows differences

2007-07-11 Thread Alberto Monteiro
[I tried to send this messages two days ago, but I guess I mistyped the To: address...] Why system is different in Linux and Windows? Both in R 2.4.1, but in Windows there is an option: system(something, wait = FALSE) while on Linux (Fedora Core 4), there is no such option? Alberto

Re: [R] Me again, about the horrible documentation of tcltk

2007-07-06 Thread Alberto Monteiro
), but this tk_getOpenFile opens a nice window in Windows, but a mutilated window in Linux, that does not show any file information except filename. That's why I wanted to know if there was a way to improve the function call - I think there isn't. Alberto Monteiro [*] I am neither paranoid nor animistic

Re: [R] Me again, about the horrible documentation of tcltk

2007-07-06 Thread Alberto Monteiro
as this, but a GUI menu with more than a few entries is just unwieldy. We do have a text reference to the help files in the ?tcltk topic. Duncan Murdoch Cheers, Mike Mike Prager wrote: Alberto Monteiro [EMAIL PROTECTED] wrote: How on Earth can I know what are the arguments

Re: [R] Recursion in R ...

2007-07-06 Thread Alberto Monteiro
to be aborted, because it consumed all the resources of the computer. Alberto Monteiro __ R-help@stat.math.ethz.ch 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

[R] Me again, about the horrible documentation of tcltk

2007-07-05 Thread Alberto Monteiro
would like to force the files to be sorted by time, with most recent files coming first (and no, the purpose is not to use for porn files). Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Me again, about the horrible documentation of tcltk

2007-07-05 Thread Alberto Monteiro
incorporated your (MacDonald's) suggestion in the R-Wiki, at... http://wiki.r-project.org/rwiki/doku.php?id=rdoc:tcltk:tkcommands Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] help again

2007-07-02 Thread Alberto Monteiro
the problematic code to a minimum code that reproduces the bug, it's much easier _for me_ to spot (and fix) the error :-) Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

[R] Fat tails

2007-06-29 Thread Alberto Monteiro
), mean2, sd2) # game over return(rval) } # test x - r.mydist(1000, 0.1, 0, 1, 0, 5) hist(x) if (require(fBasics)) cat(the sample kurtosis is, kurtosis(x), \n) Now, with this sample x, how can I get back sd1, sd2 and prob? Alberto Monteiro __ R-help

Re: [R] compare 2 vectors

2007-06-28 Thread Alberto Monteiro
] ... that this is the same as x[!(x %in% y)] and not x[(!x) %in% y] Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] Latex \ell symbol in plotmath

2007-06-05 Thread Alberto Monteiro
can't think about a program that lists all Unicode characters. A stupid and dirty solution would be: cat(u 31 = \u31\n) cat(u 32 = \u32\n) ... How can I vectorize this? Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch

[R] Inverse of encodeString

2007-06-05 Thread Alberto Monteiro
What is the inverse of encodeString? For example, \u1 is some Unicode symbol. If I do s - encodeString(\u1) then s will be the string \001. But anything I do with s, will not return the Unicode that corresponds to \u1: cat(s, \n) # prints \001 cat(\u1, \n) # prints y with umlaut Alberto

Re: [R] Latex \ell symbol in plotmath

2007-06-05 Thread Alberto Monteiro
) # error. Argument x must be an integer vector intToUtf8(33:35) # ok intToUtf8(40 + 0:9) # error. Argument x must be an integer vector Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Latex \ell symbol in plotmath

2007-06-05 Thread Alberto Monteiro
an error in R 2.4.1 for Windows. Alberto Monteiro __ R-help@stat.math.ethz.ch 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

[R] Abstract plot

2007-06-04 Thread Alberto Monteiro
values. Is it possible? Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] Excel calling R functions

2007-06-01 Thread Alberto Monteiro
after that. Slow, but better than to use Excel alone :-) Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] Running an R script without running R

2007-05-21 Thread Alberto Monteiro
have to test it. Alberto Monteiro (who does not have any special affinity with the letter I, despite this message) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] R2 always increases as variables are added?

2007-05-21 Thread Alberto Monteiro
is zero, or so insignifantly small as not to matter. For example, if you are measuring the density of some material, and you determine a lot of pairs (mass, volume), you know that mass = density * volume, with intercept zero. Alberto Monteiro __ R-help

Re: [R] Inverse gamma

2007-05-18 Thread Alberto Monteiro
... rgamma(n = number.of.points, shape = k, scale = 1/beta) ... or ... rgamma(n = number.of.points, shape = k, rate = beta) ) and take X = 1/Y (unless your beta is not the rate parameter...) Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list

Re: [R] Is it possible to control R with S+?

2007-05-17 Thread Alberto Monteiro
will install S+ in some computers. Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] Testing for existence inside a function

2007-05-15 Thread Alberto Monteiro
to change f to change this. Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] Testing for existence inside a function

2007-05-15 Thread Alberto Monteiro
- function() cat(g was called\n) f(g()) [1] 1 # g was not called Another test: f1 - function(x, y) if (x == 0) y else 1 f1(1, y.does.not.exist) f1(1, g()) The y-argument is never called. So maybe it _might_ be possible to test if y exists inside the function... Alberto Monteiro

[R] Help with map

2007-05-04 Thread Alberto Monteiro
to each country? Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] Query about finding correlations

2007-05-02 Thread Alberto Monteiro
, always) may not be the best indicator. Take, as an extreme case, this: A - (-50:50) + 100 * rnorm(101) B - abs((-50):50) + 10 * rnorm(101) C - A^2 / 50 + rnorm(101) cor(A, C) cor(B, C) A is obviously the cause of C, but B (in some cases) is better correlated to C than A to C. Alberto Monteiro

Re: [R] importing excel-file

2007-04-20 Thread Alberto Monteiro
case, but using colClasses=double, they are something that be made into dates, with as.POSIXlt(1899-12-30, GMT) + test9[100:120,1] * 86400 Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] importing excel-file

2007-04-20 Thread Alberto Monteiro
Alberto Monteiro -- Regards, Hans-Peter --- End of Original Message --- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

Re: [R] importing excel-file

2007-04-20 Thread Alberto Monteiro
Please ignore the last test case. I thought I had saved it, but I hadn't, sheet = 2 was empty. Now it works. Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

Re: [R] importing excel-file

2007-04-19 Thread Alberto Monteiro
If there are any bugs/issues, please report them to me and they - most likely - will get fixed. Ok - I will do it. Thanks. Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] convergence

2007-04-19 Thread Alberto Monteiro
Murphy: it tries hard to solve the problem, but sometimes he must give up a path and backtrack to a less optimum but faster solution. Do I make any sense? Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] importing excel-file

2007-04-19 Thread Alberto Monteiro
of the product names. So it seems that none of the four possibilities is entirely satisfactory. Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] erratic behavior of match()?

2007-04-19 Thread Alberto Monteiro
languages were developed, would use integer and rational numbers by default, only using floating point approximations when the integers became too big or when forced to use irrational numbers. But I don't think we can now repair the damage that was done so long ago. Alberto Monteiro

Re: [R] importing excel-file

2007-04-18 Thread Alberto Monteiro
and RAIZ instead of SQRT. Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] importing excel-file

2007-04-18 Thread Alberto Monteiro
enough to use Excel in Linux or Mac? :-) Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] importing excel-file

2007-04-18 Thread Alberto Monteiro
the file keeps changing. Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] Find zeros of analytic functions

2007-04-17 Thread Alberto Monteiro
Robin Hankin wrote: If iterative methods are appropriate, it's perhaps worth pointing out that Newton-Rapheson works nicely for complex functions. Hmmm... I think there are many cases where Newton-Raphson diverges for complex functions, like those that generate beautiful fractals. Alberto

Re: [R] installing new packages

2007-04-13 Thread Alberto Monteiro
that can (and does) happen is that normally the package I want requires other packages, this is easily solved with new downloads-and-installs. Alberto Monteiro __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Referencing function name from within function

2007-04-03 Thread Alberto Monteiro
[[n-1]]), \n) } evil.function - function() myfunction() evil.function() How can I get the _arguments_ to the calls? as.character strips them :-/ Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] faster computation of cumulative multinomial distribution

2007-04-02 Thread Alberto Monteiro
, k-1)), prob=p) What I am missing here? Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] (Newbie)Basic Basic global vs. local variables

2007-04-02 Thread Alberto Monteiro
alternative to globals when I have a huge database where a lot of different functions read and write. But maybe this is ideology/religion/politics... Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Wikibooks

2007-03-30 Thread Alberto Monteiro
with file.remove(CONFIG.SYS)), then this wrong answer may be accessed by newbies. A wikipedia _may_ have wrong answers, but these are (hopefully) ephemeral. BTW, is it too hard to include the wiki in RSiteSearch? Alberto Monteiro __ R-help@stat.math.ethz.ch

Re: [R] Regarding Vista

2007-03-30 Thread Alberto Monteiro
Barry Rowlingson: At some point the complexity of installing things like this for Windows will cross the complexity of installing Linux... (PS excepting live-Linux installs like Knoppix) Maybe we have reached this point :-) Alberto Monteiro __ R

Re: [R] Wikibooks

2007-03-30 Thread Alberto Monteiro
doubts - in the hope that someone will then fix it latter. Example: rnorm This is a very weird function, because things like rnorm(0.975) should return 1.96, but returns numeric(0) And then someone would either rename the page to qnorm, or write a new rnorm page. Alberto Monteiro

Re: [R] Wikibooks

2007-03-30 Thread Alberto Monteiro
on how to search. :-) Or I could ask help(help) to learn how help works :-P Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org

Re: [R] math-operations and the R-Wiki

2007-03-30 Thread Alberto Monteiro
Dimitris Rizopoulos wrote: 513 %/% 100 513 %% 100 Now this is a great opportunity to improve the R-Wiki. What about a Pascal page in the R-Wiki, where a list of Pascal-to-R translations would be available? Alberto Monteiro __ R-help

Re: [R] Wikibooks

2007-03-30 Thread Alberto Monteiro
into the R-Wiki and _writing_ everything I learned about R in the past 6 months... Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting

Re: [R] Wikibooks

2007-03-30 Thread Alberto Monteiro
into the R-Wiki and _writing_ everything I learned about R in the past 6 months... Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting

[R] RWiki, tcltk and plot

2007-03-30 Thread Alberto Monteiro
and watch !!! # ### # My question: is there any way to integrate the plot part into a tcltk window? Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Wikibooks

2007-03-30 Thread Alberto Monteiro
have posted things in 10 or 12 years ago that might cause me problems today, but I was pretty aware that I was posting to the whole world. Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] RWiki, tcltk and plot

2007-03-30 Thread Alberto Monteiro
Dirk Eddelbuettel wrote: My question: is there any way to integrate the plot part into a tcltk window? Are you aware of the tkrplot package on CRAN ? No. Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman

Re: [R] faster computation of cumulative multinomial distribution

2007-03-30 Thread Alberto Monteiro
(matrix, 1 (rows) or 2 (coluns), function) f.dist - apply(x, 2, f) # analyse it hist(f.dist) # etc R has dbinom /and/ pbinom functions, but unfortunately only a dmultinom and no pmultinom function... perhaps because there is no (known) faster way? There's a rmultinom Alberto Monteiro

[R] tcltk, tclRequire and Tktable help

2007-03-29 Thread Alberto Monteiro
(tcltk) tclRequire(Tktable) # [1] FALSE # Warning message: # Tcl package 'Tktable' not found in: tclRequire(Tktable) Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] tcltk crashing R after the (ab)use of tkwait

2007-03-29 Thread Alberto Monteiro
and there's no way of returning except by closing the R window. Why? What am I doing wrong? Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org

Re: [R] tcltk crashing R after the (ab)use of tkwait

2007-03-29 Thread Alberto Monteiro
into an infinite loop and there's no way of returning except by closing the R window. Works for me with R-2.4.1 on Windows 2000. So better tell us about the details of your operating system. R 2.4.1 on Windows XP. Should they work differently? Alberto Monteiro

[R] Wikibooks

2007-03-29 Thread Alberto Monteiro
As a big fan of Wikipedia, it's frustrating to see how little there is about R in the correlated project, the Wikibooks: http://en.wikibooks.org/wiki/R_Programming Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman

[R] Help with grep (and similar functions)

2007-03-28 Thread Alberto Monteiro
This works: grep(([A-Za-z]*) , Aaaa 3 x 0 Bbbb) # 1 This also works: grep(([A-Za-z]*) , Aaaa 3 x 0 Bbbb, value=T) # Aaaa 3 x 0 Bbbb However, I want a grep that returns the _matched_ pattern, which, in this case, would be Aaaa. How can I do it? Alberto Monteiro

Re: [R] Help with grep (and similar functions)

2007-03-28 Thread Alberto Monteiro
this: library(gsubfn) pat - ^([a-zA-Z ]+) ([1-9]*[0-9]) x ([1-9]*[0-9]) ([a-zA-Z ]+)$ s - My team 3 x 0 the team from Outer Space x - strapply(s, pat, c)[[1]] Then x[1] is s, x[2] is My team, x[3] is 3, x[4] is 0 and x[5] is the team from Outer Space. Thanks. Alberto Monteiro

Re: [R] Large matrix into a vector

2007-03-28 Thread Alberto Monteiro
]) ..)? It might be simpler than you thought... HR - matrix(1:(9*27), nrow=9) # just to create a 9x27 matrix c(HR) # oops, here it is! Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] Large matrix into a vector

2007-03-28 Thread Alberto Monteiro
, what are the side effects of c()? Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] Reading config data from text files

2007-03-27 Thread Alberto Monteiro
Pete Cap wrote: I'm writing a tcl/tk gui tool to wrap around RMySQL for some co-workers. Good luck; I find the documentation on the library(tcltk) very poor, lacking examples for most of the functions. Alberto Monteiro __ R-help@stat.math.ethz.ch

[R] Get home directory and simple I/O

2007-03-23 Thread Alberto Monteiro
in a human-readable but R-like form? For example, if (say), x is a vector defined as x - c(1, 2, 3), can I write (and read) x as a file with just one line, namely: c(1, 2, 3) ? Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch

Re: [R] Binary information convert into hexadecimal

2007-03-23 Thread Alberto Monteiro
, 4, 2, 1. x * 2^... will form the terms of the polynomial sum will compute 2^(n-1) x[0] + 2^(n-2) x[1] + ... + 2 * x[n-1] + x[n] Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Get home directory and simple I/O

2007-03-23 Thread Alberto Monteiro
that works for Windows XP, and it will probably work for Linux. Also, in Windows, there are variables homedrive and homepath, that I could combine to form the path (probably this is what path.expand does :-)) Sys.getenv(homepath) Sys.getenv(homedrive) Alberto Monteiro

Re: [R] Over-writing functions from other packages? What is a good strategy??

2007-03-21 Thread Alberto Monteiro
that are very difficult to find. Of course, YKMV.[*] Alberto Monteiro [*] I always use S.I. units :-) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting

Re: [R] newbie upgrade from 2.4.0 to 2.4.1 question

2007-03-21 Thread Alberto Monteiro
to uninstall. It does the right thing. But it will not delete the older 2.4.0 version from the Desktop, and all other places where Windows XP places programs. Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman

[R] XML - can create but can't save

2007-03-20 Thread Alberto Monteiro
para saveXML which could translate to Error in saveXML(tt, file = test.xml) : no method applicable to saveXML Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

Re: [R] XML - can create but can't save

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

[R] Bad points in regression

2007-03-16 Thread Alberto Monteiro
points. How can I retrieve this information from ll? Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] Bad points in regression

2007-03-16 Thread Alberto Monteiro
of them include information about those bad points. Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] abs(U) 0 where U is a vector?

2007-03-14 Thread Alberto Monteiro
) But this is not the most elegant solution, because there is a function to check if all [and another to check if any] component of a vector of booleans are [is] true: it's all(V) [resp. any(V)]. So: all(U 0) Sanity check: U - c(-1, 1, 2) all(U 0) # FALSE U[1] - 3 all(U 0) # TRUE Alberto Monteiro

Re: [R] How to create a list that grows automatically

2007-03-09 Thread Alberto Monteiro
myArray - vector(length=0) myArray - c(myArray, object1) myArray - c(myArray, object2) myArray # array with 2 strings Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] Error distribution question

2007-03-08 Thread Alberto Monteiro
to estimate the return in the case of success. Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] Generic distributions

2007-03-07 Thread Alberto Monteiro
'?distroptions' in: print(object) Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] How to open more windows to make more graphs at once!

2007-03-07 Thread Alberto Monteiro
Ted Harding wrote: Creating more than one graphic windows is, as far as I know, not possible in R. But, as to whether/to what extent X or equivalent is available for MS Windows, that is another question on which I have no expertise. X11() seems to work for Windows XP. Alberto Monteiro

Re: [R] Is there a quick way to count the number of times each element in a vector appears?

2007-03-06 Thread Alberto Monteiro
Dylan Arena wrote: I'm writing a function that calculates the probability of different outcomes of dice rolls (e.g., the sum of the highest three rolls of five six-sided dice). You know there are simpler ways to do this, don't you? Alberto Monteiro

[R] Package RODBC

2007-03-06 Thread Alberto Monteiro
], name1)) # ok odbcClose(channel) 2nd, it seems that only pure strings (which are not links to strings) and numerical values are correctly fetched or selected. Is this a bug? 3rd, when do something like plan1[,1] a weird message about Levels appear. What is that? Alberto Monteiro

Re: [R] Generate random numbers up to one

2007-03-06 Thread Alberto Monteiro
distribution with parameters (1,1,1...1): http://en.wikipedia.org/wiki/Dirichlet_distribution It's the distribution of uniform U1, U2, ... Un with the restriction that U1 + U2 + ... + Un = 1. Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list

[R] Generic distributions

2007-03-06 Thread Alberto Monteiro
package, that uses a language that looks like R/S, we can do things like x ~ dnorm(mu, tau), forget that x is a normal with mean mu and variance 1/tau, and then treat it generically. Alberto Monteiro PS: this is noise... but due to spam invasion, anything that increases the nonspam/spam ratio

Re: [R] plot(): I want to display dates on X-axis.

2007-03-05 Thread Alberto Monteiro
of displaying the first column values on y-axis against dates on x-axis. Of course, you can combine all that into one line, but readability will be blown up: plot(ISOdate(floor(dat[,2] / 1), floor(dat[,2] / 100) %% 100, dat[,2] %% 1), dat[,1]) Alberto Monteiro

[R] 0 * NA = NA

2007-03-05 Thread Alberto Monteiro
) wt - c(2, 0, 1) wt %*% x # NA Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] 0 * NA = NA

2007-03-05 Thread Alberto Monteiro
:-/ if (NA == 0) is NA, then is.finite(NA) should be NA too... if (NA == 0) 2 else 3 # gives an error This is why I suggested a method which tests for corresponding elements of x = NA and y = 0, since what Alberto Monteiro wanted was 0*NA = 0, when that combination occures. I.e. %*NA% - function(x

Re: [R] random uniform sample of points on an ellipsoid (e.g. WG

2007-03-02 Thread Alberto Monteiro
, Sauron and brazilian president Lula :-) Alberto Monteiro __ R-help@stat.math.ethz.ch 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

Re: [R] random uniform sample of points on an ellipsoid (e.g. WG

2007-03-01 Thread Alberto Monteiro
- diag(c(1, 1, 0.01)) ep - v %*% t(Chol) plot(ep[,1], ep[,2]) with a clear trend to generate points closer to the equator then in the polar regions, against the assumption that they should be uniformly distributed over the surface of the ellipsoid. Alberto Monteiro

[R] get more than get

2007-02-28 Thread Alberto Monteiro
This must be a stupid question, but is there any extension of get? For example: x - 10 get(x) # gives me 10 get(x^2) # gives me an error Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] matrix manipulations

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

[R] What is a expression good for?

2007-02-28 Thread Alberto Monteiro
I mean, I can generate a expression, for example, with: z - expression(x+y) But then how can I _use_ it? Is it possible to retrieve information from it, for example, that z is a sum, its first argument is x (or expression(x)) and its second argument is y? Alberto Monteiro

[R] ts; decompose; plot and title

2007-02-27 Thread Alberto Monteiro
plot(z) Now, the title is the ugly Decomposition of additive time series. How can do this with a decent title, like Analysis of UFO abductions? Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] eigenvalue ordering

2007-02-26 Thread Alberto Monteiro
Kaustubh Patil wrote: Is it possible to get unordered eigenvalues and eigenvectors of a symmetric matrix in R? Yes, see help(eigen). If you are strict about the unordered part, do a sample(set, size) to randomize the eigenvalues. Alberto Monteiro

Re: [R] eigenvalue ordering

2007-02-26 Thread Alberto Monteiro
be complex (even for real matrices). For real asymmetric matrices the vector will be complex only if complex conjugate pairs of eigenvalues are detected. So, if you are strict about getting unordered eigenvalues, you must shuffle them :-) Alberto Monteiro

Re: [R] using integrate in a function definition

2007-02-23 Thread Alberto Monteiro
) # will integrate from 0 to 1 and ignore 2:5 'plot' will probably fall into some code that uses this vector-in-vector-out hypothesis, and then fail when the size of x differs from the size of y. Alberto Monteiro PS: fff - function(x) 1 integrate(fff, 0, 1) # error. why

[R] pdf with an exact size

2007-02-23 Thread Alberto Monteiro
, 749, 250), c(250, 749, 749, 250, 250), type=l, col=black) dev.off() However, I don't know how do this with a pdf monstr... oops... file. Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] pdf with an exact size

2007-02-23 Thread Alberto Monteiro
=c(0, 210), ylim=c(0, 297), col=white) par(usr=c(0, 210, 0, 297)) points(c(100, 100, 200, 200, 100), c(100, 200, 200, 100, 100, 100), type=l, col=black) dev.off() Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch

[R] R tcl/tk

2006-10-23 Thread Alberto Monteiro
? Alberto Monteiro __ R-help@stat.math.ethz.ch 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 tcl/tk

2006-10-23 Thread Alberto Monteiro
mention R.home() evil grin Alberto Monteiro __ R-help@stat.math.ethz.ch 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

[R] Worm distribution :-)

2006-10-23 Thread Alberto Monteiro
is that the stars are randomly distributed, while the glow-worms tried to keep a distance to each other. My question: what is the best way to generate a glow-worm-like distribution? I imagine that using a Latin Hypercube would leave too many holes in the (x,y) plane. Alberto Monteiro

[R] I really don't understand functions in R :-)

2006-10-20 Thread Alberto Monteiro
An example: n - 3 f - function(x) x^n f(2) # [1] 8 n - 2 f(2) # [1] 4 f # function(x) x^n Ok, I know this is trivial, because function f is foverer bound to the variable n. But how can I _fix_ n when I define _f_, so that changing _n_ won't change the function f? Alberto Monteiro

  1   2   >