Re: [R] Derivative of a Function Expression

2007-09-03 Thread Alberto Monteiro
f(x)) / h } Ex: numerical.derivative(cos, pi) = 5e-05 # should be -sin(pi) = 0 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-

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

2007-08-29 Thread Alberto Monteiro
nfer a new calculated value, and calculates it, until there's nothing else to do or a contradiction 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

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

2007-08-24 Thread Alberto Monteiro
dir\\\n", sep="") sink() system("batch_file.bat") t2 <- Sys.time() t2 - t1 Hmmm Interesting... I did this test with 47 files, and I got: t1 - t0 Time difference of 11.439 secs t2 - t1 Time difference of 11.969 secs Oops... Alberto Monteiro ___

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

2007-08-24 Thread Alberto Monteiro
atch file and then running 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 comme

[R] Seasonality

2007-08-09 Thread Alberto Monteiro
be useful. 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
dir1/, 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 mai

[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

Re: [R] Recursion in R ...

2007-07-06 Thread Alberto Monteiro
ntentionally, even though my second computer program that I ever wrote in life had 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-

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

2007-07-06 Thread Alberto Monteiro
the tcltk R library), 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

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

2007-07-06 Thread Alberto Monteiro
hey are on your hard drive already? > > > > I'd say they are too specialized for that. There are dozens of topics > > that are as important as this, but a GUI menu with more than a few > > entries is just unwieldy. > > > > We do have a text referenc

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

2007-07-05 Thread Alberto Monteiro
helped) are so nice. I even 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/li

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

2007-07-05 Thread Alberto Monteiro
sides filetypes, what are the other arguments to tkgetOpenFile? I 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 htt

Re: [R] help again

2007-07-02 Thread Alberto Monteiro
e time, when I reduce 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 PL

[R] Fat tails

2007-06-29 Thread Alberto Monteiro
!test)) rval[!test] <- rnorm(sum(!test), 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 sam

Re: [R] compare 2 vectors

2007-06-28 Thread Alberto Monteiro
It's not obvious, in the expression... x[!x %in% y] ... 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 gui

Re: [R] Latex \ell symbol in plotmath

2007-06-05 Thread Alberto Monteiro
0:9) > As I wrote before, 33L or 40L return 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-gu

Re: [R] Latex \ell symbol in plotmath

2007-06-05 Thread Alberto Monteiro
is does not work in R 2.4.1 for Windows. 0x2110L returns an error, and intToUtf8 returns an error on anything except the simplest calls: intToUtf8(33) # 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 Mon

[R] Inverse of encodeString

2007-06-05 Thread Alberto Monteiro
ot;\u1", "\n") # prints y with umlaut 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] Latex \ell symbol in plotmath

2007-06-05 Thread Alberto Monteiro
gt; I must be sleeping, but I 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] 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
file to be created, and procceed 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.or

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

2007-05-21 Thread Alberto Monteiro
100% sure that the intercept term 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 _

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

2007-05-21 Thread Alberto Monteiro
ipt might be what I need - but I 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 PLE

Re: [R] Inverse gamma

2007-05-18 Thread Alberto Monteiro
e Y from gamma(k, 1/beta) (using... 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 __

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

2007-05-17 Thread Alberto Monteiro
o probability that my company 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 pro

Re: [R] Testing for existence inside a function

2007-05-15 Thread Alberto Monteiro
.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@stat.math.ethz.ch 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] Testing for existence inside a function

2007-05-15 Thread Alberto Monteiro
message is (almost) the same, and it happens when parsing the line. There's no way 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 htt

[R] Help with map

2007-05-04 Thread Alberto Monteiro
a del Fuego in Argentina's South) and there will be a recycling. Is there any way to associate one color 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 post

Re: [R] Query about finding correlations

2007-05-02 Thread Alberto Monteiro
ut B (in some cases) is better correlated to C than A to 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-contained, reproducible code.

Re: [R] importing excel-file

2007-04-20 Thread Alberto Monteiro
r, I just have to call read.xls twice). Without colClasses = "double", the numbers become meaningless stuff. OTOH, the dates aren't rendered as dates in either case, but using colClasses="double", they are something that be made into dates, with as.POSIXlt

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

Re: [R] importing excel-file

2007-04-20 Thread Alberto Monteiro
heets. They are exactly identical, as I tried to copy and paste them. test1 <- read.xls(filename, sheet = 1, rowNames = FALSE) # works fine test2 <- read.xls(filename, sheet = 2, rowNames = FALSE) # returns NULL Alberto Monteiro > -- > Regards, > Hans-Peter --- End of Origin

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

2007-04-19 Thread Alberto Monteiro
ny reasonable person, back when computer 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

Re: [R] importing excel-file

2007-04-19 Thread Alberto Monteiro
9-12-30", "GMT") + test4[8:17, 1] * 86400 will return a vector of dates!), but then I will lose the meaning of the columns, because test4[,1] is no longer the list of the product names. So it seems that none of the four possibilities is entirely satisfactory. Alberto Monteiro __

Re: [R] convergence

