similar to: How to Group Categorical data in R?

Displaying 20 results from an estimated 200 matches similar to: "How to Group Categorical data in R?"

2012 Mar 19
5
Output formatting in Latex and R
I am working on Latex and R and using following code. <<echo=FALSE>>= infile<-read.table("test.txt",sep="\t") Col3 <- unique(infile[,3]) LCol3 <- length(Col3) for (i in 1:LCol3) { print(paste("Column", Col3[i])) print(infile[infile[,3]==Col3[i],-3]) } @ I am getting following output. 1] "Column C" V1 V2 V4 1 A B D 2 X T K [1]
2008 Feb 26
1
Split data.frames depeding values of a column
Hello to all is there a function wich splits a data.frame (column1,column2,column3,....) into data1 <-(column1,column3....) #column2 = 1 data2 <-(column1,column3....) #column2 = 2 data3 <-(column1,column3....) #column2 = 3 ... Regards Knut
2010 Jul 26
4
using string variable as order() function argument
Hello, In my script I would like to use a loop, which sorts the dataframe according to different columns, pointed by the string variable. id col1 col2 col3 1 10 0 4 8 2 11 1 2 2 3 12 0 8 3 4 13 0 5 5 Usually the order() function can be used like this: sorted = mytable**[order(column3) , ] which results in properly sorted table: **
2010 Feb 27
1
New Variable from Several Existing Variables
I am new to R, but have been using SAS for years. In this transition period, I am finding myself pulling my hair out to do some of the simplest things. An example of this is that I need to generate a new variable based on the outcome of several existing variables in a data row. In other words, if the variable in all three existing columns are "Yes", then then the new variable should
2006 Apr 20
0
parsing arguments of a function
Hi, I have a simple problem writing a function that is to be called like Myfunction( Column1 = low, Column2 = high, Column3 = all, Column4 = all, data = mydata) {. contourplot(z ~ mydata$Column3* mydata$Column3) . } Where Column1 and Column1 are the names of the dataframe mydata. How do I parse the arguments to obtain both, name and value of the argument. I tried strsplit(Column1,
2009 May 14
2
Function to read a string as the variables as opposed to taking the string name as the variable
I am writing a custom function that uses an R-function from the reshape package: cast. However, my question could be applicable to any R function. Normally one writes the arguments directly into a function, e.g.: result=cast(table1, column1 + column2 + column3 ~ column4, mean) (1) I need to be able to write this statement as follows: result=cast(table1, string_with_columns ~
2006 Apr 06
1
reshape question
Hi, I have a data fram like this: date column1 column2 column3 value1 value2 value3 1-1 A B C 10 5 2 2-1 A B D 5 2 0 3-1 A B E 17 10 7 How can I reshape it to: date column1 column2 column3 v x 1-1 A B C value1 10 1-1 A B C value2 5 1-1 A B C value3 2 2-1 A B D value1 5 2-1 A B D value2 2 2-1 A B D value3 0 3-1 A B E value1 17 3-1 A B E value2 10 3-1 A B E value3 7 Thx! Regards, Richard
2013 Mar 21
2
Displaying median value over the horizontal(median)line in the boxplot
Hi, set.seed(45) test1<-data.frame(columnA=rnorm(7,45),columnB=rnorm(7,10)) #used an example probably similar to your actual data apply(test1,2,function(x) sprintf("%.1f",median(x))) #columnA columnB # "44.5"? "10.2" par(mfrow=c(1,2)) lapply(test1,function(x) {b<-
2004 Oct 25
2
Reading sections of data files based on pattern matching
I am about to write general functions to read the output of simulations models. These model generate output files with different sections which I want to analyze plot etc. Since this will be used many people at the department I wanted to make sure that will do this in the best way. For instance I want to read a snippets of data from a text that look like this.
2010 May 15
1
conditional calculations per row (loop versus apply)
Hi all, I'm hoping someone might help with a query about conditionally applying formulas to a dataframe. In essence I have 3 lookup tables (Table A, B & C) and a dataframe with a variable Type.Code, which identifies the Lookup Table to which each record belongs. The lookup tables reference different sensor types for which I need apply a different formula to values in Column3 in each row
2008 Apr 04
0
Can''t get backgroundrb to work with rails plugin ''batched_sql_fu''
Trying to use backgroundrb to process and insert a large list of bulk records, but when I try to use it with the batched_sql_fu plugin installed in vendor/plugins, I get the following error: ---SNIP--- /Users/jdonalds/Sites/3dial_ads/config/../vendor/plugins/ batched_sql_fu/lib/batched_sql_fu/active_record.rb:22:in `alias_insert_sql_to_batched_version!'': undefined method
2008 Feb 29
1
can the matrix size limit be increased?
Hi there, I'm brand new to R, so let me know if this question is not appropriate for this list. I've been reading through the documentation and have tried a number of things, but am pretty much stuck so far. Here's the session info: > sessionInfo() R version 2.6.2 (2008-02-08) i386-apple-darwin8.10.1 locale: C attached base packages: [1] stats graphics grDevices
2009 Mar 13
1
Realtime dialplan application versus REALTIME dialplan function
Hi All, I'm upgrading some PBX's from 1.2 to 1.4 and having a bit of trouble with converting the Realtime application to the REALTIME function. I have the method down and understand simplistically what is going on, at least enough to get my old 1.2 apps to run in 1.4 functions. I do not understand why change from the app to the func? What the benefits? To me, the app seemed so
2010 Feb 09
3
split strings in a vector and convert it to a data.frame
hi, I have a vector full of strings like; xy_100_ab xy_101_ab xy_102_ab xy_103_ab I want to seperate each string in three pieces and the separator should be the "_" at the end I want a data.frame like: column1 column2 column3 xy 100 ab xy 101 ab xy 102 ab xy 103 ab I tried strsplit but I couldn't figure out how to convert the list I get into a data.frame. I just
2009 Jul 07
2
How to separate the string?
Hi everyone, Hi want to separate the string(column1) for example column1 column2 column3 column4 column5 column6 bear b e a r cat c a t tiger t i g e r I know how to do this in excel where using MID function. Now I want to solve it using R. The list of strings is in
2009 Aug 03
2
Some SQL Challenges
Hi, Im trying to complete a list of jobs using SQL Querries and some "if else" commands but im stucked in some steps. Could any of you give me some help? -in COLUMN1 change the format 20JAN2000:00:00:00 to 20JAN2000 and exclude every row that date is different from 20. -extract the first character in COLUMN2 and creat COLUMN3 with that value ex: COL2,COL3 135,1 461,4 247,2 -in every
2012 Jun 12
4
How to index a matrix with different row-number for each column?
here's my question: suppose I have a matrix: mt<-matrix(1:12,ncol=6) now I have a vector vt<-c(1,2,2,2,1,2) which means I want to get: the 1st row for column1; the 2nd row for column2; the 2nd row for column3; the 2nd row for column4; ... that what I want is this vector: 1,4,6,8,9,12 Does anyone know how to do this fast? I know I can use for-loop to travel all columns,but
2012 May 28
6
importing multiple file form folder
Hi all, I have a set of files (which is growing) in a folder. The files are text files... The form of files is such : ...with numbers for Length (m) going up to 2000 ... Anyway...i just need the data from first two columns (length (m) and Temperature (C)), and no data before that... This Lenght (m) values are always the same. My final dataset should lokk like this : column 1 as Length(m) ;
2007 Oct 19
1
(no subject)
# Hello # I have a question regarding pairwise calculations of a matrix using a "for-loop." # Below I have a matrix "X" with 8 columns. These are Genotypic data so Column1 & Column2 is # a unit, Column3 & Column4 is a unit, Column5 & Column6 is a unit, and Coulmn7 & 8 is a unit. # I have a loop designed to calculate the number of times an individual in
2007 Oct 19
1
conduct pairwise column comparisons without comparing a column to itself
# Hello # I have a question regarding pairwise calculations of a matrix using a "for-loop." # Below I have a matrix "X" with 8 columns. These are genotypic data so Column1 & Column2 is # a unit, Column3 & Column4 is a unit, Column5 & Column6 is a unit, and Coulmn7 & 8 is a unit. # I have a loop designed to calculate the number of times an individual in