search for: r_inferno

Displaying 20 results from an estimated 42 matches for "r_inferno".

Did you mean: inferno
2010 Dec 23
1
speed issues? read R_inferno by Patrick Burns: & a memory query
Hi, I'm just starting out with R and came across R_inferno.pdf by Patrick Burns just yesterday - I recommend it! His description of how 'growing' objects (e.g. obj <- c(obj, additionalValue) eats up memory prompted me to rewrite a function (which made such calls ~210 times) so that it used indexing into a dimensioned object instead (i.e. obj[i,...
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 burns-stat.com +44 (0)20...
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
2024 Mar 24
1
an issue about subsetting a vector
...0) is integer(0) (we multiply *each of the elements of integer(0)* by -1, but integer(0) has no elements) that reduces to a[integer(0)] and from there you get "select none of the elements". A related point is explained in the R Inferno https://www.burns-stat.com/pages/Tutor/R_inferno.pdf section 8.1.13, "negative nothing is something". See also https://stackoverflow.com/questions/42615728/subsetting-vector-how-to-programatically-pass-negative-index-safely https://stackoverflow.com/questions/40026975/subsetting-with-negative-indices-best-practices/40029485#40029...
2009 Jun 01
0
vectorizing a double loop
...the serie, I have to build a loop to calculate it using the last few data. My problem is that it takes one minute to compute and I need to run this function very often. I would like to vectorize it, as much as possible. Can somebody help me? I have read the http://www.burns-stat.com/pages/Tutor/R_inferno.pdf tutorial but it seems I am not smart enough to vectorize this. here is the code of my function: momentum = function(price,H,N,HL) { indicator = price #creates the empty vector for the indicator indicator[,1]=0 if ((H/N)==floor(H/N)) {...
2010 Dec 01
1
Difference between loops and vectorization
Hello R-helpers, A fundamental question ...I'm trying to understand the differences between loop and vectorization ... I understand that it should be a natural choice to use apply / adply when it is needed to perform the same function across all rows of a data frame. Any pointers on why this is so? Unable to find the right reading place on the WWW which explains the concept. Thanks for your
2009 Sep 17
2
r-inferno.pdf with detailed table of contents and bookmarks
Hi, I don't find a r-inferno.pdf that has detailed table of contents and bookmarks. If it is possible, can somebody help generated one and post it on line? Regards, Peng
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]]
2012 Jan 22
2
if/else statement without curly brackets gives a problem
Hello, This example seems strange to me: > if (2 > 3) print('Yes'); else print('No') Error: unexpected 'else' in " else" > {if (2 > 3) print('Yes'); else print('No')} Error: unexpected 'else' in "{if (2 > 3) print('Yes'); else" > { + if (2 > 3) print('no') + else print('yes') + }
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]]
2012 Mar 03
1
"Global" Variable in R
Dear all, I would like to ask you if there is a way to define a global variable in R? I am having a bunch of function and I think the easier would be to have a global function defined at some point... Would that be possible? Regards Alex [[alternative HTML version deleted]]
2012 Nov 22
1
Optimizing nested function with nlminb()
I am trying to optimize custom likelyhood with nlminb() Arguments h and f are meant to be fixed. example.R: compute.hyper.log.likelyhood <- function(a, h, f) { a1 <- a[1] a2 <- a[2] l <- 0.0 for (j in 1:length(f)) { l <- l + lbeta(a1 + f[j], a2 + h - f[j]) - lbeta(a1, a2) } return(l) } compute.optimal.hyper.params <- function(start, limits, h_, f_) { result
2014 Aug 06
2
Subscripting Matrices
There seems to be a result type difference when subscripting a 6 x 1 matrix as compared to a 3 x 2 matrix that is caused by the ncol = 1 compared to ncol > 1. > ThinMatrix <- matrix(1:6,ncol=1) > ThinMatrix [,1] [1,] 1 [2,] 2 [3,] 3 [4,] 4 [5,] 5 [6,] 6 > FatMatrix <- matrix(1:6,ncol=2) > FatMatrix [,1] [,2] [1,] 1 4 [2,] 2 5
2009 Mar 18
3
numeric equality
Dear all, I am totally confused by the following R output, but don't have a clue for it. > a <- 1 - 0.2 > a == 0.8 [1] TRUE > a <- 1 - 0.8 > a == 0.2 [1] FALSE > a <- 1 - 0.5 > a == 0.5 [1] TRUE > a <- 1 - 0.6 > a == 0.4 [1] TRUE > a <- 1 - 0.9 > a == 0.1 [1] FALSE My R version is Windows XP R version 2.8.1 (2008-12-22).
2011 Apr 14
2
appending to a vector
Which one is more efficient? x2=c() for (i in 1:length(x)) { x2=c(x2,func(x[i])) } or x2=x for (i in 1:length(x)) { x2=func(x[i]) } where func is any function? Dirk -- View this message in context: http://r.789695.n4.nabble.com/appending-to-a-vector-tp3449109p3449109.html Sent from the R help mailing list archive at Nabble.com.
2012 Jun 30
2
incorrect number of subscripts on matrix
Hi, Wondering if anyone could help me out with this error.Im trying to fill a matrix with random numbers taken from an exponential distribution using a loop: x.3<-matrix(rep(0,3000),nrow=1000,byrow=T)for(i in 1:1000){x[i,]<-rexp(3,rate=2/3)} I get the error message: Error in x[i, ] <- rexp(3, rate = 2/3) : incorrect number of subscripts on matrix Any ideas??? Appreciate any thoughts.
2011 Feb 16
1
incomplete final line
Hi, I work like this: > data<?read.table('E:/my documents/r/consumer.xls',header=TRUE) Warning message: In read.table("E:/my documents/r/consumer.xls", header = TRUE) : incomplete final line found by readTableHeader on 'E:/my documents/r/consumer.xls' could someone shoot the trouble for me ? thx sorry for trouble ,im a newbie. -- View this message in
2012 Mar 05
2
no partial matching of argument names after dots argument - why?
I noticed that the argument names after the dots argument are not partially matched. foo <- function(one, two, ...){ one + two } > foo(o=1, t=2) [1] 3 foo <- function(one, ..., two){ one + two } > foo(o=1, t=2) Fehler in one + two : 'two' fehlt Can someone explain me the reason for this behavior? THX Mark ???????????????????????????????????? Mark Heckmann Blog:
2010 Sep 28
3
calcular la variancia de gini por bootstrap
Hola, paso el mini programita q estoy viendo, lo q me llama la atencion es una parte donde se definen las funciones. Probe primero meter adentro del boots la estadistica a estimar usando directamente gini(varible, pesos) pero no me dejo. Vi q en el ej del manual de boots, siempre define antes la funcion, entonces probe definir antes una funcion haciendo grini<-function(x) {gini(variable,
2010 Jun 22
3
Project
I am an intern in Virginia Beach and I am currently working on a project that involves converting a script of Pearl to R. The code takes one input text file and outputs six text files. If you think you can help, I will be able to provide more detailed information. Thank you for your time! Colton Hunt