t-test function in R

Good afternoon,

I was wondering if anyone could advice me on the following:
I am trying to run a t-test on log-transformed data (using t_test(y~ x) , however I am getting the following error:

Error in if (stderr < 10 * .Machine$double.eps * max(abs(mx), abs(my))) stop("data are essentially constant") :
missing value where TRUE/FALSE needed

Has it to do with the 0 values (which I have after log transformation in my dataset)? Before log transforming the data the t-test works fine.

Thank you for any advice!

is x a grouping value ?
y~ x means to compare the means of y across the levels of x ; is that your intention ?
I'm suspecting your data isn't quite organised in the way you would need it to be for a t-test.

Hey, thank you for your reply. Yes x is a grouping (e.g. male / female) and y is a continous variable.
As said, it works before log transformation but then it doesnt work anymore unfortunately.

Update:

I think I solved it. There was one value after log transformation with "-INF". After removing this row it worked.

I apologise for having doubted you. Well done for solving your issue and thank you for sharing the explanation back to the forum.

1 Like