similar to: Determining Index of Last Element in Vector

Displaying 20 results from an estimated 30000 matches similar to: "Determining Index of Last Element in Vector"

2010 May 26
2
Avoiding Loops When Iterating Over Statement That Updates Its Input
Since `for' loops are slow in R, and since `apply' functions are faster, I was wondering whether there were a way to use an apply function?or to otherwise avoid using a loop?when iterating over a statement that updates its input. For example, here's some such code: r.seq <- 2 * (1 / d$Dt[1] - 1) for (i in 2:nrow(d)) { rf <- uniroot(bdt.deviation, interval=c(0, 1),
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
2008 Nov 07
1
Updating Packages with Personal Library
I'm having trouble running `updates.packages()' and installing into a personal library. Setup: 1. .Renviron file contains: R_LIBS_USER="~/lib/R/%p-library/%v" 2. Hence "personal library" is: ~/lib/R/i486-pc-linux-gnu-library/2.6/ 3. Library path upon starting R: > .libPaths() [1] "/home/johnny/lib/R/i486-pc-linux-gnu-library/2.6" [2]
2003 May 27
3
The Wrong Choice: Locked in by license restrictions
A colleague pointed me to this article advocating R as a Matlab substitute. Here is the link (deliberately on two lines: http://searchenterpriselinux.techtarget.com/ originalContent/0,289142,sid39_gci902076,00.html I'm not a Matlab user, but I understand that it provides a nice front end to the Linpack collection of numerical linear algebra routines. My friend and I wonder if R can really
2008 Mar 15
1
How to get the value of last element in a vector/array ?
Hi, a[length(a)] gives the value of last element. Is there an alternative without using functions ? [[alternative HTML version deleted]]
2003 Jan 16
7
X11 device now needs to be explicitly started?
_ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major 1 minor 6.2 year 2003 month 01 day 10 language R > Until this version, I've not had to explicitly start the x11 device. Now,
2012 Aug 06
3
Force evaluation of a symbol when a function is created
I am porting a program in matlab to R, The problem is that Matlab has a feature where symbols that aren't arguments are evaluated immediately. That is: Y=3 F=@(x) x*Y Will yield a function such that F(2)=6. If later say. Y=4 then F(2) will still equal 6. R on the other hand has lazy evaluation. F<-function(x){x*Y} Will do the following Y=3 F(2)=6 Y=4 F(2)=8. Does anyone know of away to
2008 Nov 20
1
Math Expression in 3D Plots
Is there anyway to label axes in 3D plots with mathematical expressions? In the code below, I want to replace "delta_yrsed" with what "\Delta \widehat{yrsed}" represents in TeX, but the [xyz]lab parameters of title3d appear to only accept character strings. require("rgl") fn.delta.yrsed <- function(dist, delta.dist,
2007 Jul 16
1
R equivalent to Matlab's Bayes net toolbox
Hi, I'm attending summer School at UCLA (IPAM) on "probabilistics models of cognition". I have been an R-user since v. 1.4.1, but was trained in the frequentist tradition (as most psychologists!). I found that all faculty here use matlab and Murphy's bayes net toolbox. I have not had the need to use matlab before, and would love to stick to R for graphics models and
2006 Aug 17
1
putting the mark for censored time on 1-KM curve or competing risk curve
Hi All, I'm trying to figure out the cumulative incidence curve in R in some limited time. I found in package "cmprsk", the command "plot.cuminc" can get this curve. But I noticed that there is no mark for the censored time there, comparing with the KM curve by "plot.survfit". Here are my codes (attached is the data): ----------------
2007 Feb 06
15
R in Industry
The other day, CNN had a story on working at Google. Out of curiosity, I went to the Google employment web site (I'm not looking, but just curious). In perusing their job posts for statisticians, preference is given to those who use R and python. Other languages, S-Plus and something called SAS were listed as lower priorities. When I started using Python, I noted they have a portion of the
2012 Aug 27
1
total CPU time in Matlab - what is the equivalent in R?
I am trying to compare the speed of my R code with that reported by the authors of a reference paper who used Matlab. The authors of the paper state "Total CPU time for the algorithm was 10 s for the ...on a modest mobile 2.2 GHz Pentium processor running MATLAB v.6". I am using proc.time (similar to the example shown in ?proc.time) to determine the speed of my R code. Could someone
2010 Mar 02
1
sem package and growth curves
I have been working through the book "Applied longitudinal data analysis: modeling change and event occurrence" by Judith D. Singer and John B. Willett. I have been working examples using SAS and also using it as an opportunity for learning to use R for statistical analysis. I ran into some difficulties in chapter 8 which deals with using structural equation modeling. I have tried to
2011 Jun 23
2
packages which call functions which run C code...
I am looking at the function ks.test in the stats package and trying to figure out why it gives a different result for a p-value than does the corresponding function in MATLAB. I am hoping for one of two responses: 1. You know about ks.tests and have a familiarity with both the R and MATLAB algorithms and can tell me why this should be happening. 2. You know where I can find the
2003 Feb 13
5
position of an element in a vector
Hello. Sorry for the elementary post. I've looked through the documentation, but can't seem to find a function which allows one to extract the position of an element within a list...for example the position of the element 4 in the vector c(1,2,4,3,6) is 3. Thanks much for any help. Jason
2007 Jan 17
2
Repeated measures
I am having a hard time understanding how to perform a "repeated measures" type of ANOVA with R. When reading the document found here: http://cran.r-project.org/doc/contrib/Lemon-kickstart/kr_repms.html I find that there is a reference to a function make.rm () that is supposed to rearrange a "one row per person" type of frame to a "one row per observation" type
2006 Nov 09
2
Repeated Measures MANOVA in R
Can R do a repeated measures MANOVA and tell what dimensionality the statistical variance occupies? I have been using MATLAB and SPSS to do my statistics. MATLAB can do ANOVAs and MANOVAs. When it performs a MANOVA, it returns a parameter d that estimates the dimensionality in which the means lie. It also returns a vector of p-values, where each p_n tests the null hypothesis that the mean
2011 Nov 02
4
array manipulation
Hello, I'm at the very beginning of the learning process of this language. Sorry in advance for the (possible but plausible) stupidity of my question. I would like to find a way to permute the DIMENSIONS of an array. Something that sounds like the function "permute()" in matlab. Given an array C of dimensions c x d x T , for instance, the command permute(C, [2 1 3]) would provide
2004 Sep 02
8
newsgroup on R
HI, I wonder if there is a newsgroup on R available, instead of emaillist which I have to receive mails daily. Cheers. Bin
2010 Nov 05
2
rendering Markdown automatically
I made this thing. Some of you may find it useful. https://github.com/skurfer/RenderMarkdown I'm using it for documentation at work. It could also be handy if you run Apache on your desktop machine and want to share files (for display purposes only) that way. -- Rob McBroom <http://www.skurfer.com/>