similar to: What does `_data` mean in transform()?

Displaying 20 results from an estimated 20000 matches similar to: "What does `_data` mean in transform()?"

2023 Mar 02
1
transform.data.frame() ignores unnamed arguments when no named argument is provided
Dear r-devel, See below: transform(data.frame(a = 1), 2, 3) #> a #> 1 1 transform(data.frame(a = 1), b=2, 3) #> a b X3 #> 1 1 2 3 We need a small modification to make it work consistently, see below: transform.data.frame <- function (`_data`, ...) { e <- eval(substitute(list(...)), `_data`, parent.frame()) tags <- names(e) ## NEW LINE
2009 Jul 19
1
transform(_data,...) using strptime gives an error
I have timstamped data like this: > sd[1:10,] Tstamp Density Mesh50 Mesh70 Mesh100 Mesh150 Mesh200 2 2009/02/27 07:00 30.5 0.7 10.7 21.4 32.8 41.6 3 2009/02/27 08:00 32.2 1.6 12.4 23.3 34.5 43.0 4 2009/02/27 09:00 32.7 4.8 13.0 24.0 35.1 43.5 5 2009/02/27 10:00 26.7 0.3 6.5 17.6 28.1 36.9 6 2009/02/27 11:00
2023 Mar 02
1
transform.data.frame() ignores unnamed arguments when no named argument is provided
Note that ?transform.data.frame says arguments need to be named, so you are testing unspecified behaviour. I guess this falls in a similar category as the note If some of the values are not vectors of the appropriate length, you deserve whatever you get! Experiments for a related Problem Report (<https://bugs.r-project.org/show_bug.cgi?id=17890>) showed that packages
2009 Dec 04
0
Renaming columns of a data.frame
A question that has come up a few times on r-help is how to rename columns of a data.frame. There are several ways to do this by hand (see the list archives). There is also a 'rename' function in the reshape package. I often use the 'transform' function shortly after reading in a data file and wanted to have a renaming function that has a syntax consistent with the
2008 Dec 02
4
Bug in "transform"?
Dear useRs, Here is a weird behavior of transform function: mtcars1<-matcars transform(mtcars1,t1=3,t2=4) Error in data.frame(`_data`, e[!matched]) : arguments imply differing number of rows: 32, 1 instead, this works: mtcars1$t1<-0 transform(mtcars1,t1=3,t2=4) also works if applied in turn: transform(mtcars1,t1=3) transform(mtcars1,t2=4) I often need to use this
2018 May 19
0
Split a data.frame
Hello, Maybe something like the following. splitDF <- function(data, col, s){ n <- nrow(data) inx <- which(data[[col]] %in% s) lapply(seq_along(inx), function(i){ k <- if(inx[i] < n) (inx[i] + 1):(inx[i + 1]) data[k, ] }) } splitDF(DF, "name", split_str) Hope this helps, Rui Barradas On 5/19/2018 12:07 PM, Christofer Bogaso
2012 Apr 06
4
Order sapply
Good Afternoon, I have the following code, but it seems that something must be doing wrong, because it is giving the results I want. The idea is to create segments while the value of Commutation is less than 1000. for example, from the small set of data below text=" val_user pos v v_star v_end commutation v_source v_destine 1 1 96-96 1173438391 1173438391 0
2012 Oct 29
0
data.frame() args in transform()
Starting in SVN revision 47035 (which shows up in the R-2-9-0 line), transform.data.frame() started accepting arguments like 'row.names' and 'stringsAsFactors' to be passed through to the data.frame() function. It looks like this was an unintentional side-effect of letting multiple columns be added properly. Given that this has been implemented for quite a while, should it now be
2012 Aug 01
1
Error message: $ operator is invalid for atomic vectors
HI, The code was working perfectly fine yesterday and today, until half an hour ago.? Couldn't find any problems in the code. Still, I am getting error message. myMatrix <- data.matrix(read.table(text=" Name??????????? Age ANTONY??????? 27 IMRAN????????? 30 RAJ????????????????? 22 NAHAS????????? 32 GEO??????????????? 42 ", header=TRUE)) MinMaxArray? <- data.frame(MIN =
2011 Oct 04
1
a question about sort and BH
Hi, I have two questions want to ask. 1. If I have a matrix like this, and I want to figure out the rows whose value in the 3rd column are less than 0.05. How can I do it with R. hsa-let-7a--MBTD1 0.528239197 2.41E-05 hsa-let-7a--APOBEC1 0.507869409 5.51E-05 hsa-let-7a--PAPOLA 0.470451884 0.000221774 hsa-let-7a--NF2 0.469280186 0.000231065 hsa-let-7a--SLC17A5
2008 Jul 04
2
create a zero matrix & fill
Dear R user, I have written a function which returns max,min and variation of a power (see below) Power is a given matrix(1,n) I call the function >Variation<-VAR(p,(n-deltat)) Now the problem is when I want plot(Results[1],Results[2]). Not possible! I become the following error (in english it means: Error in as.double.default(x) :Object cannot be transformed in double) >
2003 Jan 31
2
minor error in documentation of pmax in base (PR#2513)
The documentation says, "pmax and pmin take several vectors as arguments and return a single vector giving the parallel maxima (or minima) of the vectors." I discovered that, if you use a matrix or array instead of a vector, pmax returns a matrix or array, respectively. This makes pmax and pmin much more useful, and should not be left to people to discover on their own! For example:
2015 Mar 25
2
[LLVMdev] Optimization puzzle...
Hi everyone, I am wondering what¹s stopping the LLVM optimizer (opt -O3) from eliminating the apparently useless « icmp sgt » instruction in the following piece of LLVM IR. > ; ModuleID = 'lambda-opt.bc' > target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" > target triple = "x86_64-apple-macosx10.10.0" > > ; Function
2018 May 22
0
remove rows of a matrix by part of its row name
Hello, Use grep to get the row indices and then subset with a *negative* index to remove those rows. rn <- scan(what = character(), text = " 70/556 71.1/280 72.1/556 72.1/343 73.1/390 73.1/556 ") mat <- matrix(rnorm(6*6), nrow = 6) row.names(mat) <- rn inx <- grep("73\\.", row.names(mat)) new_mat <- mat[-inx, ] new_mat Hope this helps, Rui Barradas On
2012 Oct 30
4
There is pmin and pmax each taking na.rm, how about psum?
Hi, Please consider the following : x = c(1,3,NA,5) y = c(2,NA,4,1) min(x,y,na.rm=TRUE) # ok [1] 1 max(x,y,na.rm=TRUE) # ok [1] 5 sum(x,y,na.rm=TRUE) # ok [1] 16 pmin(x,y,na.rm=TRUE) # ok [1] 1 3 4 1 pmax(x,y,na.rm=TRUE) # ok [1] 2 3 4 5 psum(x,y,na.rm=TRUE) [1] 3 3 4 6 # expected result Error: could not find function "psum" # actual result
2010 Mar 29
1
Suggestion: Adding quick rowMin and rowMax functions to base package
Hi, I wonder whether similarly to the very quick rowSums and colSums functions in the base package, one could add quick functions that calculate the min or max over rows / cols in a matrix. While apply(x,1,min) works, I found out by profiling a program of mine that it is rather slow for matrices with a very large number of rows. A quick functionality seems to be already there in the
2015 Dec 24
2
override pmin/pmax for my own matrix
Hello, I'm trying to override pmin and pmax for my own matrix. These two functions have ... as an argument. I tried to override them as follows: setMethod("pmax", class_name, function(x, ..., na.rm) { ... }) I use this way to override primitive functions such as min/max and it works fine. But it doesn't work for pmin and pmax. I guess because they are regular functions? How
2015 Mar 25
3
[LLVMdev] Optimization puzzle...
Here's a version that doesn't try to do block deletion on it's own. If you use -adce then -simplifycfg, you get what you want. It passes all tests except one, which is that we delete an invoke of a pure function, IE Transforms/ADCE/dce_pure_invoke.ll - I'm not sure why that's bad. The reason we delete it is because it returns false to I.mayHaveSideEffects(), and in particular,
2018 May 22
0
remove rows of a matrix by part of its row name
Hello, Please always cc the list. As for the question, yes, it does. If you want to remove just the ones with exactly 73.1 use the pattern grep("^73\\.1$", etc) Explanation: Beginning of string: ^ End of string: $ Escape special characters: \\ (needed because the period is a special character.) Hope this helps, Rui Barradas On 5/22/2018 12:50 PM, Ahmed Serag wrote: > Thank
2008 Jul 04
1
initialize a matrix
Dear R users, I'm trying to write a function which returns minimum,maximum,mean of a vector(power) I've done the following : VAR<-function(power,length){ for(i in tml:length)){ tvar[i]<-i pmean[i]<-mean(power[i:i+deltat]) pmin[i]<-min(power[i:i+deltat]) pmax[i]<-max(power[i:i+deltat]) varmax[i]<-100*(pmax[i]-pmean[i])/pmean[i]