Displaying 20 results from an estimated 2000 matches similar to: "Question about expand.grid function in R"
2013 Mar 25
2
Faster way of summing values up based on expand.grid
Hello!
# I have 3 vectors of values:
values1<-rnorm(10)
values2<-rnorm(10)
values3<-rnorm(10)
# In real life, all 3 vectors have a length of 25
# I create all possible combinations of 4 based on 10 elements:
mycombos<-expand.grid(1:10,1:10,1:10,1:10)
dim(mycombos)
# Removing rows that contain pairs of identical values in any 2 of
these columns:
mycombos<-mycombos[!(mycombos$Var1
2008 Jun 23
3
expand.grid() function
Hi,
I have one question on expand.grid() function.
When I write following syntax :expand.grid(c("u", "l"), c("u", "l"), c("u", "l")) I get following as desired :
Var1 Var2 Var3
1 u u u
2 l u u
3 u l u
4 l l u
5 u u l
6 l u l
7 u l l
8 l l l
However
2003 May 08
2
Expanding upon expand.grid()
Hello All:
The function expand.grid() does nearly exactly what I want for
permutation tests I wish to carry out, and it does so quickly when the
number is kept small as in the example below:
expand.grid(rep(list(c(-1, 1)), 3))
Var1 Var2 Var3
1 -1 -1 -1
2 1 -1 -1
3 -1 1 -1
4 1 1 -1
5 -1 -1 1
6 1 -1 1
7 -1 1 1
8 1 1 1
Understandably,
2013 Feb 01
2
expand.grid on contents of a list
Hello!
I have a list of variable length. One example is:
X=vector("list",3)
X[[1]]=1:2
X[[2]]=1:2
X[[3]]=1:2
How could I run expand.grid on the elements of X so that the results would
be the same as expand.grid(1:2,1:2,1:2)?
Thank you!
Dimitri
--
Dimitri Liakhovitski
gfk.com <http://marketfusionanalytics.com/>
[[alternative HTML version deleted]]
2006 Jun 22
2
programming advice
Dear R users
I want to compute Kendall's Tau between two vectors x and y.
But x and y may have zeros in the same position(s) and I wrote the
following function to be sure to drop out those "double zeros"
"cor.kendall" <- function(x,y) {
nox <- c()
noy <- c()
#
for (i in 1:length(x)) if (x[i]!= 0 | y[i] != 0)
nox[length(nox)+1]<- x[i]
for (i in
2006 May 25
1
save() saves extra stuff if object is not evaluated
Hi,
it looks like save() is saving all contents of the calling
environments if the object to be saved is *not* evaluated, although it
is not that simple either. After many hours of troubleshooting, I'm
still confused. Here is a reproducible example (also attached) with
output. I let the code and the output talk for itself:
peek <- function(file, from=1, to=500) {
2005 Sep 09
9
adding DNIS digits
Situation:
8 POTS lines, 3 companies, 1 system. Channel banking the POTS lines
onto a T1 thru an ADIT 600.
The only way our carrier will provide DNIS is thru Analog DID #'s.
Anyone know of a piece of hardware that can add DNIS digits to a
particular line?
-Darren
2003 Dec 30
2
Samba 3.0.1 RMP?
Hi All - "i'm new to linux"
My Specs: Suse 9.0 & Windows 2003 Server (PDC)
My needs: authenticating with Windows 2003 Server
My Problem: Samba 2.x.x not working with Windows 2003 Server
(worked with Windows 2000 Server!?)
My Solution: Try Samba 3.0.1...
Unfortunately - I could noy locate a RPM for Samba 3.0.1 so far...
Have any one got any idea where I would be able to
2012 May 14
1
Plot
Hello,
I am trying to make a plot of the rates of an enzyme against three different protein concentrations (there are 45 rates in total and split up into 3 groups of 15, each receiving one of the 3 protein concentrations). When I enter the following code I instead get 3 separate boxplots for each of the three different protein concentrations ...
plot(rate ~ ferm, data=LDH, col=LDH$rate,
2008 Nov 20
4
Dequantizing
I have some data measured with a coarsely-quantized clock. Let's say
the real data are
q<- sort(rexp(100,.5))
The quantized form is floor(q), so a simple quantile plot of one
against the other can be calculated using:
plot(q,type="l"); points(floor(q),col="red")
which of course shows the characteristic stair-step. I would like to
smooth the quantized
2015 Jul 08
1
[Nut-upsuser] Nut-2.7.3 & gcc-3.3.6
Hi Charles,
Yes, it looks like my g++ does contain STL library which might be just my
specific case...
However, as a temporary solution I disabled nutclient in Makefile (please
find the file attached). And nut-2.7.3 can be compiled now.
Thanks,
Sergey
On Wed, Jul 8, 2015 at 4:13 AM, Charles Lepple <clepple at gmail.com> wrote:
> On Jul 6, 2015, at 10:32 AM, Sergey Talchuk
2017 Oct 13
3
v2.2.33 released
try with 2.2.33.1
---Aki TuomiDovecot oy
-------- Original message --------From: Odhiambo Washington <odhiambo at gmail.com> Date: 13/10/2017 10:42 (GMT+02:00) To: Dovecot Mailing List <dovecot at dovecot.org> Cc: dovecot-news at dovecot.org Subject: Re: v2.2.33 released
On 10 October 2017 at 18:28, Timo Sirainen <tss at iki.fi> wrote:
>
2004 Aug 06
3
libshout2 compiling problems under FreeBSD?
Hi,
I couldn't find anything about this subject from archive - are there known
problems with compiling libshout2 under FreeBSD 5.1 or 4.8 (both are up to
date). I downloaded libshout2 latest nightly snapshot and tried to compile
it on 5.0 and then later on 4.8. Both failed (problems were mostly around
sock.c, sock.h, resolver.c - redeclaring and syntax errors). Thinking that
it might be a
2012 Dec 27
0
Suggestion: 'method' slot for expand.grid() (incl. diffs)
Dear expeRts,
The order in which the variables vary in expand.grid() is often unintuitive. I
would like to suggest a 'method' slot for expand.grid() which requires only very
little changes (100% backward compatible) and which allows one to control this
order. Please find attached diffs against R-devel.
Cheers,
Marius
### ./src/library/base/R/expand.grid.R
2003 May 04
1
image of expand.grid
Hi all,
It is not clear to me why this cannot be ploted with image. Any help?
> g <- data.frame(expand.grid(x= 1:5, y= 1:5), z= rnorm(25))
> image(g)
Error in image.default(g) : increasing x and y values expected
> is.list(g)
[1] TRUE
> g$x
[1] 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
> g$y
[1] 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5
>
Thanks in
2008 May 02
2
expand.grid using a repeated vector as a parameter
Hello.
I'm trying to do this (not necessarily 0:1) :
expand.grid ( 0:1, 0:1, 0:1, 0:1, 0:1)
etc..etc.
but I want to have control over how many 0:1 are included.
Any ideas please ?
Thankyou.
Simon Parker
Imperial College
---------------------------------
A Smarter Email.
[[alternative HTML version deleted]]
2009 Jul 11
1
Conditional expand.grid()
Hello my R buddies,
I'm trying to generate a bivariate data.frame with the elements of
first row greater than the second row. The more complicated method
that I can think of is:
n <- 10
temp <- expand.grid(1:n,1:n)
temp<-temp[temp[,1]>temp[,2],]
However, I guess there must be some easier way of doing this. Besides,
if inequality condition is applied at the very
2009 Dec 15
1
expand.grid applied to a matrix
Dear R gurus,
I'm looking for a way to expand a matrix to a data frame as detailed below:
given a Matrix M with attribute dimnames=list(c("a","b"),c("u","v")), return
a data frame df.M with
df.M$row df.M$col df.M$val
"a" "u" M["a","u"]
"b" "v"
2012 Mar 15
1
expand.grid using a matrix and a vector as input
Hello R-users,
I have the following question, for which my search did not really return any usable result.
If I have a matrix a1, and a vector a2 like below
a1<-matrix(c(1:4),2,2)
a2<-c(8,9)
is there any function like the expand.grid (or some clever calling of the function) such that it outputs a matrix or dataframe where the entire a1 matrix is repeated for each value of a2 (the
2012 Mar 24
2
expand.grid (the half!)
Dear all,
I am using expand.grid for calculating all the possible values between four pairs.
I would like to ask you if it is possible to filter the result out, so to keep all unique pairs. In my algorithm the input c(1,2) produces the same results as the c(2,1)
so for example in the following code below
> expand.grid(c(1,2,3),c(1,2,3))
Var1 Var2
1 1 1
2 2 1
3 3 1
4