[R] Subscript out of bounds

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Tue Nov 26 19:00:10 CET 2013


This is the kind of question where including the output of sessionInfo() is a really good idea.

This would, for example, answer the question of whether you are in fact using the x64 version of R.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

Keniajin Wambui <kiangati at gmail.com> wrote:
>I am using R3.0.2 on a windows 64 bit machine. I building a .rnw file
>from an .r file. I am using MikTex as the engine for latex. The
>function dtaStata <- read.dta("core2.dta", convert.dates=TRUE) works
>well in .R but; When I try reading a dta (stata) file I get an error
>"subscript out of bounds". The file has 52 variables and over 90000
>observations
>
>Below is the code in latex
>
>\section{Introduction}
>The following clinical variables are in the core data set
>
><<echo=false, results=hide>>=
>#setting the working directory
>setwd("H:/Rjob/coreGraphs/core2Report/")
>
>#load the packages
>library(ggplot2)
>library(foreign)
>library(reshape2)
>library(psych)
>library(epicalc)
>library(plyr)
>library(doBy) #used to summarize
>
>##load the core 2 data
>dtaStata <- read.dta("core2.dta", convert.dates=TRUE)
>dtaStata <- as.data.frame(dtaStata)
>dtaStata$ndad<-as.Date(dtaStata$ndad, origin='1960-01-01')
>totalData <- table(dtaStata$yr)
>#variables in core2
>@
>the data has \Sexpr{ncol(dtaStata)} columns \Sexpr{getwd()}
>\clearpage
>\end{document}



More information about the R-help mailing list