Create an S4 class object that represents formula response for recurrent event data with optional checking procedures embedded.

Recur(
  time,
  id,
  event,
  terminal,
  origin,
  check = c("hard", "soft", "none"),
  ...
)

Arguments

time

A numerical vector representing the time of reccurence event or censoring, or a list with elements named "time1" and "time2" for specifying the follow-up of recurrent events. In the latter case, function %to% (or %2%) can be used for ease of typing. In addition to numeric values, Date and difftime are allowed and converted to numeric values. An error will be thrown if this argument is not specified.

id

Subject identificators. It can be numeric vector, character vector, or a factor vector. If it is left unspecified, Recur will assume that each row represents a subject.

event

A numeric vector that may represent the status, costs, or types of the recurrent events. Logical vector is allowed and converted to numeric vector. Non-positive values are internally converted to zero indicating censoring status.

terminal

A numeric vector that may represent the status, costs, or types of the terminal events. Logival vector is allowed and converted to numeric vector. Non-positive values are internally converted to zero indicating censoring status. If a scalar value is specified, all subjects will have the same status of terminal events at their last recurrent episodes. The length of the specified terminal should be equal to the number of subjects, or number of data rows. In the latter case, each subject may have at most one positive entry of terminal at the last recurrent episode.

origin

The time origin of each subject. If a scalar value is specified, all subjects will have the same origin at the specified value. The length of the specified origin should be equal to the number of subjects, or number of data rows. In the latter case, different subjects may have different origins. However, one subject must have the same origin. In addition to numeric values, Date and difftime are also supported and converted to numeric values.

check

A character value specifying how to perform the checks for recurrent event data. Errors or warnings will be thrown, respectively, if the check is specified to be "hard" (by default) or "soft". If check = "none" is specified, no data checking procedure will be run.

...

Other arguments for future usage. A warning will be thrown if any invalid argument is specified.

Value

An Recur object.

Details

This is a successor function of the deprecated function Survr. See the vignette by `vignette("reda-Recur")` for details.

Examples

library(reda) with(valveSeats, Recur(Days, ID))
#> [1] 251: (0, 761+] #> [2] 252: (0, 759+] #> [3] 327: (0, 98], (98, 667+] #> [4] 328: (0, 326], (326, 653], ..., (653, 667+] #> [5] 329: (0, 665+] #> [6] 330: (0, 84], (84, 667+] #> [7] 331: (0, 87], (87, 663+] #> [8] 389: (0, 646], (646, 653+] #> [9] 390: (0, 92], (92, 653+] #> [10] 391: (0, 651+] #> [11] 392: (0, 258], (258, 328], ..., (621, 650+] #> [12] 393: (0, 61], (61, 539], (539, 648+] #> [13] 394: (0, 254], (254, 276], ..., (640, 644+] #> [14] 395: (0, 76], (76, 538], (538, 642+] #> [15] 396: (0, 635], (635, 641+] #> [16] 397: (0, 349], (349, 404], ..., (561, 649+] #> [17] 398: (0, 631+] #> [18] 399: (0, 596+] #> [19] 400: (0, 120], (120, 479], (479, 614+] #> [20] 401: (0, 323], (323, 449], (449, 582+] #> [21] 402: (0, 139], (139, 139], (139, 589+] #> [22] 403: (0, 593+] #> [23] 404: (0, 573], (573, 589+] #> [24] 405: (0, 165], (165, 408], ..., (604, 606+] #> [25] 406: (0, 249], (249, 594+] #> [26] 407: (0, 344], (344, 497], (497, 613+] #> [27] 408: (0, 265], (265, 586], (586, 595+] #> [28] 409: (0, 166], (166, 206], ..., (348, 389+] #> [29] 410: (0, 601+] #> [30] 411: (0, 410], (410, 581], (581, 601+] #> [31] 412: (0, 611+] #> [32] 413: (0, 608+] #> [33] 414: (0, 587+] #> [34] 415: (0, 367], (367, 603+] #> [35] 416: (0, 202], (202, 563], ..., (570, 585+] #> [36] 417: (0, 587+] #> [37] 418: (0, 578+] #> [38] 419: (0, 578+] #> [39] 420: (0, 586+] #> [40] 421: (0, 585+] #> [41] 422: (0, 582+]
with(valveSeats, Recur(Days, ID, No.))
#> [1] 251: (0, 761+] #> [2] 252: (0, 759+] #> [3] 327: (0, 98], (98, 667+] #> [4] 328: (0, 326], (326, 653], ..., (653, 667+] #> [5] 329: (0, 665+] #> [6] 330: (0, 84], (84, 667+] #> [7] 331: (0, 87], (87, 663+] #> [8] 389: (0, 646], (646, 653+] #> [9] 390: (0, 92], (92, 653+] #> [10] 391: (0, 651+] #> [11] 392: (0, 258], (258, 328], ..., (621, 650+] #> [12] 393: (0, 61], (61, 539], (539, 648+] #> [13] 394: (0, 254], (254, 276], ..., (640, 644+] #> [14] 395: (0, 76], (76, 538], (538, 642+] #> [15] 396: (0, 635], (635, 641+] #> [16] 397: (0, 349], (349, 404], ..., (561, 649+] #> [17] 398: (0, 631+] #> [18] 399: (0, 596+] #> [19] 400: (0, 120], (120, 479], (479, 614+] #> [20] 401: (0, 323], (323, 449], (449, 582+] #> [21] 402: (0, 139], (139, 139], (139, 589+] #> [22] 403: (0, 593+] #> [23] 404: (0, 573], (573, 589+] #> [24] 405: (0, 165], (165, 408], ..., (604, 606+] #> [25] 406: (0, 249], (249, 594+] #> [26] 407: (0, 344], (344, 497], (497, 613+] #> [27] 408: (0, 265], (265, 586], (586, 595+] #> [28] 409: (0, 166], (166, 206], ..., (348, 389+] #> [29] 410: (0, 601+] #> [30] 411: (0, 410], (410, 581], (581, 601+] #> [31] 412: (0, 611+] #> [32] 413: (0, 608+] #> [33] 414: (0, 587+] #> [34] 415: (0, 367], (367, 603+] #> [35] 416: (0, 202], (202, 563], ..., (570, 585+] #> [36] 417: (0, 587+] #> [37] 418: (0, 578+] #> [38] 419: (0, 578+] #> [39] 420: (0, 586+] #> [40] 421: (0, 585+] #> [41] 422: (0, 582+]
with(valveSeats, Recur(Days, ID, No., terminal = 1))
#> [1] 251: (0, 761*] #> [2] 252: (0, 759*] #> [3] 327: (0, 98], (98, 667*] #> [4] 328: (0, 326], (326, 653], ..., (653, 667*] #> [5] 329: (0, 665*] #> [6] 330: (0, 84], (84, 667*] #> [7] 331: (0, 87], (87, 663*] #> [8] 389: (0, 646], (646, 653*] #> [9] 390: (0, 92], (92, 653*] #> [10] 391: (0, 651*] #> [11] 392: (0, 258], (258, 328], ..., (621, 650*] #> [12] 393: (0, 61], (61, 539], (539, 648*] #> [13] 394: (0, 254], (254, 276], ..., (640, 644*] #> [14] 395: (0, 76], (76, 538], (538, 642*] #> [15] 396: (0, 635], (635, 641*] #> [16] 397: (0, 349], (349, 404], ..., (561, 649*] #> [17] 398: (0, 631*] #> [18] 399: (0, 596*] #> [19] 400: (0, 120], (120, 479], (479, 614*] #> [20] 401: (0, 323], (323, 449], (449, 582*] #> [21] 402: (0, 139], (139, 139], (139, 589*] #> [22] 403: (0, 593*] #> [23] 404: (0, 573], (573, 589*] #> [24] 405: (0, 165], (165, 408], ..., (604, 606*] #> [25] 406: (0, 249], (249, 594*] #> [26] 407: (0, 344], (344, 497], (497, 613*] #> [27] 408: (0, 265], (265, 586], (586, 595*] #> [28] 409: (0, 166], (166, 206], ..., (348, 389*] #> [29] 410: (0, 601*] #> [30] 411: (0, 410], (410, 581], (581, 601*] #> [31] 412: (0, 611*] #> [32] 413: (0, 608*] #> [33] 414: (0, 587*] #> [34] 415: (0, 367], (367, 603*] #> [35] 416: (0, 202], (202, 563], ..., (570, 585*] #> [36] 417: (0, 587*] #> [37] 418: (0, 578*] #> [38] 419: (0, 578*] #> [39] 420: (0, 586*] #> [40] 421: (0, 585*] #> [41] 422: (0, 582*]
with(valveSeats, Recur(Days, ID, No., origin = 10))
#> [1] 251: (10, 761+] #> [2] 252: (10, 759+] #> [3] 327: (10, 98], (98, 667+] #> [4] 328: (10, 326], (326, 653], ..., (653, 667+] #> [5] 329: (10, 665+] #> [6] 330: (10, 84], (84, 667+] #> [7] 331: (10, 87], (87, 663+] #> [8] 389: (10, 646], (646, 653+] #> [9] 390: (10, 92], (92, 653+] #> [10] 391: (10, 651+] #> [11] 392: (10, 258], (258, 328], ..., (621, 650+] #> [12] 393: (10, 61], (61, 539], (539, 648+] #> [13] 394: (10, 254], (254, 276], ..., (640, 644+] #> [14] 395: (10, 76], (76, 538], (538, 642+] #> [15] 396: (10, 635], (635, 641+] #> [16] 397: (10, 349], (349, 404], ..., (561, 649+] #> [17] 398: (10, 631+] #> [18] 399: (10, 596+] #> [19] 400: (10, 120], (120, 479], (479, 614+] #> [20] 401: (10, 323], (323, 449], (449, 582+] #> [21] 402: (10, 139], (139, 139], (139, 589+] #> [22] 403: (10, 593+] #> [23] 404: (10, 573], (573, 589+] #> [24] 405: (10, 165], (165, 408], ..., (604, 606+] #> [25] 406: (10, 249], (249, 594+] #> [26] 407: (10, 344], (344, 497], (497, 613+] #> [27] 408: (10, 265], (265, 586], (586, 595+] #> [28] 409: (10, 166], (166, 206], ..., (348, 389+] #> [29] 410: (10, 601+] #> [30] 411: (10, 410], (410, 581], (581, 601+] #> [31] 412: (10, 611+] #> [32] 413: (10, 608+] #> [33] 414: (10, 587+] #> [34] 415: (10, 367], (367, 603+] #> [35] 416: (10, 202], (202, 563], ..., (570, 585+] #> [36] 417: (10, 587+] #> [37] 418: (10, 578+] #> [38] 419: (10, 578+] #> [39] 420: (10, 586+] #> [40] 421: (10, 585+] #> [41] 422: (10, 582+]