Skip to content

Commit

Permalink
Improve the use of the 'sapply' function for graphics (outputs are hi…
Browse files Browse the repository at this point in the history
…dden)
  • Loading branch information
aursiber committed Feb 14, 2024
1 parent 6b7eebb commit 04fad4e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions R/plotdistcens.R
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ plotdistcens <- function(censdata, distr, para, leftNA = -Inf, rightNA = Inf, NP
nnoricens<-length(noricens$left)
n<-length(censdata$left)


if (specifytitle) {
plot(c(0,0),c(0,0),type="n",xlim=xlim,ylim=ylim,xlab="Censored data",
ylab="CDF",main=titleCDF, ...)
Expand All @@ -275,7 +274,8 @@ plotdistcens <- function(censdata, distr, para, leftNA = -Inf, rightNA = Inf, NP
lines(c(xmininf, lcens[ordlcens[i]]), c(y, y), ...)
}
if (nlcens>=1)
toto<-sapply(1:nlcens,plotlcens)
invisible(sapply(1:nlcens,plotlcens))

plotnoricens<-function(i) {
y<-(i+nlcens)/n
if (noricens[ordmid[i],]$left!=noricens[ordmid[i],]$right)
Expand All @@ -284,13 +284,14 @@ plotdistcens <- function(censdata, distr, para, leftNA = -Inf, rightNA = Inf, NP
points(noricens[ordmid[i],]$left,y,pch=4, ...)
}
if (nnoricens>=1)
toto<-sapply(1:nnoricens,plotnoricens)
invisible(sapply(1:nnoricens,plotnoricens))

plotrcens<-function(i) {
y<-(i+nlcens+nnoricens)/n
lines(c(rcens[ordrcens[i]],xmaxinf),c(y,y), ...)
}
if (nrcens>=1)
toto <- sapply(1:nrcens,plotrcens)
invisible(sapply(1:nrcens,plotrcens))
} # en of else if NPMLE

if (!missing(distr)){ # plot of the theoretical cumulative function
Expand Down

0 comments on commit 04fad4e

Please sign in to comment.