Displaying 20 results from an estimated 10000 matches similar to: "+= assignment operator"
2007 Nov 07
3
R as a programming language
Greetings -- coming from Python/Ruby perspective, I'm wondering about
certain features of R as a programming language.
Say I have a huge table t of the form
run ord unit words new
1 1 6939 1013 641
1 2 275 1001 518
1 3 3314 1008 488
1 4 14154 1018 463
1 5 2982 1006 421
Alternatively, it
2007 Nov 13
5
How to overload the assignment operator?
Dear all,
what is the proper way to make the assignment operator generic and define methods depending on the class of the assigned value?
Best regards
Jens Oehlschl?gel
P.S. I vaguely remember that this was possible in S+. In R I tried to no avail:
# using this like h<-1:3 gives Error: in `<-.default`(h, 1:3) : invalid (do_set) left-hand side to assignment
2002 Jan 08
6
Subsets without NA
Is there a way of removing all rows with missing values from a data frame?
I usually use
subset(x, var1!="NA")
and repeat for each variable. It would be nice to be able to do it in one
fell swoop. Also, surprisingly, it doesn't always work. Sometimes I'm left
with an empty set even though not all rows have missing values for the
variable.
Cheers,
mikkel
Mikkel Grum,
2009 Sep 27
2
dimension-preserving matrix coersion
i've written a function to coerce a matrix (e.g. from numeric to
logical), but i'd like to know if someone has a more elegant method
for this:
> m <- matrix(c(0, 1, 1, 0), ncol = 2)
> m <- as.logical(m)
> m
[1] FALSE TRUE TRUE FALSE
i'd like 'm' to still be a matrix with the original dimensions. in my
function to do this, i coerce 'm' to a logical,
2010 Mar 10
2
function to create multiple matrices
Hi All,
If given a dataframe (long form) with Year, Species, and Location,
How would I write a function that would create a unique matrix of Species &
Location for each Year?
What I've tried doing is the following:
data #dataframe
dataT<-table(data$Species,data$Location,data$Year) #creates tables of
Species vs Location for each Year
But I'm encountering issues individually
1999 Apr 06
1
One more for the wish list
Having just upgraded to 063.3 reminds me of a wish I have had for a long
time. Could we not have libraries (sorry, packages) other than for the
base distribution in a subdirectory [Rpath]/library/local/ or perhaps
/library/packages.
This tiny change would make administration so much simpler; I could move
all the old packages into the new library in one fell swoop. Granted
it's not hopelessly
2017 Jun 06
0
Subject: glm and stepAIC selects too many effects
More principled would be to use a lasso-type approach, which combines selection and estimation in one fell swoop!
Ravi
________________________________
From: Ravi Varadhan
Sent: Tuesday, June 6, 2017 10:16 AM
To: r-help at r-project.org
Subject: Subject: [R] glm and stepAIC selects too many effects
If AIC is giving you a model that is too large, then use BIC (log(n) as the penalty for adding
2004 Oct 11
1
[LLVMdev] Re: [llvm-commits] CVS: */Makefile.am
On Mon, 11 Oct 2004, John Criswell wrote:
> I believe the two best things that we can do to shorten releases is the
> following:
>
> 1. Re-arrange the LLVM and LLVM-GCC builds to build in one fell swoop.
> I checkout out, I type make, and it all builds. This requires moving
> parts of llvm/runtime into llvm-gcc, or making llvm-gcc an LLVM project,
> or some other approach.
2006 Jun 03
3
Asterisk + PRI Card -> Nortel BCM
Has anyone fed a Nortel BCM from Asterisk?
I'm interested in switching our company over, but don't want to
replace all the handsets in one fell swoop.
I imagine some of the PRI cards can "emulate" a switch?
I'd still like to pass CallerID into the Nortel, etc but all the
external traffic would be VOIP, not TDM.
2006 Jul 27
2
How to get the name of the first argument in an assignment function?
Dear All!
If I pass an object to an assignment function I cannot get it's name by
deparse(substitute(argument)), but I get *tmp* and I found no way to get
the original name, in the example below it should be "va1".
Is there a way?
Thanks,
Heinz
## example
'fu1<-' <- function(var, value) {
print(c(name.of.var=deparse(substitute(var))))}
fu1(va1) <- 3
name.of.var
2005 Jan 06
1
Calculating a table of symbol frequencies
Hello all:
I have a protein sequence alignment in a data frame (align1, 72 x 236),
where each row is a protein and each column a site in the alignment. AA is
vector of amino acid symbols plus "-" (gap). I can calculate amino acid
frequencies at each site by:
>align1.F <- matrix(0,nrow=22,ncol=236,dimnames=list(AA,seq(1:236)))
>for(i in 1:236)
>
2006 Jan 06
2
sudoku
Any doubts about R's big-league status should be put to rest, now that
we have a
Sudoku Puzzle Solver. Take that, SAS! See package "sudoku" on CRAN.
The package could really use a puzzle generator -- contributors are
welcome!
-- David Brahm (brahm at alum.mit.edu)
[[alternative HTML version deleted]]
_______________________________________________
R-packages mailing list
2006 Jan 06
2
sudoku
Any doubts about R's big-league status should be put to rest, now that
we have a
Sudoku Puzzle Solver. Take that, SAS! See package "sudoku" on CRAN.
The package could really use a puzzle generator -- contributors are
welcome!
-- David Brahm (brahm at alum.mit.edu)
[[alternative HTML version deleted]]
_______________________________________________
R-packages mailing list
2011 Dec 19
2
[LLVMdev] Disassembly arbitrary machine-code byte arrays
Hi,
My apologies if this appears to be a very trivial question -- I have
tried to solve this on my own and I am stuck. Any assistance that
could be provided would be immensely appreciated.
What is the absolute bare minimum that I need to do to disassemble an
array of, say, ARM machine code bytes? Or an array of Thumb machine
code bytes? For example, I might have an array of unsigned chars --
how
2006 Apr 28
1
as.character.factor when the factor contains "NA"
as.character.factor contains this line (where cx=levels(x)[x]):
if ("NA" %in% levels(x)) cx[is.na(x)] <- "<NA>"
Is it possible that this is no longer the desired behavior? These
two results don't seem very consistent:
> as.character(as.factor(c("AB", "CD", NA)))
[1] "AB" "CD" NA
> is.na(.Last.value)[3]
[1] TRUE
2005 Jul 06
2
Graphics: calling par(mar) after frame()
The following code produces 6 plots on a page, but the first is
distorted and different from the others:
par(mfrow=c(3,2), las=2)
for (i in 1:6) {
frame()
par(mar=c(7, 7, 1, 1))
axis(2); box(); abline(h=seq(0,1,.5), col=2:4)
}
The first plot's axes are mis-aligned with the plotting area implied
by the box. It seems to be a result of calling par(mar) after frame().
Is this expected
2002 Feb 20
1
Bug in "[<-.matrix"? (Was: Feature Request: "matrix[1:10,1:10, block=F] <- 1:10")
Thanks to David Meyer [david.meyer@ci.tuwien.ac.at] and David Brahm
[brahm@alum.mit.edu] who suggested:
m[ cbind(index.i, index.j) ] <- vals
This works fine for the example I gave.
Unfortunately, this approach doesn't extend to using the row and column
names to make assignments:
> m <- matrix("",ncol=3,nrow=3)
> dimnames(m) <-
2004 Dec 22
2
outer(-x, x, pmin) cannot allocate
R> x <- 0. + 1:8000
R> y <- outer(-x, x, pmin)
Error: cannot allocate vector of size 1000000 Kb
Why does R need to allocate a gigabyte to create an 8000 x 8000 matrix?
It doesn't have any trouble with outer(-x, x, "+"). Thanks.
-- David Brahm (brahm at alum.mit.edu)
Version:
platform = i686-pc-linux-gnu
arch = i686
os = linux-gnu
system = i686, linux-gnu
status =
2006 Aug 18
2
Floating point imprecision in sum() under R-2.3.1?
After upgrading to R-2.3.1 on Linux Redhat, I was suprised by this:
R> x <- c(721.077, 592.291, 372.208, 381.182)
R> sum(x) - 2066.758
[1] 4.547474e-13
Now I understand that floating point arithmetic is not precise, but
1) the result is exactly 0 in R-2.2.1 (patched) on the same machine,
2) .Machine$double.eps = 2.2e-16, so the error seems quite large.
Also note I get the same
2002 Jan 07
1
Is r-announce alive?
I sent a message to <r-announce at stat.math.ethz.ch> last Thursday ("New package:
colSums"), and still haven't seen it echoed on r-help or on the web archive (in
fact there is no r-announce web archive for 2002). Is something broken? Did I
need to use <r-announce at lists.R-project.org> instead?
--
-- David Brahm (brahm at alum.mit.edu)