similar to: using contents of one column to direct addition of new rows in dataframe

Displaying 20 results from an estimated 10000 matches similar to: "using contents of one column to direct addition of new rows in dataframe"

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
2017 Jan 24
3
Convertir programa Matlab a R sacado de Threshold Models of Collective Behavior de Michèle Lai & Yann Poltera
Estimados Usuarios-R: Estoy convirtiendo un programa en Matlab a R. El original lo saqu de: Lai, M., & Poltera, Y. (2009). Lecture with computer exercises: Modelling and simulating social systems with matlab. Tech. rep., Swiss Federal Institute of Technology (December 2009). 27. Ahora estoy convirtiendo la siguiente funcin: function sizes = gridsizes(N,varargin) % gridsizes(N) calculates
2012 Dec 04
1
Solve system of equations (nleqslv) only returns origin
I'm solving 4 complex equations simultaneously. Code is below. The code returns only zero's for the solution though there should also be a non-zero result. I'm pretty confident that the equations are correct because they are straight from a published paper and I checked them pretty thoroughly. The parameter values I used are from the published paper as well. Any suggestions for how
2010 Jul 24
1
Doubt about a population competition function
Hi, I'm doing a function that describe two populations in competition. that's the function that i wrote: exclusao<-function(n10, n20, k1, k2, alfa, beta, t){ n1<-k1-(alfa*n20) n2<-k2-(beta*n10) if(t==0){plot(t, n10, type='b', xlim=range(c(1:t),c (1:t)), ylim=range(n10, n20), xlab='tempo', ylab='tamanho populacional') points(t, n20, type='b',
2003 Mar 04
4
writing several command line in R console
Hi R lovers I would like to know how to step to the next line in the R console editor without breaking the continuity of my code more clearly : if for example I write a function, so far i have to write the all code inside on the same line wich may become obscure as the function is more and more complex. I would like to do like in the example of the manuels: >twosam <- function(y1, y2) {
2003 Nov 24
1
[PATCH] library functions
Hi, Here are some new library functions for klibc. Some of them are required for udev, which currently has a klibc_fixups.c file that implements these functions. mh -- Martin Hicks Wild Open Source Inc. mort@wildopensource.com 613-266-2296 # This is a BitKeeper generated patch for the following project: # Project Name: The kernel C library # This patch format is intended
2004 Oct 01
3
same test statistic for t-test with and without equal variance assumption
Could some kindly tell me if I am supposed to be getting the same test statistic value with var.equal=TRUE and var.equal=FALSE in t.test ? set.seed(1066) x1 <- rnorm(50) x2 <- rnorm(50) t.test(x1, x2, var.equal=FALSE)$statistic # 0.5989774 t.test(x1, x2, var.equal=TRUE)$statistic # 0.5989774 ??? Here are my own calculations that shows that perhaps the result when var.equal=TRUE is
2013 Feb 01
2
How does this function print, why is n1 which equals 1 printed as 2?
Windows 7, R 2.12.1 Colleagues, I am trying to understand the n.for.2means function. The code below is a copy of the function (renamed to n.for.2means.js). I have inserted a single line of code towards the bottom of the function which uses the cat function to print the value of n1. You will note the value (preceded by stars) is printed as 1. The function (1) prints a lot of output without any
2011 Feb 19
2
reading simulations
Hi to all the people (again), I'm doing some simulations with the memisc package of an own function, but I've the problem that I didn't know how to read the result of such simulations. My function is: > Torre<-function(a1,N1,a2,N2) + {Etorre<-(a1*N1)/(1+a1*N1) + Efuera<-(a2*N2)/(1+a2*N2) + if(Etorre>Efuera)Subir=TRUE + if (Etorre<Efuera)Subir=FALSE +
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
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))
2010 Jul 07
2
Sum vectors and numbers
We want to sum many vectors and numbers together as a vector if there is at least one vector in the arguments. For example, 1 + c(2,3) = c(3,4). Since we are not sure arguments to sum, we are using sum function: sum(v1,v2,...,n1,n2,..). The problem is that sum returns the sum of all the values present in its arguments: sum(1,c(2,3))=6 sum(1,2,3)=6 We do not want to turn sum(v1,v2,...,n1,n2,..) to
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 <-
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]]
2000 Aug 30
3
family question
Dear friends. Please see the program below and answer if it does simulate a population of 1.000.000 families, each with at max 20000 children (typical in Denmark, you know), constructed such that each family stops having children when more boys than girls are present ? Equal numbers of boys and girls are got in the population, according to the simulation, is that obvious ? ND <- NP <-
2009 Jun 17
2
cumulative sum in data frame
Dear R-Help List, I have a question about data manipulation. I tried to make code myself but too much for me. I would greatly appreciate your help. I have data set consisting of site (from 1 to N1) and distance and there are several variables (1 to N2) collected from each sampling site. I am interested in looking at cumulative sums of each variable based on site and distance like below. Can
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"),
2005 Jul 15
4
Can't get sample function from "An Introduction to R" to work
I'm trying to figure out R, a piece at a time, hours at a time... I was trying to copy the sample function in, "An Introduction to R" (for version 2.1.0) by W. N. Venables, D. M. Smith, page 42. Section 10.1 "Simple examples" provides a sample function which I tried to duplicate (I'm using Mac OS X 10.3.9, and "R for Mac OS X Aqua GUI v1.11). The following
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])] <-
2009 Mar 20
4
how to make aggregation in R ?
Hi, I am trying to aggregate the sum of my test data.frame as follow: testDF <- data.frame(v1 = c("a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "c", "c", "c", "c", "c", "d", "d", "d", "d",