similar to: Group level frequencies

Displaying 20 results from an estimated 8000 matches similar to: "Group level frequencies"

2008 Jul 08
4
Manipulate Data (with regular expressions)
Dear Everyone, I try to automatically manipulate the data of a variable (class = factor) like x 220 220a 221 221b B221 Into two variables (class = numeric) like x y 220 0 220 1 221 0 221 1 221 1 y has to carry the information about the class (number or string) of the former x-Variable. I could do it by hand like x[x == "220a"] <- 220
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
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
2008 Jul 22
2
Table orderd by frequencies
Dear List, I try to order the output of a table by the frequencies of the vector I am look at. The object I am looking at is a factor with a lot of levels that were named only once. Therefore it would be much easier to order the output by the frequencies of the levels. E.g. > levels(a) "a" "b" "c" "d" Preferred outcome: table(a) b c a d 10 5 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 <-
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
2010 Jul 06
3
Selection with changing number of columns
Dear list, I'm looking for a way to select rows of a data.frame with changing number of columns (constraint) involved. Assume a data (d) structure like Var.1 Var.2 Var.3 9 2 1 2 9 5 1 2 1 I know the number of involved columns. Is there a way to generate the following selection automatically (maybe for loop), so that it makes no difference if there are two or ten columns involved.
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 =
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
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'))
2008 May 02
2
Coercing by/tapply to data.frame for more than two indices?
Dear Colleagues, Apologies for a long email to ask what I feel may be a very simple question; I figure it's better to overspecify my situation. I was asked a question, recently, by a colleague in my department about pre-aggregating variables, i.e., computing the mean of defined subsets of a data frame. Naturally, I thought of the 'by' and 'tapply' functions, as
2009 May 20
1
Comparing spatial distributions - permutation test implementation
Hello everyone, I am looking at the joint spatial distribution of 2 kinds of organisms (estimated on a grid of points) and want to test for significant association or dissociation. My first question is: do you know a nice technique to do that, considering that I have a limited number of points (36) but that they are repeated (4 times)? I did GLMs to test for correlations between the
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
2002 Jul 09
3
Assignment converts variable to factor
Hello, I would like to know if this behaviour in R is as expected. I have a data frame 'dat' with column var1 being character (and not factor). Then I create a new column 'var2' by: > dat[,"var2"] <- dat$var1; Column var2 is now a factor. But if I do: > dat$var2 <- dat$var1; Then column var2 is character (and not factor). I don't want to have
2008 Apr 25
1
Summarize data for MCA (FactoMineR)
Hi :-) I'm new to R and I started using it for a project (I'm the CS guy in a group of statisticians helping them find out how to solve issues as they come out). This is my first post to the list and I am starting to learn R. Well, they were used to doing MCA analysis in other programs where the data seems to be preprocessed automatically before running MCA. So, they need to process a
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
2002 Nov 29
2
Obtaining the variable names of a glm object
Is names(model1$coef) what you're looking for? -----Original Message----- From: Kenneth Cabrera [mailto:krcabrer at epm.net.co] Sent: 29 November 2002 10:36 Cc: R-help at stat.math.ethz.ch Subject: [R] Obtaining the variable names of a glm object Hi, R users! Suppose I make a model like this:
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
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
2010 Jul 05
3
Counting defined character within String
Dear list, I'm looking for a way to count the number of "|" within an object. The character "|" is used to separated ids. Assume a data (d) structure like Var NA NA NA NA NA 1 1|2 1|22|45 3 4b|24789 I need to know the maximum number of ids within one object. In this case 3 (1|22|45) Does anybody know a better way? Thanks Mit freundlichen Gr??en Andreas Kunzler