similar to: gl() in S -- puzzle

Displaying 20 results from an estimated 30000 matches similar to: "gl() in S -- puzzle"

2011 Apr 11
1
proposal for adapting code of function gl()
Based on a discussion on SO I ran some tests and found that converting to a factor is best done early in the process. Hence, I propose to rewrite the gl() function as : gl2 <- function(n, k, length = n * k, labels = 1:n, ordered = FALSE){ rep( rep( factor(1:n,levels=1:n,labels=labels, ordered=ordered),rep.int(k,n) ),length.out=length ) } Some test results : >
2000 Jul 09
1
minor typos in help pages (PR#598)
Dear R Team, A few monor typos in help pages that I noticed. Thank you very much. Rashid Nassar 1. help(gl) Examples: # First control, then treatment: gl(2,8, label=c("Ctnrl","Treat")) ^^^^ I assume "Cntrl" is meant. ========================================== 2. help(pmatch) Details: The behaviour
2006 Jul 21
1
Parameterization puzzle
Consider the following example (based on an example in Pat Altham's GLM notes) pyears <- scan() 18793 52407 10673 43248 5710 28612 2585 12663 1462 5317 deaths <- scan() 2 32 12 104 28 206 28 186 31 102 Smoke <- gl(2,1,10,labels=c("No","Yes")) Age <- gl(5,2,10,labels=c("35-44","45-54","55-64","65-74","75-84"),
1998 Jan 16
1
data.frame(...) not constructing "1:n" row.names [diff. S <--> R]
[I think Doug Bates has already alluded to this, somewhere..] In R, data.frame( ... ) does not construct row.names whereas in S, it does: R: > data.frame(x=1:2,y=3:4) x y [1,] 1 3 [2,] 2 4 > row.names(data.frame(x=1:2,y=3:4)) NULL S-plus: > data.frame(x=1:2,y=3:4) x y 1 1 3 2 2 4 > row.names(data.frame(x=1:2,y=3:4)) [1] "1" "2"
1999 Apr 23
1
[S] uniroot -- doesn't work recursively
Dear Prof Azzalini, You have an interesting example of recursive use of uniroot(). [re-cited at the end] However, note that R currently has the same problem as S-plus: Uniroot() doesn't work reliably, recursively. When you found it to be better, you were just lucky. The relevant file in R's source, src/main/optimize.c says /* WARNING : As things stand, these routines should
1999 Jun 26
2
What is "..." when it's empty? -- differences to S
i) (function(x, ...) length(...))(1) gives 0 in S (plus 3.4) and an error in R. It also gives an error in Splus 5.0r3. So we could well remain as we are... however ii) (function(x, ...) length(...))(1,2) gives 1 in all dialects of S that I have available. So by my `continuation logic', I'd argue that "i)" above should give 0 (and R and S-plus 5.0r3 behave
1998 Mar 04
1
pretty(.) bug -- fix --> "compatibility" ?
In current versions of R, pretty(333) gives an infinite loop (due to a silent integer overflow in src/appl/pretty.c). I've looked at this problem and also at what S-plus does, (no code there to inspect, just experiments), and then I have fixed pretty.c. I think that it now behaves much more reasonably (both than before and than S / S-plus). The only problem: pretty(.) is not
1998 Jan 23
0
S-Plus graphs to LaTeX picture commands
Well, R ( http://lib.stat.cmu.edu/R/CRAN/ ) has a pictex(..) driver. >>>>> "kjetil" == kjetil halvorsen <kjetil@caoba.entelnet.bo> writes: kjetil> Is there any possibility to write code which ``translates'' kjetil> from splus graphics to latex picture commands? Or somebody has kjetil> written something like that? kjetil> I did
1998 May 06
1
min(numeric(0)) = ? -- proposal for "S incompatible change"
[Same question for max(.), cummin(.) and cummax(.)] In S, S-plus and R, this currently gives NA. I wonder if it wouldn't make more sense to follow common mathematical/logical reasoning here: min { empty set } = +Inf max { empty set } = -Inf (For integers, these would be INT_MAX and INT_MIN, respectively). Maybe this is a real ``first time'': I am proposing a change which
2006 Jul 21
0
[Fwd: Re: Parameterization puzzle]
Bother! This cold has made me accident-prone. I meant to hit Reply-all. Clarification below. -------- Original Message -------- Subject: Re: [R] Parameterization puzzle Date: Fri, 21 Jul 2006 19:10:03 +1200 From: Murray Jorgensen <maj at waikato.ac.nz> To: Prof Brian Ripley <ripley at stats.ox.ac.uk> References: <44C063E5.3020703 at waikato.ac.nz>
2005 Feb 09
2
gl and different number of replications
I am trying to use the function gl (generate levels), and would like to make levels with different number of replications. Does anyone know how to generate different number of replications in each level? Something like: [1] Site1 Site1 Site1 Site1 Site1 Site1 Site1 [8] Site2 Site2 Site2 Site2 Site2 Thanks in advance -- Rog?rio R. Silva MZUSP http://www.mz.usp.br Linux/Debian User # 354364
1999 Jan 20
1
data frames with non-unique row.names
In R and S, the general idea is that data.frames must have unique row.names (aka dimnames(.)[[1]]). Several observations / problems (in R *and* S !). [Example code at the end] 1) Both in S and R, data.frame(..) (and e.g., also cbind(<data.frame>, ..) which dispatches to data.frame()) silently drops the whole row.names and replaces it by "1" "2" ...
2007 Apr 19
4
--skip-gl-yield
Beryl has a --skip-gl-yield ( I think now managed by --force-nvidia, dont really know though), that eases the use of beryl under heavy CPU load. Is this implemented in compiz? Cause compiz is _REALLY_ slow under heavy cpu use for me. Thanks, Joel -------------- next part -------------- An HTML attachment was scrubbed... URL:
1998 Dec 10
3
[R & Unix ..] system("test",...) gives funny results...
[in an attempt to provide system.test <- function(...) { system(paste("test", ...)) == 0 } and then file.exists <- function(file){sapply(file, function(f)system.test("-e", f))} (which would provide S-plus [>= 4.x] compatibility) ] Look at this -- ``the horror'' to me : > (system("test -e /tmp")) sh: test: argument expected [1]
2017 Jan 26
2
RFC: tapply(*, ..., init.value = NA)
On a related note, the storage mode should try to match ans[[1]] (or unlist:ed and) when allocating 'ansmat' to avoid coercion and hence a full copy. Henrik On Jan 26, 2017 07:50, "William Dunlap via R-devel" <r-devel at r-project.org> wrote: It would be cool if the default for tapply's init.value could be FUN(X[0]), so it would be 0 for FUN=sum or FUN=length, TRUE
1998 Mar 25
2
R alpha/beta naming
Read this morning >>> R : Copyright 1998, Robert Gentleman and Ross Ihaka >>> Version 0.61.2 Alpha (March 15, 1998) ----- So, there still is no "R beta" around.... - If I didn't know R, would I use a statistics software, if it was still in alpha testing state? - Is this really what we want to tell people about R? More to the point: I think, we could
1999 Jun 23
1
coercing factors to matrix() --> num/char ? -- inconsistencies|?
The old factor() wars...... {{maybe don't just report that factor()s are broken by design..}} If ff is a factor, e.g., ff <- as.factor(rep(1:2,3)) f2 <- ff; levels(f2) <- c("Lo","Hi") 1) we don't allow {in R as in S-plus 3.x} arithmetic on factors, i.e. 1 + ff gives an error, and I think most of us believe this is as desired. {{if one
2005 Mar 10
1
contrast matrix for aov
How do we specify a contrast interaction matrix for an ANOVA model? We have a two-factor, repeated measures design, with Cue Direction (2) x Brain Hemisphere(2) Each of these has 2 levels, 'left' and 'right', so it's a simple 2x2 design matrix. We have 8 subjects in each cell (a balanced design) and we want to specify the interaction contrast so that: CueLeft>CueRght
2002 Feb 25
1
Wicked3D or 3dfx mini gl drivers
Has anyone gotten these drivers to work with any of their games? I'm trying for Counter-Strike(half-life mod) when i try it just sayes unsupported GL driver, though with the normal "Default" driver i have no problems, other than the lower fps, which the wicked3D drivers will fiks =) I've got all accelerations going for my voodoo banshee card, dri, and all that :D thanks
1999 Jun 29
1
text-plotting math & regular mixed ?
Maybe embarassing, but I can't quickly find out how to do this: Mix expression() text and regular text __in a variable__ for plotting: I can easily do plot(1,type="n",main=expression(paste("Plot of ", x ^ alpha, "; ", alpha==2.3) However, if alpha is really just in a variable, I don't know what to do alpha <- 2.3 ch.a <- format(alpha) and now