Re: [R] frequency distribution in figures....

2018-09-08 Thread Jim Lemon
Hi Akshay, Try this: table(cut(xht,breaks=seq(0,10,by=2))) Jim On Sat, Sep 8, 2018 at 8:26 PM akshay kulkarni wrote: > > dear members, > I am facing difficulties in plotting histograms > in R in Linux CLI. > > Is there a function in R which produces a table of freq

Re: [R] frequency distribution in figures....

2018-09-08 Thread Duncan Murdoch
On 08/09/2018 6:25 AM, akshay kulkarni wrote: dear members, I am facing difficulties in plotting histograms in R in Linux CLI. Is there a function in R which produces a table of frequency distribution in figures rather than plot that distribution? Something like

Re: [R] Frequency of Combinations

2017-04-25 Thread Thierry Onkelinx
e the (). > > Many thanks > Regards > > > > Sent from my Samsung device > > > Original message > From: Thierry Onkelinx > Date: 24/04/2017 3:43 p.m. (GMT+00:00) > To: abo dalash > Cc: "r-help@R-project.org" > Subject: Re

Re: [R] Frequency of Combinations

2017-04-24 Thread Boris Steipe
This can be easily done in base R. The solution below is pedestrian, transparent and explicit. Thus it's easy to debug and validate(!) each step. Prepare: (1) Save your Excel spreadsheet as a text file with tab-separated values. (2) Initialize a 128 * 128 matrix to hold your results. It should ha

Re: [R] Frequency of Combinations

2017-04-24 Thread Thierry Onkelinx
Dear Mustafa, I'd recommend the packages readxls to import the data, tidyr to transform the data into long format and dplyr to select the data. 1. read the data into R with read_excel() 2. transform sheet 1 into a long format with gather(). The result is one row for each patient / drug combinatio

Re: [R] Frequency of a character in a string

2016-11-14 Thread Hervé Pagès
On 11/14/2016 12:44 PM, Bert Gunter wrote: (Sheepishly)... Yes, thank you Hervé. It would have been nice if I had given correct soutions. Fixed = TRUE could not have of course worked with ["a"] character class! Here's what I found with a 10 element vector each member of which is a 1e5 length

Re: [R] Frequency of a character in a string

