non-numeric argument to mathematical function: Log

Hi all,

I'm trying to create a new variable in my dataset. I downloaded my data from Compustat and have not made any adjustments to that specific column. However now I want to create the following variable:
Full_data <-
Full_data %>%
mutate( Size = log(at))

But when I run this code I get the following error:
Error in mutate():
! Problem while computing Size = log(at).
:information_source: The error occurred in group 1: companyid = 18511, gvkey = 210835.
Caused by error in log():
! non-numeric argument to mathematical function

However if i look up this specific line it is not a text variable. How can I fix this?

This may sound silly, but how do you know it isn't a text variable? Sometimes things that look like numbers are internally coded as something else.
You may want to do something like

class(Full_data$at[companyid == 18511 &  gvkey == 210835])

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.