Displaying 20 results from an estimated 2000 matches similar to: "names<- appears to copy 3 times?"
2016 Apr 05
1
Assignment operator and deep copy for calling C functions
Hi All,
i have a problem in understanding what the assignment operator '<-' really is doing.
If i create two numeric arrays in R and copy one into the other with '<-' and
afterwards change one array by calling a C function, both arrays are changed!
The problem I am facing can easily be seen in the following example:
(The following R code and the C function is attached and
2010 Nov 23
1
Possibility for memory improvement: x <- as.vector(x) always(?) duplicates
Hi,
I've noticed that as.vector() always allocates a new object, e.g.
> x <- 1:10;
> x <- as.vector(x);
> tracemem(x);
[1] "<0x0000000005622db8"
> x <- as.vector(x);
tracemem[0x0000000005622db8 -> 0x0000000005622ec0]: as.vector
> x <- as.vector(x);
tracemem[0x0000000005622ec0 -> 0x0000000005622f18]: as.vector
> x <- as.vector(x);
2012 Jul 12
2
Understanding tracemem
Hi all,
I've been trying to get a better handle on what manipulations lead R
to duplicate a vector, creating small experiments and using tracemem
to observe what happens (all in 2.15.1). That's lead me to a few
questions, illustrated using the snippet below.
x <- 1:10
tracemem(x)
# [1] "<0x1058f8238>"
x[5] <- 5
# tracemem[0x1058f8238 -> 0x105994ab0]:
x[11] <-
2016 Aug 05
2
Extra copies of objects in environments when using $ operator?
My understanding is that R will not make copies of lists if there is
only one reference to the object. However, I've encountered a case
where R does make copies, even though (I think) there should be only
one reference to the object. I hope that someone could shed some light
on why this is happening.
I'll start with a simple example. Below, x is a list with one element,
and changing that
2006 Mar 02
5
Deparsing '...'
Hi,
The following function works, but is there a neater way to write it?
f = function(x,...)
{
# return a character vector of the arguments passed in after 'x'
gsub("
","",unlist(strsplit(deparse(substitute(list(...))),"[(,)]")))[-1]
}
> f(x,a,b,c*d)
[1] "a" "b" "c*d"
>
Thanks.
[[alternative HTML
2009 Aug 27
1
[Fwd: Re: Video demo of using svSocket with data.table]
Forwarded to R-Help, because I think it could interest people following
this thread. Clearly, RServe and svSocket have different goals and very
little overlap.
Best,
Philippe
-------- Original Message --------
Subject: Re: Video demo of using svSocket with data.table
Date: Wed, 26 Aug 2009 20:34:19 +0100
From: Matthew Dowle <mdowle at mdowle.plus.com>
Reply-To: Matthew Dowle
2006 Jul 31
5
use tracemem to dump content in function read/write
Hi Expert
I want to use dtrace to monitor the content change of one file. I made following scripts,
#!/usr/sbin/dtrace -s
inline int MYPID = $1;
syscall::write:entry
/pid == MYPID/
{
tracemem(arg1, arg2);
printf("\n");
}
It always has an following error
bash-3.00$ sudo dumpFIFO.dtrace 3836
dtrace: failed to compile script ./dumpFIFO.dtrace: line 19: tracemem( ) argument #2
2005 Dec 09
3
[R] data.frame() size
Hi,
Please see below for post on r-help regarding data.frame() and the
possibility of dropping rownames, for space and time reasons.
I've made some changes, attached, and it seems to be working well. I see the
expected space (90% saved) and time (10 times faster) savings. There are no
doubt some bugs, and needs more work and testing, but I thought I would post
first at this stage.
Could some
2012 Apr 14
1
deep copy?
Is putting a variable into a list a deep copy (and is tracemem the
correct way to confirm)?
warmstrong at krypton:~/dvl/R.packages$ R
> x <- rnorm(1000)
> tracemem(x)
[1] "<0x3214c90>"
> x.list <- list(x.in.list=x)
tracemem[0x3214c90 -> 0x2af0a20]:
>
Is it possible to put a variable into a list without causing a deep
copy (i.e. if you _really_ want the
2004 Nov 26
2
Tcl error - brace in argument?
Hi all,
Does anyone know a solution for this error ?
> tkwidget(dlg, "iwidgets::spinint", range="{0 23}")
Error in structure(.External("dotTclObjv", objv, PACKAGE = "tcltk"), class =
"tclObj") :
[tcl] wrong # args: should be ".31.1.19 configure -range {begin
end}".
Thanks,
Matthew
[[alternative HTML version
2006 Jun 29
2
tracemem() not exactly what I had in mind
I was trying to use tracemem to look at mblk contents. First, I tried to use
mblk->b_wptr - mblk->b_rptr as the size, and was told that it had to be a
constant. Foo. (RFE #1).
Then, I tried to use 8 as the size, and kept getting decimal numbers printed.
Stumbled on #pragma D option rawbytes=true (is the =true necessary, btw?) and
that didn''t help.
Then, in desperation, I
2008 Feb 26
11
Is there way to trace memory in the dtrace ?
N_conreq:entry {
self->x=1;
calledaddr=(struct xaddrf *)arg3;
callingaddr=(struct xaddrf *)arg4;
trace(calledaddr->link_id);
tracemem(calledaddr->DTE_MAC.lsap_add, 80);
trace(callingaddr->link_id);
tracemem(callingaddr->DTE_MAC.lsap_add, 80);
}
0 -> N_conreq 255
2005 Dec 08
2
data.frame() size
Hi,
In the example below why is d 10 times bigger than m, according to
object.size ? It also takes around 10 times as long to create, which fits
with object.size() being truthful. gcinfo(TRUE) also indicates a great deal
more garbage collector activity caused by data.frame() than matrix().
$ R --vanilla
....
> nr = 1000000
> system.time(m<<-matrix(integer(1), nrow=nr, ncol=2))
[1]
2006 May 23
4
Avoiding a memory copy by [[
Hi,
n = 10000000
L = list(a=integer(n), b=integer(n))
L[[2]][1:10] gives me the first 10 items of the 2nd vector in the list L.
It works fine. However it appears to copy the entire L[[2]] vector in
memory first, before subsetting it. It seems reasonable that "[[" can't
know that all that is to be done is to do [1:10] on the result and therefore
a copy in memory of the entire
2012 Mar 14
3
merge bug fix in R 2.15.0
Is it intended that the first suffix can no longer be blank? Seems to be
caused by a bug fix to merge in R 2.15.0.
$Rdevel --vanilla
DF1 = data.frame(a=1:3,b=4:6)
DF2 = data.frame(a=1:3,b=7:9)
merge(DF1,DF2,by="a",suffixes=c("",".1"))
Error in merge.data.frame(DF1, DF2, by = "a", suffixes = c("", ".1")) :
there is already a column
2019 Feb 18
2
Error in rbind(info, getNamespaceInfo(env, "S3methods"))
Dear all,
I'm experiencing an unusual installation error for one package. Could
anyone suggest how I can best investigate this from here please? I'm sorry
this isn't very much to go on. Hopefully someone can point me in the right
direction.
The problem seems to be my library. It is large (3,418 packages) and I'd
like to avoid rebuilding it, if possible. All packages are up to
2009 Apr 21
1
Closed-source non-free ParallelR ?
Dear R-devel,
REvolution appear to be offering ParallelR only when bundled with their R Enterprise edition. As such it appears to be non-free and closed source.
http://www.revolution-computing.com/products/parallel-r.php
Since R is GPL and not LGPL, is this a breach of the GPL ?
Below is the "GPL and ParallelR" thread from their R forum.
mdowle > It appears that ParallelR
2010 Aug 09
2
coef(summary) and plyr
Dear all,
I?m having trouble getting a list of regression variables back into a dataframe.
mydf <- data.frame(x1=rnorm(100), x2=rnorm(100), x3=rnorm(100))
mydf$fac<-factor(sample((0:2),replace=T,100))
mydf$y<- mydf$x1+0.01+mydf$x2*3-mydf$x3*19+rnorm(100)
dlply(mydf,.(fac),function(df) lm(y~x1+x2+x3,data=df))->dl
here I?d like to use
ldply(dl,coef(summary)) or something
2010 Mar 05
1
Suggestion to add crantastic to resources section on posting guide
Under the "further resources" section I'd like to suggest the following
addition :
* http://crantastic.org/ lists popular packages according to other users
votes. Consider briefly reviewing the top 30 packages before posting to
r-help since someone may have already released a package that solves your
problem.
Thats just a straw man idea so I hope there will be answer, or
2012 Feb 27
1
Identical copy of base function
Hello,
Regarding this in R-devel/NEWS/New features :
o ?library(pkg)? no longer warns about a conflict with a function from
?package:base? if the function is an identical copy of the base one but
with a different environment.
Why would one want an identical copy in a different environment? I'm
thinking I may be missing out on a trick here.
Matthew