Displaying 20 results from an estimated 10000 matches similar to: "integrating 2 lists and a data frame in R"
2017 Jun 06
4
integrating 2 lists and a data frame in R
Dear Bert,
thank you for your response. here it is the piece of R code : given 3 data
frames below ---
N <- data.frame(N=c("n1","n2","n3","n4"))
M <- data.frame(M=c("m1","m2","m3","m4","m5"))
C <- data.frame(n=c("n1","n2","n3"),
2017 Jun 06
0
integrating 2 lists and a data frame in R
Hi Bogdan,
Kinda messy, but:
N <- data.frame(N=c("n1","n2","n3","n4"))
M <- data.frame(M=c("m1","m2","m3","m4","m5"))
C <- data.frame(n=c("n1","n2","n3"), m=c("m1","m1","m3"), I=c(100,300,400))
2017 Jun 06
2
integrating 2 lists and a data frame in R
> On Jun 6, 2017, at 4:01 AM, Jim Lemon <drjimlemon at gmail.com> wrote:
>
> Hi Bogdan,
> Kinda messy, but:
>
> N <- data.frame(N=c("n1","n2","n3","n4"))
> M <- data.frame(M=c("m1","m2","m3","m4","m5"))
> C <-
2017 Jun 06
1
integrating 2 lists and a data frame in R
Here's another approach:
N <- data.frame(N=c("n1","n2","n3","n4"))
M <- data.frame(M=c("m1","m2","m3","m4","m5"))
C <- data.frame(n=c("n1","n2","n3"), m=c("m1","m1","m3"), I=c(100,300,400))
# Rebuild the factors using M and N
C$m <-
2017 Jun 06
0
integrating 2 lists and a data frame in R
Thank you David. Using xtabs operation simplifies the code very much, many
thanks ;)
On Tue, Jun 6, 2017 at 7:44 AM, David Winsemius <dwinsemius at comcast.net>
wrote:
>
> > On Jun 6, 2017, at 4:01 AM, Jim Lemon <drjimlemon at gmail.com> wrote:
> >
> > Hi Bogdan,
> > Kinda messy, but:
> >
> > N <-
2017 Jun 06
1
integrating 2 lists and a data frame in R
Simple matrix indexing suffices without any fancier functionality.
## First convert M and N to character vectors -- which they should
have been in the first place!
M <- sort(as.character(M[,1]))
N <- sort(as.character(N[,1]))
## This could be a one-liner, but I'll split it up for clarity.
res <-matrix(NA, length(M),length(N),dimnames = list(M,N))
res[as.matrix(C[,2:1])] <-
2017 Jun 06
0
integrating 2 lists and a data frame in R
Reproducible example, please. -- In particular, what exactly does C look ilike?
(You should know this by now).
-- Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Mon, Jun 5, 2017 at 6:45 PM, Bogdan Tanasa <tanasa at gmail.com>
2017 Aug 22
1
Error: mdbox .../storage: Duplicate GUID
Hi!
When I force-resync a mailbox of mine, I see following output:
# doveadm force-resync -u $USER $PATH
doveadm($USER): Warning: mdbox .../storage: Inconsistency in map index ($X,$Y2
!= $X,$Y2)
doveadm($USER): Warning: fscking index file .../storage/dovecot.map.index
doveadm($USER): Warning: mdbox .../storage: rebuilding indexes
doveadm($USER): Error: mdbox .../storage: Duplicate GUID $G in
2011 Dec 28
2
Gale-Shapley Algorithm for R
Dear R-helpers,
I'm not a speciallist in writing complex functions, and the function still
very rusty (any kind of suggestions are very welcome). I want to implement
Gale-Shapley algorithm for R Language. It is based on
http://www.jstor.org/stable/10.2307/2312726 Gale and Shapley (1962) , and it
has evolved to
2010 Dec 29
2
How to create an array of lists of multiple components?
Hi,
how can I create an array of lists of three components?
This approach does not work:
n1 <- 2
n2 <- 4
n3 <- 5
res <- array(rep(vector("list",3), n1*n2*n3), dim = c(n1,n2,n3))
res[1,1,1] # is not a list with three components...
The goal is that res[1,1,1] is a list with three components. Also, appending the
components didn't work. For example, I tried:
component
2010 Jul 05
2
Function to compute the multinomial beta function?
Dear R-users,
Is there an R function to compute the multinomial beta function? That is, the normalizing constant that arises in a Dirichlet distribution. For example, with three parameters the beta function is Beta(n1,n2,n2) = Gamma(n1)*Gamma(n2)*Gamma(n3)/Gamma(n1+n2+n3)
Thanks in advance for any assisstance.
Regards,
Greg
[[alternative HTML version deleted]]
2007 Apr 11
2
sem is not "taking" the model
A strange problem with sem:
I downloaded the sem library and then, I specified my simple measurement model (below). I highlighted it and ran it. It ran, but it did NOT tell me "22 lines read". And nothing works after that - it looks like it runs, but it does not produce anything...
Did I make a mistake somewhere in the model? (notice, TIME has only 1 indicator - t1, and I fixed t1's
2011 Jul 27
3
Reorganize(stack data) a dataframe inducing names
Dear Contributors,
thanks for collaboration.
I am trying to reorganize data frame, that looks like this:
n1.Index Date PX_LAST n2.Index Date.1 PX_LAST.1
n3.Index Date.2 PX_LAST.2
1 NA 04/02/07 1.34 NA 04/02/07 1.36
NA 04/02/07 1.33
2 NA 04/09/07 1.34 NA 04/09/07
2012 Feb 25
5
which is the fastest way to make data.frame out of a three-dimensional array?
foo <- rnorm(30*34*12)
dim(foo) <- c(30, 34, 12)
I want to make a data.frame out of this three-dimensional array. Each dimension will be a variabel (column) in the data.frame.
I know how this can be done in a very slow way using for loops, like this:
x <- rep(seq(from = 1, to = 30), 34)
y <- as.vector(sapply(1:34, function(x) {rep(x, 30)}))
month <- as.vector(sapply(1:12,
2012 Jun 04
1
simulation of modified bartlett's test
Hi, I run this code to get the power of the test for modified bartlett's
test..but I'm not really sure that my coding is right..
#normal distribution unequal variance
asim<-5000
pv<-rep(NA,asim)
for(i in 1:asim)
{print(i)
set.seed(i)
n1<-20
n2<-20
n3<-20
mu<-0
sd1<-sqrt(25)
sd2<-sqrt(50)
sd3<-sqrt(100)
g1<-rnorm(n1,mu,sd1)
g2<-rnorm(n2,mu,sd2)
2008 Dec 10
3
AFR healing problem after returning one node.
I've got configuration which in simple includes combination of afrs and
unify - servers exports n[1-3]-brick[12] and n[1-3]-ns and client got
cluster configuration:
volume afr-ns
type cluster/afr
subvolumes n1-ns n2-ns n3-ns
option data-self-heal on
option metadata-self-heal on
option entry-self-heal on
end-volume
volume afr1
type cluster/afr
subvolumes n1-brick2
2010 Jan 13
4
a question about deleting rows
I have a file like this:
id n1 n2 n3 n4 n5 n6
1 3 4 7 8 10 2
2 4 1 2 4 3 10
3 7 0 0 0 0 8
4 10 1 0 0 2 3
5 11 1 0 0 0 5
what I want to do is: only if n2=0 and n3=0 and n4=0 and n5=0 then delete
the row. how can I do that?
thank you,
karena
--
View this message
2006 Jun 07
2
help with combination problem
hello:
I have 3 data.frame objects.
First df object:
Of dim (149,31). Columns 2:31 are marked as T1..T14
and N1..N16.
Name T1 T2 N1 T3 N2 N3 N4 T4
mu1 10 10 9 10 9 9 8 10
mu2 11 11 9 11 9 9 9 11
...
muN 12 12 9 11 9 9 8 12
Second df object:
of Dim (50000,31). Columns 2:31 are maked as T1...T14
and N1..N16.
2011 Sep 14
1
ruby to solve a physics question
I am trying to solve one of my graduate level physics problems with
ruby...
Here is what I have so far...
a6=0.0
for n1 in -10..10
for n2 in -10..10
for n3 in -10..10
if n1!=0 and n2!=0 and n3!=0
p=Math.sqrt(n1**2+n2**2+n3**2+n1*n2/1.414+n1*n3/1.41+n2*n3/1.414)
a6+=(1/p)**6
end
end
end
end
puts a6
What I''ve got here is a 10x10x10 face-centered
2008 Aug 29
2
Newbie: Examples on functions callling a library etc.
Hello
R is pretty new to me. I need to write a function that returns three
matrices of different dimensions. In addition, I need to call a function
from a contributed package with the function. I have browsed several
manuals and docs but the examples on them are either very simple or
extremely hard to follow.
Many thanks
Ed
[[alternative HTML version deleted]]