Generic Initializer

init(repeating:count:)

Creates a new column with a repeating value.

Declaration

init<T>(repeating repeatedValue: T, count: Int) where T : MLDataValueConvertible

Parameters

repeatedValue

An initial value for every element in the new column.

count

The number of elements in the new column.

Discussion

Use this initializer to create a column of repeating elements with any type that conforms to MLDataValueConvertible, including integers, doubles, strings, arrays, and dictionaries.

let three5s = MLUntypedColumn(repeating: 5, count: 3)
print(three5s)
/* Prints...
 ValueType: Int
 Values:        [5, 5, 5]
 */

See Also

Creating an Untyped Column

init(repeating: MLDataValue, count: Int)

Creates a new column with a repeating value.

init(Range<Int>)

Creates a new column of integers from a given range.

init(ClosedRange<Int>)

Creates a new column of integers from a given closed range.

init<S>(S)

Creates a new column from a given sequence of elements that can be converted to machine learning data values.

init<S>(S)

Creates a new column from a given sequence of machine learning data values.

init()

Creates an empty, invalid column used to remove an existing column from a data table.