As Basti says, it's hard to fix the error if we can't see your code.
On the second issue: it’s not really an error, more just how the program works. It will occur if the covariate you’re trying to preserve is confounded with the batch effect you’re trying to correct.
For example, in a project I did a year ago:
combat_data <- champ.runCombat(beta=your_beta_file, pd=your_pd_file, variablename = “Grade”, batchname="Sex”)
The above did not work, ComBat could not correct for batch effects from sex of patients while preserving variation from tumour grade of patients, because in my dataset Sex and Grade were confounded.
However the following did work and correct batch effects from sample slide:
combat_data <- champ.runCombat(beta=your_beta_file, pd=your_pd_file, variablename = "Grade", batchname="Slide")
Because the variables Slide and Grade were not confounded.
To fix this issue, you could either change the batch effect you’re trying to correct for or change/remove the optional variablename parameter.
Sometimes, if ComBat is unable to correct a batch effect you really need corrected, you can account for this by analysing the batches separately. E.g. in the above example, to account for variation from sex, it was possible to analyse samples from male and female patients separately later in the pipeline.
Still quite new to ChAMP (i.e. if anything here is inaccurate please comment!) but I hope this helps.
Could you provide the structure of your pd file ?
str(myLoad$pd)or corresponding code