search for: an

Displaying 20 results from an estimated 1135 matches for "an".

Did you mean: and
2010 Jul 29
1
Using 'dimname names' in aperm() and apply()
I think that the "dimname names" of tables and arrays could make aperm() and apply() (and probably some other functions) easier to use. (dimname names are, for example, created by table() ) The use would be something like: -- x <-table( from=sample(3,100,rep=T), to=sample(5,100,rep=T)) trans <- x / apply(x,"from",sum) y <-...
1999 Nov 11
2
dimname'less array breaks apply (PR#318)
<<insert bug report here>> > apply(array(1:20,c(2,2,5)),2:3,function(x) x) Error: length of dimnames must match that of dims > Changing: dimnames = if (is.null(dn.ans)) list(ans.names, NULL) else c(list(ans.names), dn.ans) To: dimnames = if (length(dn)==0) NULL else if (is.null(dn.ans)) list(ans.names, NULL) else c(list(ans.names), dn.ans) seems to fix this. Chuck Berry --please do not edit the information below-- V...
2005 Aug 22
2
problem building dendrograms to use with heatmap()
Hi, I'm trying to build dendrograms to pass to heatmap(). The dendrograms I build plot properly, but when I pass them to heatmap() I get the error message "row dendrogram ordering gave index of wrong length" (see output log below). I looked in the code of heatmap() and saw that the error was due to a NULL return value from order.dendrogram(), which in turn got a NULL return value from unlist(). But I have no idea why unlist() is returning NULL. I've included code below which reproduces the problem and below that the output from a run of that code on my comp...
2011 Sep 09
4
Very simple question about list components
I have a list 'ans' from the following code: tt <- rnorm(50) rr <- rnorm(50) ans <- lm(rr~tt) ans[1] is "$coefficients", ans[2] is "$residuals", ans[3] is "$effects", ... and so on up to ans[12]. Is there an easy way to display just these names and not the data they conta...
2020 Aug 14
0
Bug in stats:::`[.formula`: (~ NULL)[2] gives Error ... missing value where TRUE/FALSE needed
Hi, it looks like: > stats:::`[.formula` function (x, i) { ans <- NextMethod("[") if (length(ans) == 0L || as.character(ans[[1L]])[1L] == "~") { class(ans) <- "formula" environment(ans) <- environment(x) } ans } <bytecode: 0x556688d87cc0> <environment: namespace:stats> doesn't...
2007 May 23
1
Readline - wait for user input
Hi, I've seen various posts on this question, but still can't get the code right. If I run the following code one line at a time, it works fine. If I run it together as a block, however, it doesn't wait for the input and gives an error. There must be a way to have are pause/wait for an answer, but I can't seem to find it. Thanks! J Co...
2004 Jan 12
1
question about how summary.lm works
...$qr[p1, p1, drop = FALSE]) se <- sqrt(diag(R) * resvar) I'm hoping somebody could explain the logic of these to steps or alternatively point me in the direction of a text that will explain these steps. In particular I'm puzzled what is the relationship between QR factorization and the cholesky factorization such that one can give a (sort of ) R matrix as a parameter of chol2inv(). I say sort of R matrix as the matrix generated by Qr$qr[p1, p1, drop = FALSE] has a lower triangle with non zero entries although the upper triangle corresponds to the values in the R matrix....
2011 Oct 05
4
SPlus to R
I'm trying to convert an S-Plus program to R.  Since I'm a SAS programmer I'm not facile is either S-Plus or R, so I need some help.  All I did was convert the underscores in S-Plus to the assignment operator <-.  Here are the first few lines of the S-Plus file:   sshc _ function(rc, nc, d, method, alpha=0.05, p...
2011 Mar 10
3
lattice xscale.components: different ticks on top/bottom axis
Good afternoon, I am trying to create a plot where the bottom and top axes have the same scale but different tick marks. I tried user-defined xscale.component function but it does not produce desired results. Can anybody suggest where my use of xscale.component function is incorrect? For example, the code below tries to create a plot where horizontal axes lim...
2004 Feb 11
1
.Call setAttrib(ans,R_DimSymbol,dim); Crashes.
Hi! I want to return a matrix. The code does the R interfacing. This version does it fine. SEXP ans,dim; PROTECT(ans = NEW_NUMERIC(count*2)); memcpy(NUMERIC_POINTER(ans),result,count*sizeof(double)); memcpy(&(NUMERIC_POINTER(ans)[count]),occur,count*sizeof(double)); /** PROTECT(dim=NEW_INTEGER...
2005 Jun 01
2
A suggestion to improve ifelse behaviour with vector yes/noarguments
> Thomas Lumley wrote: > > On Tue, 31 May 2005, Duncan Murdoch wrote: > > > > > >>M??kinen Jussi wrote: > >> > >>>Dear All, > >>> > >>>I luckily found the following feature (or problem) when tried to > >>>apply > >>>ifelse-function to an ordered data. > >...
2007 Dec 11
0
holidayNYSE missing some
John Putz wrote: > Thanks. > > */ > email: /**/johnputz3655@yahoo.com/* <mailto:johnputz3655@yahoo.com> > */home: 206-632-6522 > cell: 206-910-5229/* > > > ----- Original Message ---- > From: Joe W. Byers <ecjbosu@aol.com> > To: John Putz <johnputz3655@yahoo.com> > Cc:...
2004 May 10
7
strange behavior of names<-
Dear R-help, I've encounter what seems to me a strange problem with "names<-". Suppose I define the function: fun <- function(x, f) { m <- tapply(x, f, mean) ans <- x - m[match(f, unique(f))] names(ans) <- names(x) ans } which subtract out the means of `x' grouped by `f' (which is the same as, e.g.,...
2004 Aug 30
0
small bug in apply() ??? (PR#7205)
System: R 1.9.1 on Windows 2000. Description of problem: So far as I can tell, this occurs only when using apply() on an array of dimension >=3 AND when for each iteration the function returns a named vector of length >=2. I propose the source of the bug and the fix below, but let me stick to the facts first. Here is an example: >a<-array(1:24, dim=2:4) &g...
2008 Apr 15
1
by inconsistently strips class - with fix
summary: The function 'by' inconsistently strips class from the data to which it is applied. quick reason: tapply strips class when simplify is set to TRUE (the default) due to the class stripping behaviour of unlist. quick answer: This can be fixed by invoking tapply with simplify=FALSE, or changing tapply to use do.call(c instead of unlist executable example: mytimes=data.frame(date = 1:3 + Sys.time(), set = c(1,1,2)) by(mytimes$date, mytimes$set, function(x)x) INDICES: 1 [1] "2008-04-15 11:41:38 BST"...
2007 Jun 18
1
Readline
Hello, I also have problems to get to run the following lines. If I run the block instead of every single line, it simply does not wait for the input. Can anybody help me? ------------------------ pos_name <- readline("Please type: ") r <- substr(pos_name, 1,1) c <- substr(pos_name, 2,nchar(pos_name)) ------------------------ Thank you! Antje Peter Dalgaard schrieb: > > Forest Floor wrote: >> >> Hi, >&...
2008 Jul 07
2
A shorter version of ".Last.value"?
Hi, There is an object, ".Last.value" to which the result of the most recent evaluation is assigned. This is similar to "ans" in Matlab. In Matlab "ans" can be very useful and time-saving, but typing the larger R version is somewhat clunky and takes away from the usefulness. Is...
2014 Jun 24
2
using C code to create data frame but always return as list
there is my code,  expect return value  is a data frame but R say it is list: SEXP Julia_R_MD_NA_DataFrame(jl_value_t* Var) {  SEXP ans,names,rownames;  char evalcmd[4096];  int i;  const char* dfname="DataFrameName0tmp";  jl_set_global(jl_main_module, jl_symbol(dfname), (jl_value_t*)Var);  //Get Frame cols   sprintf(evalcmd,"size(%s,2)",dfname);  jl_value_t* cols=jl_eval_string(evalcmd);  int collen=jl_unbox_l...
2004 Aug 05
8
or of a logical vector
Is there some fast (built-in?) way to get the OR of all the elements in a logical vector? In other words, is there some fast (built-in) version of the function vor below? Thanks. -Ben vor <- function(v) { ans <- v[1] if (length(v) > 1) for (i in 2:length(v)) ans <- ans | v[i] ans }
1998 Apr 02
1
attributes now inherited
Hi R-Developers, After my message about a month ago concerning attributes being lost during simple operations, Martin Maechler invited me to fix the code if I was in a hurry (especially for attributes in general). We've just made the following changes here, which appear to implement the rules in the Blue Book (pg. 257) Enclosed is the output from "diff -c" from /R-0.61.1/src for: main/arithmetic.c (calls my new routine based on Blue Book rules) main/attrib.c (I added a new routine: copyMostAttrib) main/complex.c (calls my ne...