similar to: simple table/matrix problem

Displaying 20 results from an estimated 7000 matches similar to: "simple table/matrix problem"

2009 Sep 08
5
sparse vectors
Hi I deal with long vectors almost all of whose elements are zero. Typically, the length will be ~5e7 with ~100 nonzero elements. I want to deal with these objects using a sort of sparse vector. The problem is that I want to be able to 'add' two such vectors. Toy problem follows. Suppose I have two such objects, 'a' and 'b': > a $index [1] 20 30 100000000
2010 Nov 10
1
S4 package warning
Hello everyone. R-2.12.0, suse linux 11.3. I am debugging a package that uses S4 methods and R CMD check gives the following warning: > Warning in methods::findMethods(g, env) : > non-generic function 'mdm' given to findMethods() > See the information on DESCRIPTION files in the chapter 'Creating R > packages' of the 'Writing R Extensions' manual. I
2009 Jun 12
1
bundle deprecation
Hi I read that bundles are to be deprecated in 2.10. The BACCO bundle contains three packages (emulator, calibrator, approximator) which I am happy to unbundle. But the 'BACCO' moniker has some considerable cachet for me in terms of recognizability (eg with grant-giving bodies), as it has become an umbrella term for a whole bunch of related statistical functionality of which the three
2009 Jan 22
1
pdf() and pch problems
Hi R-2.8.1, Suse 11.1 I'm having problems with pdf(). In the following transcript, file 'f.pdf' does not use the expected symbols for the plot. It uses a 'q' letter instead of the open circle I get when viewing the graphics window. I also get the same under r47678. Does anyone else get this? le112:~/scratch/R-2.8.1% R --vanilla --quiet >
2009 Jan 22
1
pdf() and pch problems
Hi R-2.8.1, Suse 11.1 I'm having problems with pdf(). In the following transcript, file 'f.pdf' does not use the expected symbols for the plot. It uses a 'q' letter instead of the open circle I get when viewing the graphics window. I also get the same under r47678. Does anyone else get this? le112:~/scratch/R-2.8.1% R --vanilla --quiet >
2010 Jun 29
3
table() of a factor
Hi suppose I have a factor 'x': > x <- as.factor(c(rep("a",3),"b","d")) > table(x) x a b d 3 1 1 > > But this is not what I want because I need to include the fact that the count of "c" is zero. I can't just change the levels of x: > levels(x) <- c("a","b","c","d") >
2009 Jan 22
1
reshape() problems
Hi I have a data frame with timeseries information like this: year cell Q1 Q2 Q3 Q4 1940 1 1.2 1.4 1.4 1.9 1941 1 2.9 2.1 3.4 2.4 1942 1 2.7 3.2 1.5 2.6 1940 2 1.4 2.1 2.6 2.4 1941 2 2.4 1.4 1.4 3.4 1942 2 1.4 2.4 2.5 4.4 where the Qs mean 'quarter'. I want to extract from
2009 Oct 16
1
generalization of tabulate()
Hi I want a generalization of tabulate() which works on rows of a matrix. Suppose I have an integer matrix 'observation': > observation y1 y2 y3 1 4 0 1 4 0 2 0 3 4 1 0 0 5 0 0 1 4 2 0 3 Each row corresponds to a (multivariate) observation. Note that the first two rows are identical: this means that data "c(1,4,0)" was observed twice. Now suppose I can list the sample
2009 Nov 12
1
S4 objects in the data directory
Hi [R-2.10.0; suse linux] I am having difficulty creating S4 objects in the data directory of a package. I want to create a bunch of simple S4 objects for use in the examples section of the Rd files. It says in R-exts that: " R code should be ?self-sufficient? and not make use of extra functionality provided by the package, so that the data file can also be used without having to load
2010 Jan 26
1
add points to 3D plot using p3d {onion}
Hi, Can anyone guide me as to how I can add points to a p3d() plot from the onion package?? I want to plot points with different colors on the same 3D plot.? Perhaps I can do this without adding points but somehow directing the 'h' parameter to give different color to points based on a factor I assign to them? FYI, I can do this using using scatterplot3d() and points3d(), but these plots
2008 Dec 11
1
Complex integration in R
Dear R-user I need a function to approximate a complex integration. My function is: aprox2=function(s,x,rate){ dexp(x,rate)*exp(-s*x) } where argument s is a complex number. I can't use the integrate function because it's only used with "numeric" arguments Does anyone know some function to approximate complex integrals? Thanks Borja [[alternative HTML version deleted]]
2009 Mar 02
2
Goldbach partitions code
Folks, I put up a brief note describing my naive attempts to compute Goldbach partitions, starting with a brute-force approach and refining progressively. http://jostamon.blogspot.com/2009/02/goldbachs-comet.html I'd welcome your suggestions on improvements, alternatives, other optimisations, esp. to do with space vs time tradeoffs. Is this an example interesting enough for
2009 Oct 13
2
S4 tutorial
I'm looking for some tutorial on S4. I only find the following one, which is not in English. Can somebody let me know if there is any introductory material? I'm very familiar with OO and C++. If there is some material that suits my background, it will be great. https://stat.ethz.ch/pipermail/r-help/2009-January/184108.html
2010 Jan 06
2
Generating data from Null Distribution
Hello everyone, Can someone tell me exactly how to generate data from a null distribution for the fisher exact test? I know I have to use the hypergrometric but exactly what commands do I use? Jim [[alternative HTML version deleted]]
2008 Nov 19
2
Multidimensional array with R
Hi there I know, I'm sure you discussed this stuff 100 times, but I really have a basic understanding problem, if and how do I create a multidimensional array in R. I'm coming from MATLAB and there it's as easy as you ever could imagine. Ok, so, I want to have an array, where I can fill in data from a Excel spreadsheet. The array should be addressed like this:
2009 Dec 11
3
how to creat a matrix
Dear R family I am attempting to create a matrix. e.g., 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 How could I write a R program? Later I want to extend it to a N by N case. Thanks in advance best Moohwan
2008 Dec 05
1
Lexical Permutation Algorithm in R
Hi all Here is a rather naive implementation of the SEPA algorithm for generating lexical permutations: lexperm3 <- function(x, n=length(x)) { perms <- list() k <- 1 perms[[k]] <- x k <- k + 1 for (y in 1:(factorial(n)-1)) { i <- n-1 while (x[i] > x[i+1] && i > 0) { i <- i - 1 } # i is largest index st x[i] > x[i+1] j <- n #
2010 Sep 24
3
boundary check
Dear R, I have a covariates matrix with 10 observations, e.g. > X <- matrix(rnorm(50), 10, 5) > X [,1] [,2] [,3] [,4] [,5] [1,] 0.24857135 0.30880745 -1.44118657 1.10229027 1.0526010 [2,] 1.24316806 0.36275370 -0.40096866 -0.24387888 -1.5324384 [3,] -0.33504014 0.42996246 0.03902479 -0.84778875 -2.4754644 [4,] 0.06710229 1.01950917
2009 Dec 17
4
Fishers exact test at < 2.2e-16
In an effort to select the most appropriate number of clusters in a mixture analysis I am comparing the expected and actual membership of individuals in various clusters using the Fisher?s exact test. I aim for the model with the lowest possible p-value, but I frequently get p-values below 2.2e-16 and therefore does not get exact p-values with standard Fisher?s exact tests in R. Does anybody know
2008 Nov 14
1
Generating unique permutations of a vector
Hi all, I try to generate sets of strategies that contain probability distributions for a defined number of elements, e.g. imagine an animal that can produce 5 different types of offspring and I want to figure out which percentage of each type it should produce in order to maximize its fitness. In order to do so, I need to calculate the fitness for all potential strategies. As an example, if I