Displaying 20 results from an estimated 6000 matches similar to: "pdf with an exact size"
2006 Sep 30
1
Simple graphics
Is there any way that I can do something like this:
png("file.png", width=200, height=200)
polygon(c(50, 50, 150, 150), c(50, 150, 150, 50))
dev.off()
and then have a png file with a 100 x 100 pixels rectangle in the middle
of it? It seems that when I call "plot", it redefines the image coordinates
to some "optimized" value and then I lose any information to
2008 Apr 29
4
XML write?
Is there any function to write a XML structure, after it was
read using xmlTreeParse?
Ex:
library(XML)
x <- xmlTreeParse("Irpf2008/aplicacao/dados/12345678901/12345678901.xml")
# write it...
Alberto Monteiro
PS: please, brazilians, don't be offended by my foul language!
2007 Jul 05
4
Me again, about the horrible documentation of tcltk
How on Earth can I know what are the arguments of any of the functions of
the tcl/tk package? I tried hard to find, using all search engines
available, looking deep into keywords of R, python's tkinter and tcl/tk, but
nowhere I found anything remotely similar to a help.
For example, what are the possible arguments to tkgetOpenFile?
I know that this works:
library(tcltk)
filename <-
2007 Mar 23
5
Get "home" directory and simple I/O
Is there any generic function that gets the "home" directory? This
should return /home/<user> in Linux and
x:/Documents and Settings/<user> (or whatever) in Windows XP.
Another (unrelated) question: what is the _simplest_ way to
read and write R variables to/from files such that they are
stored in a human-readable but R-like form? For example, if
(say), x is a vector
2006 Oct 07
3
ifelse(logical, function1, function2) does not work
Why this kind of assignment does not work?
n <- 1
f <- ifelse(n == 1, sin, cos)
f(pi)
this must be rewritten as:
n <- 1
f <- cos
if (n == 1) f <- sin
f(pi)
[oops. 1.224606e-16 instead of zero. Damn floating point errors :-/]
Alberto Monteiro
2007 May 22
5
Reducing the size of pdf graphics files produced with R
Hi,
Without trying to print 1000000 points (see <http://
finzi.psych.upenn.edu/R/Rhelp02a/archive/42105.html>), I often print
maps for which I do not want to loose too much of coastline detail,
and/or plots with 1000-5000 points (yes, some are on top of each
other, but using transparency (i.e. rgb colors with alpha
information) this actually comes through as useful information.
2007 Sep 17
3
Histogram with colors
Is there a simple way to plot a histogram with colors?
For example, suppose I generate random points in the
N(2,1) distribution:
x <- rnorm(100000, mean = 2, sd = 1)
Now I would like to plot the histogram:
hist(x)
but I would like to show the bars with x < 0 in red, and the
bars with x >= 0 in lightgreen. Is there any simple way to
do it?
I think I can do it in two steps:
2008 Apr 18
3
Function redefinition - not urgent, but I am curious
This is just my curiousity working.
Suppose I write:
f1 <- function(x) x + 1
f2 <- function(x) 2 * f1(x)
f2(10)
# 22
f1 <- function(x) x - 1
f2(10)
# 18
This is quite obvious. But is there any way to define f2
in such a way that we "freeze" the definition of f1?
f1 <- function(x) x + 1
f2 <- function(x)
# put something here
2 * f1(x)
# probably put something else here
2008 Aug 18
2
A doubt about "lm" and the meaning of its summary
I have a conceptual problem (sort of). Maybe there's a simple solution,
maybe not.
First, let me explain the test case that goes ok.
Let x be a (fixed) n-dimensional vector. I simulate a lot of linear models,
y = m x + c + error, then I do a lot of regressions. As expected, the
estimated values of m (let's call them m.bar) are distributed according to a
Student's t distribution.
2006 Oct 05
5
[Fwd: Re: Block comments in R?]
Ooops! Sorry, I send it only to Uwe Ligges the first time.
Best,
Philippe Grosjean
This is perhaps another solution, more elegant in the way the block
comment is written... but it requires to redefine `!` and slows it a
little bit because it tests first its arguments before calling
.Primitive(!):
It takes advantage of `!` being not defined for character arguments:
> !2
[1] FALSE
>
2008 Apr 29
2
Legend problem when exporting a plot to PDF
Hi list,
When exporting to PDF a graph with a legend, in the final PDF, the text
is going beyond the legend box.
> dev2bitmap("test.pdf", type="pdfwrite", h=6, w=6)
The legend looks OK on the screen.
I noticed that the size of the legend box depends on the size of the
screen window, which is not the case for other graphical parts (text of
the legend, title, axis
2008 Jun 06
2
Plot matrix as many lines
Suppose that I have a matrix like:
m <- rbind(c(1,2,3,4), c(2,3,2,1))
Is there any way to efficiently plot the _lines_ as if
I was doing:
plot(m[1,], type="l")
points(m[2,], type="l", col="red")
(of course, in the "real world" there much more than
just 2 lines and 4 columns...)
Alberto Monteiro
2007 Feb 28
2
What is a expression good for?
I mean, I can generate a expression, for example, with:
z <- expression(x+y)
But then how can I _use_ it? Is it possible to retrieve
information from it, for example, that z is a sum, its
first argument is x (or expression(x)) and its second
argument is y?
Alberto Monteiro
2007 Jun 04
2
Abstract plot
I want to make a plot, but instead of showing _numerical_ values,
I would like to show _symbolic_ values.
For example, I want to plot a function y = a x + b, where
x varies between Xmin and Xmax. I would like the plot
to show, in the x-axis, the strings Xmin and Xmax, instead
of their numeric values. Is it possible?
Alberto Monteiro
2007 Apr 18
10
importing excel-file
Dear R-experts,
It is a quite stupid question but please help me. I am very confuced. I
am able to import normal txt ant mat-files to R but unable to import
.xls-file
I do not understand the online help. Can please anyone send me the
corresponding command lines? The .xls-file is attached. In my file we
use commas for the decimal format (example: 0,712), changes might be
needed.
Thanks, Corinna
2007 Feb 27
2
ts; decompose; plot and title
Is there any way to give a "decent" title after I plot something
generated by decompose?
For example:
# generate something with period 12
x <- rnorm(600) + sin(2 * pi * (1:600) / 12)
# transform to a monthy time series
y <- ts(x, frequency=12, start=c(1950,1))
# decompose
z <- decompose(y)
# plot
plot(z)
Now, the title is the ugly "Decomposition of additive time
2003 Jan 09
1
GS PDF creator
This is a snip of my smb.conf file.
This share will create a pdf file and deposit the output in a samba share
for retrieval. It works. On the client side you add a printer pointing to
the smbpdf share and give it a PS printer driver. When you print to this
printer(smbpdf) it creates the pdf file. I'd like to change one thing and
this thing is golden. When printing a file called file.txt the
2007 Mar 16
3
corAR1 in a random effects panel
Hi everyone,
I am interested in estimating this type of random effects panel:
y_it = x'_it * beta + u_it + e_it
u_it = rho * u_it-1 + d_it rho belongs to (-1, 1)
where:
u and e are independent and normally zero-mean distributed.
d is also independently normally zero-mean distributed.
So, I want random effects for group i to be correlated in t, following an
AR(1) process.
I am
2003 Feb 24
5
PDF Printer issue
Hello Everyone,
I have a slight issue with configuring a PDF printer on my Samba
servers. I have input the following into my smb.conf file and it does
create the printer as well as work to create PDF files, except that it
only functions when "printing" to that printer via Excel 2002. If I
attempt it with anything else, even the Windows Test print, it fails.
Now, in the Windows
2007 Mar 29
1
Wikibooks
As a big fan of Wikipedia, it's frustrating to see how little there is about
R in the correlated project, the Wikibooks:
http://en.wikibooks.org/wiki/R_Programming
Alberto Monteiro