Duncan: so good to get a reply from the RTools maintainer! I decided for now to
go with your simplest suggestion 1. So, I deinstalled 64 bit cygwin,
reinstalled the 32 bit version, and hope that the RTools versions of the
commands which will get picked up earlier in the PATH will not cause my c
Here's another one: match(d, unique(d)).
Arun
From:Â Greg Snow 538...@gmail.com
Reply:Â Greg Snow 538...@gmail.com
Date:Â March 12, 2014 at 8:41:31 PM
To:Â T Bal studentt...@gmail.com
Cc:Â r-help r-help@r-project.org
Subject:Â Re: [R] Assign numbers in R
Here are a couple more options if you
On Wed, 12 Mar 2014, Tim Marcella wrote:
Hi,
My data is characterized by many zeros (82%) and overdispersion. I have
chosen to model with hurdle regression (pscl package) with a negative
binomial distribution for the count data. In an effort to validate the
model I would like to calculate the R
Dear Tim,
I think that in this paper you would find a suite of different metrics
to evaluate your hurdle model:
Potts, Joanne M., and Jane Elith. "Comparing species abundance models."
Ecological Modelling 199.2 (2006): 153-163.
Best regards,
David March
El 12/03/2014 18:55, Tim Marcella escr
Here are a couple more options if you want some variety:
> d <- c(8,7,5,5,3,3,2,1,1,1)
> as.numeric( factor(d, levels=unique(d)) )
[1] 1 2 3 3 4 4 5 6 6 6
> cumsum( !duplicated(d) )
[1] 1 2 3 3 4 4 5 6 6 6
What would you want the output to be if your d vector had another 8
after the last 1? T
You can use get to grab the object, then subset it:
> test <- list(a=2)
> get('test')[['a']]
[1] 2
This way you can even have the variable names in other variables:
> whichvar <- 'a'
> whichlist <- 'test'
> get(whichlist)[[whichvar]]
[1] 2
Even better would be to have any lists that you want to
Hi,
My data is characterized by many zeros (82%) and overdispersion. I have
chosen to model with hurdle regression (pscl package) with a negative
binomial distribution for the count data. In an effort to validate the
model I would like to calculate the RMSE of the predicted vs. the observed
values
I know you already have a solution, but your original problem might have
been that you needed
attributes(Dataset1[[1]]) <-
i.e., double brackets, rather than
attributes(Dataset1[1]) <-
Example:
> foo <- data.frame(a=1:4, b=factor(letters[4]))
> attributes(foo[[2]])
$class
[1] "factor"
Hi,
This is not clear. May be this helps:
dat <- read.table(text="cid cname
101 us
102 uk
103 gm
104 NA
105 SA
106 fr
102 us
104 fr
105 gm
101 uk
102 us
106 SA
103 gm
105 SA
101 us
106 fr",sep="",header=TRUE,stringsAsFactors=FALSE)
lst1 <- split(dat,list(dat$cid,dat$cname),drop=T
Dear all,
I am using the ‘dismo’ package to conduct boosted regression trees (BRT)
for both binary and count data. The dismo package uses ‘gbm’ package for
the implementation of BRT. I would like to incorporate two offset terms
in the model, as well as being able to make predictions.
For the c
http://grokbase.com/p/r/r-help/1169gqdxcs/r-ggplot2-histogram-with-density-curve
# If you want it on the count scale, that is trickier and requires
# knowing (setting) the binwidth and keeping that value in sync in
# two places.
# In this example, the binwidth is 0.2 (set in geom_histogram and als
Dear all,
I am aiming to conduct glsm kriging using glsm.krige function (geoRglm
package).
I encounter a problem, which I have seen many times on the mailing list,
but nevertheless I can't figure out what goes wrong. Any pointers would be
great. Thanks, Olga
pred<-NULL
krva
No, this is not a homework. Thank you so much!
On Wed, Mar 12, 2014 at 10:39 AM, Kehl Dániel wrote:
> Hi,
>
> is this homework?
> Try
> d <- c(8,7,5,5,3,3,2,1,1,1)
>
> r <- rep(1,length(d))
>
> for (i in 2:length(d)) {
>
> if (d[i] != d[i-1]) {
> r[i]=r[i-1]+1;
> }
> else {
> r[i]
Hi,
Try:
cumsum(c(TRUE,d[-1]!=d[-length(d)]))
A.K.
On Wednesday, March 12, 2014 5:28 AM, T Bal wrote:
Hi,
I have the following numbers:
d <- c(8,7,5,5,3,3,2,1,1,1)
I want to convert these into the following numbers:
r:
1,2,3,3,4,4,5,6,6,6
So if two numbers are different increment it if t
I'm on 64-bit vs your 32-bit. And if you haven't received this from other
R-helpers already, here it is: FAQ 7.31. Machine precision is producing
numbers very close to zero but not zero. Then division is practically a random
number generator. Also, I'm certain that t and F are computed sepa
Hi Chris,
Here my output (I have not yet installed R 3.0.3)
> n=10;k=1;summary(lm(rep(k,n)~rnorm(n)))
Call:
lm(formula = rep(k, n) ~ rnorm(n))
Residuals:
Min 1Q Median 3QMax
-1.465e-16 1.564e-18 1.764e-17 2.147e-17 3.492e-17
Coefficients:
Es
I get what I would expect. The tstat and the Fstat are both undefined (0/0);
as are the p-values
> n=10;k=1;summary(lm(rep(k,n)~rnorm(n)))
Call:
lm(formula = rep(k, n) ~ rnorm(n))
Residuals:
Min 1Q Median 3QMax
0 0 0 0 0
Coefficients:
Esti
On 14-03-12 12:10 AM, Brent wrote:
Background:
--I already had the latest 64 bit cygwin (1.7.28) installed on my Windows
7 box
--I am a new R user; I just installed the latest 64 bit R today (3.0.3)
--a coworker told me that I also need to install RTools, so, I also
installed the
dear all,
a student of mine brought to my attention the following, somewhat odd,
behaviour of summary.lm() when the response variance is zero (yes,
possibly meaningless from a practical viewpoint). Namely something like
n=10;k=1;summary(lm(rep(k,n)~rnorm(n)))
The values of k, n and the covari
Hi,
is this homework?
Try
d <- c(8,7,5,5,3,3,2,1,1,1)
r <- rep(1,length(d))
for (i in 2:length(d)) {
if (d[i] != d[i-1]) {
r[i]=r[i-1]+1;
}
else {
r[i] = r[i-1];
}
}
Although I am sure there are better solutions!
HTH
daniel
Feladó:
Hello,
Try the following.
r <- cumsum(c(TRUE, diff(d) != 0))
Hope this helps,
Rui Barradas
Em 12-03-2014 09:13, T Bal escreveu:
Hi,
I have the following numbers:
d <- c(8,7,5,5,3,3,2,1,1,1)
I want to convert these into the following numbers:
r:
1,2,3,3,4,4,5,6,6,6
So if two numbers are
Hello,
For your example, the following will work:
R> d <- c(8,7,5,5,3,3,2,1,1,1)
R> idx <- 1:length(unique(d))
R> rep(idx, rle(d)$length)
[1] 1 2 3 3 4 4 5 6 6 6
HTH,
Pascal
On Wed, Mar 12, 2014 at 6:13 PM, T Bal wrote:
> Hi,
> I have the following numbers:
>
> d <- c(8,7,5,5,3,3,2,1,1,1)
>
>
Hi,
I have the following numbers:
d <- c(8,7,5,5,3,3,2,1,1,1)
I want to convert these into the following numbers:
r:
1,2,3,3,4,4,5,6,6,6
So if two numbers are different increment it if they are same then assign
the same number:
r <- NULL
for (i in 1:length(d)) {
if (d[i] != d[i+1]) {
r[i]
On Wed, Mar 12, 2014 at 12:10 AM, Brent wrote:
> Background:
> --I already had the latest 64 bit cygwin (1.7.28) installed on my Windows
> 7 box
> --I am a new R user; I just installed the latest 64 bit R today (3.0.3)
> --a coworker told me that I also need to install RTools, so, I a
On 12/03/2014 07:42, Alaios wrote:
Hi all,
I would like to turn some long strings like MyString$Myfield$MySubfield into
variables but it looks like that the get does not like lists
Those are expressions not names, so you need to parse them.
> eval(parse(text = "test$a"))
[1] 2
so for exam
Hi all,
I would like to turn some long strings like MyString$Myfield$MySubfield into
variables but it looks like that the get does not like lists
so for example:
test<-list(a=2)
test
>$a
[1] 2
get("test")
>$a
[1] 2
get("test$a")
>Fehler in get("test$a") : Objekt 'test$a' nicht ge
26 matches
Mail list logo