Hi,
I have a huge list. Normally it is sorted, but I want to be able to
add elements to it without having to use any special interfaces and
then sort it on demand. My idea is to use something like weak
references combined with attributes. Consider:
# Initialization.
l = as.list(1:10)
# N
RUE
>
>
> > x$getData()
>
>
> [1] 1 2 4 5 8 9
>
>
> > x
>
>
> Reference class object of class "sortedNumeric"
>
>
> Field "fData":
>
>
> [1
TRUE
> > }
> > ))
> >
> > Use it as:
> >
> >> x <- SortedNumeric$new()
> >> x$appendData(c(4,2,5))
> >> x$appendData(c(1,8,9))
> >> x
> > Reference class object of class "sortedNumeric"
> >
I have a matrix of lists. Something along the lists of (but much
bigger than):
x = array(dim=c(2, 2), data=list())
x[1,1] = list(1:5)
x[2,1] = list(6:9)
x[1,2] = list(10:13)
x[2,2] = list(14:16)
Each list contains a number of observations/ground truth for a
particular state. That is,
On Sat, 30 Jul 2016 19:28:42 +0200,
Bert Gunter wrote:
> Bottom line: No, I dont see any vectorized way to do this.
>
> However, the following may offer some slight improvement over your approach.
>
> 1. Why do you need to store these as arrays, which are merely vectors
> with a "dim" attribute?
On Sat, 30 Jul 2016 20:35:40 +0200,
Jeff Newmiller wrote:
>
> >> [1] TRUE FALSE TRUE FALSE ## NOT c(T,F,T,F)
> >
> >I'm not sure what you mean by NOT here. You get the same answer as I
> >do, as far as I can see.
> >
>
> # valid R
> T <- FALSE
> # invalid R
> TRUE <- FALSE
>
> It is much muc
Hi,
I'm using R version 3.1.1 on Debian via the CRAN repositories.
Consider the following MWE that writes a data.frame out to a file and
reads it back in (note that one of the strings contains a double
quote):
> write.table(data.frame(a=1:3, b=c("a", "b\"b", "c")), '/tmp/a',
row.names=FALSE,
At Thu, 27 Dec 2012 15:38:08 -0500,
Sam Steingold wrote:
> so,
> 1. is there a way for a function to modify a global variable?
Use <<- instead of <-.
> 2. how would you vectorize this loop?
This is hard. Your function has a feedback loop: an iteration depends
on the previous iteration's result.
Hi, Ivo,
At Fri, 28 Dec 2012 16:34:03 -0800,
ivo welch wrote:
> so, it isn't obvious to me how I get to the try-error object
> list, or how to find out what triggered the abort.
A try object is an object that captures the execution context at the
time of an error. Consider the following code:
At Sun, 30 Dec 2012 18:26:45 +0800 (CST),
meng wrote:
>
> hi all:
> Here's a dataframe(dat) and a vector(z):
>
> dat:
> x1 x2x3
> 0.2 1.2 2.5
> 0.5 2 5
> 0.8 3 6.2
>
> > z
> [1] 10 100 100
>
> I wanna do the following:
> 10*x1,100*x2,1000*x3
>
> My solution is us
ou mean multiplied by element.
Here's a better solution using t to transpose the matrix:
dat=data.frame(x1=1:3, x2=11:13)
as.matrix(dat)
x1 x2
[1,] 1 11
[2,] 2 12
[3,] 3 13
t(as.matrix(dat)) * c(2, 3)
[,1] [,2] [,3]
x1246
x2 33 36 39
>
> Andrius
>
At Mon, 31 Dec 2012 12:13:43 +0200,
catalin roibu wrote:
>
> Dear R users,
> I want to group numerical values in classes with different size and count
> the values for each classes.
>
> My data is in this forma:
> d 15 12,5 30,4 20,5 80,4 100,5 8,2 40,5 33 21 11
> And I want the group
At Mon, 31 Dec 2012 15:38:10 -0500,
Stephen P. Molnar wrote:
> The current version of R that is available in Wheezy is 2.15.1. However,
> version 2.15.2 is available at CRAN sites.
> ...
> My question is what should be the format of the line in the sources.lists?
Here's what I have:
deb http:/
At Mon, 31 Dec 2012 22:25:25 +,
Muhuri, Pradip (SAMHSA/CBHSQ) wrote:
> The issue is that, for Utah, I am getting an instead of (42,48.7] in the
> ob_mrj_cat column.
The problem is likely due to comparisons of floating point numbers.
Try moving your lower and upper bounds out a tiny bit. Whe
At Tue, 1 Jan 2013 02:00:14 +,
Muhuri, Pradip (SAMHSA/CBHSQ) wrote:
> Although David's solution (putting the right parenthesis, which I had missed)
> has resolved the issue, I would like to try yours as well.
>
> Could you please clarify the six elements: c(-1e-8, 0, 0, 0, 0, 1e8)?
It's a v
At Fri, 4 Jan 2013 17:17:40 +0530,
Christofer Bogaso wrote:
>
> Hello again,
>
> Let say I have 2 matrices which equal number of columns but different
> number of rows like:
>
> Mat1 <- matrix(1:20, 4, 5)
> Mat2 <- matrix(1:25, 5, 5)
>
> Now for each column 1-to-5 I need to fetch the correspond
At Fri, 15 Mar 2013 09:22:15 -0400,
Amir wrote:
> I have two sets T1={c1,c2,..,cn} and T2={k1,k2,...,kn}.
> How can I find the sets as follow:
>
> (c1,k1), (c1,k2) ...(c1,kn) (c2,k1) (c2,k2) (c2,kn) ... (cn,kn)
I think you are looking for expand.grid:
expand.grid(1:3, 10:13)
Var1 Var2
1
17 matches
Mail list logo