similar to: tabulate causes segmentation fault (PR#156)

Displaying 20 results from an estimated 6000 matches similar to: "tabulate causes segmentation fault (PR#156)"

1999 Apr 22
2
Assigning to a list within a loop (PR#175)
We noticed this bug in more complex code, but this succinctly describes the phenomenon. If you do not re-initialize a each time in the following loop, the final value only is assigned to all places when the loop is complete. > a <- b <- list() > for(i in 1:5) { + a$alpha <- i + b[[i]] <- a + } > unlist(b) alpha alpha alpha alpha alpha 5 5 5 5 5 If a is
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
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
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
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
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
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 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
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 Dec 31
3
tabulate: switching columns and rows
Hi all, Please, is there any way of controlling factors in row/columns when using ftable/xtabs? As far as I can see, the last cross-clasifing variable in the formula will appear in columns. The previous ones, in rows. For instance, is it possible to make tension and replicate appear in columns? ftable(xtabs(breaks ~ wool + tension + replicate, data = warpbreaks)) After some years using SAS
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
2007 Feb 28
4
PROC TABULATE with R
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?... Nom : non disponible Url : https://stat.ethz.ch/pipermail/r-help/attachments/20070228/6ebce030/attachment.pl
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
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):
2013 Apr 12
2
processing matrix equation derived from rows of two matrices
Hi, May be this helps: ?tb[1,]%*%(((val-rep(meansb79[1,],5))^2)/6) #??????? [,1] #[1,] 1.47619 tryvarb<-c(1,2,3,4,4,4,4) ?var(tryvarb) #[1] 1.47619 tb[2,]%*%(((val-rep(meansb79[2,],5))^2)/6) #???????? [,1] #[1,] 1.904762 sapply(seq_len(nrow(tb)),function(i) tb[i,]%*%(((val-rep(meansb79[i,],5))^2/6))) # [1] 1.4761905 1.9047619 1.9047619 1.9047619 1.9047619 2.2857143 1.9047619 # [8] 1.9047619
2016 Mar 16
2
match and unique
Is the phrase "index <- match(x, sort(unique(x)))" reliable, in the sense that it will never return NA? Context: Calculation of survival curves involves the concept of unique death times. I've had reported cases in the past where survfit failed, and it was due to the fact that two "differ by machine precision" values would sometimes match and sometimes not,
2012 May 17
2
Complex sort problem
Dear List, Is there a way I can sort a sample based on a sort index constructed from the data from which the sample is taken? Basically, I need to take 'many' samples from the same source data and sort them. This can be very time consuming for long vectors. Is there any way I can sort the data only once initially, and use that sort order for the samples? I believe that idea is what is
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
2011 Feb 10
3
modifynig some elements of a vector
He everybody, I want to add 1 to some elements of a vector: x is a vector u is a vector of idices, that is, integers assumed to be within the range 1..length(x) and I want to add 1 to the elements of x each time their index appears in u x[u]<-x[u]+1 works only when there are no duplicated values in u I found this solution: tu <- table(u) indices <- as.numeric(names(tu)) x[indices]
2009 Jun 12
2
Creating this vector, any suggetions?
Suppose I have the first vector: c(1, 6, 8, 9) I will like to create a second vector of size 10 composed of 0 and 1's. The second vector will be composed of four 1's and six 0's. The position of the 1's will be specificed by the first vector. So essentially, I want a second vector in the form: c(1, 0, 0, 0, 0, 1, 0, 1, 1, 0) Any help is greatly appreciated! -- View this message