Displaying 20 results from an estimated 10000 matches similar to: "Retrieving value computed in inner function call"
2006 Jul 31
2
math symbols and text with mtext()
Dear R users,
Two questions:
1) Is there a way to simplify the mtext() line below ?
beta=c(1,-1)
m=5
plot(1)
mtext( bquote(paste( beta == .(paste( "(", paste(beta, collapse=", "), ")" )) )), outer=TRUE,line=-3)
2) How do I get the embedded carriage return "\n" below to work, i.e for the text that follows it to appear on the next line?
beta=c(1,-1)
m=5
2007 Jun 19
3
Controlling text and strip arrangement in xyplot
I've searched the archives and read the xyplot help but can't figure
out the 2 lattice questions below?
Consider:
library(lattice)
DF <- data.frame(x=rnorm(20), y=rnorm(20), g1=rep(letters[1:2], 10),
g2=rep(LETTERS[1:2], each=10),
g3=rep(rep(letters[3:4],each=5),2))
xyplot(y ~ x | g1 + g2, groups=g3, data=DF)
1) Is there a way to get one strip per row and column
2006 Jun 23
1
numeric variables converted to character when recoding missing values
Dear R helpers,
I have a data frame where missing values for numeric variables are coded as
999. I want to recode those as NAs. The following only partially succeeds
because numeric variables are converted to character in the process:
df <- data.frame(a=c(999,1,999,2), b=LETTERS[1:4])
is.na(df[2,1]) <- TRUE
df
a b
1 999 A
2 NA B
3 999 C
4 2 D
is.numeric(df$a)
[1] TRUE
2007 Apr 17
2
Use of argument '...'
Dear R list,
I've read the function writing sections on both "An introduction to R" and "R language Definition" manuals but still don't understand why the following gives an error message:
fun <- function(x, ...) x + y
fun(1, y=2)
I get:
Error in fun(1, y = 2) : object "y" not found
I'd appreciate any help in understanding this.
R version 2.4.1
2007 Oct 18
2
image quality of plot inserted into PowerPoint
Dear R-helpers,
I need to insert an R (2.6.0) generated plot containing semi-transparent colors into PowerPoint (2002). When I directly paste it from the clipboard or insert it as (enhanced) Metafile (I'm on Windows XP) the semi-transparent colors don't show. When I insert it at as a Bmp, Png or Jpeg and then convert to PDF the semitransparent colors do show but the quality of the image
2007 May 25
1
Speeding up resampling of rows from a large matrix
I'm trying to:
Resample with replacement pairs of distinct rows from a 120 x 65,000
matrix H of 0's and 1's. For each resampled pair sum the resulting 2
x 65,000 matrix by column:
0 1 0 1 ...
+
0 0 1 1 ...
_______
= 0 1 1 2 ...
For each column accumulate the number of 0's, 1's and 2's over the
resamples to obtain a 3 x 65,000 matrix G.
For those
2007 May 15
1
Efficiently reading random lines form a large file
I need to read two different random lines at a time from a large
ASCII file (120 x 296976) containing space delimited 0-1 entries.
The following code does the job and it's reasonable fast for my needs:
lineNumber = sample(120, 2)
line1 = scan(filename, what = "integer", skip=lineNumber[1]-1, nlines=1)
line2 = scan(filename, what = "integer",
2010 Sep 19
1
help interpreting a model summary
Hello, I am all new here.
Thanks for the job done, R really helped me in my thesis lately. However, I
am kind of new in statistics, coming from mecanical engineering, and I
mostly teached myself with "The R Book", so I may do silly things some time.
PLease tell me if you think so.
Anyway, I've just build up a piecewise linear model to fit some data,
including some interaction and i
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
1997 May 27
1
R-alpha: signif( small , d) gives NA
signif(.) is a <primitive> function.
Unfortunately, I couldn't even find WHERE in the source,
signif(.) is defined.
Here are the symptoms:
xmin <- .Machine $ double.xmin
signif(xmin,3) #--> NA
umach <- unlist(.Machine)[paste("double.x", c("min","max"), sep='')]
for(dig in 1:10) {cat("dig=",dig,": ");
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 Aug 11
1
Unexpected parameter problem using rsaga.geoprocessor() {RSAGA}
Hello,
I discovered SAGA, an interesting free GIS, a few days ago and now, I
would like to use it from within R 2.6.2 using the RSAGA package. I read
the documentation for this package and thought that I understood it
correctly for trying to call some of the SAGA modules. For getting the
information on the usage of and arguments required by the SAGA command
line "Import Binary Raw
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
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'?
2017 Aug 24
1
rmutil parameters for Pareto distribution
In https://en.wikipedia.org/wiki/Pareto_distribution, it is clear what the
parameters are for the pareto distribution: *xmin *the scale parameter and
*a* the shape parameter.
I am using rmutil to generate random deviates from a pareto distribution.
It says in the documentation that the probabilty density of the pareto
distribution
The Pareto distribution has density
f(y) = s (1 + y/(m
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
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
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 =
2006 Jun 28
2
read file with readBin (the file was saved with a C-routine)
Hello!
I have problems with using of "readBin" to read files, which was written in C with "fwrite". In the C-File there is the following Code:
fwrite(MyitINI,sizeof(itINItype),1,outfile);
where MyitINI is a structure of the following form
typedef struct{
int KernelFileSave; /* Determined, if Systemmatrix saved or not.*/
char KernelFileName[200]; /* A-Matrix name