Displaying 20 results from an estimated 20000 matches similar to: "How to show classes with 0 count in table()?"
2008 Feb 29
2
Getting multiple tables when using table(dataframe) to tabulate data
I am having hard time tabulating data in a dataframe, and getting a single
"table" for an answer. I am trying to tabulate all "counts" for given
"status" on a given date.
I have a data frame such as:
delta_ts status count
1 2008-02-27 CLOSED 3
2 2008-02-27 NEW 56
3 2008-02-27 RESOLVED 5
4 2008-02-21 ASSIGNED 1
5
2011 Nov 01
1
Counting entries to create a new table
Hi,
I am an R novice and I am trying to do something that it seems should be fairly simple, but I can't quite figure it out and I must not be using the right words when I search for answers.
I have a dataset with a number of individuals and observations for each day (7 possible codes plus missing data)
So it looks something like this
Individual A, B, C, D
Day1 1,1,1,1
Day 2 1,3,4,2
Day3
2010 Jun 14
2
Zero counts lost with table() in functions
An embedded and charset-unspecified text was scrubbed...
Name: ikke tilgjengelig
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100614/b070ca2f/attachment.pl>
2011 Apr 07
3
force output dimension of table function
I have a small annoying problem.
When I use the 'table' function on a simple vector it counts the
number of occurences.
So depending on the values of my input vector the function returns a
class of type table with different lengths.
Is there an easy way to tell the table function, the values to expect?
That is
#############
> set.seed(0)
> s<-sample(0:5,5,rep=T)
> s
[1] 5 1
2017 Jun 07
1
Another way to count TRUE
To get the number of TRUE in logical vector 'x',
tabulate(x, 1)
can be used. Actually, it gives count of 1, but TRUE as integer is 1. Since R 3.4.0, it gives a correct answer, too, when the count is 2^31 or more.
2011 Mar 19
2
persuade tabulate function to count NAs in a data frame
Hi,
I'd like to ask you a question again. It is basically about data frames, NAs and tabulate function.
I have this data frame. I already used this in one of the previous questions of mine. It intentionally looks this simple, my real 'df' dataframe is much bigger actually and again, I am not willing to annoy anyone with huge databases... So, my database:
id
2006 Mar 06
4
Contingency table and zeros
Hello,
Let's assume I have a vector of integers :
> myvector <- c(1, 2, 3, 2, 1, 3, 5)
My purpose is to obtain the cumulative distribution of these numerical
data, i.e. something like :
value nb_occur.
<=1 2
<=2 4
<=3 6
<=4 6
<=5 7
For this, I create a table with ;
> mytable <- table(myvector)
1 2 3 5
2 2 2 1
However, table() returns an array
How to count from larger value to smaller value in ecdf (Empirical Cumulative Distribution Function)
2008 Feb 19
1
How to count from larger value to smaller value in ecdf (Empirical Cumulative Distribution Function)
Hi, all
ecdf function (Empirical Cumulative Distribution Function) in "stats"
package counts from smaller values to larger values.
However, I want to draw it by counting from larger value to smaller values
and I couldn't find options for this purpose.
How can I draw ecdf or ecdf like graph by counting from larger values to
smaller values.
Thank you in advance.
Hyunchul Kim
2007 Jun 29
1
How to add elements to a table
Hi,
I've been using R for a few weeks now, but consider myself still a
newbie, especially in what concerns the basics of data handling in R.
My situation is this:
I read in data from a database using RODBC, and then use "table" to
produce a table of "counts per years", table which I give to "plot".
All is well, as long as there are no gaps in the years
2005 Jan 05
4
output from table() in matrix form
Hi
How do I get the output from table() in matrix form?
If I have
R> table(c(1,1,1,1,2,20))
1 2 20
4 1 1
I want
[,1] [,2] [,3]
[1,] 1 2 20
[2,] 4 1 1
The problem is that names(table) is a vector of characters and I need
the numeric values.
I am using
R> rbind(as.integer(names(x)),x)
I thought tabulate() might be better as it takes an
2002 Jun 12
4
table problems
dear helplist,
my student has fifty trees, numbered one to fifty, and a vector
recording which tree a certain possum slept in on 12 nights.
R> c
[1] 3 14 17 22 26 26 17 40 43 25 46 46
R>
Thus it slept in tree #3 on Monday, then tree #14 on Tues, and so on.
I wish to test the null hypothesis that the animal chooses trees
randomly; try
R> table(c)
c
3 14 17 22 25 26 40 43 46
1 1
2010 Sep 10
4
Counting occurances of a letter by a factor
I'm trying to find a more elegant way of doing this. What I'm trying to accomplish is to count the frequency of letters (major / minor alleles) in a string grouped by the factor levels in another column of my data frame.
Ex.
> DF<-data.frame(c("CC", "CC", NA, "CG", "GG", "GC"), c("L", "U", "L",
2000 Jan 12
3
functions for flat file import/export + utilities
Dear R-Developers,
please find attached a set of drafted functions for flat file import and
export, partially extending existing functions, partially completely written
as new code.
I thought you might be interested in those functions and the accompanying
utilities for padding and trimming.
Main features are
- supports several formats, i.e. fixed width and CSV (with one exception)
- supports
2010 Mar 13
2
Two questions, first about contingency tables, and second about table () and data.frame (), from a visually impaired user.
Hi all,
I want to make a contingency table in R. I want to tabulate two variables, one as the independent and second as the dependent variable. The IV has two categories, namely, birth complications, and no birth complications. The frequency of birth complication category is fifty, and the frequency of no birth complication category is 34. The categories and frequencies of DV follows.
2006 Apr 19
4
creating empty cells with table()
Hello,
Suppose I simulate 20 observations from the Poisson distribution
with lambda = 4. I can summarize these values using table() and
then feed that to barplot() for a graph.
Problem: if there are empty categories (e.g. 0) or empty categories
within the range of the data (e.g. observations for 6, 7, 9), barplot()
does not include the empty cells in the x-axis of the plot. Is there
any way to
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
2011 Jul 31
4
How to count numbers of a vector and use them as index values?
Dear R folks,
I am sorry to ask this simple question, but my search for the right
way/command was unsuccessful.
I have a vector
> x <- c(2, 2, 3, 3, 4, 6)
Now the values of x should be considered the index of another vector
with possible greater length, say 8, and the value should be how often
the indexes appeared in the original vector x.
> length(result)
[1] 8
> result
[1] 0
2019 Dec 17
2
llvm/docs/AMDGPUUsage.rst ERROR: Malformed table
Hi
I am trying to buildĀ the documentation and view it as html. When I ran
the `make docs-llvm-html` target but ran into this below issue. Has
anyone faced this issue?
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% make
2008 Sep 19
1
frequency table across multiple variables
Dear R users,
I have a dataframe like this:
x1<-c(1,2,3,4,NA ,NA ,NA, 3, 1, 1, 1, 1, 2, 2, 3, 4, 4)
x2<-c(2,3,4,3,4,3,4,2,2,3,4,NA,NA,NA,NA,4,3)
x3<-c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,1,2)
m<-data.frame(x1,x2,x3)
I would like to create a frequency table like this:
x1 x2 x3
NA
1
2
3
4
where the values in each cell would be the count of the value for that
variable.
How can I do
2006 Mar 09
1
count pixels of same color in pixmap object?
Dear all,
I try to figure out how to use R to count the number of pixels of the
same color in some gray-level picture. I managed to read it in either
tiff or jpeg format, but the returned pixmap object keeps its
information out of (my) reach. Is there an easy way to tabulate the
different color/graylevel pixels and their numbers? Or should I use a
completely different (free) software?