2007-04-19 Thread Alberto Monteiro
eck all of them. I read somewhere that computer loop problems are treated as if the computer was "playing chess" agains 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? A

Re: [R] importing excel-file

2007-04-19 Thread Alberto Monteiro
* cases to make such a strong assertion O:-) > Do you use > the newest version (v1.3.1 or v1.3.2)? > No, I was using 1.1.1 > 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 _

Re: [R] importing excel-file

2007-04-18 Thread Alberto Monteiro
s not the best solution when 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 c

Re: [R] importing excel-file

2007-04-18 Thread Alberto Monteiro
use windows. > Ok, but who would be insane 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/p

Re: [R] importing excel-file

2007-04-18 Thread Alberto Monteiro
is portable to other languages, even when the evil geniuses of M$ decided to localize function names so that, in Portuguese, we have SENO instead of SIN and RAIZ instead of SQRT. Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://

Re: [R] Find zeros of analytic functions

2007-04-17 Thread Alberto Monteiro
e beautiful fractals. 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] installing new packages

2007-04-13 Thread Alberto Monteiro
local zip The worse 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

Re: [R] Referencing function name from within function

2007-04-03 Thread Alberto Monteiro
lls() n <- length(call.stack) cat(as.character(call.stack[[n]]), " crashed, called from ", as.character(call.stack[[n-1]]), "\n") } evil.function <- function() myfunction() evil.function() How can I get the _arguments_ to the calls? as.character strips them :-/ A

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

2007-04-02 Thread Alberto Monteiro
me simpler. I don't see a nice 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://s

Re: [R] faster computation of cumulative multinomial distribution

2007-04-02 Thread Alberto Monteiro
tional probabilities. For example, hitting exactly once every hole would be k <- length(p) prod(dbinom(1, N - (0:(k-2)), p[k - (0:(k-2))])) BTW, this is exactly dmultinom(c(N-k+1, rep(1, k-1)), prob=p) What I am missing here? Alberto Monteiro __

Re: [R] faster computation of cumulative multinomial distribution

2007-03-30 Thread Alberto Monteiro
ist) # 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-help@stat.math.ethz.c

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 l

Re: [R] Wikibooks

2007-03-30 Thread Alberto Monteiro
#x27;s a scary thought; I may 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/mailm

[R] RWiki, tcltk and plot

2007-03-30 Thread Alberto Monteiro
tkgrid(dist.widget[[i]], row=i-1) tkgrid(plot.widget[[i]], row=i-1, column=1) } # # Game over - click and watch !!! # ####### # My question: is there any way to integrate the plot part into a tcltk window? Alberto Monteiro

Re: [R] Wikibooks

2007-03-30 Thread Alberto Monteiro
they're not > horribly undocumented. > :-)) Ok, maybe I should shut up complaining and actually _do_ something useful, like going into the R-Wiki and _writing_ everything I learned about R in the past 6 months... Alberto Monteiro _

Re: [R] Wikibooks

2007-03-30 Thread Alberto Monteiro
they're not > horribly undocumented. > :-)) Ok, maybe I should shut up complaining and actually _do_ something useful, like going into the R-Wiki and _writing_ everything I learned about R in the past 6 months... Alberto Monteiro _

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

Re: [R] Wikibooks

2007-03-30 Thread Alberto Monteiro
DOC~~ # what is this? R> wikiHelp( tkWidgets ) No documentation for 'tkWidgets' in specified packages and libraries: you could try 'help.search("tkWidgets")' R> wikiHelp( seq ) Here it worked as expected. > > The wiki has its own search e

Re: [R] Wikibooks

2007-03-30 Thread Alberto Monteiro
w how to use some function, I can _create_ this page and fill it with my 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 eith

Re: [R] Regarding Vista

2007-03-30 Thread Alberto Monteiro
/UNIX/48_R/02.html, from 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 :-)

Re: [R] Wikibooks

2007-03-30 Thread Alberto Monteiro
asks "how can I open the file CONFIG.SYS", and an evil person replies 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 RSi

[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/ma

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

2007-03-29 Thread Alberto Monteiro
long as I click the OK. However, if I close >> the window (by clicking in the X), R enters 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

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

2007-03-29 Thread Alberto Monteiro
nters into an infinite loop 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

[R] tcltk, tclRequire and Tktable help

2007-03-29 Thread Alberto Monteiro
) library(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/li

Re: [R] Large matrix into a vector

2007-03-28 Thread Alberto Monteiro
ued. > I agree; but for our enlightnment, 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

Re: [R] Large matrix into a vector

2007-03-28 Thread Alberto Monteiro
t(HR[,2]), t(HR[,3]) > ..)? > 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/listinf

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

2007-03-28 Thread Alberto Monteiro
which could be any strings) or the numbers 3 and 0, I would do 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",

