I am new in R and for my class, I am trying to write the codes for one sample, a one-sided t-test for the alternative B<0. As you probably can understand, weight is the independent variable I want to test.
I wrote:

t.test(Data$weight, alternative = "less", mu = 0, paired = FALSE, var.equal = FALSE)

For some mistake I did, I am receiving a p value=1 where it is certainly should be 0.1.

I know I can find the p-value from the two-sided test but I want to be able to do it this way.
Would you please point out my mistake or suggest a fix, a better option?

I think you need to give us some background on what you are doing and some sample data.

See a reproducible example (reprex)

A handy way to supply sample data is to use the dput() function. See ?dput. If you have a very large data set then something like head(dput(myfile), 100) will likely supply enough data for us to work with.

I just put them down just in case but I guess this specific test is about testing the mean of the independent variable rather than its coefficient and significance. That is what I have been told. Thank you.