-
Notifications
You must be signed in to change notification settings - Fork 992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
solved #4519 Need a reference page for .internal.selfref #6695
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
\name{.internal.selfref} | ||
\alias{.internal.selfref} | ||
\title{Internal Self-Reference Attribute in data.table} | ||
\description{ | ||
The `.internal.selfref` attribute is an internal mechanism used by \code{data.table} to optimize memory management and performance. This attribute ensures that \code{data.table} objects can be modified by reference without unnecessary copying, enabling efficient data manipulation. | ||
} | ||
\usage{ | ||
\code{.internal.selfref} | ||
} | ||
\details{ | ||
The `.internal.selfref` attribute is a pointer that allows \code{data.table} objects to reference their own memory location. This avoids redundant memory allocation when performing in-place modifications such as adding or updating columns, filtering rows, or performing joins. | ||
|
||
If the `.internal.selfref` attribute is lost or corrupted (e.g., due to operations that inadvertently break reference semantics), \code{data.table} falls back to standard \code{data.frame}-like behavior, which can lead to reduced performance due to copying. | ||
|
||
Users generally do not need to interact directly with `.internal.selfref`, but understanding its purpose can help debug issues related to memory usage or unexpected copying in \code{data.table} operations. | ||
|
||
Note that `.internal.selfref` is automatically managed by \code{data.table} and is not intended to be modified by users. | ||
} | ||
\value{ | ||
The `.internal.selfref` attribute is an internal implementation detail and does not produce a value that users would typically interact with. It is invisible during regular \code{data.table} operations. | ||
Comment on lines
+11
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing about the backtick syntax here. |
||
} | ||
\seealso{ | ||
\code{\link{data.table}}, \code{\link{setkey}}, \code{\link{merge}}, \code{\link{[.data.table}} | ||
} | ||
\examples{ | ||
# Example to illustrate the presence of .internal.selfref | ||
dt <- data.table(A = 1:5, B = letters[1:5]) | ||
attr(dt, ".internal.selfref") # Check the internal self-reference attribute | ||
|
||
# Modify the data.table in-place | ||
dt[, C := A * 2] | ||
|
||
# Verify .internal.selfref is maintained | ||
attr(dt, ".internal.selfref") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not very informative because the pointer fields always contains the address of R's |
||
} | ||
\keyword{ internal } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use the
`
backtick syntax`
in Rd files. The Rd syntax has\code
for anything that can be parsed as valid R and\samp
or\verb
for other cases.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yha @venom1204 is my account i am closing this pull request as @venom1204 will be my main account .
i will introduce all the necesarry changes and push them through @venom1204 account. @aitap