similar to: Understanding tracemem

Displaying 20 results from an estimated 10000 matches similar to: "Understanding tracemem"

2006 Jul 31
5
use tracemem to dump content in function read/write
Hi Expert I want to use dtrace to monitor the content change of one file. I made following scripts, #!/usr/sbin/dtrace -s inline int MYPID = $1; syscall::write:entry /pid == MYPID/ { tracemem(arg1, arg2); printf("\n"); } It always has an following error bash-3.00$ sudo dumpFIFO.dtrace 3836 dtrace: failed to compile script ./dumpFIFO.dtrace: line 19: tracemem( ) argument #2
2006 Jun 29
2
tracemem() not exactly what I had in mind
I was trying to use tracemem to look at mblk contents. First, I tried to use mblk->b_wptr - mblk->b_rptr as the size, and was told that it had to be a constant. Foo. (RFE #1). Then, I tried to use 8 as the size, and kept getting decimal numbers printed. Stumbled on #pragma D option rawbytes=true (is the =true necessary, btw?) and that didn''t help. Then, in desperation, I
2010 Aug 24
2
Comparing/diffing strings
Hi all, all.equal is generally very useful when you want to find the differences between two objects. It breaks down however, when you have two long strings to compare: > all.equal(a, b) [1] "1 string mismatch" Does any one know of any good text diffing tools implemented in R? Thanks, Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice
2016 Apr 05
1
Assignment operator and deep copy for calling C functions
Hi All, i have a problem in understanding what the assignment operator '<-' really is doing. If i create two numeric arrays in R and copy one into the other with '<-' and afterwards change one array by calling a C function, both arrays are changed! The problem I am facing can easily be seen in the following example: (The following R code and the C function is attached and
2010 Nov 23
1
Possibility for memory improvement: x <- as.vector(x) always(?) duplicates
Hi, I've noticed that as.vector() always allocates a new object, e.g. > x <- 1:10; > x <- as.vector(x); > tracemem(x); [1] "<0x0000000005622db8" > x <- as.vector(x); tracemem[0x0000000005622db8 -> 0x0000000005622ec0]: as.vector > x <- as.vector(x); tracemem[0x0000000005622ec0 -> 0x0000000005622f18]: as.vector > x <- as.vector(x);
2010 Nov 15
2
Trying to understand the search path and namespaces
Hi all, I'm trying to understand how the search path and namespaces interact. For example, take the devtools package which suggests the testthat package. Here's what the search path looks like after I load each of those packages: > library(devtools) > search() [1] ".GlobalEnv" "package:devtools" "package:stats" [4]
2011 Dec 28
1
Subsetting a data frame vs. subsetting the columns
Hi all, There seems to be rather a large speed disparity in subsetting when working with a whole data frame vs. working with just columns individually: df <- as.data.frame(replicate(10, runif(1e5))) ord <- order(df[[1]]) system.time(df[ord, ]) # user system elapsed # 0.043 0.007 0.059 system.time(lapply(df, function(x) x[ord])) # user system elapsed # 0.022 0.008 0.029
2016 Aug 05
2
Extra copies of objects in environments when using $ operator?
My understanding is that R will not make copies of lists if there is only one reference to the object. However, I've encountered a case where R does make copies, even though (I think) there should be only one reference to the object. I hope that someone could shed some light on why this is happening. I'll start with a simple example. Below, x is a list with one element, and changing that
2011 Oct 18
9
readRDS and saveRDS
Hi all, Is there any chance that readRDS and saveRDS might one day become read.rds and write.rds? That would make them more consistent with the other reading and writing functions. Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/
2011 Dec 31
4
Base function for flipping matrices
Hi all, Are there base functions that do the equivalent of this? fliptb <- function(x) x[nrow(x):1, ] fliplr <- function(x) x[, nrow(x):1] Obviously not hard to implement (although it needs some more checks), just wondering if it had already been implemented. Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/
2011 Sep 21
3
Quelplot
Hi all, Does anyone have an R implementation of the queplot (K.?M. Goldberg and B.?Iglewicz. Bivariate extensions of the boxplot. Technometrics, 34(3):pp. 307?320, 1992)? I'm struggling with the estimation of the asymmetry parameters. Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/
2011 May 04
4
Recursive objects
Hi all, Does anyone have a comprehensive list of recursive-type objects in R? is.recursive defines them as by exclusion: "most types of objects are regarded as recursive, except for vector types, ?NULL? and symbols (as given by ?as.name?)." I think this that means recursive objects are: * lists * pairlists * calls * expressions Did I miss anything? Hadley -- Assistant
2012 Jan 17
1
names<- appears to copy 3 times?
Hi, $ R --vanilla R version 2.14.1 (2011-12-22) Platform: i686-pc-linux-gnu (32-bit) > DF = data.frame(a=1:3,b=4:6) > DF a b 1 1 4 2 2 5 3 3 6 > tracemem(DF) [1] "<0x8898098>" > names(DF)[2]="B" tracemem[0x8898098 -> 0x8763e18]: tracemem[0x8763e18 -> 0x8766be8]: tracemem[0x8766be8 -> 0x8766b68]: > DF a B 1 1 4 2 2 5 3 3 6 > Are those 3
2010 Aug 24
3
require is to suggests as what is to imports?
Hi all, If a package suggests another package in its description, you can check it at runtime with requires. How do you do check if a package is available without loading it, if you only want to access one function in the package namespace. Thanks, Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/
2010 Mar 19
5
Encrypt/decrypt in R
Hi all, Does any one know of any encryption/decryption algorithms in R? I'm not looking for anything robust - I want some way of printing output to the screen that the user can't read immediately, but can decrypt a little later. The main thing I don't want to the user to see is a number, so (e.g.) ROT13 isn't appropriate. Hadley -- Assistant Professor / Dobelman Family Junior
2011 Apr 13
2
Line plots in base graphics
Am I missing something obvious on how to draw multi-line plots in base graphics? In ggplot2, I can do: data(Oxboys, package = "nlme") library(ggplot2) qplot(age, height, data = Oxboys, geom = "line", group = Subject) But in base graphics, the best I can come up with is this: with(Oxboys, plot(age, height, type = "n")) lapply(split(Oxboys[c("age",
2012 Apr 14
1
deep copy?
Is putting a variable into a list a deep copy (and is tracemem the correct way to confirm)? warmstrong at krypton:~/dvl/R.packages$ R > x <- rnorm(1000) > tracemem(x) [1] "<0x3214c90>" > x.list <- list(x.in.list=x) tracemem[0x3214c90 -> 0x2af0a20]: > Is it possible to put a variable into a list without causing a deep copy (i.e. if you _really_ want the
2010 Oct 08
2
What do you call the value that represents a missing argument?
Hi all, What's the official name for the value that represents a missing argument? e.g. formals(plot)$x str(formals(plot)$x) deparse(formals(plot)$x) is.symbol(formals(plot)$x) What's the correct way to create an object like this? (for example if you are manipulating the formals of a function to add an argument with no default value, as in http://stackoverflow.com/questions/3892580/).
2012 Jul 25
1
Rconfig.h & unsupported architectures
Hi all, Recently, when compiling R packages containing C code, I've started getting the following error: * installing to library ?/Users/hadley/R? * installing *source* package ?appdirs? ... ** Creating default NAMESPACE file ** libs *** arch - i386 gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -DNDEBUG
2010 Nov 09
3
How to detect if a vector is FP constant?
Hi all, What's the equivalent to length(unique(x)) == 1 if want to ignore small floating point differences? Should I look at diff(range(x)) or sd(x) or something else? What cut off should I use? If it helps to be explicit, I'm interested in detecting when a vector is constant for the purpose of visual display. In other words, if I rescale x to [0, 1] do I have enough precision to get