2016-11-14 Thread William Dunlap via R-help
Here is another variant, v3, and a change to your first example so it returns the same value as your second example. > set.seed(1001) > x <- sapply(1:100, function(x)paste0(sample(letters,rpois(1,1e5),rep=TRUE),collapse = "")) > system.time(v1 <- lengths(strsplit(paste0("X", x, "X"),"a",fixed=TRUE

Re: [R] Frequency of a character in a string

2016-11-14 Thread Bert Gunter
(Sheepishly)... Yes, thank you Hervé. It would have been nice if I had given correct soutions. Fixed = TRUE could not have of course worked with ["a"] character class! Here's what I found with a 10 element vector each member of which is a 1e5 length string: > system.time((lengths(strsplit(paste0

Re: [R] Frequency of a character in a string

2016-11-14 Thread Hervé Pagès
Hi, FWIW using gsub( , fixed=TRUE) is faster than using gsub( , fixed=FALSE) or strsplit( , fixed=TRUE): set.seed(1) Vec <- paste(sample(letters, 500, replace = TRUE), collapse = "") system.time(res1 <- nchar(gsub("[^a]", "", Vec))) # user system elapsed # 0.585 0.000 0.586

Re: [R] Frequency of a character in a string

2016-11-14 Thread Bert Gunter
Chuck, Marc, and anyone else who still has interest in this odd little discussion ... Yes, and with fixed = TRUE my approach took 1/3 as much time as Chuck's with a 10 element vector each element of which is a character string of length 1e5: > set.seed(1001) > x <- sapply(1:10, function(x)paste0(

Re: [R] Frequency of a character in a string

2016-11-14 Thread Charles C. Berry
On Mon, 14 Nov 2016, Marc Schwartz wrote: On Nov 14, 2016, at 11:26 AM, Charles C. Berry wrote: On Mon, 14 Nov 2016, Bert Gunter wrote: [stuff deleted] Hi, Both gsub() and strsplit() are using regex based pattern matching internally. That being said, they are ultimately calling .Intern

Re: [R] Frequency of a character in a string

2016-11-14 Thread Marc Schwartz
> On Nov 14, 2016, at 11:26 AM, Charles C. Berry wrote: > > On Mon, 14 Nov 2016, Bert Gunter wrote: > >> Yes, but it need some help, since nchar gives the length of the >> *entire* string; e.g. >> >> ## to count "a" 's : >> >>> x <-(c("abbababba","bbabbabbaaaba")) >>> nchar(gsub("[^a]","",x)

Re: [R] Frequency of a character in a string

2016-11-14 Thread Charles C. Berry
On Mon, 14 Nov 2016, Bert Gunter wrote: Yes, but it need some help, since nchar gives the length of the *entire* string; e.g. ## to count "a" 's : x <-(c("abbababba","bbabbabbaaaba")) nchar(gsub("[^a]","",x)) [1] 4 6 This is one of about 8 zillion ways to do this in base R if you don't wan

Re: [R] Frequency of a character in a string

2016-11-14 Thread Bert Gunter
Yes, but it need some help, since nchar gives the length of the *entire* string; e.g. ## to count "a" 's : > x <-(c("abbababba","bbabbabbaaaba")) > nchar(gsub("[^a]","",x)) [1] 4 6 This is one of about 8 zillion ways to do this in base R if you don't want to use a specialized package. Just for

Re: [R] Frequency of a character in a string

2016-11-14 Thread Brijesh Mishra
?nchar in the base R should also help... On Mon, Nov 14, 2016 at 2:26 PM, Ismail SEZEN wrote: > > > On 14 Nov 2016, at 11:44, Ferri Leberl wrote: > > > > > > Dear All, > > Is there a function to count the occurences of a certain character in a > string resp. in a vector of strings? > > Thank yo

Re: [R] Frequency of a character in a string

2016-11-14 Thread Ismail SEZEN
> On 14 Nov 2016, at 11:44, Ferri Leberl wrote: > > > Dear All, > Is there a function to count the occurences of a certain character in a > string resp. in a vector of strings? > Thank you in advance! > Yours, Ferri > library(stringr) ?str_count _

[R] Frequency of a character in a string

2016-11-14 Thread Ferri Leberl
Dear All, Is there a function to count the occurences of a certain character in a string resp. in a vector of strings? Thank you in advance! Yours, Ferri __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/

Re: [R] frequency of items

2016-07-20 Thread sri vathsan
Hi all, I understand this is not a data frame but an individual variable from the data frame which is a list. Since, I need to work on this particular variable I just added here as a sample data. Jim, your code solved the purpose.Thanks! Regards, Srivathsan On Wed, Jul 20, 2016 at 4:29 PM, Ulr

Re: [R] frequency of items

2016-07-20 Thread Ulrik Stervbo
What you show cannot be a data.frame. Using what you gave, this should help you along: x <- c(11,15,12,25, 11,12, 15,25, 134,45,56, 46, 45,56, 15,12, 66,45,56,24,14,11,25,12,134) table(x) On Wed, 20 Jul 2016 at 11:44 Jim Lemon wrote: > Oops, didn't translate that function correctly: > > has_val

Re: [R] frequency of items

2016-07-20 Thread Jim Lemon
Oops, didn't translate that function correctly: has_values<-function(x,values) { if(is.list(x)) { return(sum(unlist(lapply(svlist, function(x,values) return(all(values %in% x)),values } } Jim On Wed, Jul 20, 2016 at 7:18 PM, Jim Lemon wrote: > Hi sri, > Maybe something like this? > >

Re: [R] frequency of items

2016-07-20 Thread Jim Lemon
Hi sri, Maybe something like this? has_values<-function(x,values) { if(is.list(x)) { return(sum(unlist(lapply(svlist, function(x,values) return(all(values %in% x)),c(11,12) } } svlist<-list(a=c(11,15,12,25), b=c(11,12), c=c(15,25), d=c(134,45,56), e=46, f=c(45,56), g=c(15,12), h

Re: [R] frequency of items

2016-07-20 Thread Michael Dewey
It seems very unlikely that what you quote can be a data frame. It could be a list I suppose. Can you clarify? On 19/07/2016 11:59, sri vathsan wrote: Hi, I have a data frame like below. 11,15,12,25 11,12 15,25 134,45,56 46 45,56 15,12 66,45,56,24,14,11,25,12,134 I want to identify the freque

[R] frequency of items

2016-07-19 Thread sri vathsan
Hi, I have a data frame like below. 11,15,12,25 11,12 15,25 134,45,56 46 45,56 15,12 66,45,56,24,14,11,25,12,134 I want to identify the frequency of pairs/triplets or higher that occurs in the data. Say for example, in above data the occurrence of pairs looks like below item No of occurrence

Re: [R] frequency tables

2015-09-09 Thread David Winsemius
On Sep 9, 2015, at 11:52 AM, Nick Petschek wrote: > Hi, > > I want to run frequency tables for multiple categorical variables, ideally > one in %, and the other as a count, and am unsure how to proceed. I would > like my output to be the following: > > | favorable | unfavorable | neutral

[R] frequency tables

2015-09-09 Thread Nick Petschek
Hi, I want to run frequency tables for multiple categorical variables, ideally one in %, and the other as a count, and am unsure how to proceed. I would like my output to be the following: | favorable | unfavorable | neutral Q1 | 80% | 10%| 10% | Q2 | 70% |

Re: [R] Frequency count of terms only in a given column in R

2015-08-30 Thread PIKAL Petr
2015 5:16 PM > To: Sarah Goslee; agrima seth > Cc: r-help > Subject: Re: [R] Frequency count of terms only in a given column in R > > Dear Agrima > > As well as Sarah's seven possibilities an eighth occurs to me: you have > not yet read it into R in the first place. If

Re: [R] Frequency count of terms only in a given column in R

2015-08-28 Thread Michael Dewey
Dear Agrima As well as Sarah's seven possibilities an eighth occurs to me: you have not yet read it into R in the first place. If that is the case you may be able to use read.table to get it into a data frame with columns corresponding to your words. ?read.table may be your friend here. On 2

Re: [R] Frequency count of terms only in a given column in R

2015-08-28 Thread Sarah Goslee
Hi, On Fri, Aug 28, 2015 at 7:49 AM, agrima seth wrote: > i have a text file with data of the given format: > > white snow > lived snow > in snow > lived place > in place > a place > called place > as place That doesn't specify the format. I can think of at least seven things that could be: a ch

[R] Frequency count of terms only in a given column in R

2015-08-28 Thread agrima seth
i have a text file with data of the given format: white snow lived snow in snow lived place in place a place called place as place here i have to find the frequency of the terms only in the first column (i.e.) white - 1 lived- 2 in -2 a-1 called - 1 as -1 Could you please guide me how to do the

Re: [R] frequency of numbers

2013-11-21 Thread arun
Hi, >From the dscription, looks like you need ?rle() vec1 <- c(111, 106, 117, 108, 120, 108, 108, 116, 116, 113)  res <- rle(vec1)$lengths  names(res) <- rle(vec1)$values  res[res>1] #108 116 #  2   2 length(res[res>1]) A.K. On Thursday, November 21, 2013 10:12 AM, b. alzahrani wrote:

Re: [R] frequency of numbers

2013-11-21 Thread Charles Determan Jr
If you just need a count of how many of each number you can just use table(). > tmp <- c(111,106,117,108,120,108,108,116,113) > table(tmp) tmp 106 108 111 113 116 117 120 1 3 1 1 1 1 1 On Thu, Nov 21, 2013 at 9:10 AM, b. alzahrani wrote: > > hi guys > > Assume I have this data

Re: [R] frequency of numbers

2013-11-21 Thread b. alzahrani
Thanks, got it. ** Bander Alzahrani, r * Date: Thu, 21 Nov 2013 09:14:11 -0600 Subject: Re: [R] frequency of numbers From: deter...@umn.edu To: cs_2...@hotmail.com CC: r-help@r-project.org If

[R] frequency of numbers

2013-11-21 Thread b. alzahrani
hi guys Assume I have this dataframe: v3$number_of_ones [1] 111 106 117 108 120 108 108 116 116 113 Is there any command in r that gives me the frequency of these numbers (how many each number is repeated e.g. the number 108 repeated 2 and 111 repeated one an so on) I have around 10^6 numb

Re: [R] Frequency count of Boolean pattern in 4 vectors.

2013-06-01 Thread William Dunlap
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Sridhar Iyer > Sent: Saturday, June 01, 2013 2:57 PM > To: r-help@r-project.org > Subject: [R] Frequency count of Boolean pattern in 4 vectors. > > I need to do this on very large data

[R] Frequency count of Boolean pattern in 4 vectors.

2013-06-01 Thread Sridhar Iyer
I need to do this on very large datasets ( > a few million data points). So seeking help in figuring out an implementation of the task. Input 4 vectors which contain values as 0 or 1. (as integers, not boolean bits) vec_A = ( 0, 1, 0, 0, .. 1, 0, 1, 0) etc vec_B = (0,0,1,1.) vec_C, vec_D

Re: [R] Frequency Block Chart

2013-04-23 Thread Eik Vettorazzi
Hi Angelo, you might have a look at this http://lmdvr.r-forge.r-project.org/figures/figures.html?chapter=06;figure=06_15;theme=stdBW;code=right Cheers Am 23.04.2013 12:42, schrieb Angelo Scozzarella Tiscali: > Hi, friends. > I'd like to illustrate the relationship between two categorical variable

[R] Frequency Block Chart

2013-04-23 Thread Angelo Scozzarella Tiscali
Hi, friends. I'd like to illustrate the relationship between two categorical variables with a block chart (a three-dimensional bar chart) with the height of the blocks being proportional to the frequencies. Is there a way to do it with R? Thanks in advance Angelo [[alternative HTML ver

Re: [R] frequency table-visualization for complex categorical variables

2013-02-26 Thread Niklas Fischer
Thanks Rui, It is very useful indeed. Bests, Niklas 2013/2/26 Rui Barradas > Hello, > > I'm not sure I understand, do you want to treat BCC, CBC and CCB as the > same? If so try > > w2 <- apply( y , 1 , function(x) paste0(sort(x) , collapse = "" )) > > table(w2) > > > Hope this helps, > > Rui Ba

Re: [R] frequency table-visualization for complex categorical variables

2013-02-26 Thread Rui Barradas
Hello, I'm not sure I understand, do you want to treat BCC, CBC and CCB as the same? If so try w2 <- apply( y , 1 , function(x) paste0(sort(x) , collapse = "" )) table(w2) Hope this helps, Rui Barradas Em 26-02-2013 13:58, Niklas Fischer escreveu: Hi again, Thanks for Anthony about the

Re: [R] frequency table-visualization for complex categorical variables

2013-02-26 Thread Niklas Fischer
Hi again, Thanks for Anthony about the links on reproducible codes. Thanks for Rui about ordering when rows are intact. One more question Here is your code. x <- cbind( sample( LETTERS[1:6] , 100 , replace = TRUE ) , sample( LETTERS[1:6] , 100 , replace = TRUE )

Re: [R] frequency table-visualization for complex categorical variables

2013-02-25 Thread Rui Barradas
Hello, I disagree with the way you've sorted the matrix, like this all A's become first, then B's, etc, irrespective of the respondents. Each row is a respondent, and the rows should be kept intact, but with a different ordering. To this effect, use order(): z <- y[order(y[,1], y[,2], y[,3])

Re: [R] frequency table-visualization for complex categorical variables

2013-02-25 Thread Anthony Damico
in the future, please provide R code to re-create some example data :) read http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-examplefor more detail.. # create a data table with three unique columns' values.. # treat these values just like letters x <- cbind(

Re: [R] frequency

2012-10-23 Thread farnoosh sheikhi
Thanks a lot. Is count command in package COUNT? I'm having a hard fine to fine this package. Thanks again:)   Best,Farnoosh Sheikhi Cc: R help Sent: Tuesday, October 23, 2012 2:07 PM Subject: Re: [R] frequency Hi, Try this: dat1<-read.table(t

Re: [R] frequency

2012-10-23 Thread arun
   3 A.K. From: farnoosh sheikhi To: arun Cc: R help Sent: Tuesday, October 23, 2012 5:29 PM Subject: Re: [R] frequency Thanks a lot. Is count command in package COUNT? I'm having a hard fine to fine this package. Thanks again:) Best,Farnoosh S

Re: [R] frequency

2012-10-23 Thread arun
l=TRUE) #ID Visit response #1  x    a1    2 #2  x    a2    2 #3  x    a2    2 #4  x    a1    2 #5  x    a1    2 #6  y    b1    3 #7  y   c23    3 #8  y   b33    3 A.K. From: farnoosh sheikhi To: arun Sent: Tuesday, October 23,

Re: [R] frequency

2012-10-23 Thread arun
uot;,all=TRUE) #  ID1 visit response #1   x    a1    2 #2   x    a2    2 #3   y    b1    3 #4   y   c23    3 #5   y   b33    3 A.K. - Original Message - From: farnoosh sheikhi To: "r-help@R-project.org" Cc: Sent: Tuesday, October 23, 2012 3:14 PM Subject: [R]

Re: [R] frequency

2012-10-23 Thread Bert Gunter
Are the data in a data frame? Is it the first letter of the id that defines unique ID's or something else? Depending on your answers: ?substring ?table ?with may be useful, as in with(yourdata,table(substring(ID,1,1))) ... or not, if you meant something else. -- Bert On Tue, Oct 23, 2012 at

[R] frequency

2012-10-23 Thread farnoosh sheikhi
Hello, I have a data as follow: ID    Visit xa1 xa2 yb1 yc23 yb33   I want to look at frequency of visit for ID and create a new column as response .  For example my response would be 2 for x and 3 for y. I think I need to write a loop, but I don't know how. I really appreciate your help. Thanks

Re: [R] frequency table with custom bands

2012-10-17 Thread jim holtman
;,x))) > res3<-within(as.data.frame(res2),{Freq<-as.numeric(Freq)}) > head(res3) > # Var1 Freq > #1 0-51 > #2 5-106 > #3 10-152 > #4 15-202 > #5 20-256 > #6 25-302 > > > A.K. > > > > > > > > > - Orig

Re: [R] frequency table with custom bands

2012-10-17 Thread arun
s.numeric(Freq)})  head(res3) #   Var1 Freq #1   0-5    1 #2  5-10    6 #3 10-15    2 #4 15-20    2 #5 20-25    6 #6 25-30    2 A.K. - Original Message - From: jcrosbie To: r-help@r-project.org Cc: Sent: Tuesday, October 16, 2012 7:37 PM Subject: [R] frequency table with custom bands

Re: [R] frequency table with custom bands

2012-10-17 Thread arun
-30    2 A.K. - Original Message - From: jim holtman To: jcrosbie Cc: r-help@r-project.org Sent: Tuesday, October 16, 2012 8:52 PM Subject: Re: [R] frequency table with custom bands ?cut try this: > seq1 = seq(0, 95, by = 5) > seq2 = seq(100, 1000, by = 100) > Band

Re: [R] frequency table with custom bands

2012-10-16 Thread jim holtman
?cut try this: > seq1 = seq(0, 95, by = 5) > seq2 = seq(100, 1000, by = 100) > Bands = c(seq1, seq2) > Prices = sample(1:1000, 200, replace=F) > table(cut(Prices, breaks = Bands)) (0,5] (5,10] (10,15] (15,20] (20,25] (25,30] (30,35] (35,40] 1 2

[R] frequency table with custom bands

2012-10-16 Thread jcrosbie
I would like to create a frequency table with custom bands. seq1 = seq(0, 100, by = 5) seq2 = seq(100, 1000, by = 100) Bands = c(seq1, seq2) Prices = sample(1:1000, 200, replace=F) How would I go about find the frequency of prices within each band? -- View this message in context: http:/

Re: [R] frequency count by row

2012-03-06 Thread R. Michael Weylandt
Or perhaps faster but less general: rowSums(mydata != 0) Michael On Tue, Mar 6, 2012 at 12:56 PM, Sarah Goslee wrote: > A reproducible example would be helpful, but lacking that > here's some untested code. If your data frame has NA values, > those will also need to be dealt with. > > apply(myd

Re: [R] frequency count by row

2012-03-06 Thread Sarah Goslee
A reproducible example would be helpful, but lacking that here's some untested code. If your data frame has NA values, those will also need to be dealt with. apply(mydata, 1, function(x)sum(x != 0)) Sarah On Tue, Mar 6, 2012 at 12:03 PM, mari681 wrote: > I feel this is a very easy thing but I'

[R] frequency count by row

2012-03-06 Thread mari681
I feel this is a very easy thing but I've never done it before and it is getting frustrating. I have a big data.frame (1445846 rows, 15 col) that looks like this: V1 V2 V3 V4 V5 1home sisterbrother chair 0 2cat

Re: [R] frequency table?

2011-12-06 Thread Sarah Goslee
After that, you might consult the source code for distance() in ecodist. That function was specifically written to make it easy for people to add new dissimilarity/similarity metrics, and I think you'll find it helpful (even if you just extract the bit you need rather than expand the whole function

Re: [R] frequency table?

2011-12-05 Thread B77S
Set, This is the same post as your "Similarity Matrix" post. I'm not trying to be a smart ass here, but ... ?Can you fit a square peg in a round hole?... yes, but it doesn't mean it belongs there. I suggest you get a piece of paper and a pencil and figure out 1) what you are trying to do and w

