Displaying 20 results from an estimated 5000 matches similar to: "Abstract plot"
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 <-
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!
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
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.
2010 Apr 04
4
ggplot2 geom_rect(): What am I missing here
Hi R fans,
As a newbie following the five-hour rule (after hitting my head against
the wall for five hours, post to this list), I am appealing for some
help understanding geom_rect() in ggplot2.
What I want to do is very simple. I want to generate a plot of
rectangles. Each one represents a business cycle. The x-values will be
pairs representing the start and end of each cycle. The y-values
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
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
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 Jul 30
1
read XML
I have a xml exported by Manifold GIS but I'm not being able to import it
into R using XLM package.
The file have this structure:
<?xml version="1.0" encoding="UTF-8" ?>
- <layout>
<name>Layout 2</name>
<pagesByX>1</pagesByX>
<pagesByY>1</pagesByY>
- <elements>
<legend
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 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
2006 Jul 10
2
Setting the colors of lines in a trellis plot...
With some help from those with expertise on this list, I managed to
produce a plot using trellis that looked like I wanted it to look.
Now, I need to take the same plot and make the lines on it color, but
I want to specify the color for the lines myself.
I've managed to make the key use the colors I want. I've managed to
make the symbols of the actual plot use the colors I want. But I
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
2014 Jun 15
2
abline; setting plot limits
Relatively new user with a question regarding abline.
I want to draw a st. line fit to some data but I want the line to span the
range of the x-data and NOT the plot limits.
In short the line spans xmin to xmax(of plot axis) but I want it to span
xmin to xmax (of x data).
Can this but done with abline or do I have to use lines and construct the
line from a+bx?
Paul Rydelek, Ph.D.
5232 Dorset
2008 Apr 22
3
Using the 'by' function within a 'for' loop
Dear R experts,
I am sorry for sending this email again. I would
imagine yesterday and maybe today, have been very busy
days with the release of R v 2.7.0. I join all the R
users who are very gratful for your contant work and
efforts, specially knowing that you are doing this for
the sake of science, without gettig any compensation
for that.
Having written that, I decided to send the
2006 Feb 21
1
color quantization / binning a variable into levels
Hi all,
I'd like to quantize a variable to map it into a limited set of integers
for use with a colormap. "image" and filled.contour" do this mapping
inside somewhere, but I'd like to choose the colors for plotting a set of
polygons. Is there a pre-existing function that does something like this
well? i.e., is capable of using 'breaks'?
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
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
2000 Dec 14
2
Accuracy problem in dchisq for non-central chi-squared
Hi,
I think I have identified a inaccuracy in dchisq when the non-centrality
parameter is non-zero and large. Here's a little test:
sys.dchisq.test <- function(N = 100000,mean = 0)
{
z <- rnorm(N,mean = mean, sd = 1)
x <- z^2
xmin <- min(x)
xmax <- max(x)
br <- seq(xmin,xmax,length = 101)
dbr <- br[2]-br[1]
hist(x,br)
p <- dchisq(br,df = 1,ncp =