Displaying 20 results from an estimated 3000 matches similar to: "if(foo == TRUE) .. etc"
2005 Aug 22
1
cbind and rbind
Hi, I have been trying for a while to use cbind and rbind to add a row and column to the same table but seem to be able only to add one OR the other???
Any help would be most welcome,
Tony Evans
Australia
[[alternative HTML version deleted]]
2005 Apr 29
2
congratulations to the JGR developers
Just want to offer my congratulations to the JGR developers as the recepient
of the 2005 Chambers Award. Great job, guys!!
http://stats.math.uni-augsburg.de/JGR/
[Now, could JGR be updated to work with 2.1.0 (or be made R version
independent, please... 8-)]
Best,
Andy
2004 Nov 11
6
scan or source a text file into a list
I've ported somebody else's rather cumbersome Matlab model to R for
colleagues that want a free build of the model with the same type of I/O.
The Matlab model reads a text file with the initial parameters specified as:
C:\Data\Carluc\Rport>more Params.R
# Number of years to simulate
nYears = 50;
# Initial year for graphing purposes
year0 = 1970;
# NPP/GPP ratio (cpp0 unitless)
fnr =
2006 Apr 07
3
finding common elements in a list
Suppose I have a list where I want to extract only the elements that occur
in every component. For instance in the list foo I want to know that the
numbers 2 and 3 occur in every component. The solution I have seems
unnecessarily clunky. TIA, Andy
foo <- list(x = 1:10, y=2:11, z=1:3)
bar <-unlist(foo)
bartab <- table(bar)
as.numeric(names(bartab)[bartab==length(foo)])
2006 Mar 10
1
add trend line to each group of data in: xyplot(y1+y2 ~ x | grp...
Although this should be trivial, I'm having a spot of trouble.
I want to make a lattice plot of the format y1+y2 ~ x | grp but then fit a
lm to each y variable and add an abline of those models in different colors.
If the xyplot followed y~x|grp I would write a panel function as below, but
I'm unsure of how to do that with y1 and y2 without reshaping the data
before hand. Thoughts
2005 Nov 10
2
ltext - adding text to each panel from a matrix
Hi all (really probably just Deepayan):
In the plot below I want to add text on either side of each violin plot that
indicates the number of observations that are either positive or negative.
I'm trying to do this with ltext() and I've also monkeyed about with
panel.text(). The code below is generally what I want but my calls to
ltext() are wrong and I'm not sure how to fix them.
2004 Nov 17
4
summary.lme() vs. anova.lme()
Dear R list:
I modelled changes in a variable (mconc) over time (d) for individuals
(replicate) given one of three treatments (treatment) using:
mconc.lme <- lme(mconc~treatment*poly(d,2), random=~poly(d,2)|replicate,
data=my.data)
summary(mconc.lme) shows that the linear coefficient of one of the
treatments is significantly different to zero, viz.
Value Std.Error
2002 May 18
3
checkerboard plot?
Hi,
I've been doing a lot of CA modeling lately and am now wanting to make some
checkerboard plots in R.
Let's say I have a matrix:
> is.matrix(junk)
[1] TRUE
> junk
[,1] [,2] [,3] [,4] [,5]
[1,] 0 0 1 0 0
[2,] 0 1 1 1 0
[3,] 0 1 0 0 1
[4,] 0 1 1 1 1
[5,] 0 1 0 0 0
>
and I want to make a
2003 May 13
3
Sorting a matrix in an odd way
Hi, I have a matrix not unlike this:
foo <- matrix(,5,5)
foo[5,1] <- 1
foo[1:3,2] <- 1
foo[3:4,3] <- 1
foo[4:5,4] <- 1
foo[2:4,5] <- 1
foo
[,1] [,2] [,3] [,4] [,5]
[1,] NA 1 NA NA NA
[2,] NA 1 NA NA 1
[3,] NA 1 1 NA 1
[4,] NA NA 1 1 1
[5,] 1 NA NA 1 NA
I want to get a vector that is the column numbers as sorted
2005 Feb 10
3
question about sorting POSIXt vector
Dear useRs,
How come the first attempt to sort a POSIXt vector fails (Error:
non-atomic type in greater), while the second succeeds? (Code inserted
below.) The documentation says that POSIXt is used to allow operations
such as subtraction, so I'd expect sorting to work. Is this perhaps an
OS issue? (I run R 2.0.1 on Win xp.)
Thank you,
b.
#------------code
test <- c("2005-02-08
2005 Feb 07
1
THANK YOU:-)
Thank you all for your help :-) Much Much Aprreciated........
I tried with the "jitter" command and it worked :-)
Cheers,
Latha
> -----Original Message-----
> From: Latha Raja
> Sent: Monday, February 07, 2005 3:21 PM
> To: 'r-help at stat.math.ethz.ch'
> Subject: Need your help with my R plot
> Importance: High
>
> Hi,
>
> I am using R to
2005 May 23
3
Windows/7706 (PR#7889)
With 2.1 on Windows XP SP2 (32 bit) I also get no title in a png plot, so I
can reproduce this bug. R is installed from pre-built binary.
No title appears when I run this:
png("foo.png")
plot(1:10, main = "foo")
dev.off()
The jpeg device behaves as expected:
jpeg("foo.jpg")
plot(1:10, main = "foo")
dev.off()
Thoughts on this?
2003 Aug 26
1
Getting out of an embedded function safely - use try?
Helpers.
An instrument sends me data that is mostly nonlinear. I have a group of
functions to manipulate this data so that it is useful to the user. One
of them involves a nls model that called to fit a line to the data and
returns the fits. This works well 99 out of 100 times. Occasionally, the
sensor sends some bad data to which a nls model cannot be fit. When that
happens, the nls function
2004 Feb 17
4
importing ascii grids (for gstat)
Hello,
Is there anyone who could give me an example of how to import an ascii grid (i.e. ArcGIS exported raster) into R. I want to use it with gstat but don't know the appropriate import routine.
Thanks very much for your help.
Regards,
femke
Femke Reitsma
Graduate Student (ABD)
Geography Department
2181 LeFrak Hall
University of Maryland
College Park, MD 20742
Phone: 301-405-4121
2002 Apr 06
1
read.table and trouble
Hi all,
I'm porting a library I wrote in S-plus over to R. All but one of the
functions work fine. The only one that doesn't is really giving me a
headache. I'm admitting defeat. Can anybody help?
Object example3 has been read in using read.table. The statement works fine
in S-Plus.
When I run the same statement in R the column Prefix, which is read in using
the
as.character
2003 Dec 30
3
Writing data frames
Hi there -
I have been trying to generate some simple stats and save the results to
a file. My data looks like this:
x y z exp
0 3 5 1
2 11 10 1
4 4 5 1
7 6 4 1
11 1 2 2
5 7 1 2
3 3
2005 Jan 11
5
global objects not overwritten within function
Dear useRs,
I have a function that creates several global objects with
assign("obj",obj,.GlobalEnv), and which I need to run iteratively in
another function. The code is similar to
f <- function(...) {
assign("obj",obj,.GlobalEnv)
}
fct <- function(...) {
for (i in 1:1000)
{
...
f(...)
...obj...
rm(obj) #code fails without this line
}
}
I don't understand
2003 Dec 20
7
error bars around a point
All
Is there an R command to produce error bars around
a plotted point. Crawley's book uses the command
error.bar() but my version of R rejects it. Must be an
S+ command(?).
Thanks
REX
[[alternative HTML version deleted]]
2006 Oct 05
1
unexpected behavior of boxplot(x, notch=TRUE, log="y")
A function I've been using for a while returned a surprising [to me,
given the data] error recently:
Error in plot.window(xlim, ylim, log, asp, ...) :
Logarithmic axis must have positive limits
After some digging I realized what was going on:
x <- c(10460.97, 10808.67, 29499.98, 1, 35818.62, 48535.59, 1, 1,
42512.1, 1627.39, 1, 7571.06, 21479.69, 25, 1, 16143.85, 12736.96,
2005 Apr 06
3
looking for a plot function
Dear useRs,
I have a data frame and I want to plot all rows. Each row is
represented as a line that links the values in each column. The plot
looks like this:
dfr <- data.frame(A=sample(1:50,10),B=sample(1:50,10),
C=sample(1:50,10),D=sample(1:50,10))
xa <- 10*1:4
plot(c(10,40),c(0,50))
for (i in 1:nrow(dfr)) {
lines(xa,dfr[i,],pch=20,type="o")
}
Things get more complicated