Re: [R] frequency table?

2011-12-05 Thread Jim Lemon
On 12/04/2011 08:21 PM, set wrote: Hello R-users, I've got a file with individuals as colums and the clusters where they occur in as rows. And I wanted a table which tells me how many times each individual occurs with another. I don't really know how such a table is called...it is not a frequenc

[R] frequency table?

2011-12-04 Thread set
Hello R-users, I've got a file with individuals as colums and the clusters where they occur in as rows. And I wanted a table which tells me how many times each individual occurs with another. I don't really know how such a table is called...it is not a frequency tableMy eventual goal is to mak

Re: [R] Frequency table

2011-11-23 Thread Jess L
Hi, I think you can try the function rep(). Example: # this means rep 1 once, 2 twice and 3 three times > rep(c(1,2,3), c(1,2,3)) [1] 1 2 2 3 3 3 # this means rep "A", "B", "C", until it reaches length of 10 > rep(c("A","B","C"), length.out = 10) [1] "A" "B" "C" "A" "B" "C" "A" "B" "C" "A" you

Re: [R] Frequency table

2011-11-23 Thread R. Michael Weylandt
I think something like this is what you are looking for, but to be honest, I don't quite understand what you are looking for: can you actually write out the desired result: tapply(df$x, df$Var, table) where df is the name of your data. df <- structure(list(Var = c(201L, 201L, 201L, 201L, 202L, 2

