Top "Coercion" questions

Coercion, type conversion and typecasting are different ways of, implicitly or explicitly, changing an entity of one data type into another.

Convert factor to integer

I am manipulating a data frame using the reshape package. When using the melt function, it factorizes my value column, …

r integer coercion
in Dart, is there a `parse` for `bool` as there is for `int`?

in Dart, there's a convenient way to convert a String to an int: int i = int.parse('123'); is …

parsing boolean dart coercion
Array Types In Powershell - System.Object[] vs. arrays with specific types

Why does caling GetType().Name on an array of strings return Object[] and not String[]? This seems to happen with …

arrays powershell collections types coercion
What's the difference between casting and coercion in Python?

In the Python documentation and on mailing lists I see that values are sometimes "cast", and sometimes "coerced".

python casting types coercion
How can I convert a LazySeq of Characters to a String in Clojure?

Let's say I have a LazySeq of java.lang.Character like (\b \ \! \/ \b \ \% \1 \9 \/ \. \i \% \$ \i \space \^@) How can I convert …

map clojure types primitive-types coercion
Converting two columns of a data frame to a named vector

I need to convert a multi-row two-column data.frame to a named character vector. My data.frame would be something …

r vector dataframe coercion
C++ user-defined conversion operators without classes?

In C++ is it possible to define conversion operators which are not class members? I know how to do that …

c++ operator-overloading coercion
In Ruby, how does coerce() actually work?

It is said that when we have a class Point and knows how to perform point * 3 like the following: class …

ruby coercion coerce type-coercion
Is there a JavaScript idiom to change "undefined" to "null"?

There's quite a few JavaScript idioms that coerce between types and similar things. ! can convert anything falsey to boolean true, !! …

javascript null undefined idioms coercion
Forced conversion of non-numeric numpy arrays with NAN replacement

Consider the array x = np.array(['1', '2', 'a']) Tying to convert to a float array raises an …

python numpy type-conversion nan coercion