ImmuneDynamics / Spectre

A computational toolkit in R for the integration, exploration, and analysis of high-dimensional single-cell cytometry and imaging data.
https://immunedynamics.github.io/spectre/
MIT License
56 stars 21 forks source link

Generating Summary Table #139

Closed jvazquez3 closed 1 year ago

jvazquez3 commented 1 year ago

Hi,

I'm working through the "Simple Discovery Workflow". Everything is working great up to the point of generating summary table. I implemented the code under "Generating summary data", but receiving the following error:

Error in setnames(x, value) : Can't assign 1 names to a 0 column data.table

This is the code that I'm currently working on and that is generating error:

Create summary tables

           counts.dt <- data.frame('Sample' = unique(cell.dat[['Sample']]),
                            'Counts' = c(35568, 60997, 225669, 300572, 409000, 516000, 600000, 50930, 84330, 311572, 312461, 328808, 505000, 774000, 902000, 903000, 1020000, 39943, 54228, 61690, 65118, 163829, 389423, 511000, 571000, 599000, 727000, 957000)
    )
    counts.dt       

       sum.dat <- create.sumtable(dat = cell.dat, # The dataset to be summarised
                               sample.col = 'Sample', # The column that denotes the sample name/ID
                               pop.col = 'Population', # The column that denotes the population name/ID
                               use.cols = dyn.cols, # Columns (markers) whose expression we will measure on each population in each sample
                               annot.cols = c('Group', 'Batch'), # Additional columns we would like to include for annotation purposes (e.g. group names, batch names, etc)
                               counts = counts.dt) # A data.frame or data.table of the total cells per sample, to generate counts of each cell type per sample.`

Thank you, Jessica

jvazquez3 commented 1 year ago

It looks like I was missing a variable.

Thank you, Jessica

tomashhurst commented 1 year ago

Hi @jvazquez3 , glad to hear it is working out! Let us know if you run into any further issues.