Skip to content

Subscript out of bounds

4 messages · Jeff Newmiller, Keniajin Wambui

#
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}
#
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:
#
Dear Jeff;
Below is the output for sessioninfo()

R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United
Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] tools_3.0.2

On Tue, Nov 26, 2013 at 9:00 PM, Jeff Newmiller
<jdnewmil at dcn.davis.ca.us> wrote:

  
    
#
Here is the error am getting

Error:  chunk 1
Error in tt[[ll[v]]] : subscript out of bounds
Error in rle(filenames) : 'x' must be an atomic vector
Calls: <Anonymous> -> <Anonymous> -> RweaveTryStop
Execution halted
On Wed, Nov 27, 2013 at 9:25 AM, Keniajin Wambui <kiangati at gmail.com> wrote: