Displaying 20 results from an estimated 10000 matches similar to: "add=TRUE function not working"
2012 Sep 06
2
choose() function returning anomalous results (zero instead of one)
Hello,
(Apologies for length, wanted to get all the relevant detail in that I know
of).
I've been having a lot of trouble with some code for an inventory analysis
problem I was doing, and finally came to the conclusion that it appears
that choose() is returning incorrect values. Specifically:
-------------
Browse[1]> nn
[1] 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3
2009 Jul 31
5
Creating a column based on data in another column
hello all,
I have a data frame and I want to create a column which assigns a letter
based upon the value in another column. The data column has velocities
ranging from 0 to 1000. So for example, for velocities between 0 and 300
I'd like to assign the letter "A" in the new column, for 300-600, "B" and so
on and so forth. How would I do this?
Thank you very much!
Mehdi
2003 Nov 05
3
using LSODA in R
R help list subscribers,
I am a new user of R. I am attempting to use R to explore a set of
equations specifying the dynamics of a three trophic level food chain. I
have put together this code for the function that is to be evaluted by
LSODA. My equations Rprime, Cprime, and Pprime are meant to describe the
actual equation of the derivative. When I run LSODA, I do not get the
output that
2008 Oct 28
1
How to add a data line (series) to a plot using add=TRUE
Hello,
I'd like to use the add=TRUE parameter to add a second data line
(series) to an existing plot, but R is giving me an error (see below).
This code:
> rap<-plot(aspen_sort,ylim=c(1,10000),log="y")
...produces the plot to which I'd like to add the second line. But this
code:
> rap<-plot(pine_sort,add = TRUE)
...produces this error:
Warning messages:
1: In
2012 Jun 04
1
Plotting with Rgraphviz
Hi All,
After a lengthy battle just to get the package installed, I am not able to
actually use Rgraphviz to generate any plots. I tried just using the sample
code in the documentation
(http://www2.warwick.ac.uk/fac/sci/moac/people/students/peter_cock/r/rgraphviz/)
and I get the following:
*> > library(Rgraphviz)
> test.matrix<-matrix(rep(c(0,1,0,0), 9), ncol=6, nrow=6)
>
2009 Jul 29
1
Combining two dataframes and specifying tolerance levels
Hello everyone,
I have two data frames. One is a vector about 780 rows long consisting of
lat long data of 780 station locations. The other table was previously a
shape file which I have converted into a data frame object of lat long
coordinates and attribute data. What I want to do is combine the
two--assigning attribute data to each station. The problem is, however,
that those station
2008 May 28
1
Unnecssary warnings in plot function (PR#11530)
Full_Name: Joseph Amuah
Version: 2.7.0 (2008-04-22)
OS: Windows
Submission from: (NULL) (205.207.78.4)
I used the plot function to create some graphs but wanted to add soem
restrictions. A set of warning were produced even though the plot worked fine.
Can these warnings be cleaned up? Here is an example:
***************************************
> plot(xx$month, xx$log10RR, xlab="",
2009 Aug 27
1
Problem merging two data frames
Hello everyone,
Merging two dataframes should be easy. However when I try to merge, R
doesn't recognize identical values, even if I am doing it by values that
have no decimals.
willclayong:
vs30 LON LAT Net X wills.cat wills.vs30 clahan.cat clahanvs30
PolyID.wills PolyID.clahan tif.cat STA ELEVATION tif.vs30
1 338.539 -3849590 4319319 <NA> 2 D 301
2006 Oct 21
1
plot.POSIXct plot.POSIXlt
Hi,
Just to signal that when I want to plot POSIXct variable on x using
format within plot(), I get what I want on the plot but with a number of
warnings:
> plot(y~x,format="%y-%m")
Warning messages:
1: "format" is not a graphical parameter in: plot.window(xlim, ylim,
log, asp, ...)
2: "format" is not a graphical parameter in: plot.xy(xy, type, pch, lty,
2009 Feb 12
2
Messing with the "..." argument
Hi all,
Sorry if this is documented somewhere, but trying to search and google for
ways to alter my "..." argument is having me chasing my tail.
Is there someway that I can manipulate the elements in "..."?
Specifically I'd like to use certain vars in "...", then remove them
from "..." and pass the rest of "..." to another function.
2009 Jul 16
2
Problems generating image from tiff file
I imported the attached tiff file and converted the coordinate system to
long lat and graphed it:
californiatiff<- readGDAL("california1.tif")
proj4string(californiatiff)
> rasterprojection <- spTransform(californiatiff, CRS("+proj=longlat")
however, when using the plot command for rasterprojection, I get a blob. I
can see the outline of the state of california and
2008 Feb 22
2
Drawing several pictures on a plot
Hi,
I want to draw several pictures on one plot and do as follows:
xy<-matrix(rnorm(100,100,10),50)
op <- par(mfrow = c(2, 2), pty = "s")
plot(xy,ann=F);plot(xy,ann=F);plot(xy,ann=F);plot(xy,ann=F)
par(op)
What I need now is to set the size of the pictures within this plot
since there is too much free space among the pictures, making the plot
look not that pretty. How can I do
2007 Jan 10
1
map data.frame() data after having linked them to a read.shape() object
Dear all,
I try to first link data in a data.frame() to a (polygon) read.shape()
object and then to plot a polygon map showing the data in the
data.frame. The first linking is called "link" in ArcView and "relate"
in ArcMap. I use the code shown below, though without success.
Help with this would be greatly appreciated.
Thanks!
Tord
require(maptools)
# Read shape file
2007 Dec 27
1
questions about plot.zoo
Hi,
I have been having very good results using plot.zoo to chart time series
data. But I have three questions about plot.zoo and I am wondering if anyone
knows the answers.
(1) when I tried to use semi-log scale, via log="y", R issued a warning,
although it looked like plot.zoo plotted in semi-log scale anyway:
Warning message:
In plot.xy(xy.coords(x, y), type = type, ...) :
1998 Nov 28
1
No subject
Dear Friends,
Yesterday I posed a question to the list concerning the possibility of doing
animation examples in R. Here is an example S-Plus (4.5 for Windows ) that
I wrote to illustrate my problem. If I try this in R (comment out the
graphsheet and guilocator calls) I don't see my results until after the
function has iterated through the 100 trials. I would like to plot each
iteration.
2012 Nov 17
3
transform input argument (matrix) of function
Dear list!
I would like to write a function to transform matrix, which is input argument of a written function. It is easy with new matrix (see below), but my idea is to transform input argument (matrix) of function without any additional matrixes. Here is an example:
fun1 <- function(xy) {
xy <- cbind(xy[,1], xy[,2], xy[,1] + xy[,2])
return(xy)
}
df1 <- matrix(c(1,2,3,1,2,3), ncol =
2012 Feb 03
3
Cannot get "==" operator to return TRUE
I have a data.frame named "df". The dput of df is at the bottom of this e-mail.
What I'd like to do is replace the "n/a " values with NA. On Mac OSX, it works
to do this:
df[df == "n/a"] <- NA
However, it does not work on Ubuntu. See below.
Thanks in advance,
Garrett
> x <- df[27, 4] # complete data.frame dput is below
> dput(x)
"n/a?"
2009 Jun 09
3
Splicing factors without losing levels
Hi list!
An operation that I often need is splicing two vectors:
> splice(1:3, 4:6)
[1] 1 4 2 5 3 6
For numeric vectors I use this hack:
splice <- function(x, y) {
xy <- cbind(x, y)
xy <- t(xy)
dim(xy) <- length(x) * 2
return(xy)
}
So far, so good (?). But I also need splicing for factors and I tried
this:
splice <- function(x, y) {
xy <-
2014 Mar 21
1
Memcheck: error in a switch using getGraphicsEvent
Hi the list,
One of my package has an (other) error detected by memtest that I do not manage to understand.
Here is the message that I get from Memtest
--- 8< ----------------
> try(choice(cld1))
Error in switch(EXPR = choix, Up = { : EXPR must be a length 1 vector
--- 8< ----------------
The choice function does call the choiceChangeParam function, which is:
--- 8<
2010 Aug 26
1
Passing arguments between S4 methods fails within a function:bug? example with raster package.
Dear all,
This problem came up initially while debugging a function, but it
seems to be a more general problem of R. I hope I'm wrong, but I can't
find another explanation. Let me illustrate with the raster package.
For an object "RasterLayer" (which inherits from Raster), there is a
method xyValues defined with the signature