3 Grouping ppp-Hypercolumn
These packages (Note 1) are a one-person project undergoing rapid evolution. Backward compatibility (per Hadley Wickham) is provided as a courtesy rather than a guarantee.
Until further notice, these packages should
- not be used as the basis for research grant applications or referenced in final research progress reports,
- not be cited as an actively maintained tool in a peer-reviewed manuscript,
- not be used to support or fulfill requirements for pursuing an academic degree.
In addition, work primarily based on these packages (Note 1) should not be presented at academic conferences or similar scholarly venues.
Furthermore, a person’s ability to use these packages (Note 1) does not necessarily imply an understanding of their underlying mechanisms. Accordingly, demonstration of their use alone should not be considered sufficient evidence of expertise, nor should it be credited as a basis for academic promotion or advancement.
These statements do not apply to the contributors (Tip 1) to these packages (Note 1) with respect to their specific contributions.
These statements do not apply when the maintainer of these packages (Note 1), Tingting Zhan, is credited as the first author, the lead author, and/or the corresponding author in a peer-reviewed manuscript, or as the Principal Investigator or Co-Principal Investigator in a research grant application and/or a final research progress report.
These statements are advisory in nature and do not modify or restrict the rights granted under the GNU General Public License https://www.r-project.org/Licenses/.
The examples in Chapter 3 require
library(groupedHyperframe)
library(survival)Listing 3.1 creates a grouped hyper data frame s with one-and-only-one point-pattern (ppp, Chapter 24) hypercolumn from the data frame wrobel_lung. This process (Chapter 31)
- takes a data frame
wrobel_lungas input; - creates a point-pattern hypercolumn
ppp.from the \(x\)- and \(y\)-coordinates, the numeric markhladrand the multi-type markphenotype, perimage_idnested withinpatient_id; - aggregates other variables of interest, e.g.,
OS,genderandage, at the level ofimage_idnested withinpatient_id. Those variables must be identical within the nested grouping structure~patient_id/image_id; - returns a grouped hyper data frame
s.
ppp-hypercolumn
s = wrobel_lung |>
grouped_ppp(
formula = hladr + phenotype ~ OS + gender + age,
by = ~ patient_id/image_id
)Readers may view the grouped hyper data frame s (Listing 3.1) by simply typing s at the R console prompt and pressing Enter (Listing 3.2),
s (Listing 3.1)
sGrouped Hyper Data Frame: ~patient_id
3 patient_id
OS gender age patient_id image_id ppp.
1 176 M 84 #03 2-080-378 [36953,13765].im3 (ppp)
2 176 M 84 #03 2-080-378 [39206,15250].im3 (ppp)
3 176 M 84 #03 2-080-378 [40242,17359].im3 (ppp)
4 176 M 84 #03 2-080-378 [40863,16444].im3 (ppp)
5 3488+ F 85 #01 0-889-121 [40864,18015].im3 (ppp)
6 176 M 84 #03 2-080-378 [41191,13764].im3 (ppp)
7 3488+ F 85 #01 0-889-121 [42689,19214].im3 (ppp)
8 3488+ F 85 #01 0-889-121 [42806,16718].im3 (ppp)
9 3488+ F 85 #01 0-889-121 [44311,17766].im3 (ppp)
10 3488+ F 85 #01 0-889-121 [45366,16647].im3 (ppp)
11 1605 M 66 #02 1-037-393 [56576,16907].im3 (ppp)
12 1605 M 66 #02 1-037-393 [56583,15235].im3 (ppp)
13 1605 M 66 #02 1-037-393 [57130,16082].im3 (ppp)
14 1605 M 66 #02 1-037-393 [57396,17896].im3 (ppp)
15 1605 M 66 #02 1-037-393 [57403,16934].im3 (ppp)
Also, readers may view the summary information of the grouped hyper data frame s (Listing 3.1) using the function summary() (Listing 3.3),
s (Listing 3.1)
s |>
summary()Grouped Hyper Data Frame: ~patient_id
3 patient_id
OS gender age patient_id
(Surv) (factor) (numeric) (factor)
<time-to-event> :(Surv) F: 5 Min. :66.00 #01 0-889-121:5
[right-censored]:5 M:10 1st Qu.:66.00 #02 1-037-393:5
[observed] :10 Median :84.00 #03 2-080-378:5
Mean :78.33
3rd Qu.:85.00
Max. :85.00
image_id ppp.
(factor) (ppp)
[36953,13765].im3:1
[39206,15250].im3:1
[40242,17359].im3:1
[40863,16444].im3:1
[40864,18015].im3:1
[41191,13764].im3:1
(Other) :9
Readers must note that Chapter 2 and Chapter 3 describe two independent approaches to
- create a grouped hyper data frame, from a data frame (Chapter 2, Listing 2.2, Section 12.1);
- create a grouped hyper data frame with one-and-only-one point-pattern hypercolumn, from a data frame (Chapter 3, Listing 3.1, Chapter 31).
These two approaches are independent and unrelated to each other (Section 40.1).