Displaying 20 results from an estimated 2000 matches similar to: "Stucked with as.numeric function"
2009 Oct 24
6
Working with ListCtrl and ListItem
Hi List,
I''m trying to get my ListCtrl to work. Currently I''ve managed to fill
my ListCtrl with items, but I think it''s not the most beautiful way:
class MyList < Wx::ListCtrl
def initialize(parent, *args)
super(parent, :style => Wx::LC_REPORT|LC_HRULES )
create_layout
fill_list
end
def create_layout
self.insert_column(0, "Name")
2018 May 03
7
length of `...`
Hi,
In some cases the number of arguments passed as ... must be determined
inside a function, without evaluating the arguments themselves. I use
the following construct:
dotlength <- function(...) length(substitute(expression(...))) - 1L
# Usage (returns 3):
dotlength(1, 4, something = undefined)
How can I define a method for length() which could be called directly on
`...`? Or is it an
2020 Mar 12
2
support of `substitute(...())`
Dear R Core Team,
I learnt approx. two years ago in this mailing list that one can use the
following "trick" to get a (dotted pair)list of the ellipsis arguments
inside a function:
`substitute(...())`
Now my problem is that I can not find any occurrence of this call within
the R source - the most frequent solution there is
`substitute(list(...))[-1L] `
I would like to know if:
1)
2020 Nov 20
2
return (x+1) * 1000
And the related:
> f = function() stop(return("lol"))
> f()
[1] "lol"
I have a feeling all of this is just return() performing correctly though.
If there are already R CMD CHECK checks for this kind of thing (I
wasnt sure but I'm hearing from others there may be/are) that may be
(and/or may need to be) sufficient.
~G
On Fri, Nov 20, 2020 at 3:27 PM D?nes T?th
2020 Nov 20
2
return (x+1) * 1000
Without having dug into the details, it could be that one could update
the parser by making a 'return' a keyword and require it to be
followed by a parenthesis that optionally contains an expression
followed by end of statement (newline or semicolon). Such a
"promotion" of the 'return' statement seems backward compatible and
would end up throwing syntax errors on:
2020 Oct 19
2
Is there any way to check the class of an ALTREP?
Benjamin,
You happened to send a link which points to the OP's own package :) I
think Jiefei would like to know how one can "officially" determine if an
arbitrary ALTERP object belongs to a class that he owns.
Regards,
Denes
On 10/19/20 10:22 AM, Benjamin Christoffersen wrote:
> It seems as if you can you use the ALTREP macro as done in this
> package:
2010 Sep 07
3
Help with decimal points
Hi
I have found a little problem with an R script. I am trying to merge some data
and am finding something unusual going on. As shown below I am trying to
assign (MatchedValues[Value2,Value]) to (ClusteredData[k,Value]) which are two
separate dataframes.
1) By the following command you can see that the value im transferring
is 481844.03
> MatchedValues[Value2,Value]
[1] 481844.03
6618
2013 Aug 28
1
named lmer.models in do.call(anova,models)
Hi,
For some reason do.call on anova fails if the models are named lmer objects.
Consider the following example:
library(lme4)
models <- list(
lmer(Reaction ~ Days + (1| Subject), sleepstudy),
lmer(Reaction ~ Days + (Days | Subject), sleepstudy))
#
# models is an unnamed list, do.call works (although with warning):
do.call(anova, models)
#
# after labeling the models, do.call gives an
2017 Dec 11
1
possible bug in utils::removeSource - NULL argument is silently dropped
Dear R-Core Team,
I found an unexpected behaviour in utils::removeSource (also present in
r-devel as of today).
---
# create a function which accepts NULL argument
foo <- function(x, y) {
if (is.null(y)) y <- "default foo"
attr(x, "foo") <- y
x
}
# create a function which utilizes 'foo'
testSrc <- function() {
x <- 1:3
x <- foo(x,
2020 Oct 19
1
Is there any way to check the class of an ALTREP?
Thank Denes for the clarification, glad to see my package got one citation
from my own question:) Also, thank Benjamin
for sending many useful documents.
Actually, the question is related to the SharedObject package that Benjamin
has pointed to. I wanna
avoid sharing an object that has already been shared, so I need to check
whether an object is an ALTREP
that is defined in my package. Since the
2020 May 01
4
Request: tools::md5sum should accept connections and finally in-memory objects
AFAIK there is no hashing utility in base R which can create hash
digests of arbitrary R objects. However, as also described by Henrik
Bengtsson in [1], we have tools::md5sum() which calculates MD5 hashes of
files. Calculating hashes of in-memory objects is a very common task in
several areas, as demonstrated by the popularity of the 'digest' package
(~850.000 downloads/month).
Upon
2020 Oct 06
0
understanding as.list(substitute(...()))
Hi Tim,
I have also asked a similar question a couple of months ago, and someone
else did the same recently, maybe on r-devel.
We received no "official" response, but Deepayan Sarkar (R Core Team
member) claimed that:
"
There is no documented reason for this to work (AFAIK), so again, I
would guess this is a side-effect of the implementation, and not a API
feature you should
2020 Oct 06
3
understanding as.list(substitute(...()))
I probably need to be more specific. What confuses me is not the use
of substitute, but the parenthesis after the dots. It clearly works
and I can make guesses as to why but it is definitely not obvious.
The following function gives the same final result but I can
understand what is happening.
dots <- function (...) {
exprs <- substitute(list(...))
as.list(exprs[-1])
}
In the
2011 Jul 11
4
Save generic plot to file (before rendering to device)
I am looking for a way to save a plot (graphics contents) to a file after the
plot has been calculated but before it has been rendered. More specifically,
assume that I made a plot that took a very long time to produce, I would
like to save this plot to a generic file that I can later, on a different
machine, render to either PDF, PNG, SVG using the usual R graphics devices,
without recalculating
2011 Jul 11
4
Save generic plot to file (before rendering to device)
I am looking for a way to save a plot (graphics contents) to a file after the
plot has been calculated but before it has been rendered. More specifically,
assume that I made a plot that took a very long time to produce, I would
like to save this plot to a generic file that I can later, on a different
machine, render to either PDF, PNG, SVG using the usual R graphics devices,
without recalculating
1998 Oct 16
5
WIN 98 password problem
Hi!
I'm new on the list, so please, be patient with me!
I have a problem for wich I can't find the answer in the FAQ. Until
recently I was running a 16 PC-s network with SCO OpenServer 5.0.4 and
Samba 1.9.16p11 on the server and mixed clients (Win 3.11 to Win 95
OSR2). The users on the network have access to a PUBLIC directory on
they own user directories on the server without
2020 Nov 21
1
return (x+1) * 1000
On 20/11/2020 7:01 p.m., Ben Bolker wrote:
> I may be unusual but I don't find these examples surprising at all/
> I don't think I would make these mistakes (maybe it's easier to make
> that mistake if you're used to a language where 'return' is a keyword
> rather than a function?
>
> My two cents would be that it would make more sense to (1) write
2009 May 15
2
help with as.numeric
hi everyone, wondering if you could help me with a novice problem. I have a
data frame called subjects with a height and weight variable and want to
calculate a bmi variable from the two. i have tried:
attach(subjects)
bmi <- (weight)/((height/100)^2)
but it comes up with the error:
Warning messages:
1: In Ops.factor(height, 100) : / not meaningful for factors
2: In Ops.factor((weight),
2005 Jan 05
3
strange behaviour of negative binomial
Dear list,
I ran into a strange behaviour of the pnbinom function - or maybe I
just made a stupid mistake.
First thing is that pnbinom seems to be very slow. The other - more
interesting one - is that I get two different curves when I plot the
estimated density and the density given by pnbinom. Shouldn't it be the
same?
This is only the case, I think, if I use the parameter size = 1. I
2017 Sep 28
2
Searching for Enumerated Items using str_count() from the stringr package
Hi all,
I have a large number of text strings to search for enumerated items.
However, I am receiving this error message even though I thought that I
properly escaped the special character closed parenthesis:
> Count<-str_count(text3,keywords)
Error in stri_count_regex(string, pattern, opts_regex = opts(pattern)) :
Syntax error in regexp pattern. (U_REGEX_RULE_SYNTAX)
===
Here is