Another option is
x[rowSums(x<0)==0, ]
but beware of floating point if your numbers can be near zero.
Regards
Petr
r-help-boun...@r-project.org napsal dne 06.01.2010 06:52:48:
> Thank you!
>
> On Jan 6, 2010 12:31am, Peter Ehlers wrote:
> > x[apply(x,1,function(x)all(x>=0)),]
>
>
>
>
try also this:
x <- matrix(c(2,-1,-2,3,5,6,-3,7,4,2,1,0), 4, 3)
x[!rowSums(x < 0), ]
Best,
Dimitris
farida...@gmail.com wrote:
Hello All,
I would like to remove the entire row, if there is any negative element in
that row. What is the best way to do that?
For example,
x<-matrix(c(2,-1,
Dear Michael and all R users,
I find that there's no MacOS X binary of package cairoDevice on CRAN now.
Can you or anybody else give me an older MacOS X edition for cairoDevice.
Thank you.
--
Wenjun
[[alternative HTML version deleted]]
__
R
On Wed, 6 Jan 2010, Utkarsh Singhal wrote:
Hi All,
I ran the following lines in R:
print(object.size(a <- rep(1,10^6)),units="Mb")
print(object.size(a <- rep(3.542,10^6)),units="Mb")
print(object.size(b <- rep("x",10^6)),units="Mb")
print(object.size(b <- rep("xyzxyz xyz",10^6)),units="Mb")
p
Hi,
I'd like to plot resonance contours on my spectrogram in the seewave
package. Is this possible?
--
Rajesh.J
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do r
Thank you!
On Jan 6, 2010 12:31am, Peter Ehlers wrote:
> x[apply(x,1,function(x)all(x>=0)),]
> -Peter Ehlers
> Simon Blomberg wrote:
> x[-which(x
> but I'm sure someone will suggest an easier way.
> Simon.
> On Wed, 2010-01-06 at 05:13 +, farida...@gmail.com wrote:
> Hello A
x[apply(x,1,function(x)all(x>=0)),]
-Peter Ehlers
Simon Blomberg wrote:
x[-which(x < 0, arr.ind=TRUE)[,1],]
but I'm sure someone will suggest an easier way.
Simon.
On Wed, 2010-01-06 at 05:13 +, farida...@gmail.com wrote:
Hello All,
I would like to remove the entire row, if there is
x[-which(x < 0, arr.ind=TRUE)[,1],]
but I'm sure someone will suggest an easier way.
Simon.
On Wed, 2010-01-06 at 05:13 +, farida...@gmail.com wrote:
> Hello All,
>
> I would like to remove the entire row, if there is any negative element in
> that row. What is the best way to do that?
>
Have a look at the 'scales' argument. For example:
# default plot
xyplot(Sepal.Length ~ Petal.Length | Species, data = iris)
# modified plot
xyplot(Sepal.Length ~ Petal.Length | Species, data = iris,
scales=list(y=list(at=c(-5,0,5,10), limits=c(-5,10
-Peter Ehlers
Jay wrote:
Hi,
I'm
Hello All,
I would like to remove the entire row, if there is any negative element in
that row. What is the best way to do that?
For example,
x<-matrix(c(2,-1,-2,3,5,6,-3,7,4,2,1,0), 4, 3)
the returning matrix should look like
[,1] [,2] [,3]
[1,] 2 5 4
[2,] 3 7 0
Thank you in advance,
FM
Jay,
I don't recall the details of your original post so the
following may be entirely off the mark; nevertheless, here
goes:
thetext <- paste('Data', 1:8)
# or: thetext <- paste('Data', c('one', 'two', 'three', ))
xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos,
type = "a",
I am trying to debug a package to submit it to CRAN and am getting a bunch
of error messages. Most of the errors are because of the Rd files which
were automatically populated by the package.skeleton function. I find the
section on documentation to be pretty confusion in the R Extensions manual.
Hi,
I'm terribly sorry but it seems it cannot figure this one out by
myself so, please, if somebody could help I would be very grateful.
So, when I plot with xyplot() I get an y-axis that is very ugly...
starting from a random number and having so many ticks that it becomes
unreadable.
How do I t
On Jan 5, 2010, at 8:53 PM, Xanthe Walker wrote:
I would like to do a chi-squared test on the following matrix:
CP<-
matrix
(c
(26,17,9,27,8,9,9,8,29,9,6,17,81,7,43,36,2,4,3,0,5,1,0,12,29,9,12,19,0,0
),nrow=3)
dimnames(CP) <-
list
(c
("less10
","bt10and50
","more50"),c("T10","T9","T8
try this:
> x <- c("A", "A", "B", "A")
> x.t <- table(x)
> x.t
x
A B
3 1
> x.tw <- paste("W", x.t, sep='')
> names(x.tw) <- names(x.t)
> x.tw
AB
"W3" "W1"
>
On Tue, Jan 5, 2010 at 6:38 PM, wrote:
> Hi,
>
> I have generated a table of counts, and now need to add a prefix to the
> count
You have not said what the problem is, i.e. what you have tried and
what you expect. Please post a small, reproducible example if you want
help.
Regards
-Felix
2010/1/6 Jay :
> Anybody? Frustrating to be unable to solve this silly little
> problem...
>
> On Jan 3, 12:48 pm, Jay wrote:
>> Thanks,
Hi,
On Tue, Jan 5, 2010 at 7:01 PM, Amy Hessen wrote:
>
> Hi,
>
> I understand from help pages that in order to use a data set with svm, I have
> to divide it into two files: one for the dataset without the class label and
> the other file contains the class label as the following code:-
This
Hi John
Thanks for your reply. I think I was posting properly the problem.
Here are the error, R script and console errors below.
Thanks. Noli
~~~
The error:
~~
Error in data.frame(CROP_ID = x[1, 1], CROPTYPE = x[1, 2], name =
colnames(x)[4:5], :
subscript out of bounds
~~~
I
If you are using windows, In windows console.
Rgui.exe filename.R <-The command does not work at all.
You have open Rgui.exe first, retrieve filename.R then run the script.
Noli
On 1/5/10, vtvdung wrote:
>
> Hi everyone,
> I execute a script with
> source(filename)
> The script has
I would like to do a chi-squared test on the following matrix:
CP<-matrix(c(26,17,9,27,8,9,9,8,29,9,6,17,81,7,43,36,2,4,3,0,5,1,0,12,29,9,12,19,0,0),nrow=3)
dimnames(CP) <-
list(c("less10","bt10and50","more50"),c("T10","T9","T8","T7","T6","T5","T4","T3","T2","T1"))
I want to set the expected va
Hi,
Say i have three functions in a new package, a,b and c. I only want the one
function "a" to be exported for use. "b" and "c" are not very stable.
If i specify to export all the three functions in the NAMESPACE file
(export(a,b,c)), no errors appeared after checking the package. And i am
sur
You could have a look at the VGAM (vector glm /gam models) at CRAN.
Kjetil
On Tue, Jan 5, 2010 at 5:59 PM, Corey Sparks wrote:
> Dear R Users,
> I'm working on a problem where I have a multivariate response vector of
> counts and a continuous predictor.
> I've thought about doing this the same
Anybody? Frustrating to be unable to solve this silly little
problem...
On Jan 3, 12:48 pm, Jay wrote:
> Thanks, the backtickes got the code working. However, now I cant get
> it to draw the legend/key.
> For example, look at this
> figure:http://osiris.sunderland.ac.uk/~cs0her/Statistics/xyplot
Hi,
I have generated a table of counts, and now need to add a prefix to
the counts.
#count KO occurrences
KO_occur = table(groupKOIDs) #where groupKOIDs is a vector of characters
e.g.,
if groupKOIDs = c("A", "A", "B", "A")
then
KO_occur would look like this:
A B
3 1
and I need to add a
Hi,
I understand from help pages that in order to use a data set with svm, I have
to divide it into two files: one for the dataset without the class label and
the other file contains the class label as the following code:-
library(e1071)
x<- read.delim("mydataset_except-class-label.txt")
y<
The zoo package's merge.zoo routines has a fill=0 argument so: create
an expanded index, ix, and then in the next line create zoo objects
from the data and the expanded index and merge them together. Finally
in the last line convert back to a data frame.
library(zoo)
ix <- with(frame, seq(min(V1
Tena koe Dan
On approach - create a fullFrame with all your observations and merge
with the frame:
> frame <- as.data.frame(cbind(c(1:2,5:7,10),c(0.5,0.2,1,1.6,2,0)))
> fullFrame <- as.data.frame(min(frame[,1]):max(frame[,1])) # Create
fullFrame
> fullFrame
min(frame[, 1]):max(frame[, 1])
1
Hello
On 1/5/10, Lee William wrote:
> I have got matrix 'data' of dimension 22000x600. I want to make 50
> independent samples of dimension 22000x300 from the original matrix 'data'.
> And then want to calculate pearsons CC for each of the obtained 50 matrices.
> It seems it is possible to do
Hi.. thanks for the tips.. that variation works. How can I control "pch",
"lty" and "col" for each member (gp1) in the group (paste(gp2, gp3))?
Regards,Santosh
On Tue, Jan 5, 2010 at 2:15 AM, Felix Andrews wrote:
> You should reshape the data into a long format, and an easy way to do
> that is t
Hello,
I have a set of data frames, generated by an SQL query that I am working
with. Because of the way the query was written, zero values for the
dependent variable (V2 in the example) are not recorded. Up until now
this has not been a problem.
I would like to be able to fill all absent data wi
So here is some information that I hope gets criticized by the
higher-intelligences that posted on this topic. Beware that I'm not a
statistician and I'm just saying about what I think is correct.
First, before fitting any model, check the distribution of your data, in
some cases a simple anova i
Hi All,
I have got matrix 'data' of dimension 22000x600. I want to make 50
independent samples of dimension 22000x300 from the original matrix 'data'.
And then want to calculate pearsons CC for each of the obtained 50 matrices.
It seems it is possible to do this using 'boot' function from library b
quote:
There are certainly formulas for solving polynomials numerically up to
4th degree non-iteratively, but you will almost certainly get better
results using iterative methods.
endquote
I must be missing something here. Why not use the analytic formulas for
polynomials below 5th degree?
Note this:
> class(rep(1, 3))
[1] "numeric"
> class(1:3)
[1] "integer"
On Tue, Jan 5, 2010 at 3:16 PM, Utkarsh Singhal wrote:
> Hi All,
>
> I ran the following lines in R:
>
> print(object.size(a <- rep(1,10^6)),units="Mb")
> print(object.size(a <- rep(3.542,10^6)),units="Mb")
>
> print(object.
Hi All,
I ran the following lines in R:
print(object.size(a <- rep(1,10^6)),units="Mb")
print(object.size(a <- rep(3.542,10^6)),units="Mb")
print(object.size(b <- rep("x",10^6)),units="Mb")
print(object.size(b <- rep("xyzxyz xyz",10^6)),units="Mb")
print(object.size(b <- 1:10^6),units="Mb")
prin
Dear R Users,
I'm working on a problem where I have a multivariate response vector of
counts and a continuous predictor.
I've thought about doing this the same way you would do a Multvariate
regression model with normally distributed data, but since these data are
counts, they are probably better
Thank you for your kind help. Your R script works well.
Lisa
Dieter Menne wrote:
>
>
>
> Lisa wrote:
>>
>> I have a dataset that looks like this:
>>
>>> data
>> idcode1code2
>> 1 114
>> 2 123
>> 3 24
Hi all,
I have some long-running code that I'm trying to profile. I am seeing a
lot of time spent inside the function. Of course, this can
in fact be any of several functions, but I am unable to see how I could
use the information from Rprof.out to discern which function is taking
the most t
R FAQ 7.16.
R Newbies should read this first (+the FAQ for Windows, if appropriate)
_before_ posting questions to the list.
Bert Gunter
Genentech Nonclinical Biostatistics
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Tom Fle
On Thu, 24-Dec-2009 at 02:14PM +1300, Patrick Connolly wrote:
ly way I found to get round the problem was to make an
|> additional function Summarize in the same place. It involves editing
|> any old scripts/functions before they work, but work they do.
In case anyone was following this thread,
With this email I will be following up on this (some months old) post:
http://tolstoy.newcastle.edu.au/R/e7/help/09/06/0799.html
>From this I would assume that the following is also valid:
set.seed(29)
x <- gl(3, 10)
y <- rnorm(length(x), mean = c(0, 0, 1)[x])
d <- data.frame(y = y, x = x)
# w <
I am using R for my bioinformatics research. I am dealing with a graph in
which I need to find all possible path. I was looking for some package that
solve my purpose
but all in vain. There are available algorithms but most of them find
shortest path that ignore other paths So I decided to write my
Try this:
with(split(DF, with(DF, ave(SCORE, NAME, FUN = length)))[['3']],
tapply(SCORE, NAME[,drop = TRUE], FUN = mean))
Or:
with(DF, tapply(SCORE, NAME, mean))[table(DF$NAME) == 3]
On Tue, Jan 5, 2010 at 4:29 PM, Geoffrey Smith wrote:
> Hello, does anyone know how to take the mean for a sub
Here is the solution using sqldf which can do it in one statement:
> # read in data
> Lines <- "OBS NAME SCORE
+ 1 Tom 92
+ 2 Tom 88
+ 3 Tom 56
+ 4 James85
+ 5 James75
+ 6 James32
+ 7 Dawn 56
+ 8
Is it correct that the weights argument in lm and kruskal_test from
package coin have different meanings?
Example:
library("coin")
set.seed(29)
x <- gl(3, 10)
y <- rnorm(length(x), mean = c(0, 0, 1)[x])
d <- data.frame(y = y, x = x)
w <- rep(2, nrow(d)) ### double each obs
### all the same
krus
On Tue, 5 Jan 2010, Geoffrey Smith wrote:
Hello, does anyone know how to take the mean for a subset of observations?
For example, suppose my data looks like this:
OBS NAME SCORE
1 Tom 92
2 Tom 88
3 Tom 56
4 James85
5 James
On 05/01/2010 1:29 PM, Geoffrey Smith wrote:
Hello, does anyone know how to take the mean for a subset of observations?
For example, suppose my data looks like this:
OBS NAME SCORE
1 Tom 92
2 Tom 88
3 Tom 56
4 James85
5 Jam
Have a look at this post and the rest of that thread:
https://stat.ethz.ch/pipermail/r-help/2010-January/223420.html
On Tue, Jan 5, 2010 at 1:29 PM, Geoffrey Smith wrote:
> Hello, does anyone know how to take the mean for a subset of observations?
> For example, suppose my data looks like this:
Hello, does anyone know how to take the mean for a subset of observations?
For example, suppose my data looks like this:
OBS NAME SCORE
1 Tom 92
2 Tom 88
3 Tom 56
4 James85
5 James75
6 James32
7 Dawn
On Jan 5, 2010, at 12:20 PM, David Winsemius wrote:
On Jan 5, 2010, at 9:38 AM, Stefani Mallia wrote:
Hi,
I'm trying to fit a glm with a negative binomial error distribution
and a log link, using the example found in the paper Stochastic
Claims Reserving In General Insurance by England
On Jan 5, 2010, at 9:38 AM, Stefani Mallia wrote:
Hi,
I'm trying to fit a glm with a negative binomial error distribution
and a log link, using the example found in the paper Stochastic
Claims Reserving In General Insurance by England and Verrall.
I am attaching a pdf since it is more di
Lisa wrote:
>
> I have a dataset that looks like this:
>
>> data
> idcode1code2
> 1 114
> 2 123
> 3 244
> ..
>
> I want to change some numbers in the columns of “code1” and “code2” based
> on “indx”
There are probably numerous ways, but one is to add print() to the
functions that you wish to display in the console.
For example, in your source file,
Instead of
summary(x)
try
print(summary(x))
This should do the trick.
Tom Fletcher
-Original Message-
From: r-help-boun...@r-
Dear members of the R user community,
I am pleased to inform you that the Compstat'2010 conference (19th
conference on Computational statistics) will take place in Paris from
the 22 to the 27th of august.
An R session can be organized during this conference. People have to
submit a full paper
Hi everyone,
I execute a script with
source(filename)
The script has effect but i don't see the output on console screen.Why?
I'm a newbie. Thanks :handshake:
--
View this message in context:
http://n4.nabble.com/The-output-of-script-is-hidden-in-console-tp999095p999095.html
Sent from the R help
standard square root computation requires an iteration. Spencer
Peter Dalgaard wrote:
Mads Jeppe Tarp-Johansen wrote:
To R-helpers,
R offers the polyroot function for solving mentioned equations iteratively.
However, Dr Math and Mathworld (and other places) show in detail how to
solve men
I have the feeling that you can do this with ggplot2 but why?
You are likely to be much better off using a dotchart.
?dotchart
--- On Mon, 1/4/10, Elmer Wix wrote:
> From: Elmer Wix
> Subject: [R] Bar plots with stacked and grouped (juxtaposed) bars together
> To: r-help@r-project.org
> Rece
Mads Jeppe Tarp-Johansen wrote:
> To R-helpers,
>
> R offers the polyroot function for solving mentioned equations iteratively.
>
> However, Dr Math and Mathworld (and other places) show in detail how to
> solve mentioned equations non-iteratively.
>
> Do implementations for R that are non-itera
There are certainly formulas for solving polynomials numerically up to 4th
degree non-iteratively, but you will almost certainly get better results
using iterative methods.
Even the much more trivial formula for the 2nd degree (quadratic) is tricky
to implement correctly and accurately, see:
* Ge
Well, if nothing else, you have missing comma. :)
x01=y[,1]), x01=y[,1], x02=y[,2], x03=y[,3]
--
>
> fn <- function(x) {
> y <- t(x[,2])
> data.frame( Croptype=x[1,1], Period =x[1,2],
> name=colnames(x)[2],
> x01=y[,1])x01=y[,1], x02=y[,2], x03=y[,3] }
> <---Problem
> h
On Jan 5, 2010, at 10:46 AM, Tony Chiang wrote:
You should send this note to the biconductor mailing list rather
than the
R-help. As to your question, please look at the Biostrings
bioconductor
package.
The BioC webpages give a link to the Gmane archive for searching. A
search on blast
You should send this note to the biconductor mailing list rather than the
R-help. As to your question, please look at the Biostrings bioconductor
package.
On Tue, Jan 5, 2010 at 6:09 AM, Alla Bulashevska <
alla.bullashev...@fdm.uni-freiburg.de> wrote:
>
> Dear R users,
> I would like to align two
To R-helpers,
R offers the polyroot function for solving mentioned equations
iteratively.
However, Dr Math and Mathworld (and other places) show in detail how to
solve mentioned equations non-iteratively.
Do implementations for R that are non-iterative and that solve mentioned
equations exis
On Tue, 5 Jan 2010, Viechtbauer Wolfgang (STAT) wrote:
Dear All,
I have a question about formulas and model.matrix(). If one specifies a model
via a formula, the corresponding design matrix can be obtained with the
model.matrix() function. For example:
x1 <- c(1,4,2,3,5)
x2 <- c(1,1,2,2,2)
m
Dear all,
I have a question and need your help.
I have a dataset that looks like this:
> data
idcode1code2
1 114
2 123
3 244
4 315
5 324
6 4
Or if there is a requirement for speed or shorter more convenient syntax
then there is a data.table join.
Basically setkey(data1,V1,V2) and setkey(data2,V1,V2), then "data1[data2]"
does the merge very quickly. You probably then want to do something with the
merged data set, which you just add
Dear R users,
I would like to align two protein sequences using BLAST
(bl2seq). The question is whether this programm have been
implemented in R.
Thank you for your help,
Alla.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r
On 05.01.2010 14:37, FMH wrote:
Dear All,
Let mod2 and mod3 are two regression equations representing two distinct lines
and i'm keen to find the intreception point between these two lines and the
following are part of the codes.
m1<- as.matrix(rbind(coef(mod2), coef(mod3)))
Dear All,
Let mod2 and mod3 are two regression equations representing two distinct lines
and i'm keen to find the intreception point between these two lines
and the following are part of the codes.
m1 <- as.matrix(rbind(coef(mod2), coef(mod3)))
a <- cbind(c(1,1), -m1
Dear All,
I have a question about formulas and model.matrix(). If one specifies a model
via a formula, the corresponding design matrix can be obtained with the
model.matrix() function. For example:
x1 <- c(1,4,2,3,5)
x2 <- c(1,1,2,2,2)
myformula <- ~ x1 + factor(x2)
model.matrix(myformula)
My
Hi,
forests <- read.csv("C:\\Down2\\R_forestmgt\\forest_cut-Age.csv")
m <- forests
fn <- function(x) {
y <- t(x[,2])
data.frame( Croptype=x[1,1], Period =x[1,2], name=colnames(x)[2],
x01=y[,1])x01=y[,1], x02=y[,2], x03=y[,3] } <---Problem
here
m <- do.call( "rbind", lapply(split
I wrote :
> (some may return vectors, others may return vectors)
Its been pointed out there was a typo, and wasn't very clear anyway. It
should read '(some may return vectors, others may return scalars)'. I've
been asked for further explanation so here goes ...
The point I was trying to make is
Martyn Plummer-2 wrote:
>
> I wrote a function called "bugs2jags", which you will find in the coda
> package, for converting WinBUGS data files into the data format used by
> JAGS which is, by no coincidence, the format used by the R function
> dump().
>
First of all excuse me for reviving thi
You should reshape the data into a long format, and an easy way to do
that is to use the 'reshape' package:
library(reshape)
mdat <- melt(dat, measure.vars = c("y1", "y2", "y3"))
I'm still not sure what you want in the plot. Confusingly, your last
example dropped the "ID" you referred to earlier,
library(reshape)
names(harvest.dat) = c("CROP_ID", "CROPTYPE", "PERIOD","CUT_AGE")
harvest <-cast(harvest.dat, CROP_ID + CROPTYPE ~ PERIOD)
It seems that I am getting the frequencies instead of the individual values.
Output
~
CROP_ID CROPTYPE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Haiyang AI wrote:
>
> Dear all,
>
> I'm a beginner of R and I need to carry out some three-way mixed ANOVAs.
> Following examples at http://personality-project.org/r/r.anova.html, I
> managed to get the ANOVA part, but I don't know how can I check data
> normality and homogeneity of variance in
Thanks for your email.. Yes, I am looking for lattice version of matplot...
Attached are some codes for simplicity for rapid testing..Any suggestions
would be highly appreciated...
library(lattice)
dat <- data.frame(x = rep(1:10,2),
y1 = rnorm(20),
y2=rnorm(20,s
On Tue, 5 Jan 2010, Feng Li wrote:
Dear R,
I am looking for R-package related to INARMA (Integer-valued ARMA). Can
anyone give me some information? I did not get information from task view.
That's a very specialized topic, and you have not said what you want
to do with such processes. I sug
This is better by a factor of 4:
len = 10
d = replicate(len, list(pH = 3,marker = TRUE,position = "A"),FALSE)
system.time(
{
pHAll = data.frame(
pH = unlist(lapply(d,"[[",1)),
pH = unlist(lapply(d,"[[",2)),
pH = unlist(lapply(d,"[[",3)))
}
)
Dieter
--
View this messag
Greg Hirson wrote:
>
> I'd approach this by first making a matrix, then converting to a data
> frame with appropriate types.
Well, I knew that matrixes are faster for numerics, but I also knew that the
required conversion to character would be a show-stopper. My second wisdom
was bogus. Your
Dear R,
I am looking for R-package related to INARMA (Integer-valued ARMA). Can
anyone give me some information? I did not get information from task view.
Many thanks.
Feng
--
Feng Li
Department of Statistics
Stockholm University
106 91 Stockholm, Sweden
http://feng.li/
[[alternative
The as.numeric(d.df$pH) should have been an
as.numeric(as.character(d.df$pH)).
Sorry for the confusion.
Greg
On 1/5/10 12:33 AM, Greg Hirson wrote:
> Dieter,
>
> I'd approach this by first making a matrix, then converting to a data
> frame with appropriate types. I'm sure there is a way to do
Dieter,
I'd approach this by first making a matrix, then converting to a data
frame with appropriate types. I'm sure there is a way to do it with
structure in one step. Operations on matrices are usually faster than on
dataframes.
len <- 10
d <- replicate(len, list(pH = 3, marker = TRUE
83 matches
Mail list logo