Re: [R] Histogram of character elements

2018-06-07 Thread Luigi Marongiu
Thank you Ben, this also works! I have a copy of the Sarkar but, usually, I don't work with histograms. I'll brush it up, then. Best regards, Luigi On Thu, Jun 7, 2018 at 1:43 PM Ben Tupper wrote: > > Hi again, > > I'm sort of pre-coffee still, but does this do it? The data frame only has >

Re: [R] Histogram of character elements

2018-06-07 Thread Ben Tupper
Hi again, I'm sort of pre-coffee still, but does this do it? The data frame only has one variable, a factor where the order of the levels is specified. library(lattice) group <- c("a", "b", "c", "d", "e") freq<- c(1, 2, 2, 5, 3) x <- rep(group, freq) df <- data.frame(group =

Re: [R] Histogram of character elements

2018-06-07 Thread Luigi Marongiu
also, with this approach, I need to re-arrange the data. Is it possible to work directly on a dataframe? On Thu, Jun 7, 2018 at 12:48 PM Ben Tupper wrote: > > Hi, > > Is this what you are after? > > group <- c("a", "b", "c", "d", "e") > freq <-c(1, 2, 2, 5, 3) > x = rep(group, freq) >

Re: [R] Histogram of character elements

2018-06-07 Thread Luigi Marongiu
exactly! Thank you! but it is possible to do it with lattice? I might have an extra level of information, for instance super-group, and in that case, I could plot all the supergroup easily together. On Thu, Jun 7, 2018 at 12:48 PM Ben Tupper wrote: > > Hi, > > Is this what you are after? > >

Re: [R] Histogram of character elements

2018-06-07 Thread Ben Tupper
Hi, Is this what you are after? group <- c("a", "b", "c", "d", "e") freq <-c(1, 2, 2, 5, 3) x = rep(group, freq) barplot(table(x)) Cheers, Ben > On Jun 7, 2018, at 6:00 AM, Luigi Marongiu wrote: > > Dear all, > I have a dataframe with a column representing the names of the > elements (a,

[R] Histogram of character elements

2018-06-07 Thread Luigi Marongiu
Dear all, I have a dataframe with a column representing the names of the elements (a, b, etc) and one with their frequencies. How can I plot the frequencies so that each element has an associated frequency value? I have been thinking of a histogram, but I have found it difficult to implement. I