ters[1:3])
a b c
1 2 3
> x
[1] 1 2 3
- Original Message
From: William Dunlap
To: Stephen Tucker ; r-help@r-project.org
Sent: Tue, February 16, 2010 5:50:38 PM
Subject: RE: [R] side-effects in functions that replace object values
andattributes
> -Original Message-
> Fro
Hello list,
I encountered some surprising behavior in R and wanted to check to see if I was
imagining things. Previously, I thought that replacement/setter operators in
prefix notation (e.g., `[<-`(x,1,y) rather than x[1] <- y) did not produce side
effects (i.e., left 'x' unchanged), but just r
Hello,
I wonder if anyone has used the Compose() function in the 'roxygen' package. I
find its behavior a bit surprising:
> f <- function(x) x + 1
> g <- function(x) x * 2
> f(g(2))
[1] 5
> Compose(f,g)(2)
[1] 6
> g(f(2))
[1] 6
> Compose(g,f)(2)
[1] 5
I would have expected Compose(f,g)(x) == f(
Ah, thanks always -
I originally thought as.chron() was required to have all fields (m/d/y
hh:mm:ss) as for chron() but I see that the former passes its 'format' argument
to as.POSIXct()
Good deal!
Stephen
- Original Message
From: Gabor Grothendieck
To: Stephen Tucker
You may want to use the reshape package for this task:
> library(reshape)
> recast(DF3,Show ~ Datetime, id.var=names(DF3),value="Measure")
Show 08/26/2009 11:30 AM 08/26/2009 9:30 AM
1 Firefly 3 1
2 Red Dwarf 4 2
If yo
You can do something like
mat <- do.call(cbind, lapply(list.files(".data"),read.table))
## explanation:
lapply(list.files(".data"),read.table)
will store all tables in a list
do.call(cbind,...)
will bind all the columns stored in the list created above.
- Original Message
From: fer
There was a previous post about this also:
http://tolstoy.newcastle.edu.au/R/e2/help/07/05/17475.html
I was able to use bitmap(,type="pdfwrite") on Ubuntu Linux but had trouble
getting it to work on Windows.
For now, it's kind of kludgey but I have in my .Rprofle (or .Rprofile.site on
Windows)
Hello,
I am trying to install R and have it running through ESS on a Vista machine
that is not mine (I am only familiar with Windows XP and Ubuntu Linux) so
please pardon my unfamiliarity...
The Rgui.exe installation works fine and package installation also appears to
work fine. The base pack
Hi list,
I wonder if anyone has had this experience with squishplot() in the
TeachingDemos package.
Taking the example from the ?image help page,
library(TeachingDemos)
x <- 10*(1:nrow(volcano))
y <- 10*(1:ncol(volcano))
layout(matrix(c(1,2,3,4),ncol=2,byrow=TRUE),height=c(2,1))
## 1st plot
op
df()
> sqldf("select * from sqlite_master",dbname="mydb")$name
[1] irishead iristail fulltable
Levels: fulltable irishead iristail
? ...I'll try to go figure a few more things out in the in the meantime (like
using sep="\t" ?) and using connections with s
uot;,nm))
=== 3 ===
The following command
sqldf("attach 'mydb.db' as new")
DF <- read.delim(fi)
sqldf("create table myexample as select * from DF",dbname="mydb.db")
will usually create a .db file twice the size of the .txt file (for
Hi,
Does anyone know if there is a way to 'reset the plot number' on a traditional
graphics device?
For instance, I want to have two plots on stacked top of each other
(mfrow=c(2,1)) but with underlying grid lines spanning both figures vertically.
I can put the grid lines on top if I add them
I thought running it through latex will compress the pdf - but this post nicely
summarizes some options:
http://tolstoy.newcastle.edu.au/R/e2/help/07/05/17475.html
I personally prefer the pdftk approach* over the ghostscript option** as the
latter seems to give me a number of problems on Windo
Hi Kevin,
I learned to use tryCatch() from this page:
http://www1.maths.lth.se/help/R/ExceptionHandlingInR/
Hope this helps,
ST
- Original Message
From: Luke Tierney <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: r-help@r-project.org
Sent: Thursday, August 14, 2008 8:59:35 AM
Subject
Not sure what you're looking for, but does this help?
Extending your code,
> library(gsubfn)
> t(strapply(levels(my.cuts),"([0-9.]+),([0-9.]+)",
+ function(...) as.numeric(c(...)),backref=-2,simplify=TRUE))
[,1] [,2]
[1,] 15.9 38.3
[2,] 38.3 60.7
[3,] 60.7 83.1
- Original Mes
From: Duncan Murdoch
Date: Tue, 29 Jul 2008 19:45:28 -0400
On 27/07/2008 3:10 PM, Stephen Tucker wrote:
> Hi list,
>
> I was using Sweave and was
wondering if anyone has had any luck changing the font colors of the
code chunks. For instance, in my .Rnw preample I tried
Hi list, I have some questions regarding
1) conversion of date + time characters to chron
2) formatting chron object printing
Regarding (1), Gabor's Rnews 2004 4/1 article has been indispensible,
but I often work with files where dates and times are contained in a
single field. In this case, I wo
In the example below, a straight application of strsplit() is probably the
simplest solution. In a more general case where it may be desirable to match
patterns, a combination of sub() or gsub() with strsplit() might do the trick:
> x <- "Best-K Gene 11340 211952_at RANBP5 Noc= 3 - 2 LL= -963.66
Hm didn't know about the abind package. That is pretty sweet.
I do often opt for the 'list of matrices' myself though because I'm more
familiar with the methods for lists...
To answer one of Gundala's questions directly (assuming list of matrices is
acceptable):
Since you can do this,
> x <-
This page is also a brief introduction to the S3 classes:
http://www.ibm.com/developerworks/linux/library/l-r3.html
(see section on 'Object-oriented R')
and for S4, in addition to "How S4 methods work":
http://developer.r-project.org/methodDefinition.html
- Original Message
From: Jo
I've never used it myself but I recall reading about this R.oo package a while
ago - might be worth considering?
http://www1.maths.lth.se/help/R/R.oo/
- Original Message
From: Werner Wernersen <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: Sunday, July 27, 2008 4:55:26 AM
Subject: [R
Hi list,
I was using Sweave and was wondering if anyone has had any luck changing the
font colors of the code chunks. For instance, in my .Rnw preample I tried
including:
===
\usepackage[usenames]{colors}
\definecolor{darkred}{rgb}{0.545,0,0}
\definecolor{midnightblue}{rgb}{0.098,0.098,0.439}
\
Hi, hope this will help:
txt <- "Col1,Col2
A,3
, 2
,3
B,4
, 5
, 4
C,1
, 4
, 3"
## read data
dat <- read.csv(textConnection(txt),na.string="")
## fill in empty cells with correct category
dat$Col1[] <-
Reduce(function
I don't know that there is a single function, but you can perhaps apply a
sequence of available functions -
For instance, you can use fitdistr() in library(MASS) to estimate optimal
parameters for a candidate set of distributions; then look at each fit and also
compare the deviance among the f
Are you trying to look at the difference in the gamma distributions due to
variations in the shape and scale parameters? In this case, the following
approach might be more straightforward:
## assign parameter values
params <- list(curve1=c(1,1),curve2=c(1,2),curve3=c(1,3))
## define function
g
how about this?
m1 <- matrix(rep(1:3,each=5),ncol=3)
m2 <- matrix(1:15,ncol=3)
array(apply(m1,2,function(x,m) m-x,m2),dim=c(dim(m2),ncol(m1)))
- Original Message
From: Daren Tan <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: Wednesday, June 18, 2008 7:36:45 AM
Subject: [R] operations
This is a useful reference on the tryCatch() function:
http://www1.maths.lth.se/help/R/ExceptionHandlingInR/
I think something like this should work:
xml <- tryCatch(xmlTreeParse(xmlTxt, useInternal=TRUE),
error=function(err) xmlMalFormed())
- Original Message
From: ppatel3026 <[E
Hi list,
I wanted to plot an image with a colorbar to the right of the plot, but set my
own axis labels (text rather than numbers) to the image. I have previously
accomplished this with two calls to image(), but the package 'fields' has a
wrapper function, image.plot(), which does this task con
Hi Amna,
I believe you are looking for these functions
?hclust
[with method = "ward"]
?kmeans
Best regards,
Stephen
--- amna khan <[EMAIL PROTECTED]> wrote:
> Hi Sir
>
> How to perform cluster analysis using Ward's method and K- means
> clustering?
>
> Regards
>
> --
> AMINA SHAHZADI
>
Hi Klaus,
I am not exactly sure what you are asking for, but something like this? This
would be option (2) from your list - I don't know that it would be too
difficult in R that you would want to use another tool.
filt <- function(x)
with(x,which(Hole > 1))
normalize <- function(x,y)
{
x$Fea
Hi,
Either of the following should work (I assume there are 28 elements in your
list):
fdata <- cbind(as.matrix(as.data.frame(filtered)), myregime)
fdata <- cbind("colnames<-"(matrix(unlist(filtered),ncol=28),
names(filtered)), myregime)
--- livia <[EMAIL PROTECTED]> wrote:
>
> I hav
31 matches
Mail list logo