Hello.
Could you explain to a new user what are @view, @views, and other alternatives, please?
What is something equivalent on base R or data.table?
For example if I do:
A = [1 2; 3 4]
A[:,:]
I get:
2×2 Array{Int64,2}:
1 2
3 4
The same if I do:
@view A[:,:]
2×2 view(::Array{Int64,2}, :, with eltype Int64:
1 2
3 4
or if I do:
@views A[:, :]
2×2 view(::Array{Int64,2}, :, with eltype Int64:
1 2
3 4
I get the same result. I don’t understand the difference.
When do I need to use views?
The documentation provides this explanation, but anyway I don’t understand the meaning of view
:
view: Like getindex but returns a view into the parent array `A` with the
given indices.
getindex: retrieves the value(s) stored at the given key or index within a
collection.
@views: Convert every array-slicing operation in the given expression
@view: Creates a SubArray from an indexing expression.