[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

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 ___

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

2007-03-23 Thread Alberto Monteiro
> Thanks, this is the only solution 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")

Re: [R] Binary information convert into hexadecimal

2007-03-23 Thread Alberto Monteiro
2^seq(length(x)-1, 0, -1) will be the powers of two 16, 8, 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://st

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

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

2007-03-21 Thread Alberto Monteiro
thing"? > You don't have 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

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

2007-03-21 Thread Alberto Monteiro
rors 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.or

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

2007-03-20 Thread Alberto Monteiro
a way to circumvent this error, by replacing the saveXML line with: sink("test.xml") print(tt) 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://

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

2007-03-20 Thread Alberto Monteiro
Erro em saveXML(tt, file = "test.xml") : nenhum método aplicável para "saveXML" which could translate to Error in saveXML(tt, file = "test.xml") : no method applicable to "saveXML" Alberto Monteiro __ R-help@

Re: [R] Bad points in regression

2007-03-16 Thread Alberto Monteiro
d to mark those points as bad points? names(ll) gives: [1] "coefficients" "residuals" "effects" "rank" [5] "fitted.values" "assign""qr""df.residual" [9] "xlevels&quo

[R] Bad points in regression

2007-03-16 Thread Alberto Monteiro
that 15, 25 and 50 are the indexes of the bad 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

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

2007-03-14 Thread Alberto Monteiro
0) Sanity check: U <- c(-1, 1, 2) all(U > 0) # FALSE U[1] <- 3 all(U > 0) # TRUE 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] How to create a list that grows automatically

2007-03-09 Thread Alberto Monteiro
yArray.add("object1"); > myArray.add("object2"); > > // End of java code > myArray <- vector(length=0) myArray <- c(myArray, "object1") myArray <- c(myArray, "object2") myArray # array with 2 strings Alberto Monteiro ___

Re: [R] Error distribution question

2007-03-08 Thread Alberto Monteiro
our favourite) will allow it. Then you have 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.

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 wo

Re: [R] Generic distributions

2007-03-07 Thread Alberto Monteiro
ions are understood as operations on r.v.'s see 'distrARITH()'; for switching off this warning see '?distroptions' in: print(object) Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailma

[R] Generic distributions

2007-03-06 Thread Alberto Monteiro
the openbugs/winbugs 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 nonsp

Re: [R] Generate random numbers up to one

2007-03-06 Thread Alberto Monteiro
answer was the Dirichlet 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.

[R] Package RODBC

2007-03-06 Thread Alberto Monteiro
this should be the name plan1 <- sqlQuery(channel, sprintf("select * from [%s]", 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

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'

Re: [R] 0 * NA = NA

2007-03-05 Thread Alberto Monteiro
issing value times zero is zero. OTOH, 1/NA is NA, so NA could mean Inf. Maybe binary logic can't adequately handle such ideas :-/ 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 corresp

[R] 0 * NA = NA

2007-03-05 Thread Alberto Monteiro
<- c(1, NA, 1) 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 commente

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

2007-03-05 Thread Alberto Monteiro
<- dat[,2] %% 1 x <- ISOdate(years, months, days) plot(x, y) > Kindly suggest some method by which I can perform my task 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

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

2007-03-02 Thread Alberto Monteiro
lats and lats + dl will require a little bit of calculus... > Russell Senior ``I have nine fingers; you have ten.'' > So do Frodo, Sauron and brazilian president Lula :-) Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list ht

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

2007-03-01 Thread Alberto Monteiro
[,1]^2 + v[,2]^2 + v[,3]^2) # now v is uniformly distributed over the sphere Chol <- 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

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

Re: [R] matrix manipulations

2007-02-28 Thread Alberto Monteiro
t the data100 table, the y values now > take the observation count. The y values should be the same as y. y is a (random) array of integers. Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[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://sta

[R] ts; decompose; plot and title

2007-02-27 Thread Alberto Monteiro
z <- decompose(y) # plot 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

Re: [R] eigenvalue ordering

2007-02-26 Thread Alberto Monteiro
genvalues are detected. So, if you are strict about getting unordered eigenvalues, you must shuffle them :-) 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] 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 eigenval

Re: [R] pdf with an exact size

2007-02-23 Thread Alberto Monteiro
r=c(0,0,0,0)) # reset margins plot(0, xlim=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] pdf with an exact size

2007-02-23 Thread Alberto Monteiro
, 999, 0, 999)) points(c(250, 250, 749, 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.

Re: [R] using "integrate" in a function definition

2007-02-23 Thread Alberto Monteiro
s the case with integrate. For example: fff <- function(x) x integrate(fff, 0, 1) # ok integrate(fff, 0, 1:5) # 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

[R] Worm distribution :-)

2006-10-23 Thread Alberto Monteiro
the real sky 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. A

Re: [R] R tcl/tk

2006-10-23 Thread Alberto Monteiro
ose help pages, after all! Instead of R_HOME, the help page should mention R.home() 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/postin

[R] R tcl/tk

2006-10-23 Thread Alberto Monteiro
ng. Is something missing here in those help pages? 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] I really don't understand functions in R :-)

2006-10-20 Thread Alberto Monteiro
f.n <- n function(x) x^f.n }) f(2) # 8 n <- 2 f(2) # 8 Thanks for the enlightnment :-) 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-p

  1   2   >