[R] Subscript out of bounds

Keniajin Wambui kiangati at gmail.com
Tue Nov 26 17:28:47 CET 2013


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}

-- 
Mega Six Solutions
Web Designer and Research Consultant



More information about the R-help mailing list