Displaying 20 results from an estimated 8000 matches similar to: "find mean of a list of timeseries"
2009 Sep 22
3
converting a character vector to a function's input
Hi all, I have been trying to solve this problem and have had no luck so far.
I have numeric vectors VAR1, VAR2, and VAR3 which I am trying to cbind. I also have a character vector "VAR1,VAR2,VAR3". How do I manipulate this character vector such that I can input a transformed version of the character vector into cbind and have it recognize that I'm trying to refer to my numeric
2004 Aug 17
5
Bug in colnames of data.frames?
Hi,
I am using R 1.9.1 on on i686 PC with SuSE Linux 9.0.
I have a data.frame, e.g.:
> myData <- data.frame( var1 = c( 1:4 ), var2 = c (5:8 ) )
If I add a new column by
> myData$var3 <- myData[ , "var1" ] + myData[ , "var2" ]
everything is fine, but if I omit the commas:
> myData$var4 <- myData[ "var1" ] + myData[ "var2" ]
the name
2014 Aug 21
2
pregunta
Buenas noches Javier y José,
Estoy en contra de usar attach(), asi que propongo la siguiente alternativa
con with():
# paquete
require(epicalc)
# los argumentos en ... pasan de epicalc:::cc
# ver ?cc para mas informacion
foo <- function(var1, var2, var3, ...){
or1 <- cc(var1, var2, ...)
or2 <- cc(var1, var3, ...)
list(or1 = or1, or2 = or2)
}
# datos
x <-
2012 Jul 01
2
list to dataframe conversion-testing for identical
HI R help,
I was trying to get identical data frame from a list using two methods.
#Suppose my list is:
listdat1<-list(rnorm(10,20),rep(LETTERS[1:2],5),rep(1:5,2))
#Creating dataframe using cbind
dat1<-data.frame(do.call("cbind",listdat1))
colnames(dat1)<-c("Var1","Var2","Var3")
#Second dataframe conversion
2011 May 19
2
trouble with summary tables with several variables using aggregate function
Dear all,
I am having trouble creating summary tables using aggregate function.
given the following table:
Var1 Var2 Var3 dummy
S1 T1 I 1
S1 T1 I 1
S1 T1 D 1
S1 T1 D 1
S1 T2 I 1
S1 T2 I 1
S1 T2 D 1
S1 T2 D 1
S2
2014 Aug 21
2
pregunta
Estimados
Estoy entrenando hacer funciones que respondan a comandos,
en esta caso en la salida gráfica se observa que dice : Exposure=var3 y
outcome=var 1
quisiéramos que se reflejan los nombres de la base de datos : var1=estado,
var2=cake, var3=chocolate
Espero haberme explicado adecuadamente
Adjunto tabla con datos
####################################
#Comando que llama
2014 Apr 11
6
crear variable en base a nombre de columnas que tienen un 1
Buenos días.
Hoy ando un poco (o bastante) espeso y no doy con la tecla de una cosa
que seguro que es muy simple..
Pongo un ejemplo.
var1 <- c(rep(0,3),rep(1,2))
var2 <- c(rep(1,2),0,0,1)
var3 <- c(rep(1,2),rep(0,3))
var4 <- c(rep(1,2),rep(0,3))
datos <- data.frame(fila=1:5,var1, var2, var3, var4)
datos
datos
fila var1 var2 var3 var4
1 1 0 1 1 1
2 2 0
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
2014 Apr 11
2
crear variable en base a nombre de columnas que tienen un 1
Carlos, en principio si sería algo así, sólo que en vez de quedarme con
todas las columnas var1 a var4 tuviera sólo 3, ya que en mis datos no
hay ningún caso que tenga el valor 1 en más de 3 variables..
Había llegado a una solución (mucho menos elegante que usando reshape),
que implicaba un for sobre las filas.
Jorge, creo que tu solución me vale.
Muchas gracias a los dos..
Saludos
El
2011 Jan 23
3
FUNC_ODBC and ARRAY
Gentlemen,
I have googled, searched the mailing list archives, and even spoke on
the IRC channel, but have not found an answer to the following
problem. I am attempting to retrieve multiple columns in an ODBC query
using ARRAY per the solutions offered by many individuals. My dialplan
code is as follows:
exten => _.,n,Set(ARRAY(var1,var2,var3)=${ODBC_LOOKUP(${KEYVAL})})
exten =>
2010 Jun 18
3
inverse function of melt
Dear list,
I'm looking for an inverse function of melt(which is in package reshape).Namely, I had a data frame like this
(Table1)
YEAR VAR1 VAR2 VAR3
1995 7 3 45
1996 5 6 32
1997 6 10 15
I transformed my data by using the melt function and my data was reshaped in the following format:
(Table2)
YEAR variable
2009 Sep 01
2
Simple question about data.frame reduction
Hi,
this is a simple question
I have this data.frame:
> test <-
data.frame(var1=c(1,1,1,1,1,1),var2=c("a","a","b","c","d","e"),var3=c("a1","a1","b1","a1","c1","d1"))
> test
var1 var2 var3
1 1 a a1
2 1 a a1
3 1 b b1
4 1 c a1
5 1
2008 Mar 19
4
plot with diffrent colour and plotting symbols
Dear mailing list members,
I am a new R user, I would like to plot the follewing data
var1 <- c(1,2,1,1,2,1,2,1,2,2)
var2 <- round(rgamma(10,2,1)/0.1)*0.1
var3 <- c(0,1,0,1,0,0,0,0,1,0)
var4 <- c(1,2,2,2,1,1,1,1,1,1)
Var <- data.frame(var1,var2,var3,var4)
Var <- Var[sort(Var$var1),]
tt <- Var$var1+((runif(length(Var$var1))/6)-(0.5/6))
labelname <- c("time 1",
2009 Nov 25
1
Sampling dataframe
Hi,
I have a table like that:
> datatest
var1 var2 var3
1 1 1 1
2 3 1 2
3 8 1 3
4 6 1 4
5 10 1 5
6 2 2 1
7 4 2 2
8 6 2 3
9 8 2 4
10 10 2 5
I need to create another table based on that with the rules:
take a random sample by var2==1 (2 sample rows for example):
var1 var2 var3
1 1
2008 Aug 07
2
List of "occurrence" matrices
R users,
I don't know if I can make myself clear but I'll give it a try. I have
a data.frame like this
x <- "var1,var2,var3,var4
a,b,b,a
b,b,c,b
c,a,a,a
a,b,c,c
b,a,c,a
c,c,b,b
a,c,a,b
b,c,a,c
c,a,b,c"
DF <- read.table(textConnection(x), header=T, sep=",")
DF
and I would like to sum all the combinations/occurences by a factor
(letter in this case) between
2016 Apr 28
0
Antwort: RE: Interdependencies of variable types, logical expressions and NA
Hi
your initial ds
> str(ds)
'data.frame': 2 obs. of 3 variables:
$ var1: num 1 1
$ var2: logi TRUE FALSE
$ var3: logi NA NA
first result
> str(ds)
'data.frame': 2 obs. of 6 variables:
$ var1 : num 1 1
$ var2 : logi TRUE FALSE
$ var3 : logi NA NA
$ value_and_logical: logi TRUE TRUE
$ logical_and_na : logi TRUE NA
2010 May 05
3
concatenate values of two columns
Dear list,
I'm trying to concatenate the values of two columns but im not able to do it:
i have a dataframe with the following two columns:
X VAR1 VAR2
1 2
2 1
3 2
4 3
5 4
6 4
what i would like to
2011 Aug 17
2
dotchart vs. dotplot ... groups
I'm trying to create a dotplot with some grouping.
I've been able to create what I want using dotchart (basic graphics), but can't quite get it using dotplot (lattice). I prefer to use lattice (or ggplot2) because I think it's a bit easier to control some other aspects of the plot appearance.
Basically, w/ lattice I've not been able to get the y-axis label to include the
2010 Feb 01
1
Manipulating data, and performing repeated simple regressions, not multiple regression
I have a simple table of data:
Result Var1 Var2 Var3
1 0.10 0.78 0.12 0.38
2 0.20 0.66 0.39 0.12
3 0.10 0.83 0.09 0.52
4 0.15 0.41 0.63 0.95
5 0.60 0.88 0.91 0.86
6 -0.02 0.14 0.69 0.94
I am trying to achieve two things:
1) Manipulate this data so that I have the "Result" data unchanged, and all
the other data
2012 Oct 17
2
loop of quartile groups
Greetings R users,
My goal is to generate quartile groups of each variable in my data set. I
would like each experiment to have its designated group added as a
subsequent column. I can accomplish this individually with the following
code:
brks <- with(data_variables,
cut2(var2, g=4))
#I don't want the actual numbers, I need a numbered group
data$test1=factor(brks,