Displaying 20 results from an estimated 40000 matches similar to: "two questions for R beginners"
2013 Feb 28
2
Fortune?
I think the rule is that you can do anything as long as you don't
complain. If you want to complain, you must follow the instructions.
-- Jari Oksanen in
Re: [Rd] Keeping up to date with R-devel
--
Patrick Burns
pburns at pburns.seanet.com
twitter: @burnsstat @portfolioprobe
http://www.portfolioprobe.com/blog
http://www.burns-stat.com
(home of:
'Impatient R'
'The R
2014 Jan 03
1
wishlist: decreasing argument to is.unsorted
I've just realized that it could be handy
to have a 'decreasing' argument in 'is.unsorted'.
And I'm cheekily hoping someone else will
implement it.
It is easy enough to work around (with 'rev'),
but would be less hassle with an argument.
The case I have in mind uses 'is.unsorted' in
'stopifnot'.
Pat
--
Patrick Burns
pburns at pburns.seanet.com
2011 Sep 12
3
Solve your R problems
R-help is all about solving R problems.
So here ya go:
http://www.portfolioprobe.com/2011/09/12/solve-your-r-problems/
--
Patrick Burns
pburns at pburns.seanet.com
twitter: @portfolioprobe
http://www.portfolioprobe.com/blog
http://www.burns-stat.com
(home of 'Some hints for the R beginner'
and 'The R Inferno')
2009 Jan 09
5
The R Inferno
"The R Inferno" is now on the Burns Statistics website at
http://www.burns-stat.com/pages/Tutor/R_inferno.pdf
Abstract: If you are using R and you think you're in hell,
this is a map for you.
Also, I've expanded the outline concerning R on the
Burns Statistics 'Links' page. Suggestions (off-list) for
additional items are encouraged.
Patrick Burns
patrick at
2013 Mar 02
3
if value is in vector, perform this function
Hi,
I'm trying to set up R to run a simulation of two populations in which every 3.5 days, the initial value of one of the populations is reset to 1.5. I'm simulation an experiment we did in which we fed Daphnia populations twice a week with algae, so I want the initial value of the algal population to reset to 1.5 twice a week to simulate that feeding. I've use for loops and if/else
2010 May 30
4
Data Frame as Hash Table
I'm interested in using a data frame as if it were a hash table. For
instance if I had the following,
> (d <- data.frame(key=seq(0.5, 3, 0.5), value=rnorm(6)))
key value
1 0.5 -1.118665122
2 1.0 0.465122921
3 1.5 -0.529239211
4 2.0 -0.147324638
5 2.5 -1.531503795
6 3.0 -0.002720434
Then I'd like to be able to quickly retrieve the "value" of "key" 1.5
2010 Jul 04
1
arr.ind argument to which.min and which.max
Is there a reason that 'which.min' and
'which.max' don't have an 'arr.ind'
argument?
The context in which I wanted that was
a grid search optimization, which seems
like it would be reasonably common to me.
--
Patrick Burns
pburns at pburns.seanet.com
http://www.burns-stat.com
(home of 'Some hints for the R beginner'
and 'The R Inferno')
2012 Jul 17
3
complexity of operations in R
Hello!
I am optimizing my code in R and for this I need to know a bit more about
the internals. It would help tremendously if someone could link me to a
page with O()-complexities of all the operations.
In this particular case, I need something like a linked list with O(1)
insertLast/First ability. I can't preallocate a vector since I do not know
the final size of the list ahead of time.
The
2013 Mar 25
3
nested 'while' loops
Hi everyone,
I'm using the following code to go over every element of a data frame (row
wise). The problem I am facing is that the outer 'x' variable is not
incrementing itself, thus, only one row of values is obtained, and the
program does not proceed to the next row.
This is the code:
while(x<=coln)
{
while(y<=rown)
{
n<-as.numeric(df[[y]][x]);
2010 Feb 12
1
Using seq_len() vs 1:n]
Pat Burns makes a good point. -Peter
-------- Original Message --------
Subject: Re: [R] Using seq_len() vs 1:n
Date: Fri, 12 Feb 2010 09:01:20 +0000
From: Patrick Burns <pburns at pburns.seanet.com>
To: Peter Ehlers <ehlers at ucalgary.ca>
References: <4B746AEF.10900 at ucalgary.ca>
If you want your code to be compatible with
S+, then 'seq_len' isn't going to work.
2013 Mar 28
2
E-learning environment for R
Hello,
Does an e-learning environment for R (in English) exist? I would like
to point out to students a way to learn R if they have missed the
course on R.
Pekka Pere
University Lecturer
University of Helsinki
2010 Jun 20
1
proposed change to 'sample'
There is a weakness in the 'sample'
function that is highlighted in the
help file. The 'x' argument can be
either the vector from which to sample,
or the maximum value of the sequence
from which to sample.
This can be ambiguous if the length of
'x' is one.
I propose adding an argument that allows
the user (programmer) to avoid that
ambiguity:
function (x, size, replace
2012 Sep 20
3
Applying glm coefficients (Beginner Question)
Hello,
I am working with a dataset with three variables and one binomial parameter.
The glm function provides coefficients for these three variables, e.g.
-1.5 | 27.2 | -2.9
If I'm not mistaken, $fitted.values gives me an estimate of how likely my
parameter is to be true/1 . I would like to apply these coefficients on
other variables to predict the binomial parameter but I'm not sure how
2013 Mar 18
4
!0 + !0 == !0 - !0
Hi all,
The subject line is TRUE.
Today I accidentally typed rnorm(!0).
My old eyes took a minute to focus clearly enough to see what I really typed and
why I got '!0' random numbers instead of '10' random normal numbers.
If the subject line is disturbing, be assured that this is TRUE:
!0^2 == !0 * !0 # ;-)
Anyway, I hope the hands who have been around long enough to know
2009 Jun 04
4
order() with randomised order in ties?
Hi
I want to use order() to get the order of a vector.
But I would need a different behavior when ties occur: similar to the
parameter ties.method = "random" in the rank() function, I would need
to randomise the ties. Is this possible?
Example:
x <- rep(1:10, 2)
order(x)
[1] 1 11 2 12 3 13 4 14 5 15 6 16 7 17 8 18 9 19 10 20
order(x)
[1] 1 11 2 12 3 13 4 14 5 15
2018 Aug 05
2
Is this a bug in `[`?
Thanks.
This is exactly the doubt I had.
Rui Barradas
?s 05:26 de 05/08/2018, Kenny Bell escreveu:
> This should more clearly illustrate the issue:
>
> c(1, 2, 3, 4)[-seq_len(4)]
> #> numeric(0)
> c(1, 2, 3, 4)[-seq_len(3)]
> #> [1] 4
> c(1, 2, 3, 4)[-seq_len(2)]
> #> [1] 3 4
> c(1, 2, 3, 4)[-seq_len(1)]
> #> [1] 2 3 4
> c(1, 2, 3, 4)[-seq_len(0)]
2013 Mar 08
2
Unexpected behaviour of apply()
Hello everyone,
Considering the following code sample :
----
indexes <- function(vec) {
vec <- which(vec==TRUE)
return(vec)
}
mat <- matrix(FALSE, nrow=10, ncol=10)
mat[1,3] <- mat[3,1] <- TRUE
----
Issuing apply(mat, 1, indexes) returns a 10-cell list, as expected.
Now if I do:
----
mat[1,3] <- mat[3,1] <- FALSE
apply(mat, 1, indexes)
----
I would expect a
2013 Mar 12
1
rugarch: GARCH with Johnson Su innovations
Hey,
I'm trying to implement a GARCH model with Johnson-Su innovations in order to simulate returns of financial asset. The model should look like this:
r_t = alpha + lambda*sqrt(h_t) + sqrt(h_t)*epsilon_t
h_t = alpha0 + alpha1*epsilon_(t-1)^2 + beta1 * h_(t-1).
Alpha refers to a risk-free return, lambda to the risk-premium.
I've implemented it like this:
#specification of the model
2012 Jan 26
2
What does [[1]] mean?
I know that [] is used for indexing.
I know that [[]] is used for reference to a property of a COM object.
I cannot find any explanation of what [[1]] does or, more pertinently, where it should be used.
Thank you.
[[alternative HTML version deleted]]
2011 Nov 11
3
Why does length("") == 1?
It seems obvious to me that the empty string "" is length 0.
cheers
Worik
[[alternative HTML version deleted]]