similar to: Sorting dataframe by number of occurrences of factor

Displaying 20 results from an estimated 10000 matches similar to: "Sorting dataframe by number of occurrences of factor"

2012 Feb 11
3
Counting occurences of variables in a dataframe
Hi everybody, I have a large dataframe similar to this one: knames <-c('ab', 'aa', 'ac', 'ad', 'ab', 'ac', 'aa', 'ad','ae', 'af') kdate <- as.Date( c('20111001', '20111102', '20101001', '20100315', '20101201', '20110105', '20101001', '20110504',
2007 Jun 04
5
Sorting and getting occurrences of search in hit
Is there any way you could get the number of occurrences of the search in one hit? In a result I get the ferret_rank and ferret_score but not how many hits the search generated in the current record. I would also like to be able to sort after this when I search. /mattias -- Posted via http://www.ruby-forum.com/.
2011 Jan 14
9
Selecting the first occurrence of a value after an occurrence of a different value
Hello everyone, I am currently working with some data where I need to select the first occurrence of a value after the occurrence of another value. The data has two columns, one with a time and one with occurence of certain events. The column of data I want to select from looks like this (and each of these events have a corresponding time in another column). Stat71 OutMag FirstResp InMag
2012 May 17
2
Complex sort problem
Dear List, Is there a way I can sort a sample based on a sort index constructed from the data from which the sample is taken? Basically, I need to take 'many' samples from the same source data and sort them. This can be very time consuming for long vectors. Is there any way I can sort the data only once initially, and use that sort order for the samples? I believe that idea is what is
2009 Dec 20
1
how to count the total number of (INCLUDING overlapping) occurrences of a substring within a string?
Last one for you guys: The command: length(gregexpr('cus','hocus pocus')[[1]]) [1] 2 returns the number of times the substring 'cus' appears in 'hocus pocus' (which is two) It's returning the number of **disjoint** matches. So: length(gregexpr('aa','aaa')[[1]]) [1] 1 returns 1. **What I want to do:** I'm looking for a way to count
2011 Mar 17
1
calculating the occurrences of distinct observations in the subsets of a dataframe
Hello everybody, I have a data frame in R which is similar to the follows. Actually my real 'df' dataframe is much bigger than this one here but I really do not want to confuse anybody so that is why I try to simplify things as much as possible. So here's the data frame. id <-c(1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3) a
2009 May 03
1
suggestion for extending ?as.factor
In R-2.10.0, the development version, function as.factor() uses 17 digit precision for conversion of numeric values to character type. This is very good for the consistency of the resulting factor, however, i expect that people will complain about, for example, as.factor(0.3) being [1] 0.29999999999999999 Levels: 0.29999999999999999 I suggest to extend the "Warning" section of
2009 Jul 29
4
- counting factor occurrences within a group: tapply()
Dear List, I'm an [R] novice starting analysis of an ecological dataset containing the basal areas of different tree species in a number of research plots. Example data follow: > Trees<-data.frame(SppID=as.factor(c(rep('QUEELL',2), rep('QUEALB',3), 'CORAME', 'ACENEG', 'TILAME')), BA=c(907.9, 1104.4, 113.0, 143.1, 452.3, 638.7, 791.7, 804.3),
2011 Nov 02
3
how to count number of occurrences
Dear R users, I have this data frame, y samp 8 0.03060419 X 18 0.06120838 Y 10 0.23588374 X 3 0.32809965 X 1 0.36007100 X 7 0.36730571 X 20 0.47176748 Y 13 0.65619929 Y 11 0.72014201 Y 17 0.73461142 Y 6 0.76221313 X 2 0.77005691 X 4 0.92477243 X 9 0.93837591 X 5 0.98883581 X 16 1.52442626 Y 12 1.54011381 Y 14 1.84954487 Y
2012 Feb 16
2
help with e+01 number abbreviations
Dear List, I will appreciate any advice regarding how to convert the following numbers [I got in return by taxondive()] in numeric integers without the e.g. 6.4836e+01 abbreviations. Thank you very much in advance, Gian > taxa_dive Species Delta Delta* Lambda+ Delta+ S Delta+ Nat1 5.0000e+00 6.4836e+01 9.5412e+01 6.7753e+02 8.7398e+01 436.99 Nat2
2009 May 23
2
as.numeric(levels(factor(x))) may be a decreasing sequence
Function factor() in the current development version (2009-05-22) guarantees that levels are different character strings. However, they may represent the same decimal number. The following example is derived from a posting by Stavros Macrakis in thread "Match .3 in a sequence" in March nums <- 0.3 + 2e-16 * c(-2,-1,1,2) f <- factor(nums) levels(f) # [1]
2009 May 25
2
inconsistency in ?factor
In the almost current development version (2009-05-22 r48594) and also in https://svn.r-project.org/R/trunk/src/library/base/man/factor.Rd ?factor contains (compare the formulations marked by ^^^^^^) \section{Warning}{ The interpretation of a factor depends on both the codes and the \code{"levels"} attribute. Be careful only to compare factors with the same set of levels (in
2005 Apr 20
3
Keeping factors with zero occurrences in "table" output
Dear R group, I have a data frame which contains data on preferences on 7 items (ranks 1 through 7) listed by each participant. I would like to tabulate this in a 7x7 table where the rows would be the items and the columns would be the number of times that item received a particular rank. I tried doing this by creating a matrix by "rbind"ing each vector obtained using
2013 Apr 29
3
Counting number of consecutive occurrences per rows
Hi, I would appreciate if somebody could help me with following calculation. I have a dataframe, by 10 minutes time, for mostly one year data. This is small example: > dput(test) structure(list(jul = structure(c(14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655), origin = structure(0, class = "Date")), time =
2012 Jun 14
3
Lowest number in a numeric string
Hi all, I've got a very long numeric string. I want to find the lowest number that isn't in that string. E.G String = 123456 Therefore 7 is the lowest number not in that string E.G.2 String = 1234567891011 Therefore 13 is the lowest number not in that string. Any thoughts? p.s. I'm an R noob. -- View this message in context:
2006 Oct 11
2
expression as a parameter of binom.test (PR#9288)
Full_Name: Petr Savicky Version: 2.4.0 OS: Fedora Core release 2 Submission from: (NULL) (62.24.91.47) the error is > binom.test(0.56*10000,10000) Error in binom.test(0.56 * 10000, 10000) : 'x' must be nonnegative and integer while > binom.test(5600,10000) yields correct result. The same error occurrs for > binom.test(0.57*10000,10000)
2012 Jan 27
3
generate a random number with rexp ?
dear list I use runif to generate a ramdom number between min and max runif(n, min=0, max=1) however , the syntaxe of rexp does not allow that rexp(n, rate = 1) and it generate a number with the corresponding rate. The question is: how to generate a number between min and max using rexp(). Regards -- PhD candidate in Computer Science Address 3 avenue lamine, cité ezzahra, Sousse 4000
2010 Nov 04
2
count occurrence and distance of characters in string
Hello all, I want to know how often one character occurs in a given string and the distance from between every two occurences. (distance = other characters between them). thanks
2011 Dec 29
2
sorting a data.frame (df) by a vector (which is not contained in the df) - unexpected behaviour of match and factor
Dear R colleagues, consider my data.frame named "df" with 3 columns - being level, prevalence and sensitivity - and 7 rows of data (see dump below). df <- structure(list(level = structure(1:7, .Label = c("0", "1", "10", "100", "1010", "11", "110"), class = "factor"), prevalence = structure(c(4L, 2L, 3L,
2004 Jul 18
2
a problem: factors, names, tables ..
Hi all, I am *completely* lost in trying to solve a relatively simple task. I want to compute the relative number of occurences of an event, the data of which sits in a large table (read from file). I have the occurences of the events in a table 'tt' 0 2 10 11 13 14 15 15 6 1 3 8 15 10 .. meaning that event of type '0' occurs 15 times, type '2' occurs 6 times