---
title: "pack(columnsNamed:to:type:filling:)"
framework: createml
role: symbol
role_heading: Instance Method
path: "createml/mldatatable/pack(columnsnamed:to:type:filling:)"
---

# pack(columnsNamed:to:type:filling:)

Creates a new data table with an additional column that contains the combined values of the given columns.

## Declaration

```swift
func pack(columnsNamed: String..., to: String, type: MLDataTable.PackType = .sequence, filling: MLDataValue = MLDataValue.invalid) -> MLDataTable
```

## Parameters

- `columnsNamed`: The name of the columns to compact.
- `to`: The name of the new condensed column.
- `type`: The collection type for the new column. Typically, the type is a sequence or a dictionary.
- `filling`: The value to fill in any missing values with.

## Return Value

Return Value A new data table.

## Discussion

Discussion This function performs the inverse of unpack(columnNamed:valueTypes:indexSubset:keySubset:).

## See Also

### Compacting columns

- [MLDataTable.PackType](createml/mldatatable/packtype.md)
