ComeçarComece de graça

Adding a new column

As mentioned in the video, data.table does not have to deep copy objects in order to modify them. It can modify objects by reference (inplace) to save memory and runtime using the := operator. When you update a data.table by reference, you don't have to assign the result to a new object as the original data.table is modified directly.

Este exercício faz parte do curso

Data Manipulation with data.table in R

Ver curso

Instruções do exercício

Add a new column duration_hour to batrips by reference, by dividing the duration column by 3600.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Add a new column, duration_hour
___[, ___ := ___]
Editar e executar o código