search for: var3

Displaying 20 results from an estimated 314 matches for "var3".

Did you mean: var
2012 Feb 15
2
assign same legend colors than in the grouped data plot
...plotted data and coloured depending on the factor variable v3. In the legend, I'd like to assign properly the same colors than in the factor (the factor has 5 levels). I've been trying this but it doesn't work. plot(var1, var2, xlab = "var1", ylab = "var2", col =var3 , bty='L') legend(locator(1),c("level 1 var3", "level 2 var3","level 3 var3", "level 4 var3","level 5 var3"), col=var3,pch=16) Thanks in advance, crosspide at hotmail.com -- View this message in context: http://r.789695.n4.nabble.com/as...
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 vectors VAR1, VAR2, and VA...
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 1 1 1 3 3 0 0 0 0 4 4 1 0 0 0 5 5 1 1 0 0 El caso...
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 T1 I 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 a una función rm(list=ls()) #setwd("D...
2012 Jul 01
2
list to dataframe conversion-testing for identical
...ying 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 dat2<-data.frame(Var1=listdat1[[1]],Var2=listdat1[[2]],Var3=listdat1[[3]]) #Structure is different in two datasets ?>str(dat1) 'data.frame':??? 10 obs. of? 3 variables: ?$ Var1: Factor w/ 10 levels "18.6153321029756",..: 5 2 6 8 7 9 1 4...
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 shown above the 4th column is not "var4": > myData var1 var2 var3 var1 1 1...
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 <- read.csv("~/Downloads/OR.csv") head(x) # resultados SIN graficas with(x, foo(estado, cake, chocolate, graph = FALSE)) Saludos, Jorge.- 2014-08-21 12:40 GMT+10:00 Javier...
2006 Jan 13
2
find mean of a list of timeseries
Can someone please give me a clue how to 're'write this so I dont need to use loops. a<-ts(matrix(c(1,1,1,10,10,10,20,20,20),nrow=3),names=c('var1','var2','var3')) b<-ts(matrix(c(2,2,2,11,11,11,21,21,21),nrow=3),names=c('var1','var2','var3')) c<-ts(matrix(c(3,3,3,12,12,12,22,22,22),nrow=3),names=c('var1','var2','var3')) data<-list(a,b,c) I now want to find the means of all vectors var1,var2 and...
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", "time 2") plot(tt,var2,xaxt = "n") axis(1,1:len...
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 d c1 6 1 e d1 Then I need to calculate the number of var3 excluding the repeated measure...
2013 Mar 25
2
Faster way of summing values up based on expand.grid
...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 == mycombos$Var2),] mycombos<-mycombos[!(mycombos$Var1 == mycombos$Var3),] mycombos<-mycombos[!(mycombos$Var1 == mycombos$Var4),] mycombos<-mycombos[!(mycombos$Var2 == mycombos$Var3),] mycombos<-mycombos[!(mycombos$Var2 == mycombos$Var4),] mycombos<-mycombos[!(mycombos$Var3 == mycombos$Var4),] dim(mycombos) # I want to write sums of elements from values1,...
2008 Apr 25
4
Equivalent of Excel pivot tables in R
Can somebody tell me how to do the equivalent of a pivot table in R ? For example, if I have : var1 var2 var3 a x 10 b y 20 a z 10 b z 20 a z 10 b z 20 I could have : x y z a 1 0 2 b 0 1 2 where entries in the table are counts of var3. x...
2007 May 18
4
Simple programming question
Hi R-users, I have a simple question for R heavy users. If I have a data frame like this dfr <- data.frame(id=1:16, categ=rep(LETTERS[1:4], 4), var3=c(8,7,6,6,5,4,5,4,3,4,3,2,3,2,1,1)) dfr <- dfr[order(dfr$categ),] and I want to score values or points in variable named "var3" following this kind of logic: 1. the highest value of var3 within category (variable named "categ") -> "high" 2. the second highest v...
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 examp...
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 value 1995 VAR1 7 1996 V...
2010 Jul 14
4
question about string handling....
Hi, I have a data.frame as following: var1 var2 1 ab_c_(ok) 2 okf789(db)_c 3 jojfiod(90).gt 4 "ij"_(78)__op 5 (iojfodjfo)_ab what I want is to create a new variable called "var3". the value of var3 is the content in the Parentheses. so var3 would be: var3 ok db 90 78 iojfodjfo how to do this? thanks, karena -- View this message in context: http://r.789695.n4.nabble.com/question-about-string-handling-tp2289178p2289178.html Sent from the R help mailing list archive...
2011 Jan 23
3
FUNC_ODBC and ARRAY
...ing 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 => _.,n,Verbose(2,var1 = ${var1}) exten => _.,n,Verbose(2,var2 = ${var2}) exten => _.,n,Verbose(2,var3 = ${var3}) Here's the func_odbc.conf code: [LOOKUP] dsn=mysql-asterisk readsql=SELECT col1, col2, col3 from table1 WHERE keycol = '${ARG1}'...
2014 Apr 11
2
crear variable en base a nombre de columnas que tienen un 1
...nos 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 11/04/14 13:49, Carlos J. Gil Bellosta escribió: > ¿Algo así? > > 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) > > library(reshape2) > > tmp <- melt(datos, id.vars="fila") > > tmp$uno <- as.character(tmp$variable) > tmp$uno[tmp$value != 1] <- &q...
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 variables and produce a list of "occurre...