Displaying 20 results from an estimated 7000 matches similar to: "R_tabulate"
2009 Jul 20
1
tabulate can accept NA values?
tabulate has
.C("R_tabulate", as.integer(bin), as.integer(length(bin)),
as.integer(nbins), ans = integer(nbins), PACKAGE="base")$ans
The implementation of R_tabulate has
if(x[i] != R_NaInt && x[i] > 0 && x[i] <= *nbin)
and so copes with (silently drops) NA. Perhaps the .C could have
NAOK=TRUE? This is useful in apply'ing tabulate to
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
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
2017 Nov 10
2
Calculating frequencies of multiple values in 200 colomns
|> x <- sample(0:2, 10, replace = TRUE)
|> x
[1] 1 0 2 1 0 2 2 0 2 1
|> tabulate(x)
[1] 3 4
|> table(x)
x
0 1 2
3 3 4
B.
> On Nov 10, 2017, at 4:32 AM, Allaisone 1 <allaisone1 at hotmail.com> wrote:
>
>
>
> Thank you for your effort Bert..,
>
>
> I knew what is the problem now, the values (1,2,3) were only an example. The values I have are
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
2017 Nov 10
0
Calculating frequencies of multiple values in 200 colomns
Thank you for your effort Bert..,
I knew what is the problem now, the values (1,2,3) were only an example. The values I have are 0 , 1, 2 . Tabulate () function seem to ignore calculating the frequency of 0 values and this is my exact problem as the frequency of 0 values should also be calculated for the maf to be calculated correctly.
________________________________
From: Bert Gunter
2017 Nov 09
2
Calculating frequencies of multiple values in 200 colomns
Always reply to the list. I am not a free, private consultant!
"For example, if I have the values : 1 , 2 , 3 in each column, applying
Tabulate () would calculate the frequency of 1 and 2 without 3"
Huh??
> x <- sample(1:3,10,TRUE)
> x
[1] 1 3 1 1 1 3 2 3 2 1
> tabulate(x)
[1] 5 2 3
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people
2017 Nov 18
0
Complicated analysis for huge databases
On 18/11/2017 4:40 PM, Allaisone 1 wrote:
>
> The loop :
>
>
> AllMAFs <- list()
>
> for (i in length(SeparatedGroupsofmealsCombs) {
> AllMAFs[[i]] <- apply( SeparatedGroupsofmealsCombs[[i]], 2, function(x)maf( tabulate( x+1) ))
> }
>
>
> gives these errors (I tried this many times and I'm sure I copied it entirely) :-
>
> Error in
2017 Nov 18
3
Complicated analysis for huge databases
The loop :
AllMAFs <- list()
for (i in length(SeparatedGroupsofmealsCombs) {
AllMAFs[[i]] <- apply( SeparatedGroupsofmealsCombs[[i]], 2, function(x)maf( tabulate( x+1) ))
}
gives these errors (I tried this many times and I'm sure I copied it entirely) :-
Error in apply(SeparatedGroupsofmealsCombs[[i]], 2, function(x) maf(tabulate(x + :
object 'i' not found
> }
2017 Nov 19
1
Complicated analysis for huge databases
Thanks but a new error appeared with the loop :
Error in x + 1 : non-numeric argument to binary operator
I think this can be solved by converting columns (I,II,II,..600) into "numeric" instead of
the current "int" type as shown below in the structure of "33_55" dataframe .
$ 33_55:'data.frame': 256 obs. of 600 variables:
..$ MealsCombinations
2010 Oct 03
1
tabulate() does not check for input bounds
Dear all,
it looks like that tabulate() does not check for the bounds of the input.
Reproducible example:
> b <- 1:2
> tabulate(b[1:100])
[1] 1 1
> R.version
_
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status Patched
major 2
minor 11.1
year 2010
month 09
day
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
2017 Nov 18
0
Complicated analysis for huge databases
> On Nov 18, 2017, at 1:52 AM, Allaisone 1 <allaisone1 at hotmail.com> wrote:
>
> Although the loop seems to be formulated correctly I wonder why
> it gives me these errors :
>
> -object 'i' not found
> - unexpected '}' in "}"
You probably did not copy the entire code offered. But we cannot know since you did not "show your code",
2012 Nov 05
1
Another code to drop factor levels
I apologize if this is not appropriate for this mailing list.
In R, there is already functionality to drop unused factor levels. However, I am proposing the code below that I wrote. In some occasions, it was faster than applying function 'factor'. In any case, there is no restriction for anyone to use the code below.
droplevels2 <- function(x) {
if (is.null(levels(x)))
stop("no
2009 Aug 11
1
Help on a combinatorial task (lists?)
Hello!
I have the following combinatorial problem.
Consider the cumulative sums of all permutations of a given weight vector
'w'. I need to know how often weight in a certain position brings the
cumulative sums equal or above the given threshold 'q'. In other words,
how often each weight is decisive in raising the cumulative sum above 'q'?
Here is what I do:
w <-
2017 Nov 18
2
Complicated analysis for huge databases
Although the loop seems to be formulated correctly I wonder why
it gives me these errors :
-object 'i' not found
- unexpected '}' in "}"
the desired output is expected to be very large as for each dataframe in the list of dataframes I expect to see maf value for each of the 600 columns! and this is only for
for one dataframe in the list .. I have around 150-200
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
2001 Jan 25
1
problems compiling R under digital unix 4.0d (PR#826)
Dear Sirs,
I am trying to compile R v1.2.1 under Digital Unix 4.0D.
The configure-script runs without any problems but during 'make' I receive
the following error-message:
[......]
g77 -mieee -g -O2 -c dtrco.f -o dtrco.o
g77 -mieee -g -O2 -c dtrsl.f -o dtrsl.o
g77 -mieee -g -O2 -c eigen.f -o eigen.o
g77 -mieee -g -O2 -c lminfl.f -o lminfl.o
ar cr libappl.a Rsock.o approx.o bakslv.o
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
2017 Nov 18
0
Complicated analysis for huge databases
Something like the following?
AllMAFs <- list()
for (i in length(SeparatedGroupsofmealsCombs) {
AllMAFs[[i]] <- apply(SeparatedGroupsofmealsCombs[[i]], 2, function(x)maf(tabulate(x+1)))
}
(untested, of course)
Also the solution is a bit generic since I don't know what the output of maf() looks like in your case, and I don't understand why you use tabulate because I would have