Can't convert character to numeric

In order to summarise certain values, I wanted to use the sum function.
However, I get an error when trying to do so:

summarise(sales = sum(sales), orderquantity = sum(orderquantity),
unitprice = mean(unitprice), shippingcost = sum(shippingcost))

Error: Problem with summarise() column shippingcost.
i shippingcost = sum(shippingcost).
x invalid 'type' (character) of argument

After a quick look in my dataset, it seems like the column shippingcost is a character:

[1] "character"

However, when trying to change it to a numeric/double only the whole numbers get converted, all the doubles get introduced as NA's:

mutate(shippingcost = as.numeric(shippingcost))
Warning message:Problem with mutate() column shippingcost.
i shippingcost = as.numeric(shippingcost).
i NAs introduced by coercion

Same goes for as.double, any ideas on how to solve this?

Can you provide a reproducible example?

This topic was automatically closed 7 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.