similar to: Help with reshaping data.frame

Displaying 20 results from an estimated 10000 matches similar to: "Help with reshaping data.frame"

2006 Mar 11
1
Non-linear Regression : Error in eval(expr, envir, enclos)
Hi.. i have an expression of the form: model1<-nls(y~beta1*(x1+(k1*x2)+(k1*k1*x3)+(k2*x4)+(k2*k1*x5)+(k2*k2*x6)+(k3*x7)+(k3*k4*x8)+(k3*k2*x9)+(k3*k3*x10)+ (k4*x11)+(k4*k1*x12)+(k4*k2*x13)+(k4*k3*x14)+(k4*k4*x15)+(k5*x16)+(k5*k1*x17)+(k5*k2*x18)+(k5*k3*x19)+
2012 Apr 12
1
Help with vectorization
Hi every one. I have a exponential function (3 fitting parameters) that I would like to use to produce data (6 series) without having to use a loop. Here wl = seq(300,500,1) k1 = c(1.2e-6, 4.9e-6, 9.6e-6, 2.7e-10, 6.7e-8, 7.44e-6) k2 = c(726, 352, 128, 5232, 1538, 128) k3 = c(-176, -224, -257, 88.7, -111, -256) stations = c('R5d', 'R5a', 'R9', '108',
2007 Aug 14
2
State Space Modelling
Hey all, I am trying to work under a State Space form, but I didn't get the help exactly. Have anyone eles used this functions? I was used to work with S-PLUS, but I have some codes I need to adpt. Thanks alot, Bernardo [[alternative HTML version deleted]]
2004 Oct 04
3
Beginners problem
Hi, I'm new to R and have a problem with a little test program (see below). Why doesn't <<- in function rk4 assign the new value to y so that it is seen in rktest. I thought that <<- does exactly this. But it seems that I didn't get it right. I would be very appreciative for an explanation of that behaviour of <<-. I know how to write the whole thing so that it
2008 Feb 01
2
the "union" of several data frame rows
Hi, I have a question about how to obtain the union of several data frame rows. I'm trying to create a common key for several tests composed of different items. Here is a small scale version of the problem. These are keys for 4 different tests, not all mutually exclusive: id q1 q2 q3 q4 q5 q6 1 A C 2 B D 3 A D B 4 C D B D I would like
2010 Aug 20
5
paired samples, matching rows, merge()
Hi everyone! I'm matching two samples to create one sample that have pairs of observations equal for the k1 variable. Merge() doesn't work because I dont't want to recycle the values. x <- data.frame(k1=c(1,1,2,3,3,5), k2=c(20,21,22,23,24,25)) x y <- data.frame(k1=c(1,1,2,2,3,4,5,5), k2=c(10,11,12,13,14,15,16,17)) y merge(x,y,by="k1") k1 k2.x k2.y 1 1 20
2013 Apr 25
2
Vectorized code for generating the Kac (Clement) matrix
Hi, I am generating large Kac matrices (also known as Clement matrix). This a tridiagonal matrix. I was wondering whether there is a vectorized solution that avoids the `for' loops to the following code: n <- 1000 Kacmat <- matrix(0, n+1, n+1) for (i in 1:n) Kacmat[i, i+1] <- n - i + 1 for (i in 2:(n+1)) Kacmat[i, i-1] <- i-1 The above code is fast, but I am curious about
2016 Sep 25
3
Variable Progresiva
Hola Comunidad, Tengo una duda, Queria que en un For si fuese ejecutando un proceso desde 1 hasta 5 por poner un ejemplo , y que el resultado se fuese guardando en variables que se llamar Ki, es decir k1, k2, k3... Un ejemplo de como crei que funcionaria y no lo hizo xD for (i in 1:3) { paste("k", i, sep = "") <- sum(1:i) } Esperaba se crearan las variables k1 =
2002 Mar 08
1
Problems with Solaris 8 and OpenSSH 3.1p1
When compiling the software it breaks with an error on the cipher.c file. Lot's of warnings and error of undeclared stuff. Snippet follows: gcc -g -O2 -Wall -Wpointer-arith -Wno-uninitialized -I. -I. -I/usr/local/ssl/include -Iyes -I/usr/local/include -DSSHDIR=\"/etc\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\"
2012 May 15
2
Renaming names in R matrix
I have the following matrix: > dat [,1] [,2] [,3] [,4] foo 0.7574657 0.2104075 0.02922241 0.002705617 foo 0.0000000 0.0000000 0.00000000 0.000000000 foo 0.0000000 0.0000000 0.00000000 0.000000000 foo 0.0000000 0.0000000 0.00000000 0.000000000 foo 0.0000000 0.0000000 0.00000000 0.000000000 foo 0.0000000 0.0000000 0.00000000 0.000000000 and given this:
2011 Aug 17
2
An example of very slow computation
This message is about a curious difference in timing between two ways of computing the same function. One uses expm, so is expected to be a bit slower, but "a bit" turned out to be a factor of >1000. The code is below. We would be grateful if anyone can point out any egregious bad practice in our code, or enlighten us on why one approach is so much slower than the other. The problem
2005 Oct 24
2
(small) bug in nb_decode?
Hi, So I got a crash on the following code: k1=SUBMODE(lpc_enh_k1); k2=SUBMODE(lpc_enh_k2); which in the newer codebase is: bw_lpc(SUBMODE(lpc_enh_k1), st->interp_qlpc, awk1, st->lpcSize); bw_lpc(SUBMODE(lpc_enh_k2), st->interp_qlpc, awk2, st->lpcSize); I am not sure if the newer code will have the same issue but the following check is
2010 Feb 10
1
looping problem
Hi R-users,   I have this code here: library(numDeriv)   fprime <- function(z) { alp  <- 2.0165;   rho  <- 0.868;   # simplified expressions   a      <- alp-0.5   c1     <- sqrt(pi)/(gamma(alp)*(1-rho)^alp)   c2     <- sqrt(rho)/(1-rho)   t1     <- exp(-z/(1-rho))   t2     <- (z/(2*c2))^a   bes1   <- besselI(z*c2,a)   t1bes1 <- t1*bes1   c1*t1bes1*t2 }   ## Newton
2006 Nov 29
2
How to solve differential equations with a delay (time lag)?
Hi, I would like to solve a system of coupled ordinary differential equations, where there is a delay (time lag) term. I would like to use the "lsoda" function "odesolve" package. However, I am not sure how to specify the delay term using the syntax allowed by odesolve. Here is an example of the kind of problem that I am trying to solve: > library(odesolve)
2009 Oct 19
1
updating columns using other column as reference
Dear R-gurus, Just supose I have a dara.frame that looks like myDF<-read.table(stdin(),head=T,sep=",") codID,namesp,k1,k2,k3,k4 1,spA,2,5,6,3 2,spB,4,5,4,6 3,spC,2,1,5,6 4,spC,5,4,3,2 5,spD,1,2,3,4 6,spE,2,4,3,1 I need to update the columns k1-k4 with the namesp, but considering the math between Kx and codID. My desired output must looks like: codID,namesp,k1,k2,k3,k4
2011 Jul 27
2
fitting sine wave
Dear R-helpers ? I have 7 data points that I want to fit a continuous curve to, that should look similar to a sine wave My data points would mark the local minima and maxima respectively. This is what I?ve got so far. And I would keep doing so, but sadly nls() then says that it has reached the maximum number of Iterations? ?
2016 Sep 26
3
Variable Progresiva
Una duda, si fuese a leer 3 archivos csv que se llamar archivo 1, archivo 2 y archivo 3 también se podría usar? gracias ________________________________ De: Isidro Hidalgo Arellano <ihidalgo en jccm.es> Enviado: lunes, 26 de septiembre de 2016 07:48 a.m. Para: 'Rafael Saturno'; 'R' Asunto: RE: [R-es] Variable Progresiva Lo que quieres hacer se hace con la función
2003 Oct 23
2
OOP like handling of lists?
Hello, I am writing a package with a collection of several models. In order to allow users to play interactively with the models (in contrast to hacking lengthy scripts), I want to put all what is needed to run a particular model into a single list object for each model. Then there will be a collection of functions to run the model or to modify parameters, time steps, integration method ...,
2010 Nov 21
1
solve nonlinear equation using BBsolve
Hi r-users, I would like to solve system of nonlinear equation using BBsolve function and below is my code.  I have 4 parameters and I have 4 eqns. mgf_gammasum <- function(p) { t  <- rep(NA, length(p)) mn <- 142.36 vr <- 9335.69 sk <- 0.8139635 kur <- 3.252591 rh  <- 0.896 # cumulants k1 <- p[1]*(p[2]+p[3]) k2 <- p[1]*(2*p[2]*p[3]*p[4] +p[2]^2+p[3]^2) k3 <-
2007 Aug 22
1
"subscript out of bounds" Error in predict.naivebayes
I'm trying to fit a naive Bayes model and predict on a new data set using the functions naivebayes and predict (package = e1071). R version 2.5.1 on a Linux machine My data set looks like this. "class" is the response and k1 - k3 are the independent variables. All of them are factors. The response has 52 levels and k1 - k3 have 2-6 levels. I have about 9,300 independent variables