[R] Frequency table

2011-11-23 Thread reynaldo_ns
Hello everybody I am new on R I have some problem when i try to obtain frequency table which script do I need to write in R in order to obtain the frecuency of a value per repetition You could see my example Var. rep x I need to obtain these 2011

Re: [R] Frequency plot --- stacked symbols

2011-02-08 Thread David Arnold
Hi, This was a terrific suggestion. I'm no expert in R, but I managed to find and read the axis command to do the following. x=c(rep(2,14),rep(4,13),rep(6,11),rep(8,4),rep(10,3),rep(12,2),14,16,18) stripchart(x,method="stack",pch=21,at=0,bg="lightblue",col="blue",offset=.5,cex=1.5,xlab="Bag B"

Re: [R] Frequency plot --- stacked symbols

2011-02-08 Thread Eik Vettorazzi
Hi, either upscale the circles (increase cex) or narrow your plot, as in x11(3,5) stripchart(x,method="stack",pch=21,at=0,bg="lightblue",col="blue",offset=.5,cex=1.5,xlab="Bag B",frame.plot=FALSE,axes=FALSE) there's a trade off between 'closing the gap' and having all your ticks readable, so just

Re: [R] Frequency plot --- stacked symbols

2011-02-08 Thread Eik Vettorazzi
Hi David, you can use base 'stripchart' stripchart(rbinom(100,size=10,p=.3),method="stack",pch=21,at=0,bg="lightblue",col="blue",offset=.5,cex=1.5,xlim=c(0,10)) and set 'pch' as you wish, e.g. as in example(points) hth. Am 08.02.2011 08:27, schrieb David Arnold: > Hi, > > We were wondering ho

