Hi,
There is a mistake in the first line. It should be:
> for(i in 1:(length(test1)-1))
Regards,
Pascal
Le 11/12/2012 16:01, surekha nagabhushan a écrit :
Hi all.
This is my first message at R-help...so I'm hoping I have some beginner's
luck and get some good help for my problem!
FYI I have
Hi all.
This is my first message at R-help...so I'm hoping I have some beginner's
luck and get some good help for my problem!
FYI I have just started using R recently so my knowledge of R is pretty
preliminary.
Okay here is what I need help with - I need to know how to use agrep in a
for loop.
Dear List,
Just wondering, is there a Bayesian version of weighted regression
available in the literature (to handle survey weights, say)? If yes,
could you suggest me a reference? Does MCMCregress handle weights?
cheers,
Ehsan
__
R-help@r-project.org
On Tue, Dec 11, 2012 at 7:49 PM, Jeff Newmiller wrote:
> What about putting your objects in a list, which does not have the search
> through parents semantics?
> ---
>
>
>>
>> You may find it more reliable to define an enviro
What about putting your objects in a list, which does not have the search
through parents semantics?
---
Jeff NewmillerThe . . Go Live...
DCN:Basics: ##.#. ##.#. Live G
>
> You may find it more reliable to define an environment in which you
> will be storing your data (perhaps globalenv(), perhaps something created
> by new.env()) and then testing for existence of a dataset by a given name
> in that environment.
>
>
I did that.
PAIR.ENV <- new.env()
get("US
I'd like to write unicode strings using the "\u" escape syntax. According to
the documentation, print.default or encodeString will escape unicode using the
\u convention. In practice, I can't make it work.
> b="Unicode character: \ufffd"
> print.default(b)
[1] "Unicode character: �"
> encodeSt
Hi
Try this (Deepayan gave me this in reply to a similar question
several years ago)
bwplot(voice.part ~ height, data=singer, xlab="Height (inches)",pch = "|",
panel = function(x, y, ...) {
panel.bwplot(x, y, ...)
meds <- tapply(x, y, median)
Why not use an indicator variable?
P1 <- ... # prediction from model 1 (Setosa) for entire dataset
P2 <- ... # prediction from model 2 for entire dataset
I <- Species=="setosa" #
Predictions <- P1 * I + P2 * ( 1 - I )
On Monday, December 10, 2012, Brian Feeny wrote:
>
> I have a dataset and I
On 11 Dec 2012, at 03:05, "Ranjan Maitra"
mailto:maitra.mbox.igno...@inbox.com>> wrote:
How does one change the dot for the median in a boxplot drawn using lattice?
Check your ?panel.bwplot help page. The online version at
http://stat.ethz.ch/R-manual/R-devel/library/lattice/html/panel.bwplot.ht
I will look into that, thanks. I am afraid I don't quite understand what is
going on there with the multiplication, so I will need to read up. What I
ended up doing was like so:
For train data, its easy, as I can subset to have the model only work off the
data I want:
rbfSVM_setosa <-
Hi,
How does one change the dot for the median in a boxplot drawn using
lattice? I have been looking at
> names(trellis.par.get())
[1] "grid.pars" "fontsize" "background"
[4] "panel.background" "clip" "add.line"
[7] "add.text" "plot.polyg
Dear All,
I know this may be a trivial question.
In the past I have used glm to make logistic regressions on data. The output
creates an object with the results of the logistic regression. This object can
then be used to make predictions.
Great.
I have a different problem. I need to make pre
> Exactly. I got around this by assigning NULL to the variable names that I
> would have deleted. Then instead of testing for existence I tested for
> NULL.
You may find it more reliable to define an environment in which you
will be storing your data (perhaps globalenv(), perhaps something creat
On Tue, Dec 11, 2012 at 2:27 PM, Duncan Murdoch wrote:
> On 12-12-10 7:33 PM, Worik R wrote:
>
>> Let me restate my question.
>>
>> Is there a straightforward way of ensuring I can use the variable name
>> USDCHF?
>>
>
> You can use any legal variable name. The only risk is that you will
> overwr
On Dec 10, 2012, at 4:55 PM, Hans Thompson wrote:
Hello.
I have a two statement logical that if NA is returned for the second
statement I want to rely on result of the first statement. I still
would
like to use both when I can though.
x <- c(1:5)
y <- c(1,2,NA,4,5)
x < 5 & x-y == 0
How c
On 12-12-10 7:55 PM, Hans Thompson wrote:
Hello.
I have a two statement logical that if NA is returned for the second
statement I want to rely on result of the first statement. I still would
like to use both when I can though.
x <- c(1:5)
y <- c(1,2,NA,4,5)
x < 5 & x-y == 0
How can I trick R
On 12-12-10 7:33 PM, Worik R wrote:
Let me restate my question.
Is there a straightforward way of ensuring I can use the variable name
USDCHF?
You can use any legal variable name. The only risk is that you will
overwrite some other variable that you created. You can't overwrite
variables f
Dear all,
I have imported a dataset from Stata using the foreign package. The original
data contain French characters such as è and ç .
After importing, string variables containing names of French departments have
changed. E.g. Ardèche became Ard\x8fche. I would like to ask how I could plot
the
HI Jonathan,
Thanks for the email.
I crosschecked my output with the output generated from the initial solution
("ind").
perhaps <- function(A,B){
nA <- nrow(A)
nB <- nrow(B)
C <-
kronecker(matrix(1,nrow=nA,ncol=1),B) >=
kronecker(A,matrix(1,nrow=nB,ncol=1))
matrix(rowSums(C) == ncol(A), nA, n
Hello.
I have a two statement logical that if NA is returned for the second
statement I want to rely on result of the first statement. I still would
like to use both when I can though.
x <- c(1:5)
y <- c(1,2,NA,4,5)
x < 5 & x-y == 0
How can I trick R to refer back to (x < 5) where it is NA on t
Let me restate my question.
Is there a straightforward way of ensuring I can use the variable name
USDCHF? Is there a straight forward way of ensuring that when I delete a
variable by name I delete all copies in scope?
Worik
On Tue, Dec 11, 2012 at 11:08 AM, Duncan Murdoch
wrote:
> On 12-12-1
Package plyr is designed for this sort of thing, but functions split() and
unsplit() will work as well. This example just uses a simple lm() model:
> data(iris)
> iris <- iris[(iris$Species=="setosa" | iris$Species=="versicolor"),]
> set.seed(42)
> irisindex <- sample(1:nrow(iris), nrow(iris))
> i
I have a dataset and I wish to use two different models to predict. Both
models are SVM. The reason for two different models is based
on the sex of the observation. I wish to be able to make predictions and have
the results be in the same order as my original dataset. To
illustrate I will us
If you have a large number of small groups the tapply(x, factor, sum) can
be sped up by replacing it with Rigroup::igroupSums(x, as.integer(factor)), as
in:
> library(Rigroup)
> x <- 1:1e6
> fgroup <- factor(c(seq_len(length(x)/2), sample(length(x)/2,
size=length(x)/2, replace=TRUE)))
>
On 12-12-10 4:40 PM, Worik R wrote:
When I import the library timeSeries I get (at least) the variable USDCHF
imported too.
I would like to delete it, but I cannot. As you can see below.
You didn't import timeSeries, you attached it. It is on your search
list; you can see the full list usin
On Dec 10, 2012, at 1:03 PM, john-usace wrote:
Hi,
This question should be simple to answer. I am a new R user.
I have a data.frame called appended. I would like to break it into 7
smaller
datasets based on the value of a categorical variable dp (which has
values
1:7). I would like to nam
You can do this with basic R functions:
## create vectors of the longitude and latitude values
x <- seq(from = 24, to = 34, by = 0.025)
y <- seq(from = -24, to = -14, by = 0.025)
## create a grid of all pairs of coordinates (as a data.frame)
xy <- expand.grid(x = x, y = y)
## load the "foreign"
Hello,
Try the following.
set <- list()
for (i in 1:7) {
set[[i]] <- appended[which(appended$dp == i & appended$sampled == 0), ]
fl <- paste0("output/set", i, ".csv")
write.table(set[[i]], file = fl, sep = ",", row.name=F)
}
Hope this helps,
Rui Barradas
Em 10-12-2012 21:03, joh
When I import the library timeSeries I get (at least) the variable USDCHF
imported too.
I would like to delete it, but I cannot. As you can see below.
Clearly I am doing something wrong. What is it?
> library(timeSeries)
Loading required package: timeDate
> class(USDCHF)
[1] "timeSeries"
attr(
On Dec 10, 2012, at 3:29 PM, Marc Schwartz wrote:
>
> On Dec 10, 2012, at 2:52 PM, David Winsemius wrote:
>
>>
>> On Dec 10, 2012, at 11:29 AM, Sam Steingold wrote:
>>
>>> How do I sum portions of a vector into another vector?
>>> E.g., for
>>> --8<---cut here---star
On Dec 10, 2012, at 2:52 PM, David Winsemius wrote:
>
> On Dec 10, 2012, at 11:29 AM, Sam Steingold wrote:
>
>> How do I sum portions of a vector into another vector?
>> E.g., for
>> --8<---cut here---start->8---
>>> vec <- 1:10
>>> breaks <- c(3,8,10)
>> --
Hi,
It's not very clear.
Here, the dimensions are different.
dim(RawData)
#[1] 1 101
dim(ResultMat)
#[1] 1 149
ResultMat[,1]<-sum(RawData[RawData<=RawData[8]])
ResultMat[,2:94]<-RawData[RawData>=RawData[9]]
A.K.
- Original Message -
From: Christofer Bogaso
To: r-help@r-project
Hi,
May be this also helps:
do.call(rbind,lapply(split(vec,findInterval(vec,c(4,9))),function(x)
paste0(sum(x),"=",paste(x,collapse="+"
[,1]
#0 "6=1+2+3"
#1 "30=4+5+6+7+8"
#2 "19=9+10"
a.K.
- Original Message -
From: Sam Steingold
To: r-help@r-project.org
Cc:
Hi,
This question should be simple to answer. I am a new R user.
I have a data.frame called appended. I would like to break it into 7 smaller
datasets based on the value of a categorical variable dp (which has values
1:7). I would like to name the smaller datasets set1, set2, set3,,set7.
I d
On Dec 10, 2012, at 1:29 PM, Sam Steingold wrote:
> How do I sum portions of a vector into another vector?
> E.g., for
> --8<---cut here---start->8---
>> vec <- 1:10
>> breaks <- c(3,8,10)
> --8<---cut here---end--->8---
> I
On Dec 10, 2012, at 11:29 AM, Sam Steingold wrote:
How do I sum portions of a vector into another vector?
E.g., for
--8<---cut here---start->8---
vec <- 1:10
breaks <- c(3,8,10)
--8<---cut here---end--->8---
I want to get
Dear all,
Let say I have following data:
RawData <- matrix(1:101, nr = 1); colnames(RawData) <- c("ASD",
as.character(as.yearmon(seq(as.Date("2012-03-01"), length.out = 100, by
= "1 month"; rownames(RawData) <- "XYZ"
CutOffDate <- as.Date("2012-09-01")
NewDateSeries <- as.character(as.y
Dear friends,
does anyone know how I can bootstrap a multinomial regression (say using
mlogit or multinom from the nnet package) in a way similar to the one
implemented bybootStepAIC?
Thanks
Dr. Iasonas Lamprianou
Department of Social and Political Sciences
University of Cyprus
[[al
How about?
> vec <- 1:10
> breaks <- c(3,8,10)
> g <- cut(vec, c(0, breaks))
> sums <- aggregate(vec, list(g), sum)$x
> nums <- tapply(vec, g, paste0, collapse="+")
> results <- paste0(sums, " = ", nums)
> results
[1] "6 = 1+2+3" "30 = 4+5+6+7+8" "19 = 9+10"
---
On Dec 10, 2012, at 11:29 AM, Sam Steingold wrote:
How do I sum portions of a vector into another vector?
E.g., for
--8<---cut here---start->8---
vec <- 1:10
breaks <- c(3,8,10)
--8<---cut here---end--->8---
I want to get
HI,
It is working for me.
gamma(1:15)
[1] 1 1 2 6 24 120
[7] 720 5040 40320 362880 3628800 39916800
[13] 479001600 6227020800 87178291200
z<-.Last.value
z
# [1] 1 1 2
Hi,
Not sure if this helps you:
res<-do.call(rbind,lapply(split(d,d$treatment),function(x)
{x$diff1<-x[,4]-(d[,4][d$treatment=="C"]);
x$diff2<-x[,5]-(d[,5][d$treatment=="C"]); return(x)}))
A.K.
- Original Message -
From: "Thaler,Thorn,LAUSANNE,Applied Mathematics"
To: R help
Cc:
Se
On 10/12/2012 2:37 PM, Sam Steingold wrote:
> * arun [2012-12-10 11:22:03 -0800]:
>
> It is working for me.
I do not claim to have found a bug.
I am merely pleading for help figuring out what could have gone wrong.
.Last.value word when I first start R under Emacs/ESS.
Then it stops working.
I
On Dec 10, 2012, at 5:40 AM, Simon Kiss wrote:
Hi there
I'm trying to fit a logistic regression model to data that looks
very similar to the data in the sample below. I don't understand
why I'm getting this error; none of the data are proportional and
the weights are numeric values. Sh
On Mon, Dec 10, 2012 at 7:13 PM, Sam Steingold wrote:
>> * Richard M. Heiberger [2012-02-09 21:48:50 -0500]:
>>
>> .Last.value
>
> Thanks; it worked for a while, but not anymore:
>
> http://stat.ethz.ch/R-manual/R-patched/library/base/html/Last.value.html
> --8<---cut here
> * arun [2012-12-10 11:22:03 -0800]:
>
> It is working for me.
I do not claim to have found a bug.
I am merely pleading for help figuring out what could have gone wrong.
.Last.value word when I first start R under Emacs/ESS.
Then it stops working.
I can't figure out when or why...
--8<-
How do I sum portions of a vector into another vector?
E.g., for
--8<---cut here---start->8---
> vec <- 1:10
> breaks <- c(3,8,10)
--8<---cut here---end--->8---
I want to get a vector of length 3 with content
--8<--
> * Richard M. Heiberger [2012-02-09 21:48:50 -0500]:
>
> .Last.value
Thanks; it worked for a while, but not anymore:
http://stat.ethz.ch/R-manual/R-patched/library/base/html/Last.value.html
--8<---cut here---start->8---
> gamma(1:15)
[1] 1
I thought I had solved this problem. But I am still having trouble
converting times. I am looking for a way to print out the string versions
of times in different time zones. Same time, different zones.
I have times stored as seconds since epoch and as text strings in local
time.
For instance
Make sure you have version 1.8 of plyr installed. With 2.15.1 using
update.packages("plyr") does not seem to update from 1.7 to 1.8 (which
contains the revalue function). Using install.packages("plyr") should get
the current version.
--
David L Carlson
A
Please ask the ggplot2 maintainer: this looks like ggplot2 depends on
some other package/version that you have not updated yet and ggplot2
does not declare it correctly.
So you should
1. update R
2. run update.packages()
3. report to the ggplot2 maintainer about your findings and the probably
Thanks a lot - here is win 64 bits too
> library(ggplot2)
pakke ‘ggplot2’ blev bygget under R version 2.15.2
> qplot(mpg, wt, data=mtcars)
Error in rename(x, .base_to_ggplot, warn_missing = FALSE) :
could not find function "revalue"
sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-p
And a third way to interpret the question!
Rui count rows per category in - A = 3 rows, 1 row, 1 row
David count different letters used in B per category
in A 3 (a,b,c), 1 (v), 1 (g)
Felipe - count different strings in B per category - 3 (aaa,
bbb, abc), 1 (vvv), 1 (ggg)
Interes
Hi,
May be this also helps:
dat2<-within(dat1,{group<-as.numeric(factor(paste0(dim1,dim2,dim3)))})
head(dat2)
# var dim1 dim2 dim3 group
#1 0.5366483 x 1 1 1
#2 0.3081562 y 2 2 17
#3 0.1493687 z 1 3 23
#4 0.3202687 x 2 4 9
#5 0.1177976
HI Jonathan,
Tested your code from Nabble:
Looks like your solution is the fastest, but:
N <- 1000
M <- 5
P <- 5000
set.seed(15)
A <- matrix(runif(N,1,1000),nrow=N,ncol=M)
set.seed(425)
B <- matrix(runif(M,1,1000),nrow=P,ncol=M)
library(matrixStats)
Marius.5.0 <- function(A,B) outer(rowMaxs(A),ro
And another way:
library(plyr)
ddply(dta,"A",summarise,B=length(B))
Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish & Wildlife Service
California, USA
http://www.fws.gov/redbluff/rbdd_jsmp.aspx
From: David L Carlson
>To: 'Mat' ; r-help@r-project.org
>Sent: M
Thank you all, a few ideas worked perfectly for me.
I take "with(dat1,aggregate(B,by=list(A=A),length))" for my task.
Have a nice day.
Mat
--
View this message in context:
http://r.789695.n4.nabble.com/Count-cell-Count-by-her-frequency-tp4652650p4652678.html
Sent from the R help mailing li
Hello,
I couldn't reproduce your error.
> library(ggplot2)
Warning message:
package ‘ggplot2’ was built under R version 2.15.2
> qplot(mpg, wt, data=mtcars, colour=cyl) # directly from the qplot help
> #(no error message and the graph shows up)
> sessionInfo()
R version 2.15.1 (2012-06-22)
Platf
On 12/10/2012 07:01 AM, Johannes Graumann wrote:
Hi,
What goes wrong when the following error shows up:
Error in reconcilePropertiesAndPrototype(name, slots, prototype,
superClasses, :
No definition was found for superclass “sequencesuperclass” in the
specification of class “sequences”
Dear friends, I'm on windows, R 2.15.1 -
library(ggplot2)
#compiled under 2.15.2
qplot(mpg, wt, data=mtcars, colour=cyl) # directly from the qplot help
Error in rename(x, .base_to_ggplot, warn_missing = FALSE) :
could not find function "revalue"
Is that due to a .1 lack in R
All the best
Troels
Hi,
Try this:
#changed data to dat1
list1<-split(dat1,list(dat1$dim1,dat1$dim2,dat1$dim3))
names(list1)<-1:length(list1)
res<-do.call(rbind,lapply(list1,function(x)
data.frame(x,group=names(list1)[match.call()[[2]][[3]]])))
row.names(res)<-1:nrow(res)
head(res)
# var dim1 dim2 dim3 gr
You request is not completely clear. I am assuming you want to count the
number of different characters in B for each category in A:
> A <- c("10-1", "10-1", "10-1", "10-2", "10-3")
> B <- c("aaa", "bbb", "abc", "vvv", "ggg")
> dta <- data.frame(A, B)
> dta
A B
1 10-1 aaa
2 10-1 bbb
3 10-1
Hello,
As a follow-up, I must say that I've implemented the KMP algorithm in C
using the .Call interface, to search for a vector in another vector.
What do you want to do? Can you describe your problem?
Rui Barradas
Em 08-12-2012 22:37, Rui Barradas escreveu:
Hello,
As far as I know, the an
Hello,
Try the following.
dat <- read.table(text = "
A B
1 10-1 aaa
2 10-1 bbb
3 10-1 abc
4 10-2 vvv
5 10-3 ggg
", header = TRUE)
tbl <- table(dat$A)
data.frame(tbl)
Hope this helps,
Rui Barradas
Em 10-12-2012 08:50, Mat escreveu:
Hello togehter, i have a dat
Dear all,
Assume that I have the following data structure:
d <- expand.grid(subj=1:5, time=1:3, treatment=LETTERS[1:3])
d$value <- 10 ^ (as.numeric(d$treatment) + 1) + 10 * d$subj + d$time
d$value2 <- 10 + d$value
where d$treatment == "C" stands for my control group. What I want to achieve
On Mon, 10 Dec 2012, Jeremy Goss wrote:
Dear all,
I am modeling the incidence of recreational anglers along a stretch of
coastline, and with a vary large proportion of zeros (>80%) have chosen to
use a zero inflated negative binomial (ZINB) distribution. I am using the
same variables for both pa
Hi,
On Mon, Dec 10, 2012 at 9:33 AM, Francesco Sarracino
wrote:
>
> Dear R listers,
>
> I am trying to create a new variable that uniquely identifies groups of
> observations in a dataset. So far I couldn't figure out how to do this in
> R. In Stata I would simply type:
> egen newvar = group(dim1
Dear R listers,
I am trying to create a new variable that uniquely identifies groups of
observations in a dataset. So far I couldn't figure out how to do this in
R. In Stata I would simply type:
egen newvar = group(dim1, dim2, dim3)
Please, find below a quick example to show what I am dealing wi
On 10-12-2012, at 14:48, Elizabeth Fuller Bettini wrote:
> Please unsubscribe me from this mailing list.
> Thank you
> Liz
>
You do that yourself.
See the link at the very end of each message.
Repeated here for your convenience:
https://stat.ethz.ch/mailman/listinfo/r-help
And don't hijack
I would like to create a geographical grid to have a sort of a reference grid
for my georeferenced survey data. The grid should be in a xy format, wgs1984
with a 0.025 degree, alternatively 10km, resolution covering -14 to -24 S and
24 to -34 E (Zimbabwe).
Additionally I need to be able to expor
Hello togehter, i have a data.frame, with value like this:
A B
1 10-1 aaa
2 10-1 bbb
3 10-1 abc
4 10-2 vvv
5 10-3 ggg
I want now a evaluation, which character is how often in my data.frame. Like
this one:
A B
1 10-1 3
2 10-2 1
3 10-3
Perfect, thanks very much.
On 10/12/12 02:00, Jeff Newmiller wrote:
bwplot is a trellis function. There is something very basic about the way that
library works that any intro to trellis/lattice should tell you:
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-n
Dear all,
I am modeling the incidence of recreational anglers along a stretch of
coastline, and with a vary large proportion of zeros (>80%) have chosen to
use a zero inflated negative binomial (ZINB) distribution. I am using the
same variables for both parts of the model, can anyone help me with R
Please unsubscribe me from this mailing list.
Thank you
Liz
On Mon, Dec 10, 2012 at 8:40 AM, Simon Kiss wrote:
> R-help@r-project.org
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listi
Hi there
I'm trying to fit a logistic regression model to data that looks very similar
to the data in the sample below. I don't understand why I'm getting this
error; none of the data are proportional and the weights are numeric values.
Should I be concerned about the warning about non-integ
On 12-12-10 12:02 AM, Tyler Rinker wrote:
I have a long equation that I need to break in the R documentation of a package
or it trails off the right hand side of the page. Here's the formula:
\deqn{Cov(r_{ist}, r_{iuv})= [.5\rho_{ist}\rho_{iuv}(\rho_{isu}^2 +
\rho_{isv}^2 + \rho_{itu}^2 + \r
On 12-12-10 7:08 AM, Guillaume Chapron wrote:
Hi list,
I'm running R CMD check for a package and I would like to save the .tex file
that generates later the pdf documentation.
I have only seen it appearing and disappearing quickly in a tmp folder but I
have not been able to save it. I could n
Hi list,
I'm running R CMD check for a package and I would like to save the .tex file
that generates later the pdf documentation.
I have only seen it appearing and disappearing quickly in a tmp folder but I
have not been able to save it. I could not find any option to the check command
to sav
Dear R users, I have been searching thru the documentation of R but did not
find anything about reading or manipulating a binary data block file
(.DBL).a link to one example
https://echange-fichiers.inra.fr/get?k=5Hzw2B1wZDng9ztO34E
--
View this message in context:
http://r.789695.n4.nabble
80 matches
Mail list logo