Try this:
(mat1 + mat2 + mat3) / 3
On Mon, May 18, 2009 at 8:40 PM, dxc13 wrote:
>
> useR's,
> I have several matrices of size 4x4 that I want to calculate means of their
> respective positions with. For example, consider I have 3 matrices given by
> the code:
> mat1 <- matrix(sample(1:20,16,re
ectors.
Here it is applied to zoo objects:
> library(zoo)
> rollapply(zoo(x), 2, diff)
1 2 3
3 5 7
> rollapply(zoo(x), 2, sum)
1 2 3
5 13 25
On Tue, May 19, 2009 at 4:23 AM, Wacek Kusnierczyk
wrote:
> Stavros Macrakis wrote:
>> On Mon, May 18, 2009 at 6:00 PM,
On Tue, May 19, 2009 at 6:17 AM, marc bernard
wrote:
>
> Dear all,
>
>
>
> I am trying to install a package called "GFCURE" from a local zip file. This
> package fits a cure survival model and has been downloaded from:
>
You are assuming its in the form of an R *package* but its not.
Unzip it a
Try this (note dot after ~):
lm(response[, 3] ~., as.data.frame(spectra.spec[, 2:20]))
On Tue, May 19, 2009 at 6:21 PM, MikSmith wrote:
>
> Hi
>
> I'm fairly new to R and am trying to analyse some large spectral datasets
> using stepwise regression (fairly standard in this area). I have a field
If DF is your data frame:
DF2 <- edit(DF)
and then make the changes manually in the spreadsheet that
pops up.
On Tue, May 19, 2009 at 3:50 PM, tsunhin wong wrote:
> Dear R users,
>
> I have 1 data.frame of 1500x80 - data1. I found out that there are a
> few cells of data that I have misplace, a
w could you still calculate the means? Example code below:
> mat1 <- matrix(c(1,2,3,4,5,NA,7,8,9),3,3)
> mat2 <- matrix(c(NA,6,1,9,0,5,8,2,7),3,3)
> mat3 <- matrix(c(5,9,1,8,NA,3,7,2,4),3,3)
>
>
> Gabor Grothendieck wrote:
>>
>> Try this:
>>
>> (mat1 +
On Wed, May 20, 2009 at 7:48 AM, Wacek Kusnierczyk
wrote:
> Paulo Grahl wrote:
>> Dear All:
>>
>> I have a question regarding the behavior of functions.
>> Say I define a function that returns another function :
>> A <- function(parameters) {
>> # calculations w/ parameters returning 'y'
>>
Here are a few possibilities:
Lines <- "GM1 GM2 GM3 GM4 GM5
Run1 1 2 1 2 3
Run2 2 1 3 2 1
Run3 2 1 1 1 1"
DF <- read.table(textConnection(Lines), header = TRUE)
long <- as.data.frame.table(as.matrix(DF))
head(long)
with(long, b
There is a times class in the chron package. Times are measured
in fractions of a day so 1/24 is one hour.
> library(chron)
> dt <- Sys.time()
> tt <- times(format(dt, "%H:%M:%S"))
> tt
[1] 12:27:46
> tt + 1/24
[1] 13:27:46
There is an article on dates and times in R News 4/1.
On Wed, May 20, 2
There are several arbitrary precision packages available: gmp (an
interface to the GNU multi-precision library on CRAN) and
bc (an R interface to the bc arbitrary precision calculator):
http://r-bc.googlecode.com
There are also packages providing R interfaces to two computer
algebra systems and th
Here are a few ways:
gsub("[+]", "K", "8.00+00")
gsub("\\+", "K", "8.00+00")
gsub("+", "K", "8.00+00", fixed = TRUE)
Note that with gsubfn you can replace several at once as
it is like gsubfn but can take a replacement translation list:
library(gsubfn)
gsubfn(".", list("+" = " plus", "0" = " zer
Here are a few more to add to the list.
x <- c("5/31/2009 12:34:00","6/1/2009 1:14:00")
# 1
read.table(textConnection(x), as.is = TRUE)[, 2]
# 2
format(as.POSIXct(x, format = "%m/%d/%Y %H:%M:%S"), "%H:%M:%S")
# 3
library(gsubfn)
strapply(x, "[0-9]*:..:..", simplify = c)
Also see R News 4/1.
On Thu, May 21, 2009 at 5:04 PM, Stavros Macrakis wrote:
> On Wed, May 20, 2009 at 12:28 PM, Gabor Grothendieck
> wrote:
>>
>> There is a times class in the chron package.
>
> Perfect! Just what I was looking for.
>
> On Wed, May 20, 2009 at 12:19 PM, jim holtman
If you are willing to go down one level and work at the grid level
then you can do it without modifying the panel function.
Below gg.ls$name lists the grid object names. Within that
list look at the ones that have rect in their name. Among
those are 5 in success (the 2nd through 6th rect objects
ther wrong but simply
represent different viewpoints.
On Fri, May 22, 2009 at 9:33 AM, Stavros Macrakis wrote:
> On Thu, May 21, 2009 at 8:28 PM, Gabor Grothendieck
> wrote:
>>
>> It uses hours/minutes/seconds for values < 1 day and uses days and
>> fractions
>> of
Try it this way:
# test list of data frames
L <- list(anscombe[1:4], anscombe[5:8], anscombe[1:4], anscombe[5:8])
# get columns 2 and 3 from each component; cbind those together
do.call(cbind, lapply(L, "[", 2:3))
On Fri, May 22, 2009 at 11:01 AM, Rowe, Brian Lee Yung (Portfolio
Analytics) wro
On Fri, May 22, 2009 at 11:01 AM, Stavros Macrakis
wrote:
> On Fri, May 22, 2009 at 10:03 AM, Gabor Grothendieck
> wrote:
>>
>> Regarding division you could contribute that to the chron package.
>> I've contributed a few missing items and they were incorporated.
>
On Fri, May 22, 2009 at 1:55 PM, Stavros Macrakis wrote:
> On Fri, May 22, 2009 at 12:28 PM, Gabor Grothendieck
> wrote:
>
>> ...The way this might appear in code is if someone wanted to calculate the
>> number of one hour intervals in 18 hours. One could write:
>>
Try this:
Lines <- "Tanaka Mitchell Wang Hunter Chen Chim
miR-191* let-7e let-7b miR-126let-7a let-7g
miR-198let-7f let-7c miR-146a let-7b let-7i
miR-22 let-7g miR-1224 miR-16 let-7d miR-130b
miR-223let-7i miR-124
Try this:
D(expression(x*x), "x")
On Sat, May 23, 2009 at 12:46 PM, dimitris kapetanakis
wrote:
>
> Dear all,
>
> I want to save a value from an expression that I created by using the deriv
> function. So for example the output from an expression using the deriv
> command is:
>
> expression({
>
Try this:
with(rle(test), max(lengths[!!values]))
On Sat, May 23, 2009 at 1:09 PM, tsunhin wong wrote:
> Dear R Users,
>
> I am trying to write a script to count the longest consecutive
> occurring 1 in a sequence:
> test<-c(1,1,1,1,1,1,1,0,0,0,0,1,1,0,1,0,1,0,1,1)
>
> In the case of the object
> On Sat, May 23, 2009 at 1:17 PM, Gabor Grothendieck
> wrote:
>> Try this:
>>
>> with(rle(test), max(lengths[!!values]))
>>
>>
>> On Sat, May 23, 2009 at 1:09 PM, tsunhin wong wrote:
>>> Dear R Users,
>>>
>>> I am t
Try storing them as character strings rather than factors:
black_gray <- data.frame(black, gray, stringsAsFactors = FALSE)
Try this to view what you've got:
str(black_gray)
On Sun, May 24, 2009 at 7:15 AM, Andreas Christoffersen
wrote:
> Hi,
>
> In the example dataset below - how can I cahnge
Check out the xts, zoo and quantmod packages.
xts has a vignette (pdf document) and zoo has
three vignettes.
Also look at:
?read.zoo in zoo to read your data, or
?getSymbols in quantmod.to fetch data from the net, and
the discussion list:
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
On M
nce daily data" seemed to produce
> something sensible.
>
> Thanks,
> Spencer
> Gabor Grothendieck wrote:
>>
>> Check out the xts, zoo and quantmod packages.
>> xts has a vignette (pdf document) and zoo has
>> three vignettes.
>>
>> Also l
Depending on what you want (haven't checked the speed) you could try
this one where
we have changed the ldlc in the first row so that it has none > 130
for id=1 just to
illustrate that case as well:
> d <- data.frame(id = c(rep(1, 3), rep(2, 2), 3), age=c(5, 10, 15, 4, 7, 12),
+ ldlc=c(122, 120
x <- 1; y <- 2
# 1
paste("x is", x, "y is", y)
# 2
sprintf("x is %d, y is %d", x, y)
# 3
library(gsubfn)
fn$cat("x is $x, y is $y\n")
For the last one see http://gsubfn.googlecode.com
If we preface a function by fn$ then it interpolates
strings subject to some qualifications, e.g.
fn$sqlQuery(
If, as in this example, i is always 1, 2, ... and has an odd length
in each group then:
do.call(rbind, by(DF, DF$id, function(x) x[median(x$i), ]))
On Tue, May 26, 2009 at 8:13 AM, Zeljko Vrba wrote:
> I have a large data-frame with measurements such as:
>
> id i v1 v2 v3
> 1 1 1.1 1.2 1.3
>
Try this:
sub(".tif$", "", basename(metr_list))
On Tue, May 26, 2009 at 9:27 AM, Monica Pisica wrote:
>
> Hi everybody,
>
> I have a vector of characters and i would like to extract certain parts. My
> vector is named metr_list:
>
> [1] "F:/Naval_Live_Oaks/2005/data//BE.tif"
> [2] "F:/Naval_Li
Although speed is really immaterial here this is likely
to be faster than all shown so far:
sub(".tif", "", basename(metr_list), fixed = TRUE)
It does not allow file names with .tif in the middle
of them since it will delete the first occurrence rather
than the last but such a situation is highly
Try this:
> as.POSIXct(c("06:00:00.100","06:00:01.231"), format = "%H:%M:%S%OS")
[1] "2009-05-26 06:00:00.100 EDT" "2009-05-26 06:00:00.231 EDT"
On Tue, May 26, 2009 at 5:52 PM, Tim Clark wrote:
>
> Dear List,
>
> I am having problems converting a file with fractional seconds to class
> POSIXc
Its in the second paragraph after the list of % codes.
On Tue, May 26, 2009 at 6:11 PM, wrote:
>
> Thanks for beating me to that, Gabor. The %OS format spec isn't in the
> strptime() docs. How else might we have found this for ourselves?
>
> cur
>
> r-help-boun...@r-project.org wrote on 05/26/
seem to convert the POSIX value to Chron
> times(), and Chron won't take fractional seconds. Are there other ways to
> deal with just time and not date?
>
> Thanks,
>
> Tim
>
> Tim Clark
> Department of Zoology
> University of Hawaii
>
>
> ---
Try this where Age.Group is a factor whose
levels represent the columns of out and Seq is
a sequence number labeling the first Name
in each Age.Group 1, the second 2 and
so on.
> DF <- data.frame(Name = LETTERS, Age = 1:26)
> DF$Age.Group <- cut(DF$Age, seq(0, 30, 10))
> DF$Seq <- with(DF, ave(seq
p.plot is an S3 object and you are attempting to define an S4 class
so you if you really want to do that then you would need this to let
S4 know about the ggplot class:
# S4 class with S3 slot
setClass("ggplot") # make ggplot visible to S4
setClass("AClass", representation(mFirst = "numeric", mSe
Try matching on word boundaries as well:
> gsub("\\bCl\\b","(Cl+beta)",as.character(form))
[1] "((Cl+beta) - (V * ka)) + (V * Vm * exp(-(Clm/Vm) * t))"
See ?regexp
On Thu, May 28, 2009 at 11:41 AM, Caroline Bazzoli
wrote:
> Dear R-experts,
>
> I need to replace in an expression the character "C
Just place a point with an NA value between the two segments.
Here is one way to do it in zoo:
set.seed(123)
library(zoo)
# create sample data
tt <- c(1:1000, 1200:2000)
z <- zoo(rnorm(length(tt)), tt)
# this will fill in omitted values with NAs
z <- as.zoo(as.ts(z))
plot(z)
On Thu, May 28,
Try this:
> sapply(1:n, function(i) sum(abs(outer(a, b, "-")-i)==0))
[1] 10 10 10 10 9
On Thu, May 28, 2009 at 5:45 PM, KARAVASILIS GEORGE wrote:
> Hello, R users.
> I have the following code:
>
> a=1:10
> b=-3:15
> n=5
> x <- rep(0,n)
> for (i in 1:n) x[i] <- sum( outer(a,b, function(s,t) ab
Paul Murrel has an article about using grid graphics
to do this. He also mentions specialized R packages
that are specifically aimed at this task.
http://journal.r-project.org/current.html
On Thu, May 28, 2009 at 11:00 PM, George Chen wrote:
> Hi,
>
> I would like to represent the treatment cour
Try this:
> as.data.frame.table(xtabs(area ~ habitat + sq, DF), responseName =
> "area.sum")[c(2:3, 1)]
sq area.sum habitat
1 10 field
2 13 garden
3 13pond
4 10 river
5 21 field
6 22 garden
7 20pond
8 2
On Fri, May 29, 2009 at 11:01 AM, Zheng, Xin (NIH) [C]
wrote:
> Sometimes I get confused with R's documentation. It seems the documents is
> not maintained and updated well. Anyone has similar feeling? I don't mean to
> offend anyone. I hope R would get better and better. But documentation is
>
Try this:
> m <- matrix(1:9, 3, dimnames = list(R = letters[1:3], C = LETTERS[1:3]))
> as.data.frame.table(m, responseName = "Value")
R C Value
1 a A 1
2 b A 2
3 c A 3
4 a B 4
5 b B 5
6 c B 6
7 a C 7
8 b C 8
9 c C 9
On Fri, May 29, 2009 at 2:08 PM, Ian Coe
Here are are assuming
1. for each row that if that row's value is within 200 - 300 of the
prior or next value with the same ind then that row should be extracted.
2. the input is sorted by values within ind
If that's not the intention then modify the code accordingly.
First we read in the data i
Here is yet another way:
library(gtools)
DF[mixedorder(DF$ip), ]
On Fri, May 29, 2009 at 12:51 AM, edwin Sendjaja wrote:
>
> Hi,
>
> Is there any way to sort a tabel with a colum with IP-address?
>
> table:
>
> id rank color status ip
> 138 29746 yellow no 162.131.58.26
> 138 29746 red yes 16
The sqldf package can read a subset of rows and columns into R without
reading the entire file into R. There are a few caveats:
- It does not support ftp so you will need to download the file to your
computer first as shown in the example below
- since value is an SQL keyword it turns value int
Try this:
boxplot(as.matrix(data) ~ as.Date(date), cex.axis = 0.5, las = 2)
or if all the dates are in the same year and month as they are here
then you might want to just display the day of the month:
boxplot(as.matrix(data) ~ month.day.year(date)$day)
On Sun, May 31, 2009 at 1:45 PM, Ken
Thanks very much. Regards.
On Sun, May 31, 2009 at 2:20 PM, Jose Quesada wrote:
> Gabor Grothendieck wrote:
>> Hi, I was looking for your sendcodetoR.ahk autohotkey script
>> but couldn't find it. Would you be able to point me to it.
>> Thanks.
>>
> Here
If you enter the code in this post first:
https://stat.ethz.ch/pipermail/r-help/2009-May/198791.html
then this post shows an example of how to do it with lattice:
https://stat.ethz.ch/pipermail/r-help/2009-May/199146.html
but I think there is a bug in grid since similar code does
not seem to work
See exampe 6c here:
http://code.google.com/p/sqldf/#Example_6._File_Input
On Mon, Jun 1, 2009 at 3:19 AM, Steven Matthew Anderson
wrote:
> I have a data.frame with three columns + the row number
>
> Sample MidPoint Count
> [1,] 1 0.025 1
> [2,] 1 0.075 3
> [3,
Try this:
Rscript -e "png('abc.png');plot(1:10);dev.off()" && abc.png
On Mon, Jun 1, 2009 at 3:23 PM, Rhizomorph wrote:
>
> I would like to be able to run an R script from the command line using
> RScript.exe. The problem is, my script generates some plots which are being
> automatically closed
Try this:
c(FALSE, !!diff(c(factor(x
On Mon, Jun 1, 2009 at 11:57 AM, liujb wrote:
>
> Hello,
>
> I have a vector:
> x <- c("A", "A", "A", "B", "A", "A", "C")
>
> I'd like to compare each of elements of vector x from its previous element
> (except for the 1st element which does not have pre
Check out:
http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:translucency
On Mon, Jun 1, 2009 at 6:17 PM, Søren Højsgaard
wrote:
> I want to create a plot of positions (x(t),y(t)) of animals in a barn for
> t=1,2,... (I have in mind creating many of these, saving them as png's and
On Tue, Jun 2, 2009 at 7:09 AM, Tony Breyal wrote:
> Dear all,
>
> I am having a problem downloading webpages through R when i run it in
> the DOS window under Windows Vista Basic. I have downloaded the
> batchfiles from http://code.google.com/p/batchfiles/ and have
> successfully set the PATH.
Y
On Tue, Jun 2, 2009 at 12:42 PM, Tony Breyal wrote:
> Hi Gabor,
>
> Thank you kindly for your response.
>
> Re: Don't need to set PATH -- When I read the batchfiles page, the
> opening paragraph says "just place any or all of them anywhere in your
> Windows path and you will be able to access them
"B", "A")
>> x1[2:length(x1)] == x1[1:(length(x1)-1)]
> [1] TRUE FALSE TRUE TRUE FALSE
>
>> !!diff(c(factor(x1)))
> [1] FALSE TRUE FALSE FALSE TRUE
>
> (Your trick of computing differences of the underlying factor representation
> ... ganz raf
Try this:
> Lines <- "No Year month rain
+ 1398 198510 104.2
+ 1399 198511 138.0
+ 1400 198512 120.4
+ 1401 1986 1 12.6
+ 1402 1986 2 19.4
+ 1403 1986 3 1.0
+ 1404 1986 4 58.8
+ 1405 1986 5 98.4
+ 1406 1986 6 56.6
+ 1407 1986 7 280.4
+ 1408 19
If you are willing to do the work RDCOMClient or rcom packages
give you complete control. See example here:
https://stat.ethz.ch/pipermail/r-help/2005-July/075877.html
This assumes your platform is Windows and that you have R and Excel
on the same machine so that R can control Excel.
On Wed, Jun
With
txt <- c("2009-04-10 1400 Fri Foo1.txt", "2009-04-10 1400 Fri
Universities2.txt",
"2009-04-10 1400 Fri Hitchhikers Guide To The Galaxy42.txt")
# Try this line:
> sub("(.*) ([^0-9]+)([0-9]+).txt", "C:test\\2\\1 \\2\\3.txt", txt)
[1] "C:\\test\\Foo\\2009-04-10 1400 Fri Foo1.txt"
[
"
[3] "C:\\test\\Hitchhikers Guide To The Galaxy\\2009-04-10 1400 Fri
Hitchhikers Guide To The Galaxy42.txt"
On Wed, Jun 3, 2009 at 10:11 AM, Gabor Grothendieck
wrote:
> With
>
> txt <- c("2009-04-10 1400 Fri Foo1.txt", "2009-04-10 1400 Fri
> Universitie
The zoo package has lattice methods and does not use require
and it puts lattice in Imports in the DESCRIPTION file. If a user
wants to the use the zoo lattice functions then they must issue
a library(lattice) call. As a result users do not have to load
lattice but if they want to use it they mus
Or even:
> library(chron)
> ch <- chron(HouseDates)
> years(ch)
[1] 1990 1991 1992 1993 1994 1995 1996
Levels: 1990 < 1991 < 1992 < 1993 < 1994 < 1995 < 1996
> # or
> with(month.day.year(ch), year)
[1] 1990 1991 1992 1993 1994 1995 1996
On Thu, Jun 4, 2009 at 4:02 AM, ONKELINX, Thierry
wrote:
Suggest you be more specific. The solution I posted does handle missing values
sorting them to the beginning:
> Lines <- "id rank color status ip
+ 138 29746 yellow no 162.131.58.26
+ 138 29746 red yes 162.131.58.16
+ 138 29746 blue yes 162.131.58.10
+ 138 29746 red no 162.131.58.17
+ 138 297
I think I would use Sundar's solution but here are a couple
more just in case:
> x <- c("a", "z", "e")
> y <- c("a", "z", "e", "r", "t", "a", "z", "a", "z", "e", "c")
>
> #1
> which(apply(embed(y, 3), 1, identical, rev(x)))
[1] 1 8
> #2
> library(zoo)
> which(rollapply(zoo(y), 3, identical, x, al
Check out:
http://wiki.r-project.org/rwiki/doku.php?id=tips:data-io:ms_windows
On Fri, Jun 5, 2009 at 1:37 PM, jlfmssm wrote:
> I am woking on Windows and using read.xls to read Excel.xls file.
> But it needs to install perl on my machine first, and then give the
> following until it can work:
>
Most of the papers in the Journal of Statistical Software use R
so that would give you many examples of such papers.
http://www.jstatsoft.org
On Sat, Jun 6, 2009 at 2:03 PM, Jason Rupert wrote:
>
> Is there a way to get a reference list of journal articles that have used R?
>
> I am just looking f
Try this:
site:journal.sjdm.org filetype:R
On Sat, Jun 6, 2009 at 6:39 PM, Jonathan Baron wrote:
> I also use R to redraw figures for the journal I edit (below), when
> the authors cannot produce usable graphics (about 50% of the author
> who try).
>
> Unfortunately, I cannot find a way to search
, Ted Harding wrote:
> On 07-Jun-09 10:56:25, Gabor Grothendieck wrote:
>> Try this:
>> site:journal.sjdm.org filetype:R
>
> When I enter that into Google, I got only the following two hits:
>
> #
> #!/usr/bin/Rscript --vanilla # input is a pre-made list of files ...
&
Try this:
t(apply(m, 1, function(x) colMeans(outer(x, x, ">="
On Sun, Jun 7, 2009 at 10:09 AM, suparna
mitra wrote:
> Hallo,
> I was trying some code, but couldn't make one step of the code properly.
> Can anybody please help me?
>
> I have one matrix like this
>> values
> [,1]
Try this. See ?regex for more.
> x <- 'This happened in the 21. century." (the dot behind 21 is'
> regexpr("(?![0-9]+)[.]", x, perl = TRUE)
[1] 24
attr(,"match.length")
[1] 1
On Mon, Jun 8, 2009 at 10:15 AM, Mark Heckmann wrote:
> Hi,
>
>
>
> i need to recognize itemization structures in string
The axis will use the internal representation of the dates. See R News 4/1
for more on that.
On Mon, Jun 8, 2009 at 2:59 PM, Graves, Gregory wrote:
> My x axis is a series of daily dates (e.g., 01/01/2000, 01/02/2000,
> etc.) from 2000 to end of 2008. The default only gives me 4 ticks. I
> want
On Mon, Jun 8, 2009 at 7:18 PM, Wacek
Kusnierczyk wrote:
> Gabor Grothendieck wrote:
>> Try this. See ?regex for more.
>>
>>
>>> x <- 'This happened in the 21. century." (the dot behind 21 is'
>>> regexpr("(?![0-9]+)[.]", x, perl
Here are four ways:
# using lapplyBy - DF is already sorted by group
library(doBy)
f <- function(x) {
x$traits[is.na(x$traits)] <- mean(x$traits, na.rm = TRUE)
x
}
do.call(rbind, lapplyBy(~ group, DF, f))
# using by - same f as before
do.call(rbind, by(DF, DF$group, f))
# using
On Tue, Jun 9, 2009 at 3:04 AM, Wacek
Kusnierczyk wrote:
> Gabor Grothendieck wrote:
>> On Mon, Jun 8, 2009 at 7:18 PM, Wacek
>> Kusnierczyk wrote:
>>
>>> Gabor Grothendieck wrote:
>>>
>>>> Try this. See ?regex for more.
>>>>
&g
Those are linear in the coefficients so try these:
library(quantreg)
rq1 <- rq(demand ~ Time + I(Time^2), data = BOD, tau= 1:3/4); rq1
# or
rq2 <- rq(demand ~ poly(Time, 2), data = BOD, tau = 1:3/4); rq2
On Tue, Jun 9, 2009 at 10:55 AM, despaired wrote:
>
> Hi,
>
> I'm relatively new to R and
Rick?" "He was born in the 19. century."
>
> ---
>
> Mark Heckmann
> + 49 (0) 421 - 1614618
> www.markheckmann.de
> R-Blog: http://ryouready.wordpress.com
>
>
>
>
> -Ursprüngliche Nachricht-
> Von: Marc Sch
un...@r-project.org [mailto:r-help-boun...@r-
>> project.org] On Behalf Of Wacek Kusnierczyk
>> Sent: Tuesday, June 09, 2009 1:05 AM
>> To: Gabor Grothendieck
>> Cc: r-help@r-project.org; Mark Heckmann
>> Subject: Re: [R] using regular expressions to retrieve a di
;> Or: How do I have to interpret the results? (I get different results
>> for the
>> two methods)
>>
>> Thank you again!
>>
>>
>> Gabor Grothendieck wrote:
>> >
>> > Those are linear in the coefficients so try these:
>> >
>>
.
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.s...@imail.org
> 801.408.8111
>
>
>> -Original Message-
>> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
>> project.org] On B
t;> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
>> project.org] On Behalf Of Gabor Grothendieck
>> Sent: Tuesday, June 09, 2009 11:27 AM
>> To: Greg Snow
>> Cc: Wacek Kusnierczyk; r-help@r-project.org; Mark Heckmann
>> Subject: Re: [R] using
They have different coefficients because their model matrices
are different but they both lead to the same predictions:
> fitted(lm(y~1+x+I(x^2)))
1 2 3 4 5 6 7 8 9 10
1 4 9 16 25 36 49 64 81 100
> fitted(lm(y~poly(x,2)))
1 2 3 4 5 6 7 8 9 10
1
Try this and see R News 4/1 for more.
> now <- Sys.time(); now
[1] "2009-06-10 07:26:23 EDT"
> library(chron)
> ch <- as.chron(format(now))
> dd <- dates(ch); dd; dd+1
day
06/10/09
day
06/11/09
> tt <- times(ch) - times(dd); tt; tt+1/24
day
07:26:23
day
08:26:23
On Wed, Jun 10, 20
Try:
merge(completedf, partdf, all.x = TRUE)
or
library(sqldf) # see http://sqldf.googlecode.com
sqldf("select * from completedf left join partdf using(beta, alpha)")
On Wed, Jun 10, 2009 at 9:56 AM, Etienne B. Racine wrote:
>
> Hi,
>
> With two data sets, one complete and another one partial,
Try this:
> library(zoo)
> Lines <- "2009-03-09 12:00:00,1
+ 2009-03-09 13:30:00,2"
> z <- read.zoo(textConnection(Lines), sep = ",", tz = "")
> 1/frequency(as.zooreg(z))
[1] 5400
noting that 5400 seconds is 1.5 hours.
On Wed, Jun 10, 2009 at 5:04 AM, koj wrote:
>
> Hi all,
>
> I have time data
Using strapply in gsubfn we can match by contents rather than
delimiter. Parentheses in the regular expression
surround captured portions. The first such captured portion is
any string not containing a dot. We then follow that by matching
a dot and a second captured expression which is anything.
Or perhaps:
M10[rowSums(M10 == 63) == 0, ]
On Thu, Jun 11, 2009 at 4:49 PM, David Winsemius wrote:
>
> On Jun 11, 2009, at 2:53 PM, Payam Minoofar wrote:
>
>> Hello everyone,
>>
>> I have a couple of fairly simple questions (I hope) the answers to which I
>> cannot find through the documentation
Also try this:
X[X == 0] <- NA
or
X2 <- replace(X, X == 0, NA)
On Fri, Jun 12, 2009 at 5:54 AM, Chuck Cleland wrote:
> On 6/12/2009 4:55 AM, Christine Griffiths wrote:
>> Hello
>>
>> I have a dataset in which I would like to replace 0s with NAs. There is
>> a lot of information on how to repla
See the abind package.
On Fri, Jun 12, 2009 at 8:36 AM, Jim Lemon wrote:
> Hi all,
> I've been trying to work out how to slice an array of arbitrary dimension. I
> found a message showing how to stick two arrays together, but so far have
> been unable to transform that into what I need. Assume tha
On Fri, Jun 12, 2009 at 10:57 AM, Stavros Macrakis wrote:
> On Fri, Jun 12, 2009 at 6:09 AM, Duncan Murdoch wrote:
>
>> On 11/06/2009 5:35 PM, Stavros Macrakis wrote:
>>
>>> A table without names displays like a vector:
>>>
>>> > unname(table(2:3))
>>> [1] 1 1 1
>>>
>>> and preserves the tabl
2009/6/14 Juliet Hannah :
> Hi All,
>
> I am trying to understand panel functions. Let's use this example.
>
>
> library(lattice)
> time<-c(rep(1:10,5))
> y <-time+rnorm(50,5,2)
> group<-c(rep('A',30),rep('B',20))
> subject<-c(rep('a',10),rep('b',10),rep('c',10),rep('d',10),rep('e',10))
> myData <-
In PHP and also in MySQL the manual has a wiki capability
so that users can add notes at the end of each page, e.g.
http://www.php.net/manual/en/functions.variable-functions.php
http://dev.mysql.com/doc/refman/4.1/en/update.html
That would combine documentation and wiki into one. Here it would
i
On Sun, Jun 14, 2009 at 6:41 PM, Ted
Harding wrote:
> That is an interesting and potentially very fruitful idea. I'd like
> to propose a "quasi-readonly" mode in which wiki users could interpolate
> the comments at chosen points within the original text of a help-page
> (but without any alteration
Note that TRUE and FALSE become 1 and 0 when used in arithmetic
formulae so:
result <- with(DF,
(type %in% c("A", "B", "C")) *
(1 * (status == "a") + 2 * (status == "b") + 3 * (status ==
"c")) +
(type %in% c("D", "E", "F")) *
(9 * (status == "a") +
Check out:
http://tolstoy.newcastle.edu.au/R/e2/help/07/05/17714.html
On Mon, Jun 15, 2009 at 9:26 AM, Cecilia Carmo wrote:
> Hi everyone, my data is in a dataframe similar to this but with more firms,
> more industries, more years and variables that correspond to financial
> information:
>
>> fir
Check out:
http://wiki.r-project.org/rwiki/doku.php?id=tips:data-io:ms_windows
On 6/15/09, ram basnet wrote:
> Dear all,
>
> I was using older version of R (installed early). I install new version of R
> (R.2.9.0) but i could not find package "xlsReadWrite" to read Excel file. Is
> there any alte
See R News 4/1.
On Tue, Jun 16, 2009 at 9:04 AM, wrote:
> Hi all
>
> I have an irregular zoo series, where the time index looks like the
> following:
>
>> head(time(l.zoo))
>
> [1] "2009-06-15 01:44:20.802 GMT" "2009-06-15 01:44:20.812 GMT" "2009-06-15
> 01:44:20.837 GMT" "2009-06-15 01:44:20.848
com wrote:
>> Thanks Gabor - I'll check it out.
>>
>> Actually I just realised I can also do what I am looking for in a
>> ridiculously simple manner (as the data I have is intra-day):
>>
>> aggregate(l.zoo, hours(index(l.zoo)), mean)
>>
>&g
Try:
2 - is.na(a)
On Tue, Jun 16, 2009 at 5:46 PM, Grześ wrote:
>
> Hi,
> I have a vector a=c(NA, 3, 4, 4, NA, NA, 3) and I would like to use is.na(a)
> function to get a vector like this:
> wy=(1,2,2,2,1,1,2) - you know, this vector create 1 or 2 depends on value in
> vector "a"
>
> This is my
See
?dump
?dput
On Wed, Jun 17, 2009 at 10:43 AM, Mark Na wrote:
> Hi,
>
> I am helping another R user (off list) and I would like to email her
> an R script containing the data she needs and the code to solve her
> problem. I have made a small dummy dataset, but instead of sending her
> a CSV I
read.xls in the gdata package works on Linux.
On Wed, Jun 17, 2009 at 11:37 AM, wrote:
> Sorry for this trivial question. I have just installed R on SuSE/Linux and
> cannot cope with the character terminal.
> I am going to install JGR that will make my life easier at searching for
> existing R
read.csv.sql in sqldf will create an sqlite database on the fly,
read the file in (without going through R) and then extract into
R only that portion specified by an SQL statement. Alternately
use read.csv with appropraite colClasses argument.
On Wed, Jun 17, 2009 at 4:59 PM, liujb wrote:
>
> Hel
1101 - 1200 of 4528 matches
Mail list logo