Displaying 20 results from an estimated 1000 matches similar to: "tabulate can accept NA values?"
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
1999 Apr 03
2
tabulate causes segmentation fault (PR#156)
Peter,
I thought this one was noted and fixed, but I could be wrong.
R : Copyright 1999, The R Development Core Team
Version 0.63.3 (March 6, 1999)
....
[Previously saved workspace restored]
> tabulate(1:10, 5)
Process R:1 segmentation fault at Sat Apr 3 17:48:34 1999
--
(The following contact details become official on 1 May 1999, but
the email
2013 Jan 22
1
R_tabulate
How could I get the code of the inner function ( written in C, I guess ) of
R_tabulate?
This function is used by R function tabulate.
Thank you.
[[alternative HTML version deleted]]
2004 Oct 20
2
apply function
Hi all,
I have a question about apply function. Is that possible to pass some
non-default arguments in the function we want to apply ?
For example:
if "mat" is a matrix and I want to use the "tabulate" function on its row.
The command apply(mat,1,tabulate) works but I have problem with this one
apply(mat, 1, tabulate(nbins=4)).
Any clue ?
Thanks,
Eric
--
Eric
2010 Apr 16
2
how to change the position of xlab in truehist?
Hi,
I'm wondering how can I change the position of xlab in truehist. For example, the following code creats a histogram with 4 bins for my discrete data. I want each bin to be labelled as 0, 1, 2, or 3 in the middle, so that it's clear each bin corresponds to each of the discrete case.
I was thinking of first delete xlab and then add marks myself, but it doesn't look like it's
2006 Feb 18
1
truncated negative binomial using rnegbin
Dear R users,
I'm wanting to sample from the negative binomial distribution using the
rnegbin function from the MASS library to create artificial samples for the
purpose of doing some power calculations. However, I would like to work
with samples that come from a negative binomial distribution that includes
only values greater than or equal to 1 (a truncated negative binomial), and
I
2006 Feb 06
2
panel.levelplot() for 2D histograms
Dear R-wizards,
I'm trying to plot "binned scatterplots", or 2d histograms, if you wish, for
a number of groups by using the lattice functionality
it works fine for one group at a time, and probably I could find a
work-around, but I prefer to do it the elegant way
here's an example of what I want, what I tried and where it goes wrong:
require(gregmisc)
require(lattice)
#toy
2015 Sep 20
2
Long vectors: Missing values and R_xlen_t?
Is there a missing value constant defined for R_xlen_t, cf. NA_INTEGER
(== R_NaInt == INT_MIN) for int(eger)? If not, is it correct to
assume that missing values should be taken care/tested for before
coercing from int or double?
Thank you,
Henrik
2017 Nov 10
0
Calculating frequencies of multiple values in 200 colomns
Hi,
To clarify the default behavior that Boris is referencing below, note the definition of the 'bin' argument to the tabulate() function:
bin: a numeric vector ***(of positive integers)***, or a factor. Long vectors are supported.
I added the asterisks for emphasis.
This is also noted in the examples used for the function in ?tabulate at the bottom of the help page.
The second
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
2006 Apr 05
1
Bin by bin histogram comparisons
Hello,
I have created two histograms with:
hist2d(gps2, nbins=200, col = c("white",heat.colors(16)))
Both of them have the same range and the same number of bins.
Now I would like to compare them bin by bin and plot the results.
Could someone please tell me how to do that. I searched the man pages and
the web, but couldn't find anything.
Thank you very much.
Phil
2013 Aug 09
1
a fast table() for the 1D case
Hi,
table1D() below can be up to 60x faster than base::table() for the 1D
case. Here are the detailed speedups compared to base::table().
o With a logical vector of length 5M: 11x faster
(or more if 'useNA="always"')
o With factor/integer/numeric/character of length 1M and 9 levels
(or 9 distinct values for non-factors):
2012 Jun 14
2
density plot on a log scale
I'm working with a large dataset - large enough that when I do a scatter plot
the points all blur together, so I want to plot their density by color - a
heat map or something like that. I've used smoothScatter for tasks like
this, but the problem is that my current dataset really only looks good on a
log-log scale. When I do the following command
smoothScatter(
data,
2003 Jan 27
1
rmultinom() -- how \\ via own C code?
I've had a need for multinomial "random number generation"
occasionally. And other people too.
The following code is currently in the
(very small ``not very high importance'') CRAN package normix
--- which I will rename to "nor1mix" very seen because of a
``name registration'' problem
I want to add "this" (well the functionality) to a
2010 Apr 13
2
how to work with big matrices and the ff-package?
Hello everyone,
I need to create and work with some big matrices that actually have somewhat over 2 million columns and 117 rows. To do some calculations on such big matrices R just needs too much memory for my PC (4GB installed). So I need a solution to work with large datasets. I'm trying to use the ff-package but I don't think I really understand the whole functionality of the
2009 Apr 22
1
reversing xlim, ylim in smoothScatter
Hello,
I have found that in smoothScatter it is not possible to reverse the axes plotted (R version 2.9.0) . It appears that this arises from the hard coding of xlim and ylim in smoothscatter.R in the lines :
x <- x[ xlim[1] <= x[,1] & x[,1] <=xlim[2], ] (line number 25)
and
x <- x[ ylim[1] <= x[,2] & x[,2] <= ylim[2], ] (line number 31)
This results in a x
2007 Mar 20
1
truehist bug?
Hi,
Is this a bug in truehist()?
> library(MASS)
> x <- rep(1, 10)
> truehist(x)
Error in pretty(data, nbins) : invalid 'n' value
Thanks,
Gad
> R.version
platform i486-pc-linux-gnu
arch i486
os linux-gnu
system i486, linux-gnu
status
major 2
minor 4.1
year 2006
month 12
day 18
svn
2007 Mar 20
1
truehist bug?
Hi,
Is this a bug in truehist()?
> library(MASS)
> x <- rep(1, 10)
> truehist(x)
Error in pretty(data, nbins) : invalid 'n' value
Thanks,
Gad
> R.version
platform i486-pc-linux-gnu
arch i486
os linux-gnu
system i486, linux-gnu
status
major 2
minor 4.1
year 2006
month 12
day 18
svn
2002 Jan 18
1
New R on Mac user fails to run MASS
My R installation (Mac OS9.2.2) is working, but when I try to run the
examples from Venables & Ripley (p. 6):
R : Copyright 2001, The R Development Core Team
Version 1.4.0 (2001-12-19)
...
> library(MASS)
> x<-rnorm(1000)
> y<-rnorm(1000)
> truehist(c(x,y+3),nbins=25) % Plots nicely
> dd<-con2tr(kde2d(x,y)) % Doesn't complain
> contourplot(z ~ x + y,
2007 Nov 18
1
many zeroes in rgamma ... what's going on?
Hello fellow R users,
I wanted to view the density on the standard deviation scale of a gamma(0.001, 0.001) prior for the precision. I did this as seen in the code below and found that for some reason rgamma is giving many values equal to zero, which is strange since a gamma distribution is continuous. What is going on here?
Thanks for any help in advance.
Greg
> x1 <- rgamma(10000,