Re: [R] continuous coloring of a polygon

2008-08-15 Thread Johannes Hüsing
Am 15.08.2008 um 14:00 schrieb Roger Leenders: I can draw the polygon as above, but I don't know how to do the coloring. It is easy to give the polygon only one color (e.g. through polygon(c(x1,x2),c(y1,y2), col="red")), but I need a way in which to color the polygon such that the color moves

Re: [R] bootstrap confidence bands

2008-08-28 Thread Johannes Hüsing
This is an attempt to an answer to Geertja van der Heijden's question, which seems not to have been answered yet. Your attempt was: >drought <- read.table("D:/drought080525.txt", header=T) >regres <- function(x, indices) { >x <- x[indices,] >coef(lm(x$AGB ~ x$days, weights=x$weights)) >} and

Re: [R] Accumulating results from "for" loop in a list/array

2009-09-11 Thread Johannes Hüsing
Steven Kang schrieb: Dear R users, I would like to accumulate objects generated from 'for' loop to a list or array. To illustrate the problem, arbitrary data set and script is shown below, x <- data.frame(a = c(rep("n",3),rep("y",2),rep("n",3),rep("y",2)), b = c(rep("y",2),rep("n",4),rep("y"

Re: [R] OT Really: Odds Are, It's Wrong...

2010-03-16 Thread Johannes Hüsing
Dieter Menne schrieb: Marc Schwartz-3 wrote: I thought that readers of R-Help might find the following article at ScienceNews of interest: Odds Are, It's Wrong Science fails to face the shortcomings of statistics By Tom Siegfried March 27th, 2010; Vol.177 #7 (p. 26) http://www.scie

Re: [R] Re gression using age and Duration of disease as a continous factors

2009-07-21 Thread Johannes Hüsing
Mehdi Khan schrieb: http://www.amazon.com/gp/product/007310874X/ref=pd_lpo_k2_dp_sr_1?pf_rd_p=304485901&pf_rd_s=lpo-top-stripe-1&pf_rd_t=201&pf_rd_i=0256117365&pf_rd_m=ATVPDKIKX0DER&pf_rd_r=155Y7AP1SHTSJESHM15M This is our textbook for regression analysis. Go through the first 8 or 9 chapters a

Re: [R] unusual result with "any"

2009-11-01 Thread Johannes Hüsing
Erin Hodgess schrieb: xy [1] 0.7305081 2.4224211 str(xy) num [1:2] 0.73 2.42 any(xy) > 1 [1] FALSE Warning message: In any(xy) : coercing argument of type 'double' to logical What am I doing wrong please? xy > 1 should return TRUE FALSE, and you want to appl

Re: [R] Looking for a quick way to combine rows in a matrix

2009-05-12 Thread Johannes Hüsing
jim holtman schrieb: Try this: key <- rownames(a) key[key == "AT"] <- "TA" do.call(rbind, by(a, key, colSums)) something like paste(sort(strsplit(key, split="")[[1]]), "") might be more general. __ R-help@r-project.org mailing list https:/

Re: [R] (no subject)

2009-05-17 Thread Johannes Hüsing
Debbie Zhang schrieb: Dear R users, I incurred some problems with importing data into R. i.e. If I want to import a text file or word file which contains lots of numerical numbers, what function should I use? It does help if you read the posting guide first. In general, the file has to

Re: [R] Finding data association in R

2009-05-18 Thread Johannes Hüsing
Am 19.05.2009 um 05:39 schrieb phen_ys: surgery <- data.frame(outcome = c(0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, + 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0), age = c(50, 50, 51, + 51, 53, 54, 54, 54, 55, 55, 56, 56, 56, 57, 57, 57, 57, 58, + 59, 60, 6

Re: [R] Graphics help

2009-04-16 Thread Johannes Hüsing
Liz Webb schrieb: Hi, I would like to draw a graph as follows: A simplified example is that on the X axis are different countries, I have several temperature measurements taken from each country and would like to plot these linearly above each country. So one would imagine that cold countries

Re: [R] Solving graph theory problems with R ? (minimum vertex cover)

2010-01-11 Thread Johannes Hüsing
Tal Galili schrieb: I just realized (after many discussion with friends), that I might need to solve a (classical) graph theory problem with R. My specific problem is called: Minimum vertex cover for a hypergraph

Re: [R] persp()

2011-08-05 Thread Johannes Hüsing
Am Donnerstag, den 04.08.2011, 02:58 +0200 schrieb Rosario Garcia Gil: > I am trying to draw a basic black and white map of two European countries. > Are you planning just to draw the boundaries? Or what do you mean by "basic black and white". > After searching some key words in google and readi

Re: [R] Thinking about using two y-scales on your plot?

2008-03-25 Thread Johannes Hüsing
I wonder how long it will take until metereologists will see the light. http://www.zoolex.org/walter.html __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting

Re: [R] APPLY as alternate to FOR loop?

2008-04-02 Thread Johannes Hüsing
se apply instead of for when the steps can be performed independently and are parallelizable. By the same token as I use map instead of recursion in Lisp. R is essentially concealed Lisp, or so I'm told. -- Johannes Hüsing There is something fascinating about science.

Re: [R] Multiset Permutations

2008-04-06 Thread Johannes Hüsing
You can use the function permutation from the e1071 package, then library(e1071) multisetperm <- function(multiset) { unique(apply(matrix(multiset[permutations(length(multiset))], ncol=length(multiset)), 1, paste, sep="", collapse="")) } multisetperm(c("0", "0", "1", "2", "2")) > The output wo

Re: [R] Thinking about using two y-scales on your plot?

2008-04-07 Thread Johannes Hüsing
Am 07.04.2008 um 12:24 schrieb Richard Cotton: > > thegeologician wrote: >> >> Of course, these plots could be plotted separately with a common >> x-axis, >> it's just a matter of saving space and of being used to that kind of >> graph. I can't imagine anyone being falsely lead to a thought like

Re: [R] Naming rows oe columns in a data frame.

2008-04-07 Thread Johannes Hüsing
?colnames __ R-help@r-project.org 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] If(cond) statement

2008-04-29 Thread Johannes Hüsing
Beck, Kenneth (STP) <[EMAIL PROTECTED]> [Tue, Apr 29, 2008 at 07:21:40PM CEST]: > mxx=max(cpx_list$nMV); > mxy=max(trend_list$nMV); > if (mxx>mxy) > mxy=mxx > else > mxx=mxy > Can't this be replaced by mxx <- max(c(cpx_list$nMV, trend_list$n

Re: [R] using the sink() function in a for-look

2008-04-30 Thread Johannes Hüsing
uot;, append=TRUE) summary(rnorm(80)) sink()} When you do the following: for (i in 1:100) { summary(rnorm(80))} what output do you get? And all this output is redirected to your file by sink(), so it works as expected. -- Johannes Hüsing There is something fascinating abou

Re: [R] using the sink() function in a for-look

2008-05-01 Thread Johannes Hüsing
Rolf Turner <[EMAIL PROTECTED]> [Thu, May 01, 2008 at 06:59:29AM CEST]: > > On 1/05/2008, at 4:40 PM, Johannes Hüsing wrote: [...] > > > >When you do the following: > > > >for (i in 1:100) { > >summary(rnorm(80))} > > > >what output do y

Re: [R] regular expression question

2008-05-01 Thread Johannes Hüsing
how to use sub to pull out the GGG Doesn't strsplit() help you more easily here? -- Johannes Hüsing There is something fascinating about science. One gets such wholesale returns of conjecture mailto:[EMAIL PROTECTED] from such a trifling i

Re: [R] Matlab user: Octave, scilab or R-project?

2008-05-01 Thread Johannes Hüsing
schoappied <[EMAIL PROTECTED]> [Thu, May 01, 2008 at 06:00:51PM CEST]: > what is a good alternative for matlab? Octave is generally said to be the alternative. -- Johannes Hüsing There is something fascinating about science. One gets such

Re: [R] Categorizing Fonts using Statistical Methods

2008-05-04 Thread Johannes Hüsing
..] > - maybe some other measures If you can obtain the *.afm information of the font, you have some useful parameters such as cap height, ascender height, descender height, oblique angle ... -- Johannes Hüsing There is something fascinating about science.

Re: [R] a repetition of simulation

2007-11-15 Thread Johannes Hüsing
Excuse me, but I think your code deserves some comments. Unfortunately, the history of postings is in reverse order, so I'll address your first question first: > > >>> The simulation looks like this: > > >>> > > >>> z <- 0 > > >>> x <- 0 > > >>> y <- 0 > > >>> aps <- 0 > > >>> tiss <- 0 > > >>> fo

[R] protecting "..."

2007-11-17 Thread Johannes Hüsing
Dear expRts, I just realized that the "..." argument in a function cannot be used without taking precautions sometimes. The following behaviour is what I stumbled upon: > myrepl <- function(length, fun, ...) { + replicate(length, fun(...))} > myrepl(20, sample, 1:5) [1] 0 0 0 0 0 0 0 0 0 0 0 0 0

Re: [R] protecting "..."

2007-11-17 Thread Johannes Hüsing
Duncan Murdoch <[EMAIL PROTECTED]> [Sat, Nov 17, 2007 at 11:56:52PM CET]: > On 17/11/2007 5:04 PM, Johannes Hüsing wrote: > >I just realized that the "..." argument in a function cannot be used > >without > >taking precautions sometimes. The following

[R] "Couldn't find function par"

2007-11-18 Thread Johannes Hüsing
gth(args) == 1) { if (is.list(args[[1]]) | is.null(args[[1]])) args <- args[[1]] else if (is.null(names(args))) single <- TRUE } } value <- if (single) .Internal(par(args))[[1]] else .Internal(par(arg

Re: [R] "Couldn't find function par"

2007-11-18 Thread Johannes Hüsing
Peter Dalgaard <[EMAIL PROTECTED]> [Sun, Nov 18, 2007 at 02:20:14PM CET]: > Johannes HXXsing wrote: [...] > > > >Fehler: konnte Funktion "par" nicht finden > > > >>par > >> > >function (..., no.readonly = FALSE) > > > Hmm, this could happen as a result of calling par() in a startup file >

Re: [R] Packages - a great resource, but hard to find the right one

2007-11-22 Thread Johannes Hüsing
Antony Unwin <[EMAIL PROTECTED]> [Thu, Nov 22, 2007 at 12:43:07PM CET]: > There have been several constructive responses to John Sorkin's > comment, but none of them are fully satisfactory. Of course, if you > know the name of the function you are looking for, there are lots of > ways to sea

Re: [R] Rating R Helpers

2007-12-01 Thread Johannes Hüsing
Mark Kimpel <[EMAIL PROTECTED]> [Sat, Dec 01, 2007 at 05:28:28PM CET]: > What I would find useful would be some sort of tagging system for messages. Hrm. I find tags immensely useful for entities which do not contain primarily text, such as photos. I am at doubt how keywords are important when the

Re: [R] Function for AUC?

2007-12-17 Thread Johannes Hüsing
Armin Goralczyk <[EMAIL PROTECTED]> [Mon, Dec 17, 2007 at 11:07:25AM CET]: [AUC] > > I tried it: > > > y<-c(1,2,3,4,5);x<-c(10,15,10,5,0) Are you sure you don't have x and y wrong? Normally the x values should be monotonically increasing. -- Johannes H�sing There is something fas

Re: [R] Scatterplot Showing All Points

2007-12-17 Thread Johannes Hüsing
Wayne Aldo Gavioli <[EMAIL PROTECTED]> [Tue, Dec 18, 2007 at 02:14:23AM CET]: > Is there anyway to indicate the frequency of such points > on such a graph? Should I be using a different command than "plot"? ?sunflowerplot -- Johannes H�sing There is something fascinating about sci

Re: [R] Randomization tests, grouped data

2008-01-11 Thread Johannes Hüsing
he permutation test just as well. You might save a little bit of computation time by singling these group-preserving permutations out, but this is not worth the while at all. -- Johannes Hüsing There is something fascinating about science. One gets

Re: [R] Proper power computation for one-sided binomial tests.

2008-09-24 Thread Johannes Hüsing
Am 23.09.2008 um 23:57 schrieb Peter Dalgaard: For this kind of problem I'd go directly for the binomial distribution. If the actual probability is 0, this is essentially deterministic and you can look at > binom.test(0,99,p=.03, alt="less") This means that you don't sample from the p=.03

Re: [R] apply

2008-09-26 Thread Johannes Hüsing
Am 27.09.2008 um 05:46 schrieb John Sorkin: Windows XP R 2.7.1 I am trying to use apply (or lapply, sapply) to get the sample function to select 1000 samples of size 10 from c(1,2,3) with probability c(0.1,0.2,0.7), i.e. for (i in 1:1000) { j<-sample(c(1,2,3),10,replace=TRUE,prob=c(0.1,0.2

Re: [R] Sweave-LaTEX question

2008-10-12 Thread Johannes Hüsing
Am 12.10.2008 um 01:39 schrieb Felipe Carrillo: Does LATEX have to be installed on your computer? Not necessarily, but you'd have to have a graphic imagination to get an idea of how your document will look printed on paper. The general idea is that you don't have to (separation of content a

Re: [R] Select only cases with negative values

2008-10-18 Thread Johannes Hüsing
Am 18.10.2008 um 23:03 schrieb Michael Just: Hello, I was wondering if there was a way to only select cases my from data frame that contained a negative value? c<-c(1,2,3,4,5,6,7,8,9,10) d<- c(-1,2,-3,-4,5,6,-7,8,-9,10) f <- cbind(c,d) dat <-data.frame(f) dat.lm <-lm(c~d) If I wanted to onl

Re: [R] Re : Have a function like the "_n_" in R ? (Automatic count function )

2009-02-27 Thread Johannes Hüsing
If you are in the context of a data frame (which is closest to the concept of a "data set" in SAS), the 1:nrow(df) is closest to what you may look for. For instance: data(iris) .n. <- 1:nrow(iris) You may notice that this number is not very idiomatic in R. If you have something like: if(_N_

Re: [R] How to create following chart for visualizing multivariate time series

2008-02-03 Thread Johannes Hüsing
ean http://bp0.blogger.com/_k3l6qPzizGs/RvDVglPknRI/AKo/itlWOvuuOtI/s1600-h/pairwise_kl_window60.png type ?heatmap at the R prompt and proceed from there. Greetings Johannes -- Johannes Hüsing There is something fascinating about science. One gets

Re: [R] writing a function

2008-02-10 Thread Johannes Hüsing
ctors that make explicit looping unnecessary. An error such as yours wouldn't have occurred to a more experienced expRt because indices wouldn't turn up in the code at all: mm <- function(m, n) { a <- array(nrow=m, ncol=n) row(a)+col(a) } Greetings Johannes

Re: [R] [OT] "normal" (as in "Guassian")

2008-03-02 Thread Johannes Hüsing
Am 02.03.2008 um 17:44 schrieb Gabor Csardi: > I'm not a statistician, but do i remember well that among all > distributions with a given mean and variance, the normal distribution > has the highest entropy? This is good enough for me to call it > "normal" There's more. Among all rotation-sym

Re: [R] Formula for Xi

2008-10-31 Thread Johannes Hüsing
Am 30.10.2008 um 16:53 schrieb [EMAIL PROTECTED]: Hallo! "urn:schemas-microsoft-com:office:office" /> [...] [[alternative HTML version deleted]] This is a rare case where I would have liked to see the HTML version in order to see how these tags are interpreted (paragraphs?

Re: [R] alternative way to replicate()

2008-12-05 Thread Johannes Hüsing
Am 03.12.2008 um 09:06 schrieb Liviu Andronic: Dear all, I'm looking for an alternative way to replicate the "2," string for an x number of times, and end up with one string containing "2," x times. I can partly achieve this using replicate(). y <- rep("2,", times=3) y JFTR: replicate() is

[R] random walk w/ reflecting boundary: avoid control construct?

2007-10-24 Thread Johannes Hüsing
Dear expeRts, recently I asked for a nice way to re-program a problem without using control constructs such as "for" or "sapply(1:length(x), ...". Is there a way to program a random walk with a reflecting boundary without resorting to such constructs? A working solution is ranwalk <- function(leng

Re: [R] random walk w/ reflecting boundary: avoid control construct?

2007-10-26 Thread Johannes Hüsing
This is beautiful, thank you! Greetings Johannes __ R-help@r-project.org 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-contai