You might want to breakdown some of the expressions you are using; for example:
x-c(2,3,4,4,5,5,6,6,8,10)
df-as.data.frame(table(x))
df-df[order(df$Freq),]
m-max(df$Freq)
(MODE1-as.vector(as.numeric(as.character(subset(df,Freq==m)[,1]
[1] 4 5 6
ifelse(sum(df$Freq)/length(df$Freq)==1
+
So the thing is this, ifelse puts together a vector elementwise from two
other vectors (or other things, but vectors is vague enough for now) based
on a series of T/F values: you only put in one logical test, so you only get
a vector of length 1 back, here MODE1[1]=4. It seems like a regular
Thanks toy Jim and Michael for their response. The suggestion to use regular
if/else was spot on.
From: tyler_rin...@hotmail.com
To: r-help@r-project.org
Date: Sat, 30 Jul 2011 01:48:21 -0400
Subject: [R] ifelse returns
Greetings R Community,
I am working with the ifelse function
Thanks a lot for your answer.
You're right, I need to continue reading some papers to define a relevant
testing strategy.
Thanks to your package, I think I've got all what I need to proceed on
the exception of using 'breakpoints' with my data !
I've tested all possibilities (dummy or not)
Hello,
I'm just trying to wrap my head around the syntax for creating loops,
functions in R. I have an array of values from a .csv. Looks something like
header-c(species,coefficient1, exponent1, coefficient2, exponent2,
constant)
with a species name for the first column, and values for
Or maybe that function should look more like
vol.exp-function(x) {
V-((coefficient1*(x)^exponent1)+(coefficient2*(x)^exponent2)+constant)
V
}
?
*Ben *
On Sat, Jul 30, 2011 at 10:06 AM, Benjamin Caldwell btcaldw...@berkeley.edu
wrote:
Hello,
I'm just trying to wrap my head around the
test-by(vol,x, vol.exp)
Error in tapply(1L:45L, list(DBH = 80:200), function (x) :
arguments must have same length
*Ben *
On Sat, Jul 30, 2011 at 10:16 AM, Benjamin Caldwell btcaldw...@berkeley.edu
wrote:
Or maybe that function should look more like
vol.exp-function(x) {
I would like to reorder a two-column table by column A, then fill column B with
the values above it. For example: Original:A B2 545 NA8 784 NULL3
269 NULL First sort by column A:A B2 543 264 NULL5 NA8
789 NULL Then replace null/na values in column
Just checked. To get lapply to work for the both functions, I have to
convert the matrix M into a dataframe. Trying it with apply for the
matrix works perfectly fine. The missing x was the problem
So here my improved code.
require(Deducer)#Package for perm.t.test
c(rep(A, 5), rep(B,
Hi:
Try this:
set.seed(266)
dfm - data.frame(c1 = sample(1:5, 10, replace = TRUE),
e1 = sample(1:3, 10, replace = TRUE),
c2 = sample(1:5, 10, replace = TRUE),
e2 = sample(1:3, 10, replace = TRUE),
c3 = sample(1:5, 10,
Hi, I used a ks-function of another library (kstwo() of numerical recipes, a
mathematics book) to test it for myself and the same happens there - I
cannot understand why this observation happens? I hope someone can
'enlighten' me.
--
View this message in context:
On Sat, 30 Jul 2011, Michel Lutz wrote:
Thanks a lot for your answer.
You're right, I need to continue reading some papers to define a relevant
testing strategy.
Thanks to your package, I think I've got all what I need to proceed on
the exception of using 'breakpoints' with my data !
Wir sind bis am 20. August in den Ferien und werden keine e-mails beantworten.
Bei dringenden Fällen melden Sie sich bei Stefanie von Felten
steffi.vonfel...@oikostat.ch
We are on vacation until 20. August. In urgent cases, please contact Stefanie
von Felten steffi.vonfel...@oikostat.ch
hi, R users
here is my problem, i want to make a clusterring tree, than do the searching
through the tree using branch and bound method.
the code to make the tree, but i dont know how to do the searching part.
thanks for any helping...
d - dist(data, method = euclidean)
h1 - hclust(d,
Thanks!
On Wed, Jul 27, 2011 at 7:16 PM, Uwe Ligges-3 [via R]
ml-node+3699381-219890429-254...@n4.nabble.com wrote:
On 25.07.2011 19:42, eilunedpearce wrote:
Hi,
I'm trying to install CAIC directly into the newest version of R using
the
code on the R-Forge CAIC website and I get an
But, if I use coxph() function with gaussian frailty effect and I extract the
residuals from this model, it's correct?
I noticed that I obtained different estimates for same coefficients (very
small).
--
View this message in context:
Hi,
I want to use rbpspline {SpatialExtremes}.
My predictor variables have multiple dimensions,
In R-help it says that knots will be a vector givint the coordinates of the
knots.
However, my knots should have multiple dimension.
How can I generate knots for multidimensional case?
Thanks in
Thank you Dennis and Peter.
On Fri, Jul 29, 2011 at 1:59 PM, Dennis Murphy djmu...@gmail.com wrote:
Hi:
To add to Peter Dalgaard's comments, a look at head(ret) and
head(returns) would also have clued you in:
head(ret, 1)
GOOG.OpenGOOG.High GOOG.Low GOOG.Close
At 09:03 29/07/2011, gaiarrido wrote:
Hi,
I´m trying to move to ubuntu at all, but I don´t like R in Ubuntu because it
runs in the terminal, so i can´t access directly to some options R gots in
Windows.
Mario, it would help if you told us which options
from the Windows GUI you are missing.
Am Freitag, den 29.07.2011, 15:28 +0200 schrieb Paul Menzel:
wanting to compare different implementations of a solution I want to
script it to iterate over the different implementations. Is there a way
to do this in the R shell/command line?
$ more /tmp/iterf.r
f1 -
# plyr
plyr is a set of tools for a common set of problems: you need to
__split__ up a big data structure into homogeneous pieces, __apply__ a
function to each piece and then __combine__ all the results back
together. For example, you might want to:
* fit the same model each patient subsets of
Great, that works... even if I don't really understand the fuzz trick...
But now at least I've got all the material to take a deeper look into this
subject. So don't worry, no emergency at all for the no-workaround fixing.
I tested with HAC, the change seems to occur a bit later, around point
Dear R-users
I am new to R and struggling not to bother the list with silly questions.
I read the documentation on xts and searched for some examples over the
internet on how to use plot.xts.
The xts object is as follows
dataxts : An 'xts' object from 2010-06-27 to 2010-08-05
On Jul 30, 2011, at 5:13 AM, Dennis Murphy wrote:
Hi:
Try this:
set.seed(266)
dfm - data.frame(c1 = sample(1:5, 10, replace = TRUE),
e1 = sample(1:3, 10, replace = TRUE),
c2 = sample(1:5, 10, replace = TRUE),
e2 = sample(1:3, 10, replace =
This doesn't sound like it would be too hard to do at all, but I really
can't read your table: could you resend the table and the desired
intermediate and final steps but format them more legibly?
Something like:
A B
2 545
NA8 784
NULL 3
269 NULL
assuming that is where you are starting.
I'm
On Jul 30, 2011, at 2:25 AM, Jeffrey Joh wrote:
I would like to reorder a two-column table by column A, then fill
column B with the values above it. For example: Original:A B2
545 NA8 784 NULL3 269 NULL First sort by column A:A
B2 543 264 NULL5 NA8
Hi Eduardo,
I'm not too familiar with plot.xts, but this answers 2/3 of your requests.
R plot(x, major.ticks=weeks, major.format=%b %d)
plot.zoo is quite a bit more flexible and has a lot of examples in
?plot.zoo. Combining plot.zoo with endpoints should be able to give
you what you want.
sorry to bother all,
I am recently doing a topic about spillover effect between two markets. And
I want to use AR(1)-GJR-GARCH(1,1)-M Model. I find that rgarch package has
functions for univariate GARCH model, including GJR.
My GJR model is
http://r.789695.n4.nabble.com/file/n3706508/formula.jpg
On Sat, 30 Jul 2011, Rolf Turner wrote:
On 29/07/11 19:57, Martin Maechler wrote:
SNIP
but *also* see the *workaround* for the bug that has been on
R's ?pdf help page for years []
-- search for q (including the quotes).
Why oh why oh why ... are people always thinkg of bugs in
Sorry that X in the first equation should be Ɛ
--
View this message in context:
http://r.789695.n4.nabble.com/About-AR-1-GJR-GARCH-1-1-MODEL-tp3706508p3706512.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org
On Jul 30, 2011, at 10:39 AM, selwyn quan wrote:
On Sat, 30 Jul 2011, Rolf Turner wrote:
On 29/07/11 19:57, Martin Maechler wrote:
SNIP
but *also* see the *workaround* for the bug that has been on
R's ?pdf help page for years []
-- search for q (including the quotes).
Why oh
I am looking for introductory/published papers on spectral analysis\Frequency
domain analysis for both univariate and multivariate Time Series data that use
R-preferabily climate or economic data. I have some but most of them are not
for begginers.
Peter Maclean
Department of Economics
UDSM
What makes you think that the p-value of 1 is more accurate than the p-value of
0? The K-S test will show significance for very small differences in
distributions when the sample size is big enough.
Also, it is not clear that you are using it correctly. Generally you would
just give the raw
Which package is gofstat in? can you show us your data, or some details about
your data?
Note that the KS test (and all goodness of fit tests) are rule out tests, they
can show that the data is unlikely to come from a distribution, but can never
prove that it does come from a distribution.
Dear List,
Several times I use this package I get the error message shown below.
When I work out simple examples, it turns out to be fine, but when
working with real and moderate size data sets I always get the same
error.
Do you know what could be the cause of the problem?
Error in
Dear Lars,
There's not nearly enough information here to know what's wrong. I can guess
(but shouldn't have to) that the model glm.sev1 is a generalized linear
model of some sort, probably fit by glm(). At a minimum, it would help to
know what command you used to fit the model, the history of
Not with a description like that.
You need to make a reproducible example. Try using head () or subset to make a
smaller data set. Provide the data (using e.g. dput()). Provide the commands
that trigger the errors. Who knows... you might even see the issue yourself
then.
Dear all, I am looking for some procedure to apply 'ifelse' condition on
function. I have created an alternative to lapply() function with exactly same
set of arguments named lapply1(), however with different internal codes.
Therefore I want something like, if (some condition) then call
Sorry about the last message. I forgot to turn the HTML off.
I would like to reorder a table by column A, then fill column B with the values
above it. For example:
A B
2 54
5 NA
8 78
4 NULL
3 26
9 NULL
First sort by column A:
A B
2 54
3 26
4 NULL
5 NA
8 78
9 NULL
You can use ifelse() if you want...
x - 1:10
ifelse(x 5, mean(x), length(x))
Although I do not really see how you are hoping to improve on if
(condition) lapply1() else lapply().
Josh
On Sat, Jul 30, 2011 at 12:56 PM, Megh Dal megh700...@yahoo.com wrote:
Dear all, I am looking for some
I am assuming that what you say is NULL is really a character string
NULL, so try this:
x
AB
1 2 54
2 5 NA
3 8 78
4 4 NULL
5 3 26
6 9 NULL
str(x)
'data.frame': 6 obs. of 2 variables:
$ A: int 2 5 8 4 3 9
$ B: Factor w/ 4 levels 26,54,78,..: 2 NA 3 4 1 4
dput(x)
ok. Here's an example:
R version 2.11.1
effects_2.0-10
var1 - c(25631.9392, 2521.2590, 6656.6516, 1362.5997, 6369.9818,
27253.4223, 2073.1909, 9959.3792,
3318.2500, 15323.8103, 11583.8717, 3054.5558, 625.6597,
2500., 11996.2271)
var2 - as.factor(c(B:=500, B:=500, B:=500,
Dear GIS people
What is the best way of implemeting spatial data interpolation (from large to
small grids)-especially for dummies. I searched the internet and could not get
concrete answer. Here is an example with simulated data.
#Example of spatial data interpolation
require(utils)
#I need to
On 11-07-30 3:56 PM, Megh Dal wrote:
Dear all, I am looking for some procedure to apply 'ifelse' condition on
function. I have created an alternative to lapply() function with exactly same
set of arguments named lapply1(), however with different internal codes.
Therefore I want something
Hi All,
Did anyone else have a problem like this? I am sorry if its a small issue, I
seem to not understand what to do to get rid of this error.
Sigma
[1] 0.1939025
MuRest
[1] 8.512772
TauZero
[1] 0.1
curve(qlnorm(x,-TauZero+MuRest, Sigma,lower.tail=F), xlim=c(4000,9000),
The qDIST() functions are the inverse of the pDIST() functions, that is to
say, the inverse CDFs of whatever distribution you are interested in.
Your code is asking it to plot values of the inverse CDF from x from 4000 to
9000, which are impossible values. (I hope the reason for this is evident
On 30.07.2011 21:58, Jeffrey Joh wrote:
Sorry about the last message. I forgot to turn the HTML off.
I would like to reorder a table by column A,
df2 - df[order(df$A),]
then fill column B with the values above it.
for (i in 1:nrow(df2)) {
if (is.na(df2$B[i]) | df2$B[i] == NULL)
On Jul 30, 2011, at 5:04 PM, Vishal Thapar wrote:
Hi All,
Did anyone else have a problem like this? I am sorry if its a small
issue, I
seem to not understand what to do to get rid of this error.
I hope that everyone else has this problem. You do not seem to
understand the qdist
Dear Lars,
The problem is the : in the levels of var2, which confuses effect() about
the structure of the model, since a colon indicates interaction. Try, e.g.,
removing the colons:
var2 - as.factor(c(B=500, B=500, B=500, B=500, B=500, B=500,
B=500, B=500,
B=500, C750-1000,
Thanks for your quick response on this issue John!
Yes, in my real dataset I have many predictors and more observations
than in this example. I've started to remove one predictor at the time
until this one was found to be causing the problem.
Thanks again!
Lars.
On Sat, Jul 30, 2011 at 5:33 PM,
Dear List,
I'd like to extend the glmnet package to account for one additional
distribution: the Tweedie (compound of Poisson and Gamma). Could you please
point me on how should I do this?
Thanks for any help,
Axel.
[[alternative HTML version deleted]]
Hi Joshua
Many thanks.
library(Hmisc);
plot.xts(x,major.ticks=weeks,major.format=%b/%d %H:%M:%S);
minor.tick(nx=7);
The above commands give me almost what I need. I just need to figure out
how to split the labels in two lines (without using ggplot2)
Cheers
Ed
-Original Message-
Dear list,
I have two questions regarding grid.symbols() in the grImport package.
This package allows you to import a vector graphic in R, and
grid.symbols() can be used to plot the resulting glyph at arbitrary
locations in a grid viewport.
I have tried the code in the grImport vignette, which
On Jul 30, 2011, at 6:05 PM, Eduardo M. A. M.Mendes wrote:
Hi Joshua
Many thanks.
library(Hmisc);
plot.xts(x,major.ticks=weeks,major.format=%b/%d %H:%M:%S);
minor.tick(nx=7);
The above commands give me almost what I need. I just need to
figure out
how to split the labels in two lines
Hi Michael, David,
I agree it was an error on my part. It should have been plnorm only. I
should have looked more closely. Thanks for the help!
Best,
Vishal
On Sat, Jul 30, 2011 at 5:18 PM, R. Michael Weylandt
michael.weyla...@gmail.com michael.weyla...@gmail.com wrote:
The qDIST()
On 11-07-30 5:55 PM, Axel Urbiz wrote:
Dear List,
I'd like to extend the glmnet package to account for one additional
distribution: the Tweedie (compound of Poisson and Gamma). Could you please
point me on how should I do this?
Your question is quite ambiguous. Are you asking about the
Others have shown how to do this, but a better approach may be to load your
.Rdata file into a new environment rather than the global environment, then you
can work with the environment (and all the objects in it) using lapply, or
loops with [[]] instead of fighting with get and assign.
57 matches
Mail list logo