similar to: `[` not recognized as a primitive in certain cases.

Displaying 20 results from an estimated 10000 matches similar to: "`[` not recognized as a primitive in certain cases."

2017 Mar 28
2
`[` not recognized as a primitive in certain cases.
?typeof? is your friend here: > typeof(`[`) [1] "special" > typeof(mc[[1]]) [1] "symbol" > typeof(mc2[[1]]) [1] "special" so mc[[1]] is a symbol, and thus not a primitive. - Lukas > On 28 Mar 2017, at 14:46, Michael Lawrence <lawrence.michael at gene.com> wrote: > > There is a difference between the symbol and the function (primitive >
2017 Mar 28
0
`[` not recognized as a primitive in certain cases.
Thank you gents, I overlooked the subtle differences. On Tue, Mar 28, 2017 at 2:49 PM, Lukas Stadler <lukas.stadler at oracle.com> wrote: > ?typeof? is your friend here: > > > typeof(`[`) > [1] "special" > > typeof(mc[[1]]) > [1] "symbol" > > typeof(mc2[[1]]) > [1] "special" > > so mc[[1]] is a symbol, and thus not a
2017 Mar 28
0
`[` not recognized as a primitive in certain cases.
There is a difference between the symbol and the function (primitive or closure) to which it is bound. This: mc2 <- as.call(list(`[`,iris,2,"Species")) Evaluates `[` to its value, in this case the primitive object, and the primitive itself is incorporated into the returned call. If you were to do this: mc2 <- as.call(list(quote(`[`),iris,2,"Species")) The `[` would
2010 May 08
2
apply a function on elements of a list two by two
Dear all, I want to apply a function to list elements, two by two. I hoped that combn would help me out, but I can't get it to work. A nested for-loop works, but seems highly inefficient when you have large lists. Is there a more efficient way of approaching this? # Make some toy data data(iris) test <- vector("list",3) for (i in 1:3){ x <- levels(iris$Species)[i] tmp
2010 Jul 28
1
strange error : isS4(x) in gamm function (mgcv package). Variable in data-frame not recognized???
Dear all, I run a gamm with following call : result <- try(gamm(values~ s( VM )+s( RH )+s( TT )+s( PP )+RF+weekend+s(day)+s(julday) ,correlation=corCAR1(form=~ day|month ),data=tmp) )" with mgcv version 1.6.2 No stress about the data, the error is not data-related. I get : Error in isS4(x) : object 'VM' not found What so? I did define the dataframe to be used, and the
2010 Jun 24
1
Question on WLS (gls vs lm)
Hi all, I understand that gls() uses generalized least squares, but I thought that maybe optimum weights from gls might be used as weights in lm (as shown below), but apparently this is not the case. See: library(nlme) f1 <- gls(Petal.Width ~ Species / Petal.Length, data = iris, weights = varIdent(form = ~ 1 | Species)) aa <- attributes(summary(f1)$modelStruct$varStruct)$weights f2 <-
2010 Jun 21
2
ctree
Hello, This is a re-submittal of question I submitted last week, but haven't rec'd any responses. I need to extract the probabilities used to construct the barplots displayed as part of the graph produced by plot("ctree"). For example, library(party) iris.ct <- ctree(Species ~ . , data = iris) plot(iris.ct) Instead of a simple example with only 4 terminal nodes, my
2018 Jan 31
3
Best practices in developing package: From a single file
On 31/01/2018 6:33 AM, Joris Meys wrote: > 3. given your criticism, I'd like your opinion on where I can improve > the documentation of https://github.com/CenterForStatistics-UGent/pim. > I'm currently busy updating the help files for a next release on CRAN, > so your input is more than welcome. After this invitation I sent some private comments to Joris. I would say his
2011 Nov 18
2
round() ignores missing arguments if it is used inside another function where some arguments are missing.
I have stumbled across some behaviour in R that I really can't place, and that makes coding a bit tricky. I know that I can work around it when explicitly checking for missing arguments, but still... I have two functions. I have a first function based on paste ? ? fun1 <- function(x,y){ ? ? ? print(missing(y)) ? ? ? paste(x,'X',sep=y) ? ? } If I try this function without
2018 Jan 31
1
Best practices in developing package: From a single file
I fully agree with Joris and Hadley on roxygen2. Additionally: I wrote and published my first package before roxygen (or roxygen2) was available. I found editing .Rd extremely terse (especially when code is updated). For example, the fact that there are no spaces allowed between } and { in \param{}{} has hurt my brain quite a few times, especially since R CMD check did not give any useful error
2012 Feb 24
1
function remains loaded in the search space after detaching the package
I ran into some very irritating behaviour I don't understand. Let me illustrate with the package gdata() and the function print.object_size() : > print(object.size(iris),units='Kb') 6.3 Kb > getAnywhere(print.object_size) A single object matching ?print.object_size? was found It was found in the following places registered S3 method for print from namespace utils
2010 Aug 25
1
Change value of a slot of an S4 object within a method.
Dear all, I have an S4 class with a slot "extra" which is a list. I want to be able to add an element called "name" to that list, containing the object "value" (which can be a vector, a dataframe or another S4 object) Obviously setMethod("add.extra",signature=c("PM10Data","character","vector"), function(object,name,value){
2015 Oct 22
3
Changed behaviour when passing a function?
Hi all, When teaching this year's class, I was quite amazed that one of my examples didn't work any longer. I wanted to illustrate the importance of match.fun() with following code: myfun <- function(x, FUN, ...){ FUN(x, ...) } round <- 2 myfun(0.85, FUN = round, digits=1) I expected to see an error, but this code doesn't generate one. It seems as if in the current R
2010 Dec 21
2
Warning message when items of Hmisc are masked by loading a package.
I've noticed that I get a warning message every time a package masks some functions from Hmisc. The warning message says : Warning message: In identical(get(., i), get(., lib.pos)) : ignoring non-pairlist attributes This happens with eg: library(plyr) library(xtable) I think I've seen this passing by before, but I'm not sure any more. Just thought I'd mention it. Cheers Joris
2010 Jun 18
3
Non-procedural access to columns of a matrix
Hi, I would like to have an index for a column in a matrix encoded in a cell of the same matrix. For example: x = matrix(c(11,12,13,1, 21,22,23,3, 31,32,33,2),byrow=T,ncol=4) In this case, column 4 is the index. I then access the column specified in the index by: > for (i in 1:3) print(x[i,x[i,4]]) [1] 11 [1] 23 [1] 32 > > for (i in 1:3) {x[i,x[i,4]] <- x[i,x[i,4]] + 5} > x
2016 Sep 06
2
The use of match.fun
Dear gurus, I was utterly surprised to learn that one of my examples illustrating the need of match.fun() doesn't give me the expected result. center <- function(x,FUN) FUN(x) center(1:10, mean) mean <- 4 center(1:10, mean) Used to give me the error message "could not find function FUN". Now it just works, even though I didn't expect it to. I believe this is at least
2010 Jun 24
2
count data with a specific range
I would like to prepare the data for barplot. But I only have the data frame now. x1=rnorm(10,mean=2) x2=rnorm(20,mean=-1) x3=rnorm(15,mean=3) data=data.frame(x1,x2,x3) If there a way to put data within a specific range? The expected result is as follows: range x1 x2 x3 -10-0 2 5 1 (# points in this
2010 Jun 08
2
Please help me
Dear Mr. or Ms.,   I used the R-software to run the zero-inflatoin negative binomial model (zeroinfl()) .   Firstly, I introduced one dummy variable to the model as an independent variable, and I got the estimators of parameters. But the results are not satisfied to me. So I introduced three dummy variables to the model. but I could not get the results. And the error message is
2011 Feb 04
2
terribly annoying bug with POSIXlt : one o'clock is midnight?
Apparently, as.POSIXlt takes one o'clock as the start of the day : > as.POSIXlt(0,origin="1970-01-01") [1] "1970-01-01 01:00:00 CET" > as.POSIXlt(0,origin="1970-01-01 00:00:00") [1] "1970-01-01 01:00:00 CET" > as.POSIXlt(0,origin="1970-01-01 23:59:59") [1] "1970-01-02 00:59:59 CET" Cheers -- Joris Meys Statistical
2015 Apr 01
4
evaluation in transform versus within
On 01/04/2015 1:35 PM, Gabriel Becker wrote: > Joris, > > > The second argument to evalq is envir, so that line says, roughly, "call > environment() to generate me a new environment within the environment > defined by data". I think that's not quite right. environment() returns the current environment, it doesn't create a new one. It is evalq() that created