Displaying 20 results from an estimated 1000 matches similar to: "write in rimage package"
2006 Dec 31
1
rimage package broken with fedora upgrade
Dear R list members
I would be grateful if anyone could guide me to a solution for fixing my
rimage package problem described below.
I recently upgraded my machine from fedora core 3 to fedora core 6 and
then upgraded R from version 2.3.1 from version 2.4.1.
I then fired up R, tried to load the rimage library and received the
following messages:
> library(rimage)
Error in dyn.load(x,
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 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!
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.
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
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 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
>
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
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
2005 Nov 23
1
assign() problem
I've written a piece of code (see below) to do a wavelet image
decomposition, during the evaluation of this code I would like to write
the results of some calculations back to the R root directory. I used
assign() to do so because the names should vary when going thrue a
while() loop. For some unknown reason I get an error that says:
Error in assign(varname[i], imwrImage) :
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 Oct 02
1
Cannot Install rimage
I'm trying to install rimage in R version 2.5.1 running on Fedora 6
(kernel 2.6.22.7-57.fc6 with the headers and gcc installed, along with
fftw2 and libjpeg and headers):
> install.packages("rimage")
Warning in install.packages("rimage") : argument 'lib' is missing: using
'/usr/lib/R/library'
trying URL
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
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
2008 Mar 08
1
Change the index argument of a series
This is probably very trivial - so I can't find an answer in the help files.
When I have a series x (x[1], x[2], ... x[n]) and I want to construct a
new series y (y[1], y[2], ... y[m]) such that y's are either interpolations
of the x's (when m > n) or a weighted mean (when m < n), is there
any direct function to do it?
For example, passing from 3 to 4 would be the same as
2010 May 16
1
Reading JPEG file, converting to HEX
Colleagues,
I am using R to assemble RTF documents (which are plain text). I need to embed a JPEG graphic that was created with R. I presume that the steps need to be:
a. read the file into R
b. convert the object to HEX format
c. write the converted object to a textfile.
If I read the file into R using readLines, I get the following (only the first 5 lines shown):
> >
2009 Oct 22
1
arima crashes too
Another pathological test.
arima does not crash for that series that crashes arma:
arima(c(2.01, 2.22, 2.09, 2.17, 2.42), order=c(1,0,0))
However, arima crashes for this:
arima(c(1.71, 1.78, 1.95, 1.59, 2.13), order=c(1,0,0))
arima seems pretty consistent in its crashing behaviour, since crashing for
one series means crashing for all affine series:
lets.crash.arima <- c(71, 78, 95, 59,