Skip to content
This repository was archived by the owner on Oct 13, 2022. It is now read-only.
This repository was archived by the owner on Oct 13, 2022. It is now read-only.

Substitution in lcens? #11

@ldecicco-USGS

Description

@ldecicco-USGS

I think this is a problem with substituting ]<-

set.seed(1932)
Xu <- rlnorm(100)
df <- data.frame(Xu = as.lcens(Xu, 1.0), group=factor(rep(c("A","B","C","D"),25), 
                                       levels = c("A","AA","B","C","D")))
df[as.character(df$group) == "A","Xu"] <- as.lcens(values = rnorm(25, 10, 3), detlim = 1)
head(df)
                 Xu group
1 <11.1744104888759     A
2                <1     B
3                <1     C
4  1.31066322812092     D
5 <10.4998180442565     A
6   1.2511555692737     B

All of the "A" values are now < some number greater than the detlim of 1.

Trying it this way:

Xu <- rlnorm(100)
Xu <- as.lcens(Xu, 1.0)
group=rep(c("A","B","C","D"),25)

Xu[group == "A"] <- as.lcens(values = rnorm(25, 10, 3), detlim = 1)
> Xu
      Values Limits
[1]    13.17 1     
[2]   <1     1     
[3]   <1     1     
[4]    1.46  1     
[5]    11.97 1     
[6]    4.113 1     
[7]   <1     1     
[8]    6.35  1     
[9]    9.318 1     
[10]   2.622 1     
[11]   3.121 1     
[12]   5.615 1     
[13]  <5.857 1     #?
[14]  <1     1     
[15]  <1     1     
[16]   1.52  1     
[17]  <14.06 1     #?
[18]  <1     1     
[19]   8.248 1     
[20]   3.612 1     
[21]   10.06 1     
[22]  <1     1     
[23]  <1     1     
[24]   4.469 1     
[25]   8.485 1     
[26]   2.197 1     
[27]   2.092 1     
[28]  <1     1     
[29]  <11.96 1     #?
[30]  <1     1     
[31]  <1     1     
[32]   2.517 1     
[33]  <5.774 1     
[34]  <1     1     
[35]   3.956 1     
[36]   1.571 1     
[37]  <6.398 1     
[38]   4.952 1     
[39]  <1     1     
[40]   1.465 1     
[41]  <5.178 1     
[42]   1.538 1     
[43]  <1     1     
[44]  <1     1     
[45]  <6.179 1     #?
[46]  <1     1     
[47]  <1     1     
[48]  <1     1     
[49]  <7.594 1     #?
[50]   4.034 1     
[51]  <1     1     
[52]   1.247 1     
[53]  <13.42 1     #?
[54]  <1     1     
[55]  <1     1     
[56]   3.374 1     
[57]   2.628 1     
[58]  <1     1     
[59]   2.101 1     
[60]   2.45  1     
[61]  <16.29 1     
[62]  <1     1     
[63]  <1     1     
[64]  <1     1     
[65]  <8.623 1     
[66]   3.365 1     
[67]  <1     1     
[68]  <1     1     
[69]  <6.917 1     
[70]  <1     1     
[71]   2.391 1     
[72]   2.895 1     
[73]   9.814 1     
[74]   2.214 1     
[75]  <1     1     
[76]   1.725 1     
[77]  <9.72  1     
[78]  <1     1     
[79]   1.384 1     
[80]   1.836 1     
[81]  <7.856 1     
[82]  <1     1     
[83]  <1     1     
[84]  <1     1     
[85]   9.089 1     
[86]  <1     1     
[87]   7.156 1     
[88]   2.071 1     
[89]   14.26 1     
[90]   1.083 1     
[91]   3.837 1     
[92]  <1     1     
[93]   12.49 1     
[94]  <1     1     
[95]  <1     1     
[96]  <1     1     
[97]  <11.29 1     
[98]   2.356 1     
[99]   1.097 1     

Still have values that are above the detlim, but designated as < (ie <11.29 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions