Case-Cohort analysis in R I am attempting to conduct a Case-Cohort analysis with Cox's Proportional Hazards Model. 
The data set looks similar to the one below:
ID      Covariate1       Covariate2      Case   Cohort   SurvLength     Death 
001     1                0               1       NA      27             1
002     1                1               1       1       38             1 
003     0                1               NA      1       45             0
004     1                0               NA      1       33             0

My understanding is that a 'weighted' version of the Cox Proportional Hazards model can be used via the COXPHW package in R. This would then use one of the following weighting schemes:
 1. Prentice
 2. Self-Prentice
 3. Lin-Yang
Typically with a Cox regression can be conducted in the following manner with R:
res.cox <- coxph(Surv(time, status) ~ treatment + covariate, data = data)

My question is how does this work with a Case-Cohort design? Specifically, how would it work with a data set similar to the one above?
Thanks for any insight you can provide. 
 A: Your question is very general, since you do not specify which weighting method you intend to use in your analysis.  At its present level of generality, you are essentially asking for a recounting of the theory of unit-weighting in case control studies.  This is quite a big topic in its own right, and it is not possible to replicate the material in the literature in a single post.  Nevertheless, I will try to give you some basic introductory insight, and references to the appropriate literature, to get you started.
In a case-cohort study, the case group is fully sampled but the non-case group is sampled only through a sub-cohort that is usually substantially smaller than the full cohort, and is therefore "underrepresented" in the data.$^\dagger$  There are a number of different weighting methods for case-cohort studies in the statistical literature, but all of these aim to re-weight the data to adjust for the under-representation of the non-case data in the "case-cohort" group, with subsequent adjustment to variances of the estimators.  You can find a good overview of the various methods in Kulathinal et al (2007).  Below I give an overview of the general form of the pseudo-likelihood function in these problems, and some of the weighting methods in the literature.
Before you get to issues of implementation in R, you are going to have to decide which weighting method you want to use for your analysis.  To make this decision, I would recommend you review the literature on this matter, starting with reading some of the linked papers above.  Once you have done this, you will be able to determine the appropriate weighting method for your analysis, and implement this in R.  The coxphw  package is discussed in detail in Dunkler et al (2018), where the authors set out the background of the weighted Cox proportional-hazards estimation method, and show how this is applied in the package.  That paper gives an  overview of weighted Cox proportional-hazards estimation and its implementation in the package.

General form of weighted pseudo-likelihood: Suppose we have a full cohort $\mathscr{U}$ with subcohort $\mathscr{V} \subset \mathscr{U}$ and case group $\mathscr{C} \subset \mathscr{U}$.  The "case-cohort" group is the set $\mathscr{D} \equiv \mathscr{V} \cup \mathscr{C}$.  In order to implement certain weighting methods, we also define the "risk set" $\mathscr{R} \subset \mathscr{D}$, which gives the events in the case-cohort that are counted in the weighting of hazards (this will become clearer soon).  With these stipulations, the weighted pseudo-likelihood for the case-cohort can be written in general as:
$$L_{\mathbf{t}}(\boldsymbol{\lambda}) = \prod_{i \in \mathscr{D}} \frac{w_i(t_i) \lambda_i(t_i)}{\sum_{k \in \mathscr{R}} w_k(t_i) \lambda_k(t_i)},$$
where $\lambda_k$ is the hazard rate for individual $k$ (which is generally posited to be a function of the covariates) and $w_k$ is a weighting function.  (Note that the weighting is also affected by the stipulated "risk set" $\mathscr{R}$ through the fact that the sum in the denominator is taken only over this set.)  The weighting function and risk set are used to adjust for the under-representation of the non-cases in the case-cohort group $\mathscr{D}$.
There are a number of different weighting schemes that have been proposed in the literature.  Prentice (1986) uses a simple weighting where the weight function is set to unity, but the risk set is restricted to exclude cases that are outside the sub-cohort before the event of interest.  Barlow (1999) also restricts the risk set in this way, but uses the weighting $w_k = |\mathscr{U}|/|\mathscr{V}|$ for all non-cases in the sub-cohort and cases occuprring before the event of interest.  Kalbfleish and Lawless (1988) use a risk set $\mathscr{R}=\mathscr{D}$ (i.e., the risk set is the whole case-cohort), with weighting $w_k = |\mathscr{U}|/|\mathscr{V}|$ for non-cases in the sub-cohort.

$^\dagger$ Note that this terminology is somewhat confusing, since the "case-cohort" group consists the union of the cases and the sub-cohort.  It is therefore simpler to think of this as the "case + sub-cohort" group.