Re: [R] Frequency plot --- stacked symbols

2011-02-08 Thread Karl Ove Hufthammer
David Arnold wrote: > We were wondering how we could make a stacked frequency diagram such as > this one: > > http://msemac.redwoods.edu/~darnold/math15/liz.pdf See the ‘dots’ function in the ‘TeachingDemos’ package or the ‘dotPlot’ (not to be confused with ‘dotplot’) function in the ‘BHH2’ pac

[R] Frequency plot --- stacked symbols

2011-02-08 Thread David Arnold
Hi, We were wondering how we could make a stacked frequency diagram such as this one: http://msemac.redwoods.edu/~darnold/math15/liz.pdf We don't necessarily need the shaded "balls", other characters would be fine, such as stacks of x's. David __ R-

Re: [R] Frequency tables including the zero frequencies

2010-11-23 Thread Jorge Ivan Velez
Hi Liliana, Try > table(factor(x, levels = 0:10)) 0 1 2 3 4 5 6 7 8 9 10 0 2 0 6 0 2 2 1 0 1 6 Also, see ?factor. HTH, Jorge On Tue, Nov 23, 2010 at 10:29 PM, Liliana Pacheco <> wrote: > Hi R users > I want to make a table of frequencies to show how many times the numbe

[R] Frequency tables including the zero frequencies

2010-11-23 Thread Liliana Pacheco
Hi R users I want to make a table of frequencies to show how many times the numbers form 0 to 10 appear in a vector. For example, if the vector is: > x [1] 5 10 3 5 10 10 3 6 10 1 10 3 7 1 10 3 6 9 3 3 In this case I want a table that will show that the zero has frequency 0, the o

Re: [R] frequency table for a list matching some conditions

2010-08-26 Thread Olga Lyashevska
Thanks Dimitris, It works nicely! Regards, Olga On Thu, 2010-08-26 at 11:55 +0200, Dimitris Rizopoulos wrote: > one way is the following: > > mylist <- list(x1 = c("A","A","A","B","C","Z","Y"), > x2 = c("D","D","E","E","F","Z","X"), > x3 = c("A","A","A","B","Y","Z")) > newlist <- c("

Re: [R] frequency table for a list matching some conditions

2010-08-26 Thread Dimitris Rizopoulos
one way is the following: mylist <- list(x1 = c("A","A","A","B","C","Z","Y"), x2 = c("D","D","E","E","F","Z","X"), x3 = c("A","A","A","B","Y","Z")) newlist <- c("A","B","C","D","E","F") tab <- t(sapply(mylist, function (x) table(factor(x, levels = newlist tab[tab == 0] <- NA tab

[R] frequency table for a list matching some conditions

2010-08-26 Thread Olga Lyashevska
Dear all, I have a list that contains 3 sublists( x1, x2, x3) mylist<-list(x1=c("A","A","A","B","C","Z","Y"),x2=c("D","D","E","E","F","Z","X"),x3=c("A","A","A","B","Y","Z")) mylist $x1 [1] "A" "A" "A" "B" "C" "Z" "Y" $x2 [1] "D" "D" "E" "E" "F" "Z" "X" $x3 [1] "A" "A" "A" "B" "Y" "Z" I also ha

Re: [R] frequency, count rows, data for heat map

2010-08-26 Thread Jan van der Laan
Please, reply to the r-help and not only to me personally. That way others can can also help, or perhaps benefit from the answers. You can use strplit to remove the last part of the strings. strplit returns a list of character vectors from which you (if I understand you correctly) only want to sel

Re: [R] frequency, count rows, data for heat map

2010-08-25 Thread Dennis Murphy
Hi: Here are a couple of ways to render a basic 2D table. Let's call your input data frame dat: > names(dat) <- c('samp', 'sequen') > ssTab <- as.data.frame(with(dat, table(samp, sequen))) > ssTab # data frame version samp sequen Freq 1 111abc1 2 1079abc1 3 5576abc1 4

Re: [R] frequency, count rows, data for heat map

2010-08-25 Thread Jan van der Laan
Your problem is not completely clear to me, but perhaps something like data <- data.frame( a = rep(c(1,2), each=10), b = rep(c('a', 'b', 'c', 'd'), 5)) library(plyr) daply(data, a ~ b, nrow) does what you need. Regards, Jan On Wed, Aug 25, 2010 at 4:53 PM, rtsweeney wrote: > > Hi all, >

[R] frequency, count rows, data for heat map

2010-08-25 Thread rtsweeney
Hi all, I have read posts of heat map creation but I am one step prior -- Here is what I am trying to do and wonder if you have any tips? We are trying to map sequence reads from tumors to viral genomes. Example input file : 111 abc 111 sdf 111 xyz 1079 abc 1079 xyz 1079 xyz 55

Re: [R] frequency

2010-05-06 Thread Dennis Murphy
Hi: There's always prop.table: I read in your data as a data frame d. Since prop.table() expects a matrix/array as input, > prop.table(as.matrix(d), 2) V2 V3V4 [1,] NaN 0.53846154 0.3636364 [2,] NaN 0.15384615 0.000 [3,] NaN 0.07692308 0.2727273 [4,] NaN 0.23076923 0.36

Re: [R] frequency

2010-05-06 Thread Joachim de Lezardiere
, 2010 1:09 PM To: r-help@r-project.org Cc: n.via...@libero.it Subject: Re: [R] frequency On 06-May-10 17:06:26, n.via...@libero.it wrote: > > Dear list, > Im trying to do the following operation but im not able to do it > This is my table: > 1 2 3 > 1 0 7 4 &

Re: [R] frequency

2010-05-06 Thread Joris Meys
For completeness. On Thu, May 6, 2010 at 8:03 PM, Joris Meys wrote: > Table <- matrix(ncol=3,nrow=4,c(0,0,0,0,7,2,1,3,4,0,3,4)) > > # one way > t(t(Table)/colSums(Table)) > > # another way > apply(Table,2,function(x){x/sum(x)}) > > Take in mind that your solution is wrong. If you divide 0 by 0,

Re: [R] frequency

2010-05-06 Thread Ted Harding
On 06-May-10 17:06:26, n.via...@libero.it wrote: > > Dear list, > Im trying to do the following operation but im not able to do it > This is my table: > 1 2 3 > 1 0 7 4 > 2 0 2 0 > 3 0 1 3 > 4 0 3 4 > > what i would like to do is > > divide each row values wit

[R] frequency

2010-05-06 Thread n.via...@libero.it
Dear list, Im trying to do the following operation but im not able to do it This is my table: 1 2 3 1 0 7 4 2 0 2 0 3 0 1 3 4 0 3 4 what i would like to do is divide each row values with the corresponding column' sum,namely: 1 2

Re: [R] Frequency table

2010-04-17 Thread Kevin Turner
Thanks Robin. I used the following line, which got my table looking correct. Wind_freq_speed <- t(table(cut(Wind_Dir_vec, 0:36), cut(Wind_Speed_vec, seq(0, to=60, by=10 Unfortunately, the rosavent function produced a wind rose diagram that repeats my frequency data 6 times throughout the 360

Re: [R] Frequency table

2010-04-16 Thread Robin Evans
> but I need to incorporate the speed values and have a table like the > following: >                 1     2     3     4     5     6 36 > 0-9 > 10-19 > 20-29 > 30-39 > 40-49 > 50+ > The final table will be used in the rosavent function to produce a wind rose > diagram just like in this exampl

[R] Frequency table

2010-04-16 Thread Kevin Turner
Hello, I'm trying to make a table like windfreq.dat in the rose diagram example of the climatol package. It looks like: N NNE NE ENEE ESE SE SSES SSW SW WSWW WNW NW NNW 0-3 59 48 75 90 71 15 10 11 14 20 22 22 24 15

[R] Frequency: NA values returns zero

2010-02-23 Thread Muhammad Rahiz
Hi all, I created the following script to make a frequency count for multi-dimenstioanl array. There is no problem with the results except for the NA values which returns 0. Now, I don't want NA to return 0 but to return as NA. This is because I'm dealing with gridded data in which the NODAT

[R] frequency table help

2010-01-25 Thread Paola Pesci
Hi, I have a dataset like this: Specieslength (cm) A 12.4 B 45 A 34.6 C 73 C 24.5 D 4.5 .. I'm trying to obtain a barplot with the class length in x (fixed classes, 5 cm) and the number of

Re: [R] Frequency tables.

2009-12-11 Thread David Winsemius
On Dec 11, 2009, at 10:48 PM, Kim Jung Hwa wrote: Thank you David and Ista for your suggestions. I got the latex part. But, this may be stupid, I got the html code using following command, how can I make use of it? Thanks anyways. On my computer just copying that to a text editor and ope

Re: [R] Frequency tables.

2009-12-11 Thread Kim Jung Hwa
Thank you David and Ista for your suggestions. I got the latex part. But, this may be stupid, I got the html code using following command, how can I make use of it? Thanks anyways. temp<-xtable(summary(Orange)) print(temp, type="html") Treeage circumference 1 3:7 M

Re: [R] Frequency tables.

2009-12-11 Thread Ista Zahn
There are a variety of packages that help format output using either LaTeX or html. I've grown to prefer the latex() function in the Hmisc packages, but you might also be interested in xtable (can output either to LaTeX or html), R2html, or prettyR. -Ista On Fri, Dec 11, 2009 at 6:55 PM, Kim Jung

Re: [R] Frequency tables.

2009-12-11 Thread David Winsemius
On Dec 11, 2009, at 6:55 PM, Kim Jung Hwa wrote: library(datasets) Orange summary(Orange) > library(xtable) > xtable(summary(Orange)) % latex table generated in R 2.10.1 by xtable 1.5-6 package % Fri Dec 11 21:39:50 2009 \begin{table}[ht] \begin{center} \begin{tabular}{rlll} \hline & Tree

[R] Frequency tables.

2009-12-11 Thread Kim Jung Hwa
Hi All, I'm a SAS user but I'm very much interested in learning R. I use ODS system in SAS to make nice frequency tables. Is it possible to export the output of table() [in TABULAR FORM]? So, that I can use those directly for publications? Thank you. # R Code: library(datasets) Orange summary(Or

Re: [R] Frequency

2009-11-02 Thread Nikhil Kaza
try sort (table(MAT), decreasing=T) if MAT is your matrix I think this is what you want. though if you want to sort by the first occurrence then it is a different story. Nikhil On 2 Nov 2009, at 1:35PM, Val wrote: V1 v2 v3 v4 569 10 347 10 46 10 18

Re: [R] Frequency

2009-11-02 Thread David Winsemius
On Nov 2, 2009, at 2:49 PM, Jorge Ivan Velez wrote: Hi Ashta, Yes, it is possible. Here is a suggestion: # Data set x <- read.table(textConnection("v1 v2 v3 v4 569 10 347 10 46 10 18"), header = TRUE) closeAllConnections() # Table res <- table(data.matrix(x))

Re: [R] Frequency

2009-11-02 Thread Jorge Ivan Velez
Hi Ashta, Yes, it is possible. Here is a suggestion: # Data set x <- read.table(textConnection("v1 v2 v3 v4 569 10 347 10 46 10 18"), header = TRUE) closeAllConnections() # Table res <- table(data.matrix(x)) f <- sort(res, decreasing = TRUE) data.frame(value = na

Re: [R] Frequency

2009-11-02 Thread Ashta
Thank you Jorge and > res <- table(unlist(x)) > res[order(res, decreasing = TRUE)] > # 10 4 6 3 5 7 9 18 > # 3 2 2 1 1 1 1 1 This one works fine for me. Is it possible to transpose it? I tried t(res[order(res, decreasing = TRUE)]), but it did not work! I want the result like this

Re: [R] Frequency

2009-11-02 Thread Joe King
: r-help@r-project.org Subject: [R] Frequency BAYESIAN INFERENCES FOR MILKING TEMPERAMENT IN CANADIAN HOLSTEINS Hi All, I have a data set "x" with several variables. Sample of the data is shown below V1 v2 v3 v4 569 10 347 10 46 10 18 I want the freq

Re: [R] Frequency

2009-11-02 Thread Jorge Ivan Velez
Hi Val, Here is a suggestion: res <- table(unlist(x)) res[order(res, decreasing = TRUE)] # 10 4 6 3 5 7 9 18 # 3 2 2 1 1 1 1 1 HTH, Jorge On Mon, Nov 2, 2009 at 1:35 PM, Val <> wrote: > BAYESIAN INFERENCES FOR MILKING TEMPERAMENT IN CANADIAN HOLSTEINS > > Hi All, > > I have a da

[R] Frequency

2009-11-02 Thread Val
BAYESIAN INFERENCES FOR MILKING TEMPERAMENT IN CANADIAN HOLSTEINS Hi All, I have a data set "x" with several variables. Sample of the data is shown below V1 v2 v3 v4 569 10 347 10 46 10 18 I want the frequency of each data point sorted by their occ

Re: [R] frequency of numbers in a list

2009-08-08 Thread Phil Spector
Julius - Both mag and i are vectors, but of different lengths. R interprets the statement mag>=i as "return a vector the same length as mag and i whose elements compare the corresponding elements of the two vectors." The error message is due to the fact that mag and i are of different lengt

  1   2   >