Error: unexpected ',' in "mylm=lm(`weight`~`pressure`, data=meter),"

data=lm(weight~pressure, data=meter), data$coefficients[1]

how can i fix it?

Erase the comma at the end of the first line

You need this on separate lines or to use a semi-colon.

Option 1:

data=lm(weight~pressure, data=meter)

Option 2:

data=lm(weight~pressure, data=meter); data$coefficients[1]

For R these options are identical, but Option 1 is easier to read for humans. Hence it is better stick to the Option 1.

Thank you so much for your helping