Hi,
Is it this?
aggregate(iris$Sepal.Length,by=list(iris$Species),FUN=function(x)
sum(x)/sum(iris$Sepal.Length)*100)
Group.1 x
1 setosa 28.55676
2 versicolor 33.86195
3 virginica 37.58129
A.K.
From: Karine Charlebois
To: arun
Sent: Tuesd
Dear R users,
I have a question about matrix manipulation with its rows.
Plz see the simple example below
sample <- list(matrix(1:6, nr=2,nc=3), matrix(7:12, nr=2,nc=3),
matrix(13:18,nr=2,nc=3))
> sample
[[1]]
[,1] [,2] [,3]
[1,]135
[2,]246
[[2]]
[,1] [,2] [,
Dear I am using the 'as.dendrogram' function from the 'stats' library to
convert from an hclust object to a dendrogram with a dataset of size
~3 (an example code is below). I need the dendrogram structure to
use the "dendrapply" and "attributes" functions and to access the child
nodes, I
Le mercredi 16 janvier 2013 à 07:29 +0200, Ibrahim Sobh a écrit :
> Dear I am using the 'as.dendrogram' function from the 'stats' library
> to convert from an hclust object to a dendrogram with a dataset of
> size
> ~3 (an example code is below). I need the dendrogram structure to
> use the
Le mardi 15 janvier 2013 à 22:49 +, Esformes, Carley M. a écrit :
> I am getting the error message:
>
>
> > library(Rcmdr)
>
> Loading required package: car
>
> Loading required package: MASS
>
> Loading required package: nnet
>
> Error : .onAttach failed in attachNamespace() for 'Rcmdr',
Hi,
Consider:
x=c(2,4,5,10,13,73)
names(x)=c("American\nIndian",
"No\ncategory\nlisted",
"Hispanic",
"African-\nAmerican",
"Asian",
"White")
barplot(x,main="Undergraduate Enrollment by Race",
xlab="Race",
ylab="Percent",
Readers,
Am trying to use the function 'approx' to interpolate time series data sets:
data1:
01:23:40 5
01:23:45 10
01:23:50 12
01:23:55 7
data2:
01:23:42
01:23:47
01:23:51
01:23:54
The objective is to obtain interpolated values of 'data1' column 2 (5,
10, 12, 7) for the times shown in data2. T
On 01/16/2013 07:48 PM, David Arnold wrote:
Hi,
Consider:
x=c(2,4,5,10,13,73)
names(x)=c("American\nIndian",
"No\ncategory\nlisted",
"Hispanic",
"African-\nAmerican",
"Asian",
"White")
barplot(x,main="Undergraduate Enrollment by Race",
Hi
with your specific example you can use
remat<-function(mat) {
mt<-t(mat)
mt<-c(mt[1:3], rep(0,6), mt[4:6])
matrix(mt, 2,6, byrow=TRUE)
}
lapply(sample, remat)
Regards
Petr
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf O
Not a great solution, I don't think, but:
> kronecker(diag(2), matrix(1:6, 2, byrow=TRUE))[c(1,4),]
[,1] [,2] [,3] [,4] [,5] [,6]
[1,]123000
[2,]000456
So using a function that does this in 'lapply'
should solve the problem you state. I'm gue
Dear All,
I am struggling to jitter the labels in this plot:
p<-ggplot(centbev,aes(x=bet,y=eig,label=rownames(centbev),colour=res,
size=abs(res)))+xlab("Betweenness Centrality")+ylab("Eigenvector
Centrality")
p+geom_text()+labs(title="Key Actor Analysis AD FD Network")
When I try this without ji
Hello,
Like this?
data1 <- read.table(text = "
01:23:40 5
01:23:45 10
01:23:50 12
01:23:55 7
")
data2 <- read.table(text = "
01:23:42
01:23:47
01:23:51
01:23:54
")
approx(as.POSIXct(data1$V1, format = "%H:%M:%S"), y = data1$V2, xout =
as.POSIXct(data2$V1, format = "%H:%M:%S"))
Hope this h
thanks, it goes a lot faster. Just one thing though, when I apply the code to
my data, both data.frames end up "differente. Or at least identical(df1, df2)
if false
however when i do which(df1!=df2) it says 'integer (0)'.
Could that be due to the class of the vectors or some thing of the sort?
Hi
I would like to read table data from a text-files with extra
informations in the header (of unknown line count). Example:
informations (unknown count of lines)
... and at some point the table
--
year month mday value
2013 1 16 0
...
If it was an excel fi
You could use a variant of apply(), probably sapply
For example
d <- as.data.frame( matrix(sample(0:1, 200, replace=TRUE), ncol=5))
head(d)
sapply(d, table)
S Ellison
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Pancho M
You really don't want to use internals like isBaseVar as there is no
guarantee they will continue to exist. Even collectUsage and otehr
things mentioned on the same page may need to change if this is
reimplemented.
The most robust approach is to use findGlobals and omit what you don't
want, e.g.
Hello All,
I have a data frame (dput information below) with food item weight for fish
species.
I need to calculate the Mean proportion by weight of each food item for
each specie, as show in solution data frame (dput information below).
I use the ddply function (plyr package) in two steps. Firs
Dear list,
I'm working with a large data set, where I grouped several species in one
group (guild). Then I reshaped my data as shown below. Now, I just want to
have "Rep" only as 1 or 0.
I'm not being able to change the values of rep>=1 to 1... tried many things
and I'm not being successful!
>
Hello,
Read the file using readLines, then grep "^year". You can then use a
textConnection to read.table:
x <- readLines(con = textConnection(
"informations (unknown count of lines)
... and at some point the table
--
year month mday value
2013 1 16 0 "))
# This is it
i <- grep("^year", x)
Hello,
If you want to calculate the mean weight by Specie and Food.item, you
can use ?aggregate.
In what follows, I've named your EXAMPLE ex and your SOLUTION sol. Note
that the result is different from sol.
(No exemplo não há Peixe, é Fish, e os números são outros.)
aggregate(Weight ~ Specie +
Sorry, but i don't get the problem at all.
Could you provide a bit of y by using dput()?
Can you provide an example of how you want the data to look like after the
transformation?
On 16.01.2013, at 16:42, Andrea Goijman wrote:
> Dear list,
>
> I'm working with a large data set, where I groupe
Dear Andrea
I may have not understood the question properly, but I guess it has to do with
replacing values before and after casting.
The molten object ('melting') is a data frame, whilst the cast object ('y') is
an array.
Crucially, the values of the variable "Rep" in the 'melting' data f
Sure! Although I'm not sure how to use dput()
Here is more detail and some data what I want is that the repetitions
in Y (at the end) only have 1 or 0...
> library(reshape)
> library(car)
>
> ###Read in the occurence data
> occ.data <- read.table("Occ_short.csv",
header=TRUE,sep=",",na.string
I want to download and unzip many files from the FTP and create variables for
year, month, and day for each file based on the naming mechanism. I am stack
with the following lines and any help will be appreciated.
library(RCurl)
# Download the files for 1985.
url = "ftp://ftp.cpc.ncep.noaa.gov
Hi,
In my first solution, you would get FALSE for identical(res,tutu) if you don't
convert `res` columns to numeric.
Both res1, and tutu were matrix.
You can check the column class by:
apply(res1,2,class)
Also try:
all.equal(res1,tutu)
#[1] TRUE
A.K.
Hello!
I have got a dataframe with 10 columns and 100 rows. The seventh column
consists of a lot of country names.
When I use newdata=subset(data, data[, 7]=="United Kingdom"|data[,
7]=="Germany") I get just the rows where the country name is UK or
Germany.
But the level information doesn`t cha
HI,
You could also do this:
lapply(sample1,function(x) {mat1<-cbind(matrix(0,nrow=2,ncol=3),x);
mat1[cbind(rep(1,3),1:3)]<- mat1[cbind(rep(1,3),4:6)];
mat1[cbind(rep(1,3),4:6)]<-0; mat1})
A.K.
- Original Message -
From: Kathryn Lord
To: r-help@r-project.org
Cc:
Sent: Wednesday, Janu
Hi
I tried removing the missing values and installing "plyr". Still error
message appears with ggplot2
Btw, did you get the attachments with my earlier mail?
Ta.
On Wed, Jan 16, 2013 at 3:16 AM, arun kirshna [via R] <
ml-node+s789695n4655612...@n4.nabble.com> wrote:
>
>
> Hi,
> Check these lin
Hi,
I'd like to compare SST data for year 2000 with SST for year 2001. I managed
to get filled contour plots showing monthly SST for both years (12 plots for
each year, 24 plots in total). In order to compare year 2000 and year 2001,
however, I'd need to have the same legend scale (same color bar)
Hi R-Core,
i am using nnet and DEoptim,
Xcc=matrix(rnorm(100,0.5,0.08),50,2)
Ycr=matrix(rnorm(50,0.2,0.05),50,1)
pred_regm1 <- function(A) {
A1=A[1]
A2=A[2]
A3=A[3]
regm1 <-
nnet(Xcc,Ycr,entropy=T,size=A1,decay=A2,maxit=2000,trace=F,Hess=T,rang=A3,skip=T)
dif=sum((predict(regm1,Xcc)-Y
Respected Sir,
With reference to my mail to you dated 8th
January,2013, and the reply by you dated 9th January, 2013, I am sending
this mail to you. I had a problem regarding running a program in the latest
version of the "BRugs" package in R 2.15.1 and 2.15.2. I want to mention
Hello all,
I have a time format looks like
31JAN2002:00:00:00.000
How could I cut it to
31JAN2002
?
I tried with format() but not work.
Thanks,
Rebecca
--
This message, and any attachments, is for the intended r...{{droppe
Hello:
I'd like to know if R will run under Windows 8?
Thank you,
CJO
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.
On 13-01-16 11:06 AM, Claire Oswald wrote:
Hello:
I'd like to know if R will run under Windows 8?
As far as I know, it has not been tested there.
Duncan Murdoch
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEAS
Hi,
see ?droplevels and/or the "stringsAsFactors" section of ?options
Best,
Ista
On Wed, Jan 16, 2013 at 4:56 AM, paladini wrote:
> Hello!
> I have got a dataframe with 10 columns and 100 rows. The seventh column
> consists of a lot of country names.
> When I use newdata=subset(data, data[, 7]=
On Wed, Jan 16, 2013 at 11:06 AM, Claire Oswald
wrote:
> Hello:
>
> I'd like to know if R will run under Windows 8?
>
I am running R on Windows 8 with no apparent problems.
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
Nice, worked very well. But because of the realignment, I now need to lower
by xlab a bit. Any suggestions?
David.
--
View this message in context:
http://r.789695.n4.nabble.com/Aligning-labels-to-bars-in-barplot-tp4655701p4655749.html
Sent from the R help mailing list archive at Nabble.com.
Lines1 <- readLines(con = textConnection(
"informations (unknown count of lines)
... and at some point the table
--
year month mday value
2013 1 16 0 "))
indx<-seq(match(regmatches(Lines1,regexpr("^year.*",Lines1)),Lines1),length(Lines1))
read.table(text=Lines1[indx],sep="",header=TRUE)
# y
Hi,
May be this helps you.
source("Andreadata.txt")
head(occ.data)
melting<- melt(occ.data,id.var=c("Point", "Site", "Rep",
"Año"),measure.var="Pres")
y<-cast(melting,Site~Rep~Point~Año)
dim(y)
#[1] 10 5 25 6
y[,,25,6]
# Rep
#Site 1 2 3 4 5
# 1021 0 0 0 0 0
# 1022 0 0 0 0 0
# 10
Thanks!! that should work!!
On Wed, Jan 16, 2013 at 1:03 PM, arun wrote:
> HI,
>
> Saw ur post in Nabble.
> occ.data<-read.table(text="
> Año Punto Especie Pres Ruta_com Point Site Rep guild
> 1 201230TYSA1 10830 1086 5 OTHER
> 2 201226VACH1 10826 1
HI,
Saw ur post in Nabble.
occ.data<-read.table(text="
Año Punto Especie Pres Ruta_com Point Site Rep guild
1 2012 30 TYSA 1 108 30 1086 5 OTHER
2 2012 26 VACH 1 108 26 1086 1 OTHER
3 2012 27 VACH 1 108 27 1086 2 OTHER
4 2012 26 ZE
> I have a time format looks like
> 31JAN2002:00:00:00.000
> How could I cut it to
> 31JAN2002
You have several options depending on what form the data are in.
Assuming it is character data, you could use substr:
substr("31JAN2002:00:00:00.000", 1, 9)
or gsub:
gsub("(.{9}).+", "\\1", "31JAN
On 16/01/2013 16:06, Claire Oswald wrote:
Hello:
I'd like to know if R will run under Windows 8?
We have students running it under Windows 8, 32- and 64-bit OS.
--
Brian D. Ripley, rip...@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
Uni
On Mon, 07-Jan-2013 at 10:21PM +1100, Roland Seubert wrote:
|> Hello all,
|>
|> I would like to make a parallel coordinate plot with lattice. The
|> plot should have vertical log scale axes, and should in principle
|> look like this one (I put less chemical elements in my example
|> below):
|>
|
I'm using R 64 in Win8 64 without problems. Only the StatET plugin for
eclipse is not working.
2013/1/16 Prof Brian Ripley
> On 16/01/2013 16:06, Claire Oswald wrote:
>
>> Hello:
>>
>> I'd like to know if R will run under Windows 8?
>>
>
> We have students running it under Windows 8, 32- and 64
Hello Ellison,
Thanks very much!
I use the substr() and it works!
Have a great day!
Cheers,
Rebecca
-Original Message-
From: S Ellison [mailto:s.elli...@lgcgroup.com]
Sent: Wednesday, January 16, 2013 1:35 PM
To: Yuan, Rebecca; R help
Subject: RE: How to cut the time format short
On 16.01.2013 12:13, moumita chatterjee wrote:
Respected Sir,
With reference to my mail to you dated 8th
January,2013, and the reply by you dated 9th January, 2013, I am sending
this mail to you. I had a problem regarding running a program in the latest
version of the "BRug
On 15.01.2013 22:24, Beto . wrote:
Hello,
Does anyone knows if there is a Documentation or any wiki that
could help me to configure and build R
using cygwin with the Intel Compilers on Windows?
No, cygwin is an unsupported platform.
Best,
Uwe Ligges
Thanks,
Humberto.
On 16.01.2013 17:13, David Zamora Ávila wrote:
Hi R-Core,
i am using nnet and DEoptim,
Xcc=matrix(rnorm(100,0.5,0.08),50,2)
Ycr=matrix(rnorm(50,0.2,0.05),50,1)
pred_regm1 <- function(A) {
A1=A[1]
A2=A[2]
A3=A[3]
regm1 <-
nnet(Xcc,Ycr,entropy=T,size=A1,decay=A2,maxit=2000,trace=F
On 16.01.2013 12:00, Sarah Magozzi wrote:
Hi,
I'd like to compare SST data for year 2000 with SST for year 2001. I managed
to get filled contour plots showing monthly SST for both years (12 plots for
each year, 24 plots in total). In order to compare year 2000 and year 2001,
however, I'd need
On Jan 16, 2013, at 20:24 , Uwe Ligges wrote:
>
>
> On 15.01.2013 22:24, Beto . wrote:
>> Hello,
>>
>> Does anyone knows if there is a Documentation or any wiki that
>> could help me to configure and build R
>> using cygwin with the Intel Compilers on Windows?
>
>
> No, cygwin is an unsuppo
On Wed, Jan 16, 2013 at 12:05 PM, Patrick Connolly <
p_conno...@slingshot.co.nz> wrote:
> On Mon, 07-Jan-2013 at 10:21PM +1100, Roland Seubert wrote:
>
> |> Hello all,
> |>
> |> I would like to make a parallel coordinate plot with lattice. The
> |> plot should have vertical log scale axes, and sho
On 16.01.2013 20:44, peter dalgaard wrote:
On Jan 16, 2013, at 20:24 , Uwe Ligges wrote:
On 15.01.2013 22:24, Beto . wrote:
Hello,
Does anyone knows if there is a Documentation or any wiki that
could help me to configure and build R
using cygwin with the Intel Compilers on Windows?
On Wed, Jan 16, 2013 at 12:46 PM, ilai wrote:
Oops... That's
require(latticeExtra)
> c(parallelplot(~ df_n, horizontal.axis = FALSE, scales=list(x = list(log =
> TRUE))) ,
> parallelplot(~ df_n, horizontal.axis = FALSE))
>
or you'll get the full printout of the two objects.
Sorry
> HTH
>>
Hi,
I have both R and R64 installed on Mac OSX 10.8 Mountain Lion (64-bit).
When I run the command
sessionInfo()
from within Rscript, I get:
R version 2.15.2 (2012-10-26)
Platform: i386-apple-darwin9.8.0/i386 (32-bit)
Is there a way to make Rscript point at the R64 rather than R (32-bit)?
Th
We have the same problem. And we reported as bug:
https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15166
Hope someone can help
Orvalho
On Wed, Jan 16, 2013 at 8:05 PM, voldermatt wrote:
> Thanks in advance.
>
> I pass data sets between R and Stata and think dta files would be the best
> fi
On 16/01/2013 20:16, Matthew Pettis wrote:
Hi,
I have both R and R64 installed on Mac OSX 10.8 Mountain Lion (64-bit).
When I run the command
sessionInfo()
from within Rscript, I get:
R version 2.15.2 (2012-10-26)
Platform: i386-apple-darwin9.8.0/i386 (32-bit)
Is there a way to make Rscrip
thanks much.
Saptarshi
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
I need to automate changing the reference value for factors in analysis, and
it is my understanding that the following two sets of code should produce
identical results, but they do not:
1)dataset$method
2)eval(parse(text=paste("dataset",IVcat[k],sep="$")))(in this case I
have IVcat[k]=meth
>> eval(parse(text=paste("dataset",IVcat[k],sep="$")))<-relevel(eval(parse(text=paste("dataset",IVcat[k],sep="$"))),ref="online")
>This code returns the following error:
>Error in eval(parse(text = paste("dataset", IVcat[k], sep = "$"))) <-
>relevel(eval(parse(text = paste("dataset", :
> target
I want to download and unzip many files from the FTP and create variables for
year, month, and day for each file based on the naming mechanism. I am stack
with the following lines and any help will be highly appreciated. I want to
create a spreadsheet file with lat lon and estimate as headers.
Hello,
You have an extra "argument" to getURL that is _not_ an argument:
ftp://ftp.use.epsv/
To get the list of files just do
url <- "ftp://ftp.cpc.ncep.noaa.gov/fews/AFR_CLIM/ARC2/DATA/1985/";
filenames <- getURL(url, dirlistonly = TRUE)
fn <- unlist(strsplit(filenames, "\r\n"))
# To download
Paul Murell's article "What's in a Name" in The R Journal Vol 4/2
gives an interesting example of editing a stacked barplot of the barley
data. Using the method described in that article, it's easy to do
something along the lines of
grid.edit("plot_01.border.strip.1",
grep=TRUE, global=
Hi, I am new to bioconductor, trying to install KEGGSOAP package, but got
warnings() when installing and error message when trying to load the package,
can anyone suggest what went wrong?
many thanks
John
> source("http://bioconductor.org/biocLite.R";)
Bioconductor version 2.11 (BiocInstalle
What went wrong? You cross-posted. Don't ask about bioconductor packages on
R-help.
---
Jeff NewmillerThe . . Go Live...
DCN:Basics: ##.#. ##.#. Live Go...
Hi Kathryn,
take a look at the kronecker function.
Cheers
Andrew
On Thu, Jan 17, 2013 at 1:11 PM, Kathryn Lord wrote:
> Dear R users,
>
> I'd like to create a block diagonal matrix with each rows in a matrix.
>
> Here is a simple example. (In fact, the matrix is big)
>
>
> x <- matrix(1:20, 4
Dear All,
I wrote a function datagen to simulate a dataset. I would like to generate
1000 datasets and export them with file names from data0001.dat to
data1000.dat. Would anybody please provide some useful codes on this? Thank
you very much.
Best Regards,
Ray
[[alternative HTML version
Hi,
May be this helps:
library(Matrix)
res1<-lapply(split(x,1:nrow(x)),function(y)
sparseMatrix(i=rep(1:4,each=5),j=1:(4*5),x=y))
do.call(rbind,lapply(seq_along(res1),function(i) res1[[i]][i,]))
# [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14]
#[1,] 1 5 9
HI,
In the same link at the bottom of the page,
"
All is well now after updating all packages with the following:
update.packages()"
It may or may not solve your problem.
I got your attachments. You should post those questions in
(r-sig-mixed-mod...@r-project.org). I suggest you to read lme
Hi everyone,
I am trying to graph a step function in R Studio. I just learned about R
today and decided to try it! The following is what I want it to look like.
I graphed it using
x <- 0:5
y <- c(0, .2, .3, .6, .9, 1.0)
plot(x, y, type = "s")
And used Microsoft Paint to get it to how I wante
Hello Rui!
Thanks a lot for your help!
Sorry for make mistake with the factor's name, was inattention during data
preparation for the asking mail.
Unfortunately, it not simple mean calculation, because same individual
could have more than one row, if it eat more than a food item. In example
data
Dear
I have changed some code in R file inside the stats package (dendrogram.R). Now
I wan to test and run the stats package with the new updated code, what should
I do in detail?
RegardsIbrahim Sobh
[[alternative HTML version deleted]]
__
On 17 January 2013 07:03, Ibrahim Sobh wrote:
>
> Dear
> I have changed some code in R file inside the stats package (dendrogram.R).
> Now I wan to test and run the stats package with the new updated code, what
> should I do in detail?
For testing the simplest thing you can do is to ?source th
On 01/16/2013 05:58 PM, array chip wrote:
Hi, I am new to bioconductor, trying to install KEGGSOAP package, but got
warnings() when installing and error message when trying to load the package,
can anyone suggest what went wrong?
many thanks
John
source("http://bioconductor.org/biocLite.R
Base Graphics:
plot(x,y,type="n")
segments(x[-length(x)],y[-length(x)],x[-1],y[-length(x)])
points(x[-length(x)],y[-length(x)],pch=16)
points(x[-1],y[-length(x)],pch=1)
Ggplot graphics:
library(ggplot2)
dta <- data.frame( x= x[-length(x)],y=y[-length(x)], xend=x[-1],
yend=y[-length(x)] )
ggplot
Sorry, this is not the place for a detailed answer to this question.
For testing you can load modified R functions into an R session by loading the
original package using the library function and then pasting the new function
definition at the command line. When R goes looking for that function
Hi
or you can just call factor function after subsetting
newdata[,7] <- factor (newdata[,7])
Regards
Petr
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Ista Zahn
> Sent: Wednesday, January 16, 2013 6:36 PM
> To: paladini
Sorry, missed a parenthesis:
ggplot( dta, aes( x=x, y=y, xend=xend, yend=yend )) +
geom_segment()+
geom_point( shape=16, size=4 ) +
geom_point( aes( x=xend, y=yend ), shape=1, size=4 )
If you have questions about base graphics or lattice, this forum is good. If
you have questions about ggplot2,
Thanks,
I hereby declare this thread as resolved.
-Original Message-
From: S Ellison [mailto:s.elli...@lgcgroup.com]
Sent: Wednesday, January 16, 2013 4:27 PM
To: Pancho Mulongeni; R help
Subject: RE: Using table to get frequencies of several factors at once
You could use a variant of a
79 matches
Mail list logo