Thanks Bert. I’ll check it out.
Don
On Nov 22, 2013, at 10:25 PM, Bert Gunter wrote:
> Use the Rcolorbrewer package.
>
> -- Bert
>
> On Fri, Nov 22, 2013 at 8:43 PM, Don McKenzie wrote:
>> I would like to produce a levelplot with divergent colors such that
>> increasingly negative values o
Use the Rcolorbrewer package.
-- Bert
On Fri, Nov 22, 2013 at 8:43 PM, Don McKenzie wrote:
> I would like to produce a levelplot with divergent colors such that
> increasingly negative values of Z get darker in the first color and
> increasingly
> positive values get darker in the second color
I would like to produce a levelplot with divergent colors such that
increasingly negative values of Z get darker in the first color and increasingly
positive values get darker in the second color. this is common in cartography.
I have tried tinkering with the col.regions argument but the best I
Hi Ann
Looks like a typo - I see "moreley.tab" that should be "morley.tab".
Works for me after correcting that.
> filepath <- system.file("data", "moreley.tab", package="datasets")
> filepath
[1] ""
>
> filepath <- system.file("data", "morley.tab", package="datasets")
> filepath
[1] "C:/PROGRA~1
Hi,
dat<-as.data.frame(cbind(c("a","a","a","b","b"), c(1,2,3,3,2),c(4,3,5,4,4)))
str(dat)
#'data.frame': 5 obs. of 3 variables:
# $ V1: Factor w/ 2 levels "a","b": 1 1 1 2 2
# $ V2: Factor w/ 3 levels "1","2","3": 1 2 3 3 2
# $ V3: Factor w/ 3 levels "3","4","5": 2 1 3 2 2
#better way would
Sorry, there's a bug in my previous answer.
dat <- data.frame(c("a","a","a","b","b"), c(1,2,3,3,2), c(4,3,5,4,4))
aggregate(as.matrix(dat[,-1]) ~ dat[,1], FUN = mean)
Don't use as.data.frame(cbind(...)), everything becomes factors.
Rui Barradas
Em 22-11-2013 23:02, Rui Barradas escreveu:
He
Hello,
Try the following.
aggregate(cbind(V2, V3) ~ V1, dat, FUN = mean)
Hope this helps,
Rui Barradas
Em 22-11-2013 21:43, john d escreveu:
Dear all,
I apologize for the newbie question, but I'm stuck.
I have a data frame in the following form:
dat<-as.data.frame(cbind(c("a","a","a","b"
On Nov 22, 2013, at 1:43 PM, john d wrote:
> Dear all,
>
> I apologize for the newbie question, but I'm stuck.
>
> I have a data frame in the following form:
>
> dat<-as.data.frame(cbind(c("a","a","a","b","b"), c(1,2,3,3,2),c(4,3,5,4,4)))
>
> I need a way to generate a new dataframe with the
Dear all,
I apologize for the newbie question, but I'm stuck.
I have a data frame in the following form:
dat<-as.data.frame(cbind(c("a","a","a","b","b"), c(1,2,3,3,2),c(4,3,5,4,4)))
I need a way to generate a new dataframe with the average for each factor.
The result should look like:
res<-as.
Sending again as it did not make the list
-Original Message-
From: Duncan Mackay [mailto:dulca...@bigpond.com]
Sent: Friday, 22 November 2013 09:35
To: 'Smilyanov Georgi'
Subject: RE: [R] changing the surface coloring (using lattice::wireframe)
Hi Georgi
I have not used wireframe for ye
Sending again as it did not make the list
-Original Message-
From: Duncan Mackay [mailto:dulca...@bigpond.com]
Sent: Friday, 22 November 2013 09:19
To: 'smart hendsome'; R
Subject: RE: [R] The profile log-likelihood problem
Hi
Without knowing anything about the data and the warning mess
Hi,
Suppose I have all the folders in my working directory.
dir(recursive=T) #created two folders each with a single excel file
#[1] "Folder1/File1.xls" "Folder2/File2.xls"
library(XLConnect)
lst1 <- lapply(dir(recursive=T),function(x) {wb <- loadWorkbook(x);
readWorksheet(wb,sheet="Sheet1")}
Bert is correct.
In addition, you are using prcomp() for your principal
components analysis so the initial principal component loadings
are called "rotation" in contrast to princomp() where they are
called "loadings." So you do not have "rotated" components in
the traditional sense of the word. I
On 22 Nov 2013, at 11:13 , lillosdos wrote:
> Hi I'm Pasquale,
> I need to recode variables (columns) of a dataframe (call it X). The
> observations (rows) are coded as numeric 0,1,2 and NA. I managed to use the
> lapply() function with recode() as FUN and for() loop but I failed.
> *My problem
You probably want to use cut(), but as currently stated, your
intervals leave gaps (between 20 and 21 for example):
set.seed(42)
values <- runif(25)*100
values
[1] 91.480604 93.707541 28.613953 83.044763 64.174552 51.909595
73.658831
[8] 13.40 65.699229 70.506478 45.774178 71.911225 93.46722
Hi all
I have about 10 folders in my directory i.e Folder 1 Folder 10. Each
Folder has a single excel file containing data with the following
attributes State,lat,lon, address i.e
State Lat LonAddress
Anchorage45.87576 -
Many thanks to Wolfgang Wiechtbauer for the explanation.
Sincerely
Mario Petretta
Message: 31
Date: Thu, 21 Nov 2013 19:08:14 +0100
From: "Viechtbauer Wolfgang (STAT)"
To: "petre...@unina.it" , "r-help@r-project.org"
Subject: Re: [R] metafor escalc(measure="SMCC")
Mess
Peter,
thank you. this is perfect. I have been looking for this idiom for years.
xyplot(0 ~ 1, sub=as.expression(
bquote(pi==.(pi) ~ e==.(exp(1)))
))
Can you add this idiom to the examples in the ?plotmath page.
And perhaps also to the ?xyplot page
Rich
On Fri, Nov 22, 2013 at 3:14
Hi again.
I realized that the example I give is not valid, because the number I'm using
is not an integer (ex. 50.1).
So I thought using
is.between = function(x, a, b) { (x - a) * (b - x) > 0}
But I'm not sure how to use it with lapply to avoid looping in my code.
Regards,Phil
> From: pmassico
Thank you everyone for your suggestions.
> Date: Fri, 22 Nov 2013 18:04:16 +
> From: pbu...@pburns.seanet.com
> To: pmassico...@hotmail.com; r-help@r-project.org
> Subject: Re: [R] data manipulation
>
> The final ")" went missing in the command
> starting 'names(neutralVec) <- '.
>
> On 22/1
The final ")" went missing in the command
starting 'names(neutralVec) <- '.
On 22/11/2013 17:51, Patrick Burns wrote:
I think a list is the wrong structure,
a vector would be better since you can
use 'match':
# transform data structure:
neutralVec <- unlist(neutral_classes)
names(neutralVec) <
Hi,
You could use either:
names(which(sapply(lapply(neutral_classes,`%in%`,50),any)))
#[1] "B"
#or
vec1 <-unlist(neutral_classes)
names(vec1) <- gsub("\\d+","",names(vec1))
names(vec1)[vec1==50]
#[1] "B"
A.K.
Hi everyone.
I have a list like this:
neutral_classes = list(A = 71:100, B = 46
On Nov 22, 2013, at 1:28 AM, Noor Aziani Bt Harun wrote:
> Hi,
>
> I'm going to run my thesis that use R language for Lee-Carter method but
> some error occur when I'm running this code.
>
> Please guide me Sir.
>
>
>
>> male.lca<-lca(malaysia.male)
>
> Error in pop * mx : non-numeric argum
I think a list is the wrong structure,
a vector would be better since you can
use 'match':
# transform data structure:
neutralVec <- unlist(neutral_classes)
names(neutralVec) <-
names(neutral_classes[rep(1:length(neutral_classes),
sapply(neutral_classes, length))]
# get one or more results w
On Nov 21, 2013, at 8:35 PM, ivo welch wrote:
> Dear R users: before I try to undertake my own rewrite, has anyone already
> written a contour function that does not require a regularly spaced grid,
> preferably plot.contour(x,y,z,...)?
>
> (it would be nice if it were based on loess() and plot
Rachel
Using fix() is not really a good way to view or modify your data. It is better
to use functions like head(), tail() or index values in the dataframe to view
your data and then also modify elements through indexing.
For instance, something like this
> tmp <- data.frame(v1 = rnorm(10), v
On Nov 22, 2013, at 12:14 AM, peter dalgaard wrote:
>
> On 22 Nov 2013, at 07:53 , Rolf Turner wrote:
>
>> On 11/22/13 18:47, William Dunlap wrote:
a <- 2; b <- 3; xyplot(1:10 ~ a*(1:10), sub = c(bquote(a == .(a) ~
b==.(b
the subtitle contains three copies of the "a =
On 22/11/2013 10:06 AM, Lorenzo Isella wrote:
Dear All,
I use several R libraries (ggplot2, igraph etc...) for producing static
visualizations.
However, I'd like to be able to go beyond this.
Things I may like to be able to achieve (relying on R as much as possible):
1) network visualizations su
1. Probably not, depending on what you expect to gain from this. R's
numerical procedures can almost certainly handle the correlations.
2. Search on "R package for principal components regression" instead
of rolling your own.There are several (e.g. "chemometrics", "pls",
etc.)
-- Bert
On Fri, No
Hi everybody
Sorry guys, please ignore my previous email regarding the problem I was
having using the 'by' function with FUN=mean. Just read the given error
properly and realised my (silly) mistake in that you can no longer apply
the mean function to a dataframe regardless of whether its wrapped
For task #1, if you have the coordinates where the nodes were plotted
then you can just pass this information along with the meta data to
the identify function (assuming base graphics). If you want the
metadata to only appear for the current point (disappear when leave
that point) then look at the
Hi everybody
I'm having some unexpected errors from the 'by' function when using it to
apply the mean function (by a factor) to a dataframe of numerical
variables. The following piece of toy code demonstrates:
myDataF<-warpbreaks
myDataF$X<-runif(54) # creating an additional numerical variable i
Hi everyone.
I have a list like this:
neutral_classes = list(A = 71:100, B = 46:70, C = 21:45, D = 0:20)
and I'm trying to return the letter of the named vector for with an integer
belong. For example, B if I use the value 50.
Any help would be greatly appreciated.
Regards,Phil
Hi,
I'm building my own dataset using data downloaded from my qualtrics survey
(in .csv format), supplemented by my coding of qualitative variables. When
I first downloaded the .csv from qualtrics, it loaded into R quite easily,
and I was able to use the fix(dta) command to see my variables. Howev
Dear useRs:
We would like to introduce the "pedgene" package, version 1.2, available now on
CRAN, with a brief manual available as a vignette:
http://cran.r-project.org/web/packages/pedgene/index.html
The pedgene package performs gene-level kernel and burden association tests
with disease statu
Hi I'm Pasquale,
I need to recode variables (columns) of a dataframe (call it X). The
observations (rows) are coded as numeric 0,1,2 and NA. I managed to use the
lapply() function with recode() as FUN and for() loop but I failed.
*My problem is that for each columns the recoding system is different
Hi,
I'm going to run my thesis that use R language for Lee-Carter method but
some error occur when I'm running this code.
Please guide me Sir.
> male.lca<-lca(malaysia.male)
Error in pop * mx : non-numeric argument to binary operator
Regards
[[alternative HTML version deleted]]
My data has correlations between predictors so I think it would be
advantageous to rotate the axes with prcomp().
> census <-
read.table(paste("http://www.stat.wisc.edu/~rich/JWMULT02dat","T8-5.DAT",sep
="/"),header=F)
> census
V1 V2V3 V4 V5
1 5.935 14.2 2.265 2.27 2.91
2 1.523 1
Similar to Don MacQueen's:
unsplit(lapply(split(DF, DF$ID), transform, cv = c(0, diff(YoS))), DF$ID)
-- David Reiner
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Lopez, Dan
Sent: Thursday, November 21, 2013 6:38 PM
To: MacQuee
Hi All
We are using R to spit out plots(heatmaps) which are being rendered on
a shiny app (web page). Currently we are facing an issue with the time
it takes R to render a plot taking out the time it takes to do the
computation. Let me show the same through a contrived example. In this
basic test
I'm not sure if there is a single function, but a quick script
would look something like this and would be easily adjusted
attach(mtcars)
mtcars.ls <- loess(mpg~wt*hp)
wtg <- seq(min(wt), max(wt), length.out=50)
hpg <- seq(min(hp), max(hp), length.out=50)
grid <- expand.grid(wt=wtg, hp=hpg)
mpg.fi
I think you will need to do this in a web page running java. So you need a way
to link your R stuff to java, possibly back and forth depending upon exactly
what you end up doing. You've found some pages already. But look also at
shiny and d3.
http://www.rstudio.com/shiny/
http://d3js.org/
A
Dear All,
I use several R libraries (ggplot2, igraph etc...) for producing static
visualizations.
However, I'd like to be able to go beyond this.
Things I may like to be able to achieve (relying on R as much as possible):
1) network visualizations such that when you click on a node, you see its
p
Dear All,
I use several R libraries (ggplot2, igraph etc...) for producing static
visualizations.
However, I'd like to be able to go beyond this.
Things I may like to be able to achieve (relying on R as much as possible):
1) network visualizations such that when you click on a node, you see it
Hi,
May be this helps:
set.seed(49)
dat1 <- as.data.frame(matrix(sample(c(NA,0:2),20,replace=TRUE),ncol=2))
dat2 <- dat1
lst1 <- list(letters[1:3],letters[26:24])
library(plyr)
dat1[] <-lapply(seq_len(ncol(dat1)),function(i) {x1 <-dat1[,i]; x2 <-
lst1[[i]]; mapvalues(x1,c(0,1,2),x2)})
#Or
dat
Hi,
Assuming that this is the case:
dat1 <- read.table(text="a b c d e
1 2 3 4 5
10 9 8 7 6",sep="",header=TRUE)
Names1<- read.table(text="Original New
e ee
g gg
a aa
c cc
f ff",sep="",header=TRUE,stringsAsFactors=FALSE
On 22 Nov 2013, at 07:53 , Rolf Turner wrote:
> On 11/22/13 18:47, William Dunlap wrote:
>>> a <- 2; b <- 3; xyplot(1:10 ~ a*(1:10), sub = c(bquote(a == .(a) ~
>>> b==.(b
>>>
>>> the subtitle contains three copies of the "a = 2 b = 3" phrase.
>>> Why does it do that? How do I tell it to
47 matches
Mail list logo