Displaying 20 results from an estimated 3000 matches similar to: "pdf() and pch problems"
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 Jul 30
3
simple table/matrix problem
Hi
Given three vectors
x <- c(fish=3, dogs=5, bats=2)
y <- c(dogs=1, hogs=3)
z <- c(bats=3, dogs=5)
How do I create a multi-way table like the following?
> out
x y z
bats 2 0 3
dogs 5 1 5
fish 3 0 0
hogs 0 3 0
('out' is a matrix).
See how the first line shows 'x' has 2 bats, 'y' has zero bats, and 'z'
has 3 bats
and so on for each
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
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
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 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 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
2012 Apr 17
5
loss of information in pdf plots
Hi there
is it possible that pdfs generated using the pdf() function with default settings leads to loss of information? I was plotting copy number changes from Agilent 180k data in form of rectangles (rect()) while each rectangle represents one region of copy number change. When plotting into a pdf I noticed that some very small rectangles do not appear (even after extensive zooming) in the pdf
2009 Feb 19
2
vignette compilation times
Dear All
I am preparing a number of vignettes that require a very long time to
process with Sweave. The longest one takes 10 hours. I love the weaver
package!
Is a package that includes such a computationally intensive vignette
acceptable on CRAN? Are there any guidelines here?
--
Robin K. S. Hankin
Uncertainty Analyst
University of Cambridge
19 Silver Street
Cambridge CB3 9EP
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 Dec 03
1
S4 and head() problems
Hi
I am having difficulty defining an S4 method for head() and tail().
I can't quite provide minimal self-contained code
because the problem appears to require the whole corpus
of my package; and there also appears to be a difference
between sourcing the lines directly, and having them
installed in a package.
The lines in question (I think) are:
setClass("mdm",
2008 Dec 05
1
array indexing
Hi.
I have been pondering array indexing via matrices.
> a <- array(1:27,rep(3,3))
> index <- matrix(c(1,1,1,1,2,3),2,3,byrow=TRUE)
> a[index]
[1] 1 22
as expected and documented. But what was the thinking
behind the decision to access the array by rows rather
than columns?
The 'index' matrix is ordered as [1,1,1,2,1,3] and so
the extraction is a[index[c(1,3,5)]]
2009 Oct 23
1
access elements of a named list using a factor
Hi
I have a factor 'f' and a named list 'jj'.
I want names(jj) to match up with levels(f).
How do I use levels(f) to access elements of jj?
> f <- factor(c("pigs","pigs","slugs"))
> f
[1] pigs pigs slugs
Levels: pigs slugs
>
> jj <- list(pigs=1:10,slugs=1:3)
My attempts to produce jj$pigs all give errors:
>
2010 Oct 26
1
S4 methods for rbind()
Hello.
I am trying to write an S4 method for rbind(). I have a class of objects
called 'mdm', and I want to be able to rbind() them to one another.
I do not want the method for rbind() to coerce anything to an mdm object.
I want rbind(x1,x2,x1,x2) to work as expected [ie rbind() should take any
number of arguments].
This is what I have so far:
setGeneric(".rbind_pair",
2010 Jul 30
4
transpose of complex matrices in R
Hello everybody
When one is working with complex matrices, "transpose" very nearly
always means
*Hermitian* transpose, that is, A[i,j] <- Conj(A[j,i]).
One often writes A^* for the Hermitian transpose.
I have only once seen a "real-life" case
where transposition does not occur simultaneously with complex conjugation.
And I'm not 100% sure that that wasn't a
2013 Oct 23
1
Scripting call to R-Studio compile PDF
Hey everyone,
I have several RStudio (.rnw) files that I am using a script to assemble
into a composite document. For this purpose, it would be helpful if the
script could automatcially make a call to whatever is called when a user
opens up one of these files and manually clicks "Compile PDF". Basically,
this would allow me to refresh all of the reports before assimilating their
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