Title: | Counts the Number of True Positives and False Positives |
---|---|
Description: | Calculates the number of true positives and false positives from a dataset formatted for Jackknife alternative free-response receiver operating characteristic which is used for statistical analysis which is explained in the book 'Chakraborty' 'DP' (2017), "Observer Performance Methods for Diagnostic Imaging - Foundations, Modeling, and Applications with R-Based Examples", Taylor-Francis <https://www.crcpress.com/9781482214840>. |
Authors: | Issei Tsunoda [aut, cre] |
Maintainer: | Issei Tsunoda <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.1 |
Built: | 2024-11-16 06:48:08 UTC |
Source: | CRAN |
m,q,c
from integers: M,Q,C
Makes m,q,c
vectors
from a collection of three integers M,Q,C
,
where three vectors m,q,c
denotes modality ID, reader ID, confidence level,
respectively.
caseID_m_q_c_vector_from_NI_M_Q_C(NI, M, Q, C)
caseID_m_q_c_vector_from_NI_M_Q_C(NI, M, Q, C)
NI |
A positive integer, indicating the number of cases, i.e., images |
M |
A positive integer, representing modality ID |
Q |
A positive integer, representing reader ID |
C |
A positive integer, representing confidence level |
My research is not supported any found, I am completely independent and only my own or my parents are supported my research. No internet, poor condition, I made this. I must go on untill jounal accepts my manuscripts.
I am not happy to spent with FROC analysis, since it is not my interest. I want to research pure mathematics. I do not want to waste a time. I do not want to waste a time in hospital or plurigo nodularis. When I become happy? This program helps me? With great pain at 2019 Sept. 2019 Sept. 8
A data-frame, including three vectors, which are named m,q,c
representing modality ID and reader ID and confidence level, respectively.
For example, the resulting object of a <- m_q_c_vector_from_M_Q_C(2,3,4)
is given by
> a
m
|
q |
c |
-------- | ------ | --------- |
1 | 1 | 4 |
1 | 1 | 3 |
1 | 1 | 2 |
1 | 1 | 1 |
1 | 2 | 4 |
1 | 2 | 3 |
1 | 2 | 2 |
1 | 2 | 1 |
1 | 3 | 4 |
1 | 3 | 3 |
1 | 3 | 2 |
1 | 3 | 1 |
2 | 1 | 4 |
2 | 1 | 3 |
2 | 1 | 2 |
2 | 1 | 1 |
2 | 2 | 4 |
2 | 2 | 3 |
2 | 2 | 2 |
2 | 2 | 1 |
2 | 3 | 4 |
2 | 3 | 3 |
2 | 3 | 2 |
2 | 3 | 1 |
#======================================================================================== # Create a ID vectors #======================================================================================== a <- caseID_m_q_c_vector_from_NI_M_Q_C(2,2,3,4) a$caseID a$m a$q a$c
#======================================================================================== # Create a ID vectors #======================================================================================== a <- caseID_m_q_c_vector_from_NI_M_Q_C(2,2,3,4) a$caseID a$m a$q a$c
.xlsx
File
of Jafroc
into R objectConvert an FROC dataset
.xlsx
file of Jafroc
R object
convertFromJafroc(No.of.Modalities, No.of.readers, No.of.confidence.levels)
convertFromJafroc(No.of.Modalities, No.of.readers, No.of.confidence.levels)
No.of.Modalities |
A positive integer, indicating the number of modalities for FROC data-set in |
No.of.readers |
A positive integer, indicating the number of readers for FROC data-set in an |
No.of.confidence.levels |
A positive integer, indicating the number of confidence levels for FROC data-set in |
The .xlsx
file of Jafroc
consists of three sheets named TP, FP, Truth, precisely! Correctly!
(other names never be permitted !!)
———————————– TP ——————————————
A sheet named TP consists of five columns precisely named from the right hand side:
ReaderID, ModalityID, CaseID, LesionID, TP_Rating.
NOTE.
Note that the above word CaseID means the Image ID vectors indicating the ID of radiographs. That is "case = image = radiograph".
Note that the first row of each sheat of .xlsx
file is constructed by the names of column as follows:
An Example of the sheet named TP in a .xlsx
file for the Jafroc software
Interpretation of table
Throughout this explanation, we follow the convention that readers are male.
For example, the first row means the first reader (ReaderID=1) correctly find the first lesion (LesionID = 1) in the first image (CaseID = 1) taken by the first modality (ModalityID = 1) with his rating 5 (TP_Rating =5).
Similarly, the second row means the first reader (ReaderID=1) correctly find the 4-th lesion (LesionID = 4) in the second image (CaseID = 2) taken by the 2-nd modality (ModalityID = 2) with his rating 4 (TP_Rating = 4).
ReaderID | ModalityID | CaseID | LesionID | TP_Rating. |
------------------- | ------------------- | ------------------- | ------------------- | ------------------ |
1 | 1 | 1 | 1 | 5 |
1 | 2 | 2 | 1 | 4 |
1 | 3 | 4 | 1 | 5 |
1 | 1 | 8 | 1 | 3 |
1 | 2 | 8 | 2 | 4 |
1 | 3 | 9 | 1 | 4 |
1 | 1 | 9 | 2 | 3 |
1 | 2 | 9 | 3 | 5 |
1 | 3 | 11 | 1 | 3 |
2 | 1 | 1 | 1 | 4 |
2 | 2 | 4 | 1 | 4 |
2 | 3 | 5 | 1 | 4 |
2 | 1 | 8 | 1 | 1 |
2 | 2 | 8 | 2 | 2 |
2 | 3 | 8 | 3 | 2 |
2 | 1 | 10 | 1 | 3 |
2 | 2 | 10 | 2 | 2 |
2 | 3 | 11 | 1 | 2 |
: | : | : | : | : |
: | : | : | : | : |
———————————– FP ——————————————
A sheet named FP consists of four columns precisely
named from the right hand side: ReaderID, ModalityID, CaseID, FP_Rating
An Example of a sheet named FP in a file of extension ".xlsx
" file for the Jafroc software
Interpretation of table
For example, the first row means that the first reader (ReaderID=1) makes a false alarm location in the first image (CaseID = 1) taken by the first modality (ModalityID = 1) with his rating 2 (TP_Rating =2).
Similarly, the second row means that the first reader (ReaderID=1) makes a false alarm location in the second image (CaseID = 2) taken by the 2-nd modality (ModalityID = 2) with his rating 1 (TP_Rating = 1).
Similarly, the 6-th and 7-th rows mean that the first reader (ReaderID=1) makes two false alarm location in the second patient (CaseID = 2). The first false alarm is in the image taken by the 1-st modality (ModalityID = 1) with his rating 1 (TP_Rating = 1). The second false alarm is in the image taken by the 3-rd modality (ModalityID = 3) with his rating 2 (TP_Rating = 2).
ReaderID | ModalityID | CaseID | FP_Rating. |
------------------- | ------------------- | ------------------- | ------------------ |
1 | 1 | 1 | 2 |
1 | 2 | 2 | 1 |
1 | 3 | 3 | 1 |
1 | 1 | 5 | 2 |
1 | 2 | 7 | 1 |
1 | 3 | 7 | 2 |
1 | 1 | 9 | 3 |
1 | 2 | 9 | 4 |
1 | 3 | 10 | 1 |
2 | 1 | 1 | 2 |
2 | 2 | 2 | 3 |
2 | 3 | 3 | 4 |
2 | 1 | 8 | 1 |
2 | 2 | 9 | 1 |
2 | 3 | 11 | 1 |
2 | 1 | 14 | 1 |
2 | 2 | 15 | 1 |
2 | 3 | 21 | 2 |
: | : | : | : |
: | : | : | : |
———————————– Truth ——————————————
A sheet named Truth consists of three columns precisely named from the right hand side:CaseID, LesionID, Weight .
An Example of a sheet named Truth in a .xlsx
file for the Jafroc software
Interpretation of table
For example, the first image (CaseID = 1) contains three lesions each of which is named 1,2,3, namely LesionID = 1,2,3. For example, the second image (CaseID = 2) contains two lesions each of which is named 1,2, namely LesionID = 1,2. For example, the third image (CaseID = 3) contains a sinle lesion named 1, namely LesionID = 1.
CaseID | LesionID | Weight |
------------------- | ------------------- | ------------------ |
1 | 1 | 0.3333... |
1 | 2 | 0.3333... |
1 | 3 | 0.3333... |
2 | 1 | 0.5 |
2 | 2 | 0.5 |
3 | 1 | 1 |
4 | 1 | 0.25 |
4 | 2 | 0.25 |
4 | 3 | 0.25 |
4 | 4 | 0.25 |
5 | 1 | 0.5 |
5 | 2 | 0.5 |
6 | 1 | 0.3333... |
6 | 2 | 0.3333... |
6 | 3 | 0.3333... |
7 | 1 | 0.3333... |
7 | 2 | 0.3333... |
7 | 3 | 0.3333... |
8 | 1 | 0.25 |
8 | 2 | 0.25 |
8 | 3 | 0.25 |
8 | 4 | 0.25 |
: | : | : |
: | : | : |
Note that the weght are used such that each image influences a same effect on the esimates. Without weight, the images including many targets (lesions) will have very strong effect on the estimates. To avoid such bias, Jafroc uses weight. In another context, weight would be used to specify more important lesions in each image.
In this package, we do not use the information of weight. Since the theory of the author of this package did not consider such weight. In the future I have to include the notion of weight. Jafroc use the notion fo figure of metric as non parametric manner. So, it seems difficult to include it in the Bayesian model, since generally speaking, Bayesian methodology is parametric.
Convert an Excel file whose extension
is .xlsx
of Jafroc format to
an R object representing FROC data
Revised 2019 Jun 19 Revised 2019 Dec 13
The return values include a
list which can be passed to the function fit_Bayesian_FROC
.
For data of Jafroc, running this function,
we immediately can fit the author's Bayesian
FROC model to this return value.
The Jafroc software's format consists of suspicious locations marked by readers and true locations. Such data is redundant for our Bayesian statistical models. So, we reduce the information of data to the number of false positives and number of hits for each confidence levels by this function.
Data can be calculated from the following Jafroc data, in which there are more information than TP and FP. In fact, in the Jafroc data, the FP and TP are counted for each images, each lesions etc. So, it has more information.
It causes limitation of our model. So, our model start to fit a model to the reduced data from Jafroc. So, the redunction will cause the non accuracy evaluation of the observer performance. The future research I should start the Jafroc formulation.
A list, representing FROC data.
Bayesian Models for Free-response Receiver Operating Characteristic Analysis,pre-print
Rjafroc, which is unfortunately not on CRAN, now 2019 Jun 19. Or JAFROC software in the Chakarboty's Web page. Unfortunately, this software is no longer supported.
## Only run examples in interactive R sessions if (interactive()) { #======================================================================================== # Example for convert the Jafroc data #======================================================================================== # Work Flow # step 0) Make an .xlsx file "JafrocDatasetExample.xlsx" as example data # to be passed to the function by an interactive manner. # step 1) Convert the "JafrocDatasetExample.xlsx" file to an R object # In the following code, when dialog box asks users to select a file, then # Select "JafrocDatasetExample.xlsx" in working directory. # This is important, so I write twice, again. # In the following code, when dialog box asks you to select a file, then # Select "JafrocDatasetExample.xlsx" in Working directory. # In the following code, when dialog box asks you to select a file, then # Select "JafrocDatasetExample.xlsx" in Working directory. #======================================================================================== # step 0) Make a Jafroc data as an example dataset #======================================================================================== # If you can find the xlsx file named JAFROC_data.xlsx # in the director "inst/extdata" of this package, # Then this step 0) is redundant. The author prepares this example for the people who # cannot find the xlsx file in the "inst/extdata" of this package. # Using an xlsx file ( which is named JAFROC_data.xlsx and # included in the director "inst/extdata" of this package,) # we can reconstruct it as follows:(If someone can obtain the Excel file # from the path tpfp/inst/extdata/JAFROC_data.xlsx, then the following code # is not required to run, because the same xlsx file is created. Truth <- readxl::read_excel(system.file("extdata", "JAFROC_data.xlsx", package="tpfp"), sheet = "Truth") ##### utils::View(Truth) TP <- readxl::read_excel( system.file("extdata", "JAFROC_data.xlsx", package="tpfp"), sheet = "TP") #### utils::View(TP) FP <- readxl::read_excel( system.file("extdata", "JAFROC_data.xlsx", package="tpfp"), sheet = "FP") #### utils::View(FP) sample <- list(TP=TP,FP=FP,Truth=Truth) openxlsx::write.xlsx(sample,"JafrocDatasetExample.xlsx") tcltk::tkmessageBox( message="A file named JafrocDatasetExample.xlsx is created in the working directory") # Now, we obtain an excel file named "JafrocDatasetExample.xlsx", which is same as # the JAFROC_data.xlsx. # whose format is available in the Jafroc software developed by Chakraborty. # Note that if you have an excel file # which is formulated correctolly for our package, # then the above process does not be required. # (0) From the above, we obtain "JafrocDatasetExample.xlsx" # which is the multiple reader and multiple modality dataset # for Jafroc analysis which is Chakraborty's software Jafroc or the R package Rjafroc # but NOT implemented in our package,. #======================================================================================== # step 1) Convert the Jafroc data obtained in the above #======================================================================================== # (1) Using "JafrocDatasetExample.xlsx" as an example excel file, # we run the function to convert the excel file from Jafroc format # to our format: dataList <- convertFromJafroc( No.of.Modalities =5, No.of.readers =4, No.of.confidence.levels = 5 ) # In the variable, there is no xlsx files, since it is selected by interactive manner. # So, please select the xlsx file, i.e., "JafrocDatasetExample.xlsx" obtained # in step 0) or your own Jafroc .xlsx file. }### Only run examples in interactive R sessions
## Only run examples in interactive R sessions if (interactive()) { #======================================================================================== # Example for convert the Jafroc data #======================================================================================== # Work Flow # step 0) Make an .xlsx file "JafrocDatasetExample.xlsx" as example data # to be passed to the function by an interactive manner. # step 1) Convert the "JafrocDatasetExample.xlsx" file to an R object # In the following code, when dialog box asks users to select a file, then # Select "JafrocDatasetExample.xlsx" in working directory. # This is important, so I write twice, again. # In the following code, when dialog box asks you to select a file, then # Select "JafrocDatasetExample.xlsx" in Working directory. # In the following code, when dialog box asks you to select a file, then # Select "JafrocDatasetExample.xlsx" in Working directory. #======================================================================================== # step 0) Make a Jafroc data as an example dataset #======================================================================================== # If you can find the xlsx file named JAFROC_data.xlsx # in the director "inst/extdata" of this package, # Then this step 0) is redundant. The author prepares this example for the people who # cannot find the xlsx file in the "inst/extdata" of this package. # Using an xlsx file ( which is named JAFROC_data.xlsx and # included in the director "inst/extdata" of this package,) # we can reconstruct it as follows:(If someone can obtain the Excel file # from the path tpfp/inst/extdata/JAFROC_data.xlsx, then the following code # is not required to run, because the same xlsx file is created. Truth <- readxl::read_excel(system.file("extdata", "JAFROC_data.xlsx", package="tpfp"), sheet = "Truth") ##### utils::View(Truth) TP <- readxl::read_excel( system.file("extdata", "JAFROC_data.xlsx", package="tpfp"), sheet = "TP") #### utils::View(TP) FP <- readxl::read_excel( system.file("extdata", "JAFROC_data.xlsx", package="tpfp"), sheet = "FP") #### utils::View(FP) sample <- list(TP=TP,FP=FP,Truth=Truth) openxlsx::write.xlsx(sample,"JafrocDatasetExample.xlsx") tcltk::tkmessageBox( message="A file named JafrocDatasetExample.xlsx is created in the working directory") # Now, we obtain an excel file named "JafrocDatasetExample.xlsx", which is same as # the JAFROC_data.xlsx. # whose format is available in the Jafroc software developed by Chakraborty. # Note that if you have an excel file # which is formulated correctolly for our package, # then the above process does not be required. # (0) From the above, we obtain "JafrocDatasetExample.xlsx" # which is the multiple reader and multiple modality dataset # for Jafroc analysis which is Chakraborty's software Jafroc or the R package Rjafroc # but NOT implemented in our package,. #======================================================================================== # step 1) Convert the Jafroc data obtained in the above #======================================================================================== # (1) Using "JafrocDatasetExample.xlsx" as an example excel file, # we run the function to convert the excel file from Jafroc format # to our format: dataList <- convertFromJafroc( No.of.Modalities =5, No.of.readers =4, No.of.confidence.levels = 5 ) # In the variable, there is no xlsx files, since it is selected by interactive manner. # So, please select the xlsx file, i.e., "JafrocDatasetExample.xlsx" obtained # in step 0) or your own Jafroc .xlsx file. }### Only run examples in interactive R sessions
.xlsx
File
of Jafroc
into R objectConvert an FROC dataset
.xlsx
file of Jafroc
R object
convertFromJafrocCasewise( No.of.Modalities, No.of.readers, No.of.confidence.levels, debug = FALSE )
convertFromJafrocCasewise( No.of.Modalities, No.of.readers, No.of.confidence.levels, debug = FALSE )
No.of.Modalities |
A positive integer, indicating the number of modalities for FROC data-set in |
No.of.readers |
A positive integer, indicating the number of readers for FROC data-set in an |
No.of.confidence.levels |
A positive integer, indicating the number of confidence levels for FROC data-set in |
debug |
A logical, whether, inner objects in function is push out into global environment or not. |
The .xlsx
file of Jafroc
consists of three sheets named TP, FP, Truth, precisely! Correctly!
(other names never be permitted !!)
———————————– TP ——————————————
A sheet named TP consists of five columns precisely named from the right hand side:
ReaderID, ModalityID, CaseID, LesionID, TP_Rating.
NOTE.
Note that the above word CaseID means the Image ID vectors indicating the ID of radiographs. That is "case = image = radiograph".
Note that the first row of each sheat of .xlsx
file is constructed by the names of column as follows:
An Example of the sheet named TP in a .xlsx
file for the Jafroc software
Interpretation of table
Throughout this explanation, we follow the convention that readers are male.
For example, the first row means the first reader (ReaderID=1) correctly find the first lesion (LesionID = 1) in the first image (CaseID = 1) taken by the first modality (ModalityID = 1) with his rating 5 (TP_Rating =5).
Similarly, the second row means the first reader (ReaderID=1) correctly find the 4-th lesion (LesionID = 4) in the second image (CaseID = 2) taken by the 2-nd modality (ModalityID = 2) with his rating 4 (TP_Rating = 4).
ReaderID | ModalityID | CaseID | LesionID | TP_Rating. |
------------------- | ------------------- | ------------------- | ------------------- | ------------------ |
1 | 1 | 1 | 1 | 5 |
1 | 2 | 2 | 1 | 4 |
1 | 3 | 4 | 1 | 5 |
1 | 1 | 8 | 1 | 3 |
1 | 2 | 8 | 2 | 4 |
1 | 3 | 9 | 1 | 4 |
1 | 1 | 9 | 2 | 3 |
1 | 2 | 9 | 3 | 5 |
1 | 3 | 11 | 1 | 3 |
2 | 1 | 1 | 1 | 4 |
2 | 2 | 4 | 1 | 4 |
2 | 3 | 5 | 1 | 4 |
2 | 1 | 8 | 1 | 1 |
2 | 2 | 8 | 2 | 2 |
2 | 3 | 8 | 3 | 2 |
2 | 1 | 10 | 1 | 3 |
2 | 2 | 10 | 2 | 2 |
2 | 3 | 11 | 1 | 2 |
: | : | : | : | : |
: | : | : | : | : |
———————————– FP ——————————————
A sheet named FP consists of four columns precisely
named from the right hand side: ReaderID, ModalityID, CaseID, FP_Rating
An Example of a sheet named FP in a .xlsx
file for the Jafroc software
Interpretation of table
For example, the first row means the first reader (ReaderID=1) makes a false alarm location in the first image (CaseID = 1) taken by the first modality (ModalityID = 1) with his rating 2 (TP_Rating =2).
Similarly, the second row means the first reader (ReaderID=1) makes a false alarm location in the second image (CaseID = 2) taken by the 2-nd modality (ModalityID = 2) with his rating 1 (TP_Rating = 1).
Similarly, the 6-th and 7-th rows mean that the first reader (ReaderID=1) makes two false alarm location in the second patient (CaseID = 2). The first false alarm is in the image taken by the 1-st modality (ModalityID = 1) with his rating 1 (TP_Rating = 1). The second false alarm is in the image taken by the 3-rd modality (ModalityID = 3) with his rating 2 (TP_Rating = 2).
ReaderID | ModalityID | CaseID | FP_Rating. |
------------------- | ------------------- | ------------------- | ------------------ |
1 | 1 | 1 | 2 |
1 | 2 | 2 | 1 |
1 | 3 | 3 | 1 |
1 | 1 | 5 | 2 |
1 | 2 | 7 | 1 |
1 | 3 | 7 | 2 |
1 | 1 | 9 | 3 |
1 | 2 | 9 | 4 |
1 | 3 | 10 | 1 |
2 | 1 | 1 | 2 |
2 | 2 | 2 | 3 |
2 | 3 | 3 | 4 |
2 | 1 | 8 | 1 |
2 | 2 | 9 | 1 |
2 | 3 | 11 | 1 |
2 | 1 | 14 | 1 |
2 | 2 | 15 | 1 |
2 | 3 | 21 | 2 |
: | : | : | : |
: | : | : | : |
———————————– Truth ——————————————
A sheet named Truth consists of three columns precisely named from the right hand side:CaseID, LesionID, Weight .
An Example of a sheet named Truth in a .xlsx
file for the Jafroc software
Interpretation of table
For example, the first image (CaseID = 1) contains three lesions each of which is named 1,2,3, namely LesionID = 1,2,3. For example, the second image (CaseID = 2) contains two lesions each of which is named 1,2, namely LesionID = 1,2. For example, the third image (CaseID = 3) contains a sinle lesion named 1, namely LesionID = 1.
CaseID | LesionID | Weight |
------------------- | ------------------- | ------------------ |
1 | 1 | 0.3333... |
1 | 2 | 0.3333... |
1 | 3 | 0.3333... |
2 | 1 | 0.5 |
2 | 2 | 0.5 |
3 | 1 | 1 |
4 | 1 | 0.25 |
4 | 2 | 0.25 |
4 | 3 | 0.25 |
4 | 4 | 0.25 |
5 | 1 | 0.5 |
5 | 2 | 0.5 |
6 | 1 | 0.3333... |
6 | 2 | 0.3333... |
6 | 3 | 0.3333... |
7 | 1 | 0.3333... |
7 | 2 | 0.3333... |
7 | 3 | 0.3333... |
8 | 1 | 0.25 |
8 | 2 | 0.25 |
8 | 3 | 0.25 |
8 | 4 | 0.25 |
: | : | : |
: | : | : |
Note that the weght are used such that each image influences a same effect on the esimates. Without weight, the images including many targets (lesions) will have very strong effect on the estimates. To avoid such bias, Jafroc uses weight. In another context, weight would be used to specify more important lesions in each image.
In this package, we do not use the information of weight. Since the theory of the author of this package did not consider such weight. In the future I have to include the notion of weight. Jafroc use the notion fo figure of metric as non parametric manner. So, it seems difficult to include it in the Bayesian model, since generally speaking, Bayesian methodology is parametric.
Convert an Excel file whose extension
is .xlsx
of Jafroc format to
an R object representing FROC data.
The return values include a
list which can be passed to the function fit_Bayesian_FROC
.
For data of Jafroc, running this function,
we immediately can fit the author's Bayesian
FROC model to this return value.
The Jafroc software's format consists of suspicious locations marked by readers and true locations. Such data is redundant for our Bayesian statistical models. So, we reduce the information of data to the number of false positives and number of hits for each confidence levels by this function.
Data can be calculated from the following Jafroc data, in which there are more information than TP and FP. In fact, in the Jafroc data, the FP and TP are counted for each images, each lesions etc. So, it has more information.
It causes limitation of our model. So, our model start to fit a model to the reduced data from Jafroc. So, the redunction will cause the non accuracy evaluation of the observer performance. The future research I should start the Jafroc formulation.
A list, representing FROC data.
Bayesian Models for Free-response Receiver Operating Characteristic Analysis,pre-print
Rjafroc, which is unfortunately not on CRAN, now 2019 Jun 19. Or JAFROC software in the Chakarboty's Web page. Unfortunately, this software is no longer supported.
## Only run examples in interactive R sessions if (interactive()) { #======================================================================================== # Example for convert the Jafroc data #======================================================================================== # Work Flow # step 0) Make an .xlsx file "JafrocDatasetExample.xlsx" as example data # to be passed to the function by interactive manner. # step 1) Convert the "JafrocDatasetExample.xlsx" file to an R object # In the following code, when dialog box asks you to select a file, then # Select "JafrocDatasetExample.xlsx" in Working directory. # This is important, so I write twice, again. # In the following code, when dialog box asks you to select a file, then # Select "JafrocDatasetExample.xlsx" in Working directory. # In the following code, when dialog box asks you to select a file, then # Select "JafrocDatasetExample.xlsx" in Working directory. #======================================================================================== # step 0) Make a Jafroc data as an example dataset #======================================================================================== # If you can find the xlsx file named JAFROC_data.xlsx # in the director "inst/extdata" of this package, # Then this step 0) is redundant. The author prepares this example for the people who # cannot find the xlsx file in the "inst/extdata" of this package. # Using an xlsx file ( which is named JAFROC_data.xlsx and # included in the director "inst/extdata" of this package,) # we can reconstruct it as follows:(If someone can obtain the Excel file # from the path tpfp/inst/extdata/JAFROC_data.xlsx, then the following code # is not required to run, because the same xlsx file is created. Truth <- readxl::read_excel(system.file("extdata", "JAFROC_data.xlsx", package="tpfp"), sheet = "Truth") ##### utils::View(Truth) TP <- readxl::read_excel( system.file("extdata", "JAFROC_data.xlsx", package="tpfp"), sheet = "TP") #### utils::View(TP) FP <- readxl::read_excel( system.file("extdata", "JAFROC_data.xlsx", package="tpfp"), sheet = "FP") #### utils::View(FP) sample <- list(TP=TP,FP=FP,Truth=Truth) openxlsx::write.xlsx(sample,"JafrocDatasetExample.xlsx") tcltk::tkmessageBox( message="A file named JafrocDatasetExample.xlsx is created in the working directory") # Now, we obtain an excel file named "JafrocDatasetExample.xlsx", which is same as # the JAFROC_data.xlsx. # whose format is available in the Jafroc software developed by Chakraborty. # Note that if you have an excel file # which is formulated correctolly for our package, # then the above process does not be required. # (0) From the above, we obtain "JafrocDatasetExample.xlsx" # which is the multiple reader and multiple modality dataset # for Jafroc analysis which is Chakraborty's software Jafroc or the R package Rjafroc # but NOT implemented in our package,. #======================================================================================== # step 1) Convert the Jafroc data obtained in the above #======================================================================================== # (1) Using "JafrocDatasetExample.xlsx" as an example excel file, # we run the function to convert the excel file from Jafroc format # to our format: dataList <- convertFromJafrocCasewise( No.of.Modalities =5, No.of.readers =4, No.of.confidence.levels = 5 ) # In the variable, there is no xlsx files, since it is selected by interactive manner. # So, please select the xlsx file, i.e., "JafrocDatasetExample.xlsx" obtained # in step 0) or your own Jafroc .xlsx file. }### Only run examples in interactive R sessions
## Only run examples in interactive R sessions if (interactive()) { #======================================================================================== # Example for convert the Jafroc data #======================================================================================== # Work Flow # step 0) Make an .xlsx file "JafrocDatasetExample.xlsx" as example data # to be passed to the function by interactive manner. # step 1) Convert the "JafrocDatasetExample.xlsx" file to an R object # In the following code, when dialog box asks you to select a file, then # Select "JafrocDatasetExample.xlsx" in Working directory. # This is important, so I write twice, again. # In the following code, when dialog box asks you to select a file, then # Select "JafrocDatasetExample.xlsx" in Working directory. # In the following code, when dialog box asks you to select a file, then # Select "JafrocDatasetExample.xlsx" in Working directory. #======================================================================================== # step 0) Make a Jafroc data as an example dataset #======================================================================================== # If you can find the xlsx file named JAFROC_data.xlsx # in the director "inst/extdata" of this package, # Then this step 0) is redundant. The author prepares this example for the people who # cannot find the xlsx file in the "inst/extdata" of this package. # Using an xlsx file ( which is named JAFROC_data.xlsx and # included in the director "inst/extdata" of this package,) # we can reconstruct it as follows:(If someone can obtain the Excel file # from the path tpfp/inst/extdata/JAFROC_data.xlsx, then the following code # is not required to run, because the same xlsx file is created. Truth <- readxl::read_excel(system.file("extdata", "JAFROC_data.xlsx", package="tpfp"), sheet = "Truth") ##### utils::View(Truth) TP <- readxl::read_excel( system.file("extdata", "JAFROC_data.xlsx", package="tpfp"), sheet = "TP") #### utils::View(TP) FP <- readxl::read_excel( system.file("extdata", "JAFROC_data.xlsx", package="tpfp"), sheet = "FP") #### utils::View(FP) sample <- list(TP=TP,FP=FP,Truth=Truth) openxlsx::write.xlsx(sample,"JafrocDatasetExample.xlsx") tcltk::tkmessageBox( message="A file named JafrocDatasetExample.xlsx is created in the working directory") # Now, we obtain an excel file named "JafrocDatasetExample.xlsx", which is same as # the JAFROC_data.xlsx. # whose format is available in the Jafroc software developed by Chakraborty. # Note that if you have an excel file # which is formulated correctolly for our package, # then the above process does not be required. # (0) From the above, we obtain "JafrocDatasetExample.xlsx" # which is the multiple reader and multiple modality dataset # for Jafroc analysis which is Chakraborty's software Jafroc or the R package Rjafroc # but NOT implemented in our package,. #======================================================================================== # step 1) Convert the Jafroc data obtained in the above #======================================================================================== # (1) Using "JafrocDatasetExample.xlsx" as an example excel file, # we run the function to convert the excel file from Jafroc format # to our format: dataList <- convertFromJafrocCasewise( No.of.Modalities =5, No.of.readers =4, No.of.confidence.levels = 5 ) # In the variable, there is no xlsx files, since it is selected by interactive manner. # So, please select the xlsx file, i.e., "JafrocDatasetExample.xlsx" obtained # in step 0) or your own Jafroc .xlsx file. }### Only run examples in interactive R sessions