similar to: data order by different level of variables

Displaying 20 results from an estimated 20000 matches similar to: "data order by different level of variables"

2007 Jul 29
1
Order by the columns
Dear useR, I have a data matrix, it has n columns, each column is a two-level variable with entires -1 and +1. They are randomly generated, now I want to order them like (for example, 5 columns case) - - - - - - - - - - ................. (first several rows are the samples with all variables in low level) + - - - - + - - - - .............................
2008 Jul 16
2
Group level frequencies
Dear List, I have Multi-level Data i= Indivitual Level g= Group Level var1= First Variable of interest var2= Second Variable of interest and I want to count the frequency of "var1" and "var2" on the group level. I found a way, but there must be a much simpler way. data.ml <- data.frame(i=c(1:8),g=as.factor(c(1,1,1,2,2,3,3,3)),var1=c(3,3,3,4,4,4,4 ,4),
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
2010 Jul 29
1
(no subject)
Dear R Users! I have a dataframe with duplicate cases. Var1 duplicated by var2. var1 var2 var3 var4 var5 var6 1 4 500 1 2 a 1 3 200 2 5 b 1 8 125 1 9 b
2010 Jul 29
3
Fwd: duplicates
-- Eredeti üzenet -- Feladó: Dévaványai Agamemnón &lt;devavanyai@citromail.hu&gt;Címzett: r-hel@r-project.org, r-hel@r-project.orgElküldve: 2010. július 29. 16:29Tárgy : duplicates Sorry! I try it again Dear R Users! I have a dataframe with duplicatecases. Var1 duplicated by var2. var1 var2 var3 var4 var5 1 4 500 1 2 1 3 200 2 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",
2010 Feb 17
2
Is the aggregate function the best way to do this?
Hi, I''m having a dataframe ''Subset1'' with a number of factor variables and 160 numerical variables Now I want to make sums for all rows that have the same values for the different factor variables, except for the factor variables: VAR1,VAR2,VAR3 who may have the same values. With the formula given below this works great, but in a situation with 15000 rows and 13
2007 Apr 02
3
Create a new var reflecting the order of subjects in existing var
Dear R helpers I have a data set sth like this: set.seed(123);dat <- data.frame(ID= c(rep(1,2),rep(2,3), rep(3,3), rep(4,4), rep(5,5)), var1 =rnorm(17, 35,2), var2=runif(17,0,1)) dat ID var1 var2 1 1 33.87905 0.02461368 2 1 34.53965 0.47779597 3 2 38.11742 0.75845954 4 2 35.14102 0.21640794 5 2 35.25858 0.31818101 6 3 38.43013
2010 Mar 18
1
Using a function to consolidate variables
Dear List, I'm getting the error: object of type 'closure' is not subsettable And am not sure how to get around the problem. I've included two short code sets below. One that shows what I want to do and works, but without using the function much, and another that tries to use the function but causes the error. # THIS WORKS AND SHOWS WHAT I'D LIKE TO DO a <- c(1,2,3) b
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
2012 Mar 10
1
Use different panel functions with lattice
Hi, I have a data.frame df with names(df) = c("Var1", "Var2", "Var3", "Var4") and I plot data with xyplot(Var1+Var2~Var3|Var4, data=df) I want to use different panel functions for Var1 and Var2. How can I do ? Something like : panel.mypanel = function(x, y, ...) { if (Var1) panel.Var1Panel(x, y, ...) else panel.Var2Panel(x, y, ...) }
2005 Nov 29
1
Indexing variables within lapply?
Hello I am using R 2.2.0 with Windows XP. I've got a five element list object, each element containing two dataframes of equivalent size. > str(mylist) List of 1 $ data1:List of 2 ..$ data1a :`data.frame': 77 obs. of 63 variables: .. ..$ var1 : num [1:77] 0.41375 0.00056 1.43040 1.43528 0.61730 ... .. ..$ var2 : num [1:77] 1.154 1.686 0.673 0.800 0.760 ... ..
2008 Jan 24
1
Grouping
I need to group some subjects according to two variables (var1, var2) I have a data frame that looks something like this: Subject var1 var2 1 400 150 2 320 100 3 580 600 4 145 789 Each suject would fall into one of 2 categories ('A' or 'B'). I want to find (and see) all the possible combinations of
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 <-
2010 Dec 20
2
Turning a Variable into String
I would like to know how to turn a variable into a string. I have tried as.symbol and as.name but it doesnt work for what I'd like to do Essentially, I'd like to feed the function below with two variables. This works fine in the bit working out number of elements in each variable. In the print(sprintf("OK with %s and %s\n", var1, var2)) line I would like var1 and var2 to be
2009 Jun 24
2
subsetting data frame using a vector of column names / values
Hello I have a data frame d with columns "var1", "var2", "var3" Then I have two vectors: columns <- c("var2", "var3") values <- c(0, 1) Is there a compact way to subset the data frame using these two vectors and get the result equivalent to: select (d, var2==0 & var3==1) ? Thank You Blazej
2006 Mar 02
1
CCF and Lag questions
I am new to R and new to time series modeling. I have a set of variables (var1, var2, var3, var4, var5) for which I have historical yearly data. I am trying to use this data to produce a prediction of var1, 3 years into the future. I have a few basic questions: 1) I am able to read in my data, and convert it to a time series format using 'ts.' data_ts <- ts(data, start = 1988, end =
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
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