Displaying 20 results from an estimated 10000 matches similar to: "Assigning to factor[[i]]"
2024 Nov 25
1
Alternative to some recently changed parts of dates.R and datetime.R
In?function?'Summary.Date'?in?dates.R?,
..1
could?be?used?instead?of
...elt(1L)
In?function?'format.POSIXlt'?in?datetime.R?,
unlist(unclass(x)[1L:3L],?use.names=FALSE)
could?be?used?instead?of
unlist(`names<-`(unclass(x)[1L:3L],?NULL))
Also, the fragment
secs <- x$sec[f0]; secs <- secs[is.finite(secs)]
could be put inside
if(np?>=?1L)
2011 Jan 21
1
match function causing bad performance when using table function on factors with multibyte characters on Windows
[I originally posted this on the R-help mailing list, and it was suggested that R-devel would be a better
place to dicuss it.]
Running ?table? on a factor with levels containing non-ASCII characters
seems to result in extremely bad performance on Windows. Here?s a simple
example with benchmark results (I?ve reduced the number of replications to
make the function finish within reasonable time):
2009 May 26
1
Bug in "$<-.data.frame" yields corrupt data frame (PR#13724)
Full_Name: Steven McKinney
Version: 2.9.0
OS: Mac OS X 10.5.6
Submission from: (NULL) (142.103.207.10)
A corrupt data frame can be constructed as follows:
foo <- matrix(1:12, nrow = 3)
bar <- data.frame(foo)
bar$NewCol <- foo[foo[, 1] == 4, 4]
bar
lapply(bar, length)
> foo <- matrix(1:12, nrow = 3)
> bar <- data.frame(foo)
> bar$NewCol <- foo[foo[, 1] == 4, 4]
2023 Apr 28
2
range() for Date and POSIXct could respect `finite = TRUE`
Hi all,
I noticed that `range.default()` has a nice `finite = TRUE` argument,
but it doesn't actually apply to Date or POSIXct due to how
`is.numeric()` works.
```
x <- .Date(c(0, Inf, 1, 2, Inf))
x
#> [1] "1970-01-01" "Inf" "1970-01-02" "1970-01-03" "Inf"
# Darn!
range(x, finite = TRUE)
#> [1] "1970-01-01"
2006 Jul 14
1
Weird validation problem
I have a field called Fax in my model. I store it as a 10-digit number
with no other characters but I display it as a nicely formatted phone
number. I have a validation on it like this:
validates_format_of :Fax,
:message => ''number should be formatted using (XXX) XXX-XXXX'',
:with => /^\(\d{3}\)\ ?\d{3}-\d{4}$/
If I put 1234567890 (10 digits) in my field, the
2023 Apr 28
1
range() for Date and POSIXct could respect `finite = TRUE`
A tiny nit-pick: Seems to me that end date = NA would mean the event has
not yet ended, whilst Inf would mean that the event is known to never
terminate, ie: an eternal fact, or physical law.
On Fri, Apr 28, 2023 at 10:12?AM Davis Vaughan via R-devel <
r-devel at r-project.org> wrote:
> Hi all,
>
> I noticed that `range.default()` has a nice `finite = TRUE` argument,
> but it
2010 Aug 13
1
RDCOMClient interface - problems setting a variable
I try to produce and modify shapes in a PowerPoint presentation but run into a difficulty setting a variable.
library(RDCOMClient) # load RDCOMClient package
library(SWinTypeLibs) # package SWinTypeLibs from Omegahat to access information about COM libraries
ppt = COMCreate("PowerPoint.Application") # create a ppt COM
ppt[["Visible"]] <- TRUE # set COM
2012 Sep 09
2
mattr_accessor inside a class
Rails extends Ruby with mattr_accessor (Module accessor). As Ruby''s
attr_accessor generates getter/setter methods for instances,
mattr_accessor provide getter/setter methods at the module level. In
below example, you see that mattr_accessor declared in the class
context of LookupContext. It''s declared in class, not module. However,
modules are defined in LookupContext, for
2004 Aug 19
2
proposed change to [.POSIXct
R developers,
The "tzone" attribute is stripped from a POSIXct object when the subscript
command is called ("[.POISXct"). This results in dates being printed in the
locale specific format after a subscript operation is applied to a POSIXct
object which has cause several problems for me in the past.
Here is an example of this problem under R 1.9.1:
> x <-
2014 Mar 05
2
[LLVMdev] [cfe-dev] C++11 reverse iterators (was C++11 is here)
This rule does not seem to be widely followed by Clang today. Looking at
Parser and Sema, many getters (0 argument functions with names matching
/^get[A-Z]/) return mutable references to long-lived objects. Looking
through Decl.h, things are a little different: we rarely return references,
but do frequently return pointers that provide mutable access to contained
objects.
On Tue, Mar 4, 2014 at
2008 Jul 31
2
dput vs unclass to see what a factor really is composed of
I used read.dta() to read in a Stata 9 dataset to R. The "Sex01" variable
takes on two values in Stata: 0 and 1, and it is labeled "M" and "F"
respectively, analogous to an R factor. Thus, read.dta reads it in as a
factor.
Now, I wanted to see what this variable *really* is, in R. For instance,
sometimes R converts a 0/1 variable into a 1/2 variable when it considers
2020 Sep 07
0
Re: [libnbd PATCH 0/3] Improve type-safety of ocaml/golang getters
On Sat, Sep 05, 2020 at 08:40:57PM -0500, Eric Blake wrote:
> Natural fallout after my recent testsuite additions that fixed a
> couple of ocaml bugs in the setters. However, on at least the OCaml
> code, I'm not sure what we should do if a newer libnbd ever returns a
> bit that an older NBD.mli was not expecting at the time the OCaml
> compiler ran (see below). I'm also
2008 May 18
4
[LLVMdev] Opaque type usage to represent foreign types
In my project I have a group of foreign types (C++ classes) that I
want to use, but don't want to represent as structs within LLVM. For
example, for each field in each C++ class I have a setter and getter
function that I'd like to use. The setters and getters are "extern C"
functions to avoid problems with C++'s name mangling.
After going over the documentation it
2010 Apr 18
1
Getter and Setter with non DB property
Hi,
I can''t find how do i created a getter and setter property for a non db
property. what i have done isnt working, i have a cnt mass assign error.
Here is what i''ve done:
attr_accessor :creator_is_participant
def creator_is_participant
@participe
end
def creator_is_participant=(participe)
if participe == true
@participe = true
else
@participe
2006 Jun 01
1
Automatted Getter/Setter
Hey..
So I have a model that has a lot of number fields. Each of these go
through a process when read in and read out to add/remove commas
(between every three numbers) to make them more readable.
The getter I currently have is like this:
def sale_price
Listing.insert_commas(read_attribte (:sale_price))
end
and the setter is:
def sale_price=(price)
write_attribute(:saleprice,
2011 May 26
0
Reference Classes: getter and setter functions/methods and possible shortcuts
Hi everyone,
just wanted to ask what's the smartest/recommended way of defining
getter and setter function *shortcuts* (i.e. something like "[", "[<-")
for Reference Class objects?
Or is it desired to not use this stuff, but define methods like
'obj$getSubset(row=1:3, col=1)' and 'obj$setSubset(value=x)' instead?
I have some example code that might
2024 Jul 14
2
xftrm is more than 100x slower for AsIs than for character vectors
? Fri, 12 Jul 2024 17:35:19 +0200
Hilmar Berger via R-devel <r-devel at r-project.org> ?????:
> This can be finally traced to base::rank() (called from
> xtfrm.default), where I found that
>
> "NB: rank is not itself generic but xtfrm is, and rank(xtfrm(x), ....)
> will have the desired result if there is a xtfrm method. Otherwise,
> rank will make use of ==, >,
2008 Apr 25
3
[ANNOUNCE] Samba 3.2.0pre3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Release Announcements
=====================
This is the third preview release of Samba 3.2.0. This is *not*
intended for production environments and is designed for testing
purposes only. Please report any defects via the Samba bug reporting
system at https://bugzilla.samba.org/.
Please be aware that Samba is now distributed under the version 3
of
2008 Apr 25
3
[ANNOUNCE] Samba 3.2.0pre3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Release Announcements
=====================
This is the third preview release of Samba 3.2.0. This is *not*
intended for production environments and is designed for testing
purposes only. Please report any defects via the Samba bug reporting
system at https://bugzilla.samba.org/.
Please be aware that Samba is now distributed under the version 3
of
2007 Mar 30
1
write attribute coming from where?
There are datatypes that need to be converted back and forth from a
string representation: they need to be parsed both coming from the
database, and coming from elsewhere like views.
Dates are an example, and I recently needed to implement a more
forgiving converter for decimal numbers. So we have here at least two
flows of execution, for example:
post.date = "22-jan-2007"