From murdoch.duncan at gmail.com  Tue Mar  3 12:46:07 2015
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Tue, 03 Mar 2015 06:46:07 -0500
Subject: [Rd] Asssistance
In-Reply-To: <CAObCh3WeWm5E0O6cZ8zsGJEZsrVbVT2OsxMHXTi_T+=Tfe=hgg@mail.gmail.com>
References: <CAObCh3WeWm5E0O6cZ8zsGJEZsrVbVT2OsxMHXTi_T+=Tfe=hgg@mail.gmail.com>
Message-ID: <54F59EFF.20409@gmail.com>

On 03/03/2015 5:47 AM, Evans Otieno Ochiaga wrote:
> Hi to All,
> 
> I am building a package in R and whenever I run command "R CMD build OAR"
> in the terminal, I get the following error:
> 
> * checking for file ?OAR/DESCRIPTION? ... OK
> * preparing ?OAR?:
> * checking DESCRIPTION meta-information ... ERROR
> Malformed Depends or Suggests or Imports or Enhances field.
> Offending entries:
>   R (>=3.0.2)
> Entries must be names of packages optionally followed by '<=' or '>=',
> white space, and a valid version number in parentheses.

That looks okay; I'm guessing it is out of place.  Can you show use your
DESCRIPTION file?

Duncan Murdoch

> 
> See the information on DESCRIPTION files in section 'Creating R
> packages' of the 'Writing R Extensions' manual.
> 
> This is my first time to build a package using R and it's very hard for me
> to figure out where the problem is. I kindly call for your assistance in
> fixing the problem. Below is my function;
> 
> bcidata <- read.csv("~/Desktop/Files_for_Package/data.csv"); bcidata
> 
> Modelsfunc<- function(bcidata){
> 
>   occupancymean.data.frame <- NULL
> 
>   for (k in seq(2.5,250,by=2.5)){
> 
>     i <- 1000/k
> 
>     j <- 500/k
> 
>     bcidata$Xgrid <- cut(bcidata$PX, breaks = i, include.lowest = T)
> 
>     bcidata$Ygrid <- cut(bcidata$PY, breaks = j, include.lowest = T)
> 
>     bcidata$IDgrid <- with(bcidata, interaction(Xgrid,Ygrid))
> 
>     bcidata$IDNgrid <- factor(bcidata$IDgrid)
> 
>     levels(bcidata$IDgrid) <- seq_along(levels(bcidata$IDgrid))
> 
>     bcidata$count <- ave(bcidata$PX, bcidata$IDgrid, FUN = length)
> 
>     aggregate <- aggregate(bcidata$PX,bcidata[,c("Xgrid","Ygrid","IDNgrid")],
> FUN = length)
> 
>     Totalgrids <- length(levels(bcidata$IDgrid))
> 
>     Occupiedgrids <- length(aggregate$IDNgrid)
> 
>     sum <- sum(aggregate$x)
> 
>     TotalArea <- 500000
> 
>     Area <- (1000/i*500/j)
> 
>     Occupancy <- (Occupiedgrids/Totalgrids)
> 
>     Mean <- length(bcidata$Latin)/(Occupiedgrids)
> 
>     Variance <- var(aggregate$x)
> 
>     occupancymean.data.frame <- rbind(occupancymean.data.frame,
> data.frame(Area, Totalgrids, Occupiedgrids, Occupancy, Mean, Variance))
> 
>   }
> 
>   occupancymean.data.frame
> 
>   Occupancy <- occupancymean.data.frame$Occupancy
> 
>   Mean <- occupancymean.data.frame$Mean
> 
>   poission <- nls(Occupancy ~ 1-exp(-rho*Mean), start = list(rho = 2.1),
> data = occupancymean.data.frame)
> 
>   nachman <- nls(Occupancy ~ 1-exp(-alpha*Mean^beta), start = list(alpha =
> 0.2, beta = 0.1), data = occupancymean.data.frame)
> 
>   logistic <- nls(Occupancy ~ (alpha*Mean^beta)/(1+alpha*Mean^beta), start
> = list(alpha = 0.2, beta = 0.1),data = occupancymean.data.frame)
> 
>   nbd <- nls(Occupancy ~ 1-(1+(Mean)/k)^-k, start = list(k = 1), data =
> occupancymean.data.frame)
> 
>   power <- nls(Occupancy ~ alpha*Mean^beta, start = list(alpha = 0.2, beta=
> 0.1), data = occupancymean.data.frame)
> 
>   inbd <- nls(Occupancy ~
> 1-(alpha*(Mean^(beta-1)))^(Mean/(1-alpha*Mean^(beta-1))), start =
> list(alpha = 0.2, beta = 0.3),
> 
>               data = occupancymean.data.frame)
> 
>   fnbd <- nls(Occupancy ~ 1- (gamma(N +
> k/(Mean*A/N)-k)*gamma(k/(Mean*A/N)))/(gamma(k/(Mean*A/N)-k)*gamma(N+k/(Mean*A/N))),
> 
> 
>               start = list(k = 0.2, A = 0.1, N = 0.2), data =  occupancymean
> .data.frame)
> 
>   bayesianII <- nls(Occupancy ~ 1-(theta*beta^(2*(TotalArea
> *Mean/sum)^0.5)*delta^(TotalArea*Mean/sum)), start = list(theta=0.9956,
> beta=1, delta=1), data = occupancymean.data.frame)
> 
> 
>   return(list(summary(poission), summary(nachman), summary(logistic),
> summary(nbd),
> 
>               summary(power), summary(inbd), summary(fnbd), summary(
> bayesianII)))
> 
> }
> 
> Modelsfunc(bcidata)
> 
> Your assistance will be highly appreciated. Thanks in advance.
> 
> Regards,
> 
> 
> *Evans Ochiaga*
> 
> *African Institute for Mathematical Sciences*
> 
> *6 Melrose Road*
> 
> *Muizenberg, South Africa*
> 
> *Msc in Mathematical Sciences+27 84 61 69 183 *
> 
> *"When I cannot understand my Father?s leading, And it seems to be but hard
> and cruel fate, Still I hear that gentle whisper ever pleading, God is
> working, God is faithful?Only wait."*
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] Asssistance
Duncan Murdoch