Displaying 20 results from an estimated 1000 matches similar to: "Identifying clusters of size n"
2009 May 29
1
Package Licences
Are there any particular licences under which R packages must be released or is
it the discretion of the author? The same question if the package is to be
destined for CRAN?
Kind regards,
Nathan
--
--------------------------------------------------------
Dr. Nathan S. Watson-Haigh
OCE Post Doctoral Fellow
CSIRO Livestock Industries
Queensland Bioscience Precinct
St Lucia, QLD 4067
Australia
2009 Jan 07
2
Memory Efficiency of Symmetric Matrix
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm generating a symmetric correlation matrix using a data matrix as input:
mat <- cor(data.mat)
My question is:
Is there a more memory efficient way to store this data? For instance, since:
all(mat == t(mat))
every value is duplicated, and I should be able to almost half the memory usage for large matrices.
Any thoughts/comments?
Cheers,
2009 Jun 17
1
Coerce rectangular matrix to symmetrical square matrix
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have a rectangular matrix of size 920 by 85. I'd like to coerce it into a
square matrix such that all row/col names are present in the new matrix and the
additional values are zero.
As an example:
A B C D
A 1 2 3 4
E 5 6 7 8
F 9 10 11 12
Would be coerced to:
A B C D E F
A 1 2 3 4 5 9
B 2 0 0 0 6 10
C 3 0 0
2009 Feb 17
1
Create package with Fortran 90 and C code
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm trying to add some Fortran 90 code to an existing package.
When I compile and load the file manually like:
SHELL> R CMD SHLIB file.f90
R> dyn.load("file.so")
I can use the .Fortran() fine. However, when I try to build, install and load
the library I seem to be missing something.
I do a:
SHELL> R CMD build dir
SHELL> R
2009 Jan 12
4
fitting curve to data
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have the following data:
> y
[1] 0.000 0.004 0.008 0.016 0.024 0.032 0.044 0.064 0.072 0.088 0.108 0.140
[13] 0.156 0.180 0.208 0.236 0.264 0.296 0.320 0.360 0.408 0.444 0.472 0.524
[25] 0.576
> x
[1] 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500
[16] 1600 1700 1800 1900 2000 2100 2200 2300 2400 2500
I'd
2009 Feb 11
1
Looping over a matrix passed to .C
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've written a function in R which takes a symmetrical matrix as input and
processes all triplicate combinations of values from the matrix. The function
looks something like:
my_fun <- function(m) {
if( nrow(mat) != ncol(mat) ) {
stop("'m' must be a square matrix")
}
size <- nrow(m)
for(x in 1:(size -2)) {
2009 Feb 03
1
pairs() help - colour histograms on diagonal
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'd like to be able to colour histograms along the diagonal using the colours
stored in colnames(d):
> d
black blue brown cyan
1 0.96405751 -0.02964390 -0.060147424 -0.06460070
2 -0.03614607 0.95475444 -0.152382053 -0.07767974
3 -0.07095613 -0.05884884 -0.061289399 -0.06445973
4 -0.03708223 -0.05997624
2009 Jan 15
2
R package tests
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I was wondering if anyone could point me in the right direction for reading up on writing tests in
R. I'm writing some functions for inclusion into a package and would like to test them to ensure
they're doing what I expect them to do.
Are these approaches used for testing packages in CRAN?
Cheers,
Nathan
- --
-
2009 Jan 07
2
Understanding dsyrk_ in C code
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm trying to understand some C code in an R package I'm using. I'm address this question here as
it's matrix algebra...and I'm no pro at that!
the C command reads:
double alpha = 1.0, beta = 0.0;
dsyrk_("L", "N", nGenes, nGenes, & alpha, mat1, nGenes,
& beta, mat2, nGenes);
- From google,
2009 Mar 26
1
Splitting Area under curve into equal portions
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have some data generated as follows:
<code>
n <- 2000
work <- vector()
for(x in 1:n) {
work[x] <- sum(1:(n-x+1))
}
plot(work)
</code>
What I want to do
- -----------------
I want to split work into a number of unequal chunks such that the sum of the
values in each chunk is approximately equal.
The numbers in
2008 Dec 15
1
Pearson Correlation Speed
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm trying to calculate Pearson correlation coefficients for a large
matrix of size 18563 x 18563. The following function takes about XX
minutes to complete, and I'd like to do this calculation about 15 times
and so speed is some what of an issue.
Does anyone have any suggestions on ways to speed this up? I'd wondered
if using C++ code to
2009 Jul 09
1
Converting indices of a matrix subset
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have two matrices:
> m1 <- matrix(1,4,4)
> m1
[,1] [,2] [,3] [,4]
[1,] 1 1 1 1
[2,] 1 1 1 1
[3,] 1 1 1 1
[4,] 1 1 1 1
> m2 <- matrix(0,3,3)
> diag(m2) <- 1
> m2
[,1] [,2] [,3]
[1,] 1 0 0
[2,] 0 1 0
[3,] 0 0 1
I want to get indicies from m2
2009 Mar 25
0
Rmpi - send/receive multiple objects to slaves
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've written a function that uses Rmpi to perform a calculation in parallel. It
works fine, but I'm trying to improve efficiency in terms of memory usage and
the amount of data being passed back and forth between mater and slaves.
Calculations are performed on a symmetrical matrix in order to zero-out some of
the cells.
In the parallel
2010 Jan 27
2
Bulk Match/Replace
This must be easy to do.....
I have a vector and a lookup data.frame:
> v
[1] "5" "234" "234" "42-43" "234" "42-43" "234" "234"
"42-43" "234" "5" "234" "234" "5" "234" "234" "5"
2010 Feb 08
2
Help with apply()
I have a 2 column data.frame:
> d[1:5,]
a b
1 80015 C
2 80016 B
3 80023 C
4 80062 B
5 80069 B
I want to apply a function across each row:
> for(i in 1:nrow(d)) {
+ myFun(con, d[i,]$a, d[i,]$b)
+ }
How do I do this using apply()? I'm unsure how to tell apply() to pass
data from columns a and b for a given row as arguments to the function
2010 Jan 25
1
RMySQL Append data.frame to table
I have a data.frame obj with 5 columns whose colnames match the fields
in my "contact" table. The only other field my MySQL table has is an id
field which is the PK and is set to auto increment.
I'd like to load this data.frame using something like:
dbWriteTable(con, "contact", dat, append=TRUE)
However, I get this error:
Error in mysqlExecStatement(conn, statement,
2010 Jan 13
1
decompress tar.gz and zip files
Can anyone point me in the right direction for decompressing text files that are
compressed as tar.gz or zip files?
Cheers,
Nathan
--
--------------------------------------------------------
Dr. Nathan S. Watson-Haigh
OCE Post Doctoral Fellow
CSIRO Livestock Industries
University Drive
Townsville, QLD 4810
Australia
Tel: +61 (0)7 4753 8548
Fax: +61 (0)7 4753 8600
Web:
2010 Mar 18
1
Intersect, Union of date/time ranges
I have 2 sets of data which defines the start and end of date/time
periods. I want to be able to obtain the following:
1) The intersect of those 2 sets of date/time ranges i.e. return
start/end date/time ranges where both sets overlap
2) The union of those 2 sets of date/time ranges i.e. return the
start/end date/time ranges which are in 1 or both sets
Is there anything that is currently able
2010 Jan 27
2
RMySQL - Bulk loading data and creating FK links
I have a table (contact) with several fields and it's PK is an auto
increment field. I'm bulk loading data to this table from files which if
successful will be about 3.5million rows (approx 16000 rows per file).
However, I have a linking table (an_contact) to resolve a m:m
relationship between the an and contact tables. How can I retrieve the
PK's for the data bulk loaded into
2010 Feb 09
1
Superimpose ksmooth() onto barplot
I'd like to superimpose a ksmooth() onto a barplot().
My data is:
> d
2009-06-20 2009-06-21 2009-06-22 2009-06-23 2009-06-24
2009-06-25 2009-06-26 2009-06-27 2009-06-28 2009-06-29 2009-06-30
2009-07-01 2009-07-02
Same Breed (B) 12.64 21.08 13.52 12.51
13.71 9.91 14.24 7.18 11.81 5.92
12.04 17.96