Define fn.default as a synonym to fn.foo1 (or just rename fn.foo1 as
fn.default) and then use NextMethod as shown:
fn <- function(x,...) UseMethod("fn")
fn.default <-
fn.foo1 <- function(x, commonA=1, ...) {
print("fn.foo1 is called.")
}
fn.foo2 <- function(x, uniqueFoo2, common=1, ...){
This will compute a loess curve and plot it:
example(loess)
plot(dist ~ speed, cars, pch = 20)
lines(cars$speed, fitted(cars.lo))
Also this directly plots it but does not give you the values of the
curve separately:
library(lattice)
xyplot(dist ~ speed, cars, type = c("p", "smooth"))
On Tue,
observations" in my case. To me, the manual seems
> a bit unclear in this regard.
>
> Looking at "car" data, I found it has multiple points with the same
> "speed" but different "dist", which is exactly what I mean by multiple
> observations, but am sti
t;corSpatial", "corStruct")
> + value
> + },
> + environment(corExp))
>> corExp
> function (value = numeric(0), form = ~1, nugget = FALSE, metric =
> c("euclidean",
> "maximum", "manhattan"), fixed = FALSE)
> {
>
D)), as.double(attr(object, "minD")),
> + factor = double(corD[["sumLenSq"]]), logDet =
> double(1))[c("factor",
> + "logDet")]
> + attr(object, "factor") <- aux[["factor"]]
> + attr(object, &quo
; ## Error in match.arg(common) : 'arg' should be one of “opt1”, “opt2”
> fn(x=y, uni="unique argument")
> ## works only when the second argument is named.
>
> It seems that I need to align every argument of fn.foo1 into
> NextMethod, then uniqueFoo2 will become part
Your model is not identifiable. The model contains the exponential of
a linear function of Ne but such a function can be described in two
parameters and you have three. Perhaps you know T? If that is the
case remove it from the start list and set it to the known value T <-
... before running nls
What does "no success" mean?
Some things to try are:
- since log(1-Ne/No) is linear in Ne and run an lm(log(1-Ne/No) ~ Ne)
and then use the implied values from that or use them as starting
values,
- reparameterize a*(b*Ne-T) to aa*Ne + bb and try nls on that
On Wed, Apr 28, 2010 at 9:13 AM,
Maybe you are applying a completely inappropriate model such as would
be the case if Ne/No is not strictly between 0 and 1. All we can do
is guess unless you provide a reproducible example which means that
if we paste it in from your post it will give the same errors you see.
aa means aa, not a*
I am not sure what the general case is here for you but here is a
kludge that works in this case:
t1 <- zoo(-100, as.POSIXct("2009-12-31")+(2:10)*60*60*24)
t2 <- zoo(matrix(0), index(t1)[1]-1)
m <- merge(t1, t2, fill = 0)
m[,1] + m[,2]
By the way, the times in the above are really dates so "Da
The development version of gtools in the subversion/svn repository here:
https://r-gregmisc.svn.sourceforge.net/svnroot/r-gregmisc/trunk/gtools
does pass R CMD CHECK on "R version 2.11.0 Patched (2010-04-26 r51822)"
The development version of gdata in the subversion/svn repository here:
https
See ?panel.number for lattice functions that can be used in your panel
function to discover which one is currently being drawn.
On Thu, Apr 29, 2010 at 6:28 AM, Santosh wrote:
> Dear R gurus..
>
> Is it possible to control span settings for different values of a grouping
> variable, when using xy
Using charmatch partial matches of 10,000 5 leters words to the same
list can be done in 10 seconds on my machine and 10,000 5 letter words
to 100,000 10 letter words in 1 minute. Is that good enough? Try
this simulation:
# generate N random words each k long
rwords <- function(N, k) {
L <- s
The batchfiles distribution has a copydir.bat which copies files from
one directory to another without overwriting anything and a
movedir.bat which is similar but moves the files rather than copying
them (which is much faster but you wont have the packages in your old
installation any more).
Get t
Correction
On Thu, Apr 29, 2010 at 6:28 PM, Gabor Grothendieck
wrote:
> The batchfiles distribution has a copydir.bat which copies files from
> one directory to another without overwriting anything and a
> movedir.bat which is similar but moves the files rather than copying
> them (w
UNIX grep selects out lines in a file and R grep similarly selects out
components of a vector of strings.On the other hand re.findall
extracts substrings from strings. These are different concepts so
there is no logical reason to expect that these two sets of commands
behave the same. Instead,
Here is a workaround:
for(i in 1:nrow(x)) x[i, x[i, ] > 0] <- 0
On Fri, Apr 30, 2010 at 11:10 AM, Abiel X Reinhart
wrote:
> When using the tis time series package (v1.9), I cannot select or alter a
> subset of a time series when the time series is created from a matrix and the
> matrix contain
>
> Tel.: +41 61 331 10 47
> Mobil: +41 79 708 67 66
> Email: richard@pueo-owl.ch
>
>
>
> On Apr 29, 2010, at 13:06 , Gabor Grothendieck wrote:
>
>> Using charmatch partial matches of 10,000 5 leters words to the same
>> list can be done in 10 seconds
You can use nls2 to try many starting values. It works just like nls but:
- if you give it a two row data frame as the start value it will
create a grid between the upper and lower values of each parameter and
then run an optimization starting at each such point on the grid
returning the best
- i
The yags package has QIC. Try
library(yags)
example(yags)
SPRUJ
On Fri, Apr 30, 2010 at 6:34 PM, Sachi Ito wrote:
> Hi,
>
> I'm using 'geepack' to run Generalized Estimating Equations. I'm aware that
> I can use anova to compare two models, but would it be possible to test QIC
> on R? It se
On Sat, May 1, 2010 at 3:41 AM, Chris Evans wrote:
> It's interesting to see this coming up quite soon after my posting
> asking for light formatting (tabs, simple tables, one day embedded
> graphics) in a default output pane in R.
>
> Greg Snow kindly pointed me to sword and I've tried it and it
The strapply function in gsubfn does that. See http://gsubfn.googlecode.com
On Sun, May 2, 2010 at 6:03 PM, OKB (not okblacke)
wrote:
> I'm trying to figure out how to get the text captured by capturing
> groups out of a regex match. For instance, let's say I have the pattern
> "foo ([^
RUE, USE.NAMES = TRUE)
NULL
so the sapply construct in your post has the effect of applying c to
tmp, pats and strapply so the output you observe is correct. The
sapply command never even calls strapply.
On Sun, May 2, 2010 at 8:20 PM, OKB (not okblacke)
wrote:
> Gabor Grothendieck wrote:
&g
See the describe functions in these packages:
Hmisc
pysch
prettyR
On Mon, May 3, 2010 at 8:12 AM, adrien Penac wrote:
> Thank a lot for these answers.
>
> Some of you wondered why I needed
> to do that!
>
> In fact, I have not so big data.frame whith many
> columns (98) and many of them are simi
Here is a workaround:
library(zoo)
# test data
z <- zoo(cbind(1:5, NA, c(1:3, NA, 5), NA))
ix <- colSums(!is.na(z)) > 0
z[, ix] <- na.approx(z[, ix])
On Mon, May 3, 2010 at 12:41 PM, Abiel X Reinhart
wrote:
> I am trying to run na.approx on a zoo object in which some of the columns
> contain
Please read and follow the last line to every message on r-help.
On Thu, Sep 24, 2009 at 5:32 AM, dhansekaran wrote:
>
> Hello R users
>
> I tried to get maximum of sale date from my dataframe using sqldf in R.
> First time when i was executing the following code
>
>>sqldf("select max(sale_date)
.7"
> R.version.string
[1] "R version 2.9.2 Patched (2009-09-08 r49647)"
Please provide the output of dput(test1) so that we know unambiguously
what your data looks like.
On Thu, Sep 24, 2009 at 9:07 AM, dhanasekaran wrote:
> The data looks like
>
> "2008-08-0
Try this:
> library(zoo)
> as.yearmon("Sep-1981", "%b-%Y")
[1] "Sep 1981"
> as.Date(as.yearmon("Sep-1981", "%b-%Y"))
[1] "1981-09-01"
> as.Date(paste(1, "Sep-1981"), "%d %b-%Y")
[1] "1981-09-01"
On Thu, Sep 24, 2009 at 7:15 PM, Worik R wrote:
> I have trouble with this:
>
> as.Date("Sep-1981"
Create the series as zoo series from the data, and then merge them and
fill in NAs with interpolated values using na.approx. Finally use
window to pick off the times that were in z1 and plot. See the three
vignettes that come with zoo and for time and dates see the article in
R News 4/1 and its r
First get the correct representation which here would be a multivariate
zoo series with 51 time points and 6 components series and then plot it
using zoo's plot function:
z <- zoo(matrix(dat, 51), time(dat2))
# all in one panel
plot(z, pch = letters[1:6], screen = 1, type = "b", col = 1:6)
# or
uot;zoo" to plot
> multiple time series. However I want to go with ggplot2 because it looks
> better. If anyone point me where is the problem in my ggplot2 code, I would
> be truly grateful.
>
> Thanks,
>
>
>
> Gabor Grothendieck wrote:
>>
>> First get the co
See the check.names argument in the help file for read.table.
On Sat, Sep 26, 2009 at 1:58 AM, Derek Foo wrote:
> Hello,
>
> I am trying to read in a csv file with column such as
> "\\LS01\Processor(_Total)\% Processor Time" with the command
> read.csv("file"). However, the column name in the res
Your files do not have data appropriate to your commands. Since you
did not provide the data (see last line of every message to r-help)
there is not much more that can be said.
On Sat, Sep 26, 2009 at 4:24 AM, e-letter wrote:
> I created separate text files for the 2 data sets. I enter the
> foll
On Sat, Sep 26, 2009 at 9:08 AM, e-letter wrote:
> Test1 file contained data set 1, test2 contained data set 2
>
Its not clear to me what you are referring to. The data in your
initial post do not exhibit this problem and there is no data in any
of your subsequent posts in this thread. Here is
Check out Simon Wood's "Generalized Additive Models: An Introduction
with R". Its actually a lot more than its title suggests with linear
model theory and related use of R in chapter 1 (and GLMs, GAMs, mixed
models and GAMMs in subsequent chapters plus an appendix on matrix
algebra). Google for m
Here are three different approaches:
1. Using the first link as an example, on Windows you can copy the
data and headers from IE (won't work in Firefox) to Excel and from
there to clipboard again and then in R:
library(zoo)
DF <- read.delim("clipboard")
z <- zooreg(c(t(DF[5:1, 2:13])), start = as
2009/9/26 "Jens Oehlschlägel" :
> Hi,
>
> Is there any official way to determine the colClasses of a data.frame?
> Why has POSIXct such a strange class structure?
> Why is colClasses "ordered" not allowed (and doesn't work)?
>
> Background
> ==
> I am writing a chunked csv reader that provi
Try:
expm( - M)
On Sat, Sep 26, 2009 at 5:06 PM, Mimosa Zeus wrote:
> Dear R users,
>
> Does anyone has implemented the inverse of the matrix exponential (expm in
> the package Matrix)?
>
> In Matlab, there're logm and expm, there's only expm in R.
> Cheers
> Mimosa
>
>
>
> [[alternative
6, 2009 at 6:24 PM, Charles C. Berry wrote:
> On Sat, 26 Sep 2009, Gabor Grothendieck wrote:
>
>> Try:
>>
>> expm( - M)
>
> Mimosa probably meant say 'the inverse function'.
>
> I do not see one in R.
>
> Chuck
>
>>
>> On Sat, Sep
Often one uses matrix logarithms on symmetric positive definite
matrices so the assumption of being symmetric is sufficient in many
cases.
On Sat, Sep 26, 2009 at 7:28 PM, Charles C. Berry wrote:
> On Sat, 26 Sep 2009, Gabor Grothendieck wrote:
>
>> OK. Try this:
>>
>>
Try this:
filenames <- sprintf("data%d.csv", 1:20)
DFs <- sapply(filenames, read.csv, simplify = FALSE)
which will return a list of data frames, DFs, each named by its
filename so that DFs[[1]] or DFs[["data1.csv"]] give the data frame
read from data1.csv, etc. and names(DFs) gives a vector of th
with(attenu, mag + as.numeric(station))
is nearly twice as fast:
> system.time(for(i in 1:1000) with(attenu, mag + as.numeric(station)))
user system elapsed
0.050.020.06
> system.time(for(i in 1:1000) rowSums(cbind(mag, station)))
user system elapsed
0.090.000.10
S
Note that Henrique's code does not give the same result as the
expression you posted although its possible that his is what you
really intended.
On Sun, Sep 27, 2009 at 10:27 AM, tzygmund mcfarlane
wrote:
> Thank you Gabor (& Henrique)!
>
> On Sun, Sep 27, 2009 at 3:26 PM,
Please read the last line to every message on r-help. In particular
make it reproducible and minimal. The code you post should look like
this where you have cut down DF1, DF2 and DF3 to the smallest number
of rows that still exhibits the error.
DF1 <- ...output from dput(DF1)
DF2 <- ...outpu
You are probably trying to use SQL reserved keywords as column names.
Try entering this at the R prompt:
library(RSQLite)
.SQL92Keywords
On Sun, Sep 27, 2009 at 5:25 PM, Christopher Bare
wrote:
> Hi,
>
> When I use RSQLite's dbWriteTable(...) function, the columns in the db
> table frequently en
Try this:
matrix(aperm(x, c(1,3,2)), nc = 6)
On Sun, Sep 27, 2009 at 6:33 PM, Daniel Malter wrote:
>
> Hi, I have an array of dimension 6:6:16. I want to stack the 16
> slices of the array into a matrix or a data frame of dimension
> 6:(6*16=96) in order to write it to a csv fil
Not sure if this is important to you but R functions don't have to
have names so what you get back won't be a name if the function was
anonymous. In the example below an anonymous function calls fname and
the returned string is the calling sequence but that's not its name
since it has no name. In
Try this:
library(lattice)
xyplot(y ~ x, mydat, groups = id)
On Sun, Sep 27, 2009 at 10:42 PM, Tim Clark wrote:
> Dear List,
>
> I am wanting to produce a multiple line plot, and know I can do it with
> matplot but can't get my data in the format I need. I have a dataframe with
> three colum
On Sun, Sep 27, 2009 at 10:36 PM, trumpetsaz wrote:
>
> I am trying to write a function that will have an input of a vector of
> functions. Here is a simplistic example.
> sumstats <- c(mean,sd)
> sumstats[1]
> #Gives this error
> #> sumstats[1]
> #[[1]]
> #function (x, ...)
> #UseMethod("mean")
>
You should be using read.zoo, not read.table. This
read.zoo(textConnection(Lines1), ...)
becomes
read.zoo("test1.txt", ...)
etc. See ?read.zoo and read the three vignettes in the zoo package.
On Mon, Sep 28, 2009 at 8:13 AM, e-letter wrote:
> I saved the data sets as files and then tried to
This looks like a problem in the chron package. Define:
c.chron <- function(...) chron(do.call("c", lapply(list(...), unclass)))
and then try it again. I will discuss it with the chron maintainer.
On Mon, Sep 28, 2009 at 6:41 AM, gunnar.p wrote:
>
> Hello Gabor,
> thanks for your reply. Pleas
Try this:
> L <- list(`0` = 1:4, `1` = 2:3)
> sum(L$`0`)
[1] 10
> with(L, sum(`0`))
[1] 10
> # not recommended tho' this is closest to what you asked for
> attach(L)
> sum(`0`)
[1] 10
On Mon, Sep 28, 2009 at 10:57 AM, Christina Rodemeyer
wrote:
> Hi guys,
>
> I have a list of 250 numbers as
There is a book called R for SAS and SPSS Users which you might want to look at.
On Mon, Sep 28, 2009 at 10:24 AM, baxterj wrote:
>
> I am just starting to code in R and need some help as I am used to doing this
> in SAS.
>
> I have a dataset that looks like this:
>
> Chemical Well1 Well2 Well3 W
1. A common way of doing this is cut:
> cut(data, c(-Inf, 10, Inf), lab = levs, right = TRUE)
[1] Pre Pre Pre Post Post
Levels: Pre Post
We don't actually need right=TRUE as its the default but if you omit
it then it can be hard to remember whether the right end of intervals
are included
See:
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f
On Wed, Sep 30, 2009 at 2:40 PM, Michael Knudsen wrote:
> Hi,
>
> Today I was flabbergasted to see something that looks like a rounding
> error in the very basic seq function in R.
>
>> a = seq
Try creating a Windows batch file along these lines:
setlocal
set R_PROFILE_USER=C:\tmp\myscript.R
"C:\Program Files\R\R-2.9.x\bin\Rgui.exe"
endlocal
and double click it. The set line sets it up to run your script and
the next line runs R.
On Wed, Sep 30, 2009 at 7:12 PM, Martin Batholdy
wrot
See lmList in the lme4 package. Each component of the result will be
one lm and you can take a summary of each.
On Wed, Sep 30, 2009 at 11:10 PM, jimdare wrote:
>
> Hi,
>
> I'm sure these are basic problems so I apologise in advance for my
> ignorance. I have a dataset with X, Y, and a Factor w
Please read the last line to every message to r-help. There is no
reproducible code in your post.
Anyways, it works for me:
> class(call("round", 1.5))
[1] "call"
> as.character(call("round", 1.5))
[1] "round" "1.5"
> format(call("round", 1.5))
[1] "round(1.5)"
On Thu, Oct 1, 2009 at 7:58 AM
Read the troubleshooting section on the home page: http://ryacas.googlecode.com
Note, in particular, that it currently only works with an older
version of the XML package.
> library(Ryacas)
> packageDescription("XML")$Version
[1] "1.96-0"
> x <- Sym("x")
> Integrate(x*x, x)
[1] "Starting Yacas!"
e
Try this:
> x <- c(1, 2, 3, 3, 4, 5)
> ave(x, x, FUN = length) > 1
[1] FALSE FALSE TRUE TRUE FALSE FALSE
On Thu, Oct 1, 2009 at 10:42 PM, Peng Yu wrote:
> Hi,
>
>> x=c(rep(1,3),rep(3,2))
>> x
> [1] 1 1 1 3 3
>> duplicated(x)
> [1] FALSE TRUE TRUE FALSE TRUE
>>
>
> As shown in the above co
Try this:
> library(gsubfn)
> s <- "abcdefghijkl"
> strapply(s, "...")[[1]]
[1] "abc" "def" "ghi" "jkl"
On Fri, Oct 2, 2009 at 5:36 AM, J Chen wrote:
>
> dear all,
>
> I have some very long strings and would like to break up each long string
> into multiple strings with a fixed length, e.g. to
dot (.) matches anything so be sure to escape it so that it only
matches a literal dot in your regular expression.
On Fri, Oct 2, 2009 at 5:39 AM, Luca Braglia wrote:
> Hello *
>
> i have to rename a lot of variables, and, given that they have regular name
> constructs, I would like to use regex
set if not a multiple of the subset length:
>
>> library(gsubfn)
>> s <- "abcdefghijklm"
>>
>> # no 'm'
>> strapply(s, "...")[[1]]
> [1] "abc" "def" "ghi" "jkl"
>>
>
>
> On Fri,
Its under 5 seconds on my Vista laptop. Do you have any startup files? If
Rgui --vanilla
is much faster then your startup files are the problem.
On Fri, Oct 2, 2009 at 11:45 AM, FMH wrote:
> Thank you for your answer. I'm using Win XP with 2GB RAM in memory.
>
> Cheers
> Fir
>
>
>
> - Ori
> Cheers
>
>
>
>
> - Original Message
> From: Gabor Grothendieck
> To: FMH
> Cc: stephen sefick ;
> Sent: Fri, October 2, 2009 4:50:52 PM
> Subject: Re: [R] How to speed up R with version 2.9.2?
>
> Its under 5 seconds on my Vista laptop. Do yo
Here is a slightly simpler version of the strapply solution with a
short string at the end:
> strapply("abcdefghijk", ".{1,3}")[[1]]
[1] "abc" "def" "ghi" "jk"
On Fri, Oct 2, 2009 at 8:20 AM, Gabor Grothendieck
wrote:
> That par
zoo objects can have one column with a heading and convert back
faithfully to ts:
> library(zoo)
> as.zoo(x)[, 1, drop = FALSE]
Juan
1(1) -0.37415224
1(2) -0.30875111
1(3) -0.02617545
1(4) -0.45053564
2(1) 0.15173749
2(2) 1.38545761
2(3) 2.11594058
2(4) -0.84970010
3(1) -0.05944844
compare John with Martha
> without them having to know (or remember) that John's data are in column 93
> and Martha's are in column 22. I'd like to do the same thing with a time
> series matrix.
>
>
> David
>
>
>
> Gabor Grothendieck wrote:
>>
>>
On Sat, Oct 3, 2009 at 2:57 PM, LinZhongjun wrote:
>
> The reason may be that I used a vista machine. I tried on a XP machine, and
> there were no error messages..
>
Try right clicking on the R icon on your desktop and choose Run as
Adminstrator and see if that helps.
_
Try this:
matrix(list(1, 11, 111, 2, 22, 222), nc = 2, dimnames = list(NULL, c("a", "b")))
or
out <- list(1, 11, 111, 2, 22, 222)
dim(out) <- c(3, 2)
colnames(out) <- c("a", "b")
On Sat, Oct 3, 2009 at 7:51 PM, Andrew Yee wrote:
> Take the following code:
> foo <- list()
>
> foo[[1]] <- list
)))
> foo[,'a'] # returns a list
> One possible solution is as follows, though I wonder if this step could be
> avoided in the first place through more careful coding of the preliminary
> steps:
> new.result <- matrix(unlist(result), ncol=ncol(result), dimnames=list(NULL,
>
Mark had intended to send the message below but due to a technical
problem only a blank message appeared on r-help:
David: I'm on the moderator list that checks which non subscriber
emails go through. I confess to letting that one
through because I figured it was better for the person to receive t
Add a flush.console() statement after each cat.
On Sun, Oct 4, 2009 at 11:32 AM, Philip A. Viton wrote:
>
> On: R 2.8.1 / Ms Windows / R-Gui-R-console
>
> I have a long-ish function, and to re-assure myself that it's actually
> making progress I've arranged a set of messages to the console (usin
x is the eigenvector corresponding to eigenvalue 1. See ?eigen.
On Sun, Oct 4, 2009 at 9:31 AM, dahuang wrote:
>
> i wanna get x from the equations: Ax=x, given A is a matrix. How can i apply
> it in R? thanks
> --
> View this message in context:
> http://www.nabble.com/help-about-solving-the
On Sun, Oct 4, 2009 at 3:45 PM, Deepayan Sarkar
wrote:
>
> Yes, unfortunately the trellis object cannot distinguish between the
> "legend" and the "key" any more.
>
If you are willing to muck around at the grid level you can do it.
First list out the grid objects using grid.ls(). Now looking for
Its not completely clear what you want to preserve and what you want
to eliminate but try this:
> L <-
> readLines("http://waterdata.usgs.gov/nwis/uv?format=rdb&period=7&site_no=021973269,06018500";)
> L.USGS <- grep("^USGS", L, value = TRUE)
> DF <- read.table(textConnection(L.USGS), fill = TRU
Repeat the DD calculation but with this pattern instead:
pat <- "^# +USGS +([0-9]+) +(.*)"
and then merge DD with DF:
DDdf <- data.frame(gauge = as.numeric(DD[,1]), gauage_name = DD[,2])
both <- merge(DF, DDdf, by = "gauge", all.x = TRUE)
On Sun, Oct 4, 2009 at
Try this. First we read a line at a time into L except for the
header. Then we use strapply to match on the given pattern. It
passes the backreferences (the portions within parentheses in the
pattern) to the function (defined via a formula) whose implicit
arguments are x, y and z. That function
Here are two approaching using Bill's sample data:
1. gsubfn supports proto objects whose methods have access to a count
variable that is built into gsubfn and automatically reset to zero at
the start of each string so you can do this (gsubfn uses proto
internally so you don't have to explicitly l
Looks interesting. Could you make a vimball out of it to facilitate
installation.
On Mon, Oct 5, 2009 at 10:12 AM, Jakson A. Aquino
wrote:
> Dear R users,
>
> The author of Tinn-R (Jose Claudio Faria) now is co-author of
> Vim-R-plugin2, a plugin that makes it possible to send commands
> from t
See below.
On Mon, Oct 5, 2009 at 6:50 PM, Gabor Grothendieck
wrote:
> Try this. First we read a line at a time into L except for the
> header. Then we use strapply to match on the given pattern. It
> passes the backreferences (the portions within parentheses in the
> pattern) to
2009/10/6 Uwe Ligges :
>
> The first rule is easy: As long as you are using scalar valued (i.e. length
> 1 vectors in R) "cond", you should prefer
> if(cond) cons.expr else alt.expr
> rather than
> ifelse(cond, yes, no)
> because the latter one evaluates both "yes" and "no" while the former one
2009/10/6 Uwe Ligges :
>
>
> Gabor Grothendieck wrote:
>>
>> 2009/10/6 Uwe Ligges :
>>>
>>> The first rule is easy: As long as you are using scalar valued (i.e.
>>> length
>>> 1 vectors in R) "cond", you should prefer
>>&g
vim/gvim does syntax highlighting of R, Sweave and latex.
On Tue, Oct 6, 2009 at 12:30 PM, Gregory Gentlemen
wrote:
> Hi fellow R-users,
>
> Are there any text editors that recognize sweave (.rnw) files? I am running
> Windows Vista and in the past I used Tinn-R for R files but it (surprisingly)
See ?rbind.fill in the plyr package.
On Wed, Oct 7, 2009 at 9:32 AM, christiaan pauw wrote:
> Hallo Everyone
> I have the kind of problem that one should never have because one must
> always plan well and communicate with your team. But now I haven't so here
> is my problem.
>
> I have data comin
Check out:
http://sourceforge.net/projects/npptor/
On Wed, Oct 7, 2009 at 11:04 PM, Jason Rupert wrote:
> I am a big fan of NotePad++
> (http://notepad-plus.sourceforge.net/uk/site.htm), which allows users to
> develop an XML schema that allows NotePad++ to be more Language aware. Thus,
> I'm
Try this (possibly after scaling the rows or columns to 1):
library(gplots)
with(as.data.frame.table(as.matrix(jevons[-1])), balloonplot(Var1, Var2, Freq))
On Thu, Oct 8, 2009 at 9:24 AM, Michael Friendly wrote:
> I have the following data set, representing the the estimated number of some
> ev
Try this:
RSiteSearch('dbf")
On Thu, Oct 8, 2009 at 4:17 PM, Michael Yutzi wrote:
>
> I have a heavy DATA saved in dbf format.
>
> What I want is to bring that data to R with SQL statements. Like: I want
> columns 1, 4, 5 and only when column 4 > 30.
>
> Sorry asking it here instead of keep sear
This may be a bug in objects of class "instantiatedProtoMethod". I
tried it with the devel version of proto and got no error so you could
try that. I will send it to you offline for your try.
On Thu, Oct 8, 2009 at 1:02 PM, baptiste auguie
wrote:
> Dear all,
>
> In mucking around with ggplot2,
:
with(g, icon)
On Thu, Oct 8, 2009 at 7:44 PM, Gabor Grothendieck
wrote:
> This may be a bug in objects of class "instantiatedProtoMethod". I
> tried it with the devel version of proto and got no error so you could
> try that. I will send it to you offline for your try
plot.zoo and xyplot.zoo in the zoo package can both do that:
library(zoo)
z <- zoo(c(21, 34, 33, 41, 39, 38, 37, 28, 33, 40),
as.Date(c("1992-01-10", "1992-01-17", "1992-01-24", "1992-01-31",
"1992-02-07", "1992-02-14", "1992-02-21", "1992-02-28", "1992-03-06",
"1992-03-13")))
#
Create two zoo series, merge them and use na.locf (last occurence
carried forward):
library(zoo)
z1 <- zoo(as.numeric(d1), d1)
z2 <- zoo(as.numeric(d2), d2)
z <- merge(z1, z2)
z.na.locf <- na.locf(z, na.rm = FALSE)[time(z1)]
transform(as.data.frame(z.na.locf), z1 = as.Date(z1), z2 = as.Date(z2))
Try this (where "lm" is the class of the lm output):
> methods(class = "lm")
[1] add1.lm* alias.lm* anova.lm case.names.lm*
[5] confint.lm*cooks.distance.lm* deviance.lm* dfbeta.lm*
[9] dfbetas.lm*drop1.lm* dummy.coef.lm* effects.l
There are many approaches to GUIs in R but for something quick, which
I gather is your main aim here, have a look at the fgui package and
also the very similar ggenericwidget function in the gWidgets package.
On Sat, Oct 10, 2009 at 1:05 AM, Jason Rupert wrote:
> It appears several that of my scr
Here are a couple of possibilities both based on first converting the
data frame to long form:
> xtabs(~ind + values, stack(DF))
values
ind 1 2 3
x1 3 1 1
x2 2 3 0
x3 3 1 1
> t(table(stack(DF)))
values
ind 1 2 3
x1 3 1 1
x2 2 3 0
x3 3 1 1
On Sat, Oct 10, 2009 at 10:43 AM, A
of the contributed packages. These really are helpful for
> accelerating the development of useful code.
>
>
>
>
>
> --- On Sat, 10/10/09, Gabor Grothendieck wrote:
>
>> From: Gabor Grothendieck
>> Subject: Re: [R] Running R scripts from a GUI interface
>> To: &
Try this:
> library(tcltk)
> as.numeric(tcl("string", "reverse", 123))
[1] 321
On Sat, Oct 10, 2009 at 5:37 PM, tom_p wrote:
>
> Hi All,
>
> Thanks for your help. I need to reverse the digits of a number (unknown
> lenght). Example 1234->4321
>
> Tom
> --
> View this message in context:
> ht
On Sun, Oct 11, 2009 at 8:09 AM, Barry Rowlingson
wrote:
> On Sun, Oct 11, 2009 at 12:53 PM, Gabor Grothendieck
> wrote:
>> Try this:
>>
>>> library(tcltk)
>>> as.numeric(tcl("string", "reverse", 123))
>> [1] 321
>
>
H projects vectors onto the range of X so any vector already in the
range of X gets projected onto itself.
On Sun, Oct 11, 2009 at 2:03 PM, Peng Yu wrote:
> Suppose I have the following hat matrix:
>
> H=X(X'X)^{-1}X'
> X is a n by p matrix, where n >= p and X_{i,1} = 1
>
> I'm wondering why H1 =
The problem is that ifelse does not work the way you might think (see
value section of ?ifelse) and basically should not be used with three
zoo objects unless the three arguments to ifelse have the same time
index.
We can get that effect by using na.pad = TRUE in your diff call:
TradedRate <-
801 - 900 of 4523 matches
Mail list logo