text: user16997: I have a Seurat object (metadata) with the single R samples consisting of cell types and sample types columns. I am trying to make a table that has a sample and percentage of cell types for each sample so that I can run a t-test across the samples that came out of 3 prime vs multi-omics.
  I have a seuratobject meta data with singler_labels (cell labels like chondrocytes, astrocytes, macrophage...), sample names (S0030, S0031, S0032.....), cell id/barcodes, and everything a seurat object has. I want to make a table with samples and percent of cell types per sample just to see what sample has what percent types of cells.
  How do I do this?
  Thank you!
  
  user73: If your cell types and sample names are in separate metadata variables attached to the Seurat object, then you can use table to count up the pairings:
  table(pbmc.seurat$singler_labels, pbmc.seurat$sample_name)
  
  This will output a matrix containing these counts
  
original_text: 16997: <p>I have a Seurat object (metadata) with the single R samples consisting of cell types and sample types columns. I am trying to make a table that has a sample and percentage of cell types for each sample so that I can run a t-test across the samples that came out of 3 prime vs multi-omics.</p>
  <p>I have a seuratobject meta data with singler_labels (cell labels like chondrocytes, astrocytes, macrophage...), sample names (S0030, S0031, S0032.....), cell id/barcodes, and everything a seurat object has. I want to make a table with samples and percent of cell types per sample just to see what sample has what percent types of cells.</p>
  <p>How do I do this?</p>
  <p>Thank you!</p>
   73: <p>If your cell types and sample names are in separate metadata variables attached to the Seurat object, then you can use <code>table</code> to count up the pairings:</p>
  <pre><code>table(pbmc.seurat<span class="math-container">$singler_labels, pbmc.seurat$</span>sample_name)
  </code></pre>
  <p>This will output a matrix containing these counts</p>
  