similar to: Combining series of variables using identifier

Displaying 20 results from an estimated 200 matches similar to: "Combining series of variables using identifier"

2008 Feb 29
1
How to export tables in list separately using write.table or sink?
R users, My intention is to take factors out of DF, create list of tables and export these tables separately using write.table or sink function. write.table writes tables out as DF:s, should I use sink instead? Here is my example: a <- data.frame( indx = 1:20, var1 = rep(c("I20", "I40", "A50", "B60"), each=5),
2013 Apr 22
7
Multiple lon lat points in the map with ggplot2
Hello R users, For the last few days I am struggling with the following task: my data.frame: A1 A2 A3 B1 B2 B3 58.81 53.292 54.501 13.013 17.39 19.407 56.02 56.251 54.033 20.099 13.15 10.411 55.376 53.099 57.625 13.396 21.031 13.22 58.584 53.194 54.218 13.038 16.854 19.289 55.7 55.921 53.847 19.942 13.153 9.828 55.093 52.934
2009 Jan 06
2
[LLVMdev] LLVM Optmizer
The following C code : #include <stdio.h> #include <stdlib.h> int TESTE2( int parami , int paraml ,double paramd ) { int varx=0,vary; int nI =0; //varx= parami; if( parami > 0 ) { varx = parami; vary = varx + 1; } else { varx = vary + 1; vary = paraml; } varx = varx + parami + paraml; for( nI = 1 ; nI <= paraml; nI++) { varx =
2005 Oct 05
1
(no subject)
hi all why does the following not work??? this was someone elses code and i couldnt explain why it doesn't work. m=matrix(c(0,0),2,1) v=matrix(c(1,0,0,1),2,2) Y=function(X1,X2,mu=m,V=v) { X=matrix(c(X1,X2),2,1) a=(1/((2*pi)*sqrt(det(V))))*exp((-0.5)*(t(X-mu)%*%solve(V)%*%(X-mu))) a[1] } x1=seq(-1,1) x2=x1 Z=outer(x1,x2,FUN="Y",mu=m,V=v) persp(x1,x2,Z) my code:
2009 Jan 07
3
[LLVMdev] LLVM optmization
The following C test program was compiled using LLVM with -O3 option and MSVC with /O2. The MSVC one is about 600 times faster than the one compiled with the LLVM. We can see that the for loop in MSVC assembler is solved in the optimization pass more efficiently than that in LLVM. Is there an way to get a optimization result in LLVM like that of the MSVC? Manoel Teixeira #include
2011 Jan 20
2
adding text to y-axis per row of panels (lattice)
Dear all, Being a newbie to R, I've trawled through many old posts on this list looking for a solution to my problem, but unfortunately couldn't quite figure it out myself. I'd be very grateful if someone here on this list could perhaps help me out. I have a lattice plot with several panels and would like to add some text next to the y-axis on the right hand side of each row of
2017 Apr 28
2
ggplot dentro de una función
Hola a todos, Partiendo de: library(ggplot2); library(data.table) datos <- data.table(Date = seq.Date(as.Date("2017-01-01"), as.Date("2017-01-10"), by = "day"), V1 = rnorm(10), V2 = rnorm(10)) Quiero crear una función para pintar un gráfico cuyos argumentos sean
2009 Aug 12
3
Laptop hd incorrect
Hello I'm new to linux and am trying to install centos 5.3 on my laptop and it has an ata drive but centos does not see the had or cdrom. Googleing does not give me much to check. The laptop is a hp-g60 249wm, latest bios update. The bios does not have any ability to change drive information. The bios basically allows me to only set time, date and boot item. Any advice or direction is
2002 Mar 27
2
Error with nls
Dear R-group members, I use: platform i386-pc-mingw32 arch x86 os Win32 system x86, Win32 status major 1 minor 4.1 year 2002 month 01 day 30 language R I try to fit a 2 compartment model. The compartments are open, connected to each other and
2012 Feb 18
3
foreach %do% and %dopar%
Hi everyone, I'm working on a script trying to use foreach %dopar% but without success, so I manage to run the code with foreach %do% and looks like this: The code is part of a MCMC model for projects valuation, returning the most important results (VPN, TIR, EVA, etc.) of the simulation. foreach (simx = NsimT, .combine=cbind, .inorder=FALSE, .verbose=TRUE) %do% { MCPVMPA = MCVAMPA[simx]
2005 Jul 05
1
by (tapply) and for loop differences
I am getting a difference in results when running some analysis using by and tapply compare to using a for loop. I've tried searching the web but had no luck with the keywords I used. I've attached a simple example below to illustrates my problem. I get a difference in the mean of yvar, diff and the p-value using tapply & by compared to a for loop. I cannot see what I am doing wrong.
2006 Feb 24
3
Sorting alphanumerically
I'm trying to sort a DATAFRAME by a column "ID" that contains alphanumeric data. Specifically,"ID" contains integers all preceeded by the character "g" as in: g1, g6, g3, g19, g100, g2, g39 I am using the following code: DATAFRAME=DATAFRAME[order(DATAFRAME1$ID),] and was hoping it would sort the dataframe by ID in the following manner g1, g2, g3, g6, g19,
2017 Nov 01
3
repeat a function
I want to populate the matrix prb through the function HWMProb <- function (a,j,dt) that encapsulates different functions (please see code below), using j= 0:2 for each j. It only populates prb if I specify each function independently in the global environment and then run the loop with the iF statement, as per below. for (j in 0:2) { if (j==0) { prb["0","1"] <-
2001 Jul 12
2
Package DSE
Hi, If I try to do this: if(is.R()) data("eg1.DSE.data.diff", package="dse1") model <- est.VARX.ls(eg1.DSE.data.diff) (Page 14 - DSE Package Manual) I obtain a Segment Violation. I use R-1.3.0 and the last dse package version Maximino Ameneiro Gomez -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read
2012 Nov 05
1
Potencia de la prueba T
Buen día para todos los que ven este correo. En estos días estoy estudiando la potencia de una prueba en inferencia, pero no entiendo bien como correr un codigo que lo haga pertinentemente, el codigo que corro es el siguiente, la idea es que a medida que crece el tamaña muestral pues la potencia de la prueba aumente, pero no se como hacer para que, repita la prueba variando el tamaño de la
2017 Nov 02
0
repeat a function
Hi Eric I did not see any answer and frankly speaking I cannot provide you with canned help. AFAIK if a function is defined within another function (which is your case) it cannot be called directly so it is necessary to define it in global environment. > fff <- function(x) { + myf <- function(a) a+2 + myf(x)^2} > > fff(5) [1] 49 > myf(5) Error in myf(5) : could not find
2009 Jul 10
3
strange strsplit gsub problem 0 is this a bug or a string length limitation?
I was working with the rmetrics portfolioBacktesting function and dug into the code to try to find why my formula with 113 items, i.e. A1 thru A113, was being truncated and I only get 85 items, not 113. Is it due to a string length limitation in R or is it a bug in the strsplit or gsub functions, or in my string? I'd very much appreciate any suggestions ============Input script:
2009 Jul 17
6
Solving two nonlinear equations with two knowns
Dear R users, I have two nonlinear equations, f1(x1,x2)=0 and f2(x1,x2)=0. I try to use optim command by minimize f1^2+f2^2 to find x1 and x2. I found the optimal solution changes when I change initial values. How to solve this? BTW, I also try to use grid searching. But I have no information on ranges of x1 and x2, respectively. Any suggestion to solve this question? Thanks, Kate
2017 Nov 02
2
repeat a function
Hi Petr, Many thanks for your response. Basically I want to create a probability matrix to be used in a trinomial tree going forward. This is the reason why I thought to build the matrix around 0 would be much more efficient. I need to loop through because the probabilities will depend on my node and is not always the same per row (e.g. if N> jmax, jmax being defined in another function) I
2010 Jul 15
1
Error using the mi package
I'm trying to impute data using the mi package, but after running through almost the entire first round of imputations (which takes quite a while), it throws this error (I'll include the whole output prior to the error for context). Does anyone know what is causing it, or how I can fix it? More specifically, how can I tell what is throwing the error so I know what to fix? Is