similar to: Propagate vector attributes to data frame

Displaying 20 results from an estimated 1100 matches similar to: "Propagate vector attributes to data frame"

2008 Jun 03
3
Rpart and case weights: working with functions
I can't get rpart accept case weights defined inside a function. It keeps using the copy defined in the "global" environment (if they exists) instead of the function-defined ones. Here is what I do: test.function <- function (formula, data) { weights <- rep(.1, 100) rpart(formula, data, weights) } test.function(x~y, data) And I get an error: > Error in
2008 Oct 23
3
xy.coords in text
Hello, I want to add text annotation about correlation on "pairs" plots. I found that I could pass a function to the "panel" argument of pairs : panel.annot <- function(x, y, ...) { points(x, y, ...) c <- cor.test(x, y) legend("topleft", legend=substitute(rho == r, list(r=sprintf("%.2f", c$estimate))), bty="n") } And then :
2005 Jun 15
1
anova.lme error
Hi, I am working with R version 2.1.0, and I seem to have run into what looks like a bug. I get the same error message when I run R on Windows as well as when I run it on Linux. When I call anova to do a LR test from inside a function, I get an error. The same call works outside of a function. It appears to not find the right environment when called from inside a function. I have provided
2002 Nov 26
0
scope (was URGENT Help required)
Please use a more meaningful subject. Some might take it as a spam and hit the delete button. Objects in the workspace are visible inside functions, but are usually not directly manipulated inside functions. When you modify an object in the workspace inside a function, what actually happens is a local copy is made, reflecting the modifications you made, and leave the one in the workspace
2009 Dec 08
1
problem with split eating giga-bytes of memory
I'm having trouble using split on a very large data-set with ~1400 levels of the factor to be split. Unfortunately, I can't reproduce it with the simple self-contained example below. As you can see, splitting the artificial dataframe of size ~13MB results in a split dataframe of ~ 144MB, with an increase memory allocation of ~10 fold for the split object. If split scales linearly, then my
2002 Nov 26
2
URGENT Help required
I've the following problem: The below function runs a loop with regression analysis and stores F-Stat in a matrix. When I call the matrix elements (models[i,j]) in the function I get proper results, but when I try to call the same elements outside the function the matrix appears to be empty e.g when I call compt inside the function I get: 5 but when I call it outside I get: 1. This is the
2019 Nov 26
0
BUG?: A copy of base::`+` (primitive) is not a clone but a "pointer"
For what it's worth, the current behavior seems to have begun starting with version 3.6.0. If I run in version 3.5.3: > p1 <- .Primitive('+') ; p2 <- p1 ; attr(p1, "myattr") <- 1 ; p2 function (e1, e2)? .Primitive("+") > On 11/18/19 10:45 AM, Martin Maechler wrote: > >>>>>>/Tomas Kalibera />>>>>>/on Mon, 18
2011 May 26
0
Reference Classes: getter and setter functions/methods and possible shortcuts
Hi everyone, just wanted to ask what's the smartest/recommended way of defining getter and setter function *shortcuts* (i.e. something like "[", "[<-") for Reference Class objects? Or is it desired to not use this stuff, but define methods like 'obj$getSubset(row=1:3, col=1)' and 'obj$setSubset(value=x)' instead? I have some example code that might
2010 Mar 11
2
Can't convert list to matrix properly
Hi guys, here is a list of names that I have: MyList: > myList<-list("A", "B","C","D") > myList [[1]] [1] "A" [[2]] [1] "B" [[3]] [1] "C" [[4]] [1] "D" I want to turn this list into a matrix of 1 row and 4 columns with those four components (A, B, C, D) so here is what I do: myDataFrame <-
2011 Apr 07
3
Correlation Matrix
Listers, I have a question regarding correlation matrices. It is fairly straight forward to build a correlation matrix of an entire data frame. I simply use the command cor(MyDataFrame). However, what I would like to do is construct a smaller correlation matrix using just three of the variable out of my data set. When I run this: cor(MyDataFrame$variable1,
2019 Nov 18
2
BUG?: A copy of base::`+` (primitive) is not a clone but a "pointer"
On 11/18/19 10:45 AM, Martin Maechler wrote: >>>>>> Tomas Kalibera >>>>>> on Mon, 18 Nov 2019 09:36:14 +0100 writes: > > On 11/18/19 9:18 AM, Martin Maechler wrote: > >>>>>>> Henrik Bengtsson > >>>>>>> on Sun, 17 Nov 2019 14:31:07 -0800 writes: > >> > $ R --vanilla R
2007 May 12
0
How to Derive an S4 Class from a data.frame?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello R-Help: I would really appreciate some help on this. I have spent a good deal of time searching for an answer for what I would think to be a common practice: Subclasses an S4 class from a data.frame. But have found very little. Here is some sample code that I've been trying: setClass("MyDataFrame",
2007 Oct 24
3
Partial aggregate on sorted data
Hi All, I'm looking for ways to compute aggregate statistics (with the aggregate function) but with an option for sorting and selecting a subset of the data frame. For example, I have would like to turn this : aggregate(myDataframe$TargetValue,list(SomeFactor = myDataframe$SomeFactor),mean) into something like aggregate(myDataframe$TargetValue,list(SomeFactor =
2007 Apr 22
1
dput/dget when a data frame has 2 rows (PR#9627)
This doesn't seem right; I'm using R version 2.4.1 (2006-12-18) on Mac OS and Win XP and find the same issue: > mydataframe <- data.frame(ppi=c(.5,.5),mmu=c(5,10)) > dput(mydataframe,"mydataframe.txt") > dget("mydataframe.txt") Error in attributes(.Data) <- c(attributes(.Data), attrib) : row names must be 'character' or 'integer', not
2010 May 15
1
Dataframe to word, using R2wd
Hi All, I'm trying to use R2wd to send a dataframe to Word. The dataframe isn't huge - 300 rows, 12 variables, although it has some long strings in it. Using: wdTable(format(myDataFrame)) or wdTable(myDataFrame) Produces a very complex table, which Word struggles to process and layout. (I can't work out what the table is - it seems to be nested tables. Converting to text gives
2012 Jul 04
2
Difference between two-way ANOVA and (two-way) ANCOVA
Hi! as my subject says I am struggling with the different of a two-way ANOVA and a (two-way) ANCOVA. I found the following examples from this webpage: http://www.statmethods.net/stats/anova.html # One Way Anova (Completely Randomized Design) fit <- aov(y ~ A, data=mydataframe) # Randomized Block Design (B is the blocking factor) fit <- aov(y ~ A + B, data=mydataframe) # Two Way
2019 Nov 18
2
BUG?: A copy of base::`+` (primitive) is not a clone but a "pointer"
On 11/18/19 9:18 AM, Martin Maechler wrote: >>>>>> Henrik Bengtsson >>>>>> on Sun, 17 Nov 2019 14:31:07 -0800 writes: > > $ R --vanilla R version 3.6.1 (2019-07-05) -- "Action of > > the Toes" Copyright (C) 2019 The R Foundation for > > Statistical Computing Platform: x86_64-pc-linux-gnu > > (64-bit) ...
2005 Apr 04
2
mysql retrive question
hello R-Users, I have this simple but not for me question: I do: > res<-dbSendQuery(con, "SELECT * FROM tabellaProva") > myDataFrame<-fetch(res) > myDataMatrix<-as.matrix(myDataFrame[,-1]) > namerows(myDataMatrix)<-as.character(myDataFrame[,1]) and I have: io tu io "0" "1" tu "1" "0" my problem is that the
2010 Apr 26
1
Sweave: centering with echo=TRUE
In a .Rnw file I want to insert the R command pairs(mydataframe) and achieve the following effects 1. the command itseld is echoed into the tex document generated by Sweave <<fig=TRUE,echo=TRUE>>= 2. The graphics generated appears in the tex document, with the graphics centred. 3. The R command > pairs(mydataframe) is not centered. Sweave-manual.pdf gives the following code chunk
2010 Apr 29
2
understanding behavior of "merge"
I'm trying to bootstrap resample from a repeated measures dataset. I sample a vector of "ID"'s from my dataframe with replacement. Then I merge this back with my dataframe. I'm re-sampling subjects in the dataset rather than rows of the data. I thought I could use the left/right join features of the merge to select the records I want from the dataframe (mydataframe), like