How do I get output with \color{blue}, i.e. with
only one backslash???
\color{blue}
[1] color{blue}
Warning messages:
1: '\c' is an unrecognized escape in a character
string
2: unrecognized escape removed from \color{blue}
\\color{blue}
[1] \\color{blue}
Any help greatly appreciated.
One way would be to use the grid function arrow(). Paul Murrell's document on
Integrating Grid Graphics Output
with Base Graphics Output has an example of integrating grid graphics arrows
in base graphics.
There's also an Arrows() function in the package IDPMisc.
Mikkel
Hi all,
I've been
When I run cut.Date or cut.POSIXt with argument breaks
= weeks, the function gives the first day of that
week, unless the date is the first day of the week, in
which case it gives an error message as in:
cut(as.Date(2006-08-16), week)
[1] 2006-08-14
Levels: 2006-08-14
cut(as.Date(2006-08-14),
sessionInfo()
R version 2.2.1, 2005-12-20, i386-pc-mingw32
attached base packages:
[1] methods stats graphics grDevices
utils datasets
[7] base
other attached packages:
RSQLite DBI
0.4-1 0.1-10
Mikkel Grum
Genetic Diversity
International Plant Genetic Resources
PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of Mikkel Grum
Sent: Wednesday, March 15, 2006 1:46 PM
To: r-help@stat.math.ethz.ch
Cc: [EMAIL PROTECTED]
Subject: [R] \r with RSQLite
What am I doing wrong, or is the \r that I'm
getting
in the example below a bug?
a - (1:10)
b
Is there any function in R like
is.not.found(x, y)
meaning if you can't find object x, then use object
y??
Mikkel Grum
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http
12 B2 12
13 B3 13
14 B4 14
Can it be done?
Mikkel Grum
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[EMAIL PROTECTED] wrote:
Mikkel Grum wrote:
Duncan and Prof, thanks for your comments and
apologies for not being more specific. I'm not
getting
the same results you get from the steps you
propose.
If I write a script foo.R with two lines
id - readline(Please enter an ID
And that was the only combination I didn't try, duhh.
As you say, it works. Excellent! TX! They'll be a
number of pleased usres too.
--- Duncan Murdoch [EMAIL PROTECTED] wrote:
Mikkel Grum wrote:
I've tried your proposal in a number of ways, and
there must be something I'm not understanding
I'm running an R script in Rterm and would like the
user to be prompted for input as in:
id - readline(Please enter ID: )
myfunction(id)
. . . etc.
This works when I run one line at a time in RGui, but
not when I try to run the script in Rterm (I'm working
with R 2.2.0 in Windows Server 2003).
id - readline(Please enter ID: )
then
source(foo.R)
Please enter ID: 5
id
[1] 5
Please do read the posting guide and explain what
you are doing it enough
detail for people to reproduce it.
On Wed, 2 Nov 2005, Mikkel Grum wrote:
I'm running an R script in Rterm
Thanks for this! This is even simpler than using
!is.null():
xmat - as.data.frame(matrix(NA, 2, 3))
try(xmat[i, 2:3] - dbGetQuery(...), silent = TRUE)
Best wishes,
Mikkel
--- Uwe Ligges [EMAIL PROTECTED]
wrote:
Mikkel Grum wrote:
I have a situation where I'm filling out a
dataframe
Javier, on the image and colors, did you try using the
breaks option? You will need 21 breaks to display 20
colors (see ?image).
Janek, the option asp = 1 should generally solve your
scaling problem (point 2 below). I don't remember
where I got that from, but it works unless you use
functions
In a number of different situations I'm trying to
remove factor levels that are represented by less than
a certain number of rows, e.g. if I had the dataset aa
below and wanted to remove the species that are
represented in less than 2 rows:
data(iris)
aa - iris[1:101,]
In this case, since I can
I have a situation where I'm filling out a dataframe
from a database. Sometimes the database query doesn't
get anything, so I end up trying to place NULL in the
dataframe like below.
temp - NULL
xmat - as.data.frame(matrix(NA, 2, 3))
xmat[1, 2:3] - temp
Error in if (m n * p (n * p)%%m)
Schwartz (via MN) [EMAIL PROTECTED]
wrote:
On Thu, 2005-07-07 at 10:20 -0700, Mikkel Grum
wrote:
I have a situation where I'm filling out a
dataframe
from a database. Sometimes the database query
doesn't
get anything, so I end up trying to place NULL in
the
dataframe like below.
temp
When I try the following code with the Windows
graphics window, a new window is opened for each
multiple of four images I produce.
par(layout(matrix(c(1,2,3,4), 2, 2, byrow = TRUE)),
mar = c(2, 3, 2, 3))
for (i in 1:n) {
image(... )
}
When I try to do the same with Sweave to produce a pdf
Hi Mathias,
Try
abline(lm(z2 ~ z1))
Mikkel
..
Hi,
when I run
plot.default(z1, z2, xlab = x, ylab = y, main =
, pch = +)
abline(lm(z1 ~ z2))
then the plot is plotted perfectly (scatterplot),
however, the lm()
function doesnt appear on the plot. What
I'm trying to select a subset of a dataframe while
dropping some factors. While the dataset gets smaller
all Factor levels remain and I need to get rid of
them. Strangely enough, I am almost certain that the
same code on the same data worked OK earlier today -
and it is not the first time that
I'm running a negative binomial model in zelig and
it's asking me to supply starting values for the
coefficients. How do I supply these? Could I use the
coefficients from the poisson model (which runs
smoothly)?
z.out - zelig(postSpmtsQ ~ (ante62Q + ante08Q +
ante29Q + ante16Q) * Trt, model =
Dear useRs,
When plotting with image(), I would like the z-values
that extend beyond the upper zlim to be indicated with
one colour, or preferably with som sort of hatching,
as I'm printing in black and white. By default these
values just show up as blank areas in the image. I've
tried all
Frank Harrel proposed the following solution:
\ifnum\Sexpr{x}=1
\section{}
. . .
\fi
and it works. Amazingly simple!
cheers,
Mikkel
--- Frank E Harrell Jr [EMAIL PROTECTED]
wrote:
Mikkel Grum wrote:
Dear useRs,
I'm writing regular survey reports using Sweave.
Each
report has
Dear useRs,
I'm writing regular survey reports using Sweave. Each
report has several sections along the lines of:
\section*{Disease X}
MapX,fig=TRUE,echo=FALSE=
image(vectorx,vectory,matrixz)
@
Notes with or without Sexpr{a}.
\vfill
\pagebreak
\section*{Disease Y}
MapY,fig=TRUE,echo=FALSE=
I'm trying to schedule R tasks in Windows Server 2003.
I can run the following from the DOS prompt without
any difficulty:
c:\Reportsc:\r\rw2001\bin\rterm.exe --no-restore
--no-save test.R test.out
where test.r has two lines: library(tools);
Sweave(rlr.Rnw).
When I try to run the same from the
Dear R-helpers,
I ran the following little test on RSQLite and got the
data below from the query. Unless I've made some
mistake, the results of both the where and order by
statements have problems:
library(RSQLite)
con-dbConnect(dbDriver(SQLite),dbname=test)
data(USArrests)
Dear R-helpers,
When I use sqlQuery in the package RODBC, I cannot
break the line, but have to write the entire SQL Query
on the same line. Is this expected behaviour? It is
definitely workable, but makes the queries a slightly
difficult to read and edit.
I'm using R 1.9.1 and RODBC 1.0-4 on
up SQL queries into
line-sized chunks, but
this is only a convenience and not required. It
does improve
readability and maintainability, in my opinion.
Sean
On Sep 1, 2004, at 5:09 AM, Mikkel Grum wrote:
Dear R-helpers,
When I use sqlQuery in the package RODBC, I cannot
break
Dear R-helpers,
This must be really simple and clearly expained
somewhere, but I can't find it. I'm writing an
R-package and want to create data sets for the
examples. How do I save them in the format needed for
a package?
cheers,
Mikkel
__
[EMAIL
Dear R-helpers,
I get GPS readings with bug counts (bugs meaning
insects in this case) made along rows in crop fields
and use these to make maps of bug distribution. The
GPS readings are not quite accurate enough for my
purpose, so since I know what row each reading is made
in, I adjust the
Hi,
I thought that the following code would give me a set
of parallel lines on a plot as in the second example.
q-c(-2253,-2119,-1985,-1850)
p-c(1,2,3,4)
a-rep(min(p),4)
b-rep(max(p),4)
plot(p,q)
# example 1
lines(c(a,b),c(q,q))
Now this gives me the lines I really want:
# example 2
Hi,
I'm extracting data from a database with values for
different observation types in the same variable
(another variable deifnes the observation type). Some
of these observation types are factors, so R naturally
classifies the entire variable as a factor. I want to
select a subset and convert
I receive GPS readings in a text string such as
0121.6723S 03643.6893E and need the coordinates as
decimal degrees in two separate variables: -1.361205
and 36.728155. How do I do this in R?
mikkel
__
[EMAIL PROTECTED] mailing list
32 matches
Mail list logo