search for: obj1

Displaying 20 results from an estimated 71 matches for "obj1".

Did you mean: obj
2011 Oct 05
6
reporting multiple objects out of a function
Dear folks, I?m trying to build a function to create and make available some variables I frequently use for testing purposes. Suppose I have a function that takes some inputs and creates (internally) several named objects. Say, fun1 <- function(x, y, z) {obj1 <- x; obj2 <- y; obj3 <- z <missing stuff> } Here is the challenge: After I run it, I want the objects to be available in the calling environment, but not necessarily in the global environment. I want them to be individually available, not as part of a list or some larger object....
2006 Jan 19
4
multiple database in the same actions?
Hi, I read the example in http://wiki.rubyonrails.com/rails/pages/HowtoUseMultipleDatabases, it show us how to connect to other database, each time we start a new action, however, this doesn''t work while you try to connect to two different database within the same action. SO I wonder is it possible to bind to two or more database within the same action???? Thanks you very much Saiho
1998 May 14
0
all.equal - cut two, test.equal
...shortly in a separate post. One shortcoming of the following all.equal is that numeric elements of a list are not compared using tolerance. If anyone has a simple suggestion for extracting the numeric parts of a list I would like to incorporate it. Paul Gilbert _______ test.equal <-function (obj1, obj2, ...) UseMethod("test.equal") test.equal.default <-function (obj1, obj2, ...) { if (is.array(obj1)) test.equal.array(obj1, obj2, ...) else is.logical(all.equal(obj1, obj2, ...)) } all.equal <- function(obj1, obj2, tolerance=100*Machine()$doubl...
1998 May 21
1
all.equal - cut three
...y extract all numeric elements and compare using tolerance. It also tries to do a relative comparison rather than an absolute comparison, except for very small numbers. I hope someone with more experience than I have will examine this part carefully! Paul Gilbert _______ test.equal <-function (obj1, obj2, ...) UseMethod("test.equal") test.equal.default <-function (obj1, obj2, ...) { if (is.array(obj1)) test.equal.array(obj1, obj2, ...) else is.logical(all.equal(obj1, obj2, ...)) } all.equal <- function(obj1, obj2,...) {UseMethod("all.equ...
2012 Jul 24
1
Function for ddply
...ional Election Study (nes), looking at mean values of a numeric dep_var (environ.therm) across values of a factor (partyid3). I use ddply from plyr and wtd.mean from Hmisc. The nes requires a weight var (wt). I use Rcmdr's plotMeans to obtain a line chart. The following code works: attach(nes) obj1 = ddply(nes, .(partyid3), summarise, var = wtd.mean(environ.therm, wt)) print(obj1) plotMeans(obj1$var, obj1$partyid3, error.bars="none") Here is what happens when I write and run the function, meanN: meanN=function(data,x,y,w=NULL) + {obj1=ddply(data,.(x),summarise, var=wtd.mean(y,w...
2011 Aug 28
2
converting matrix in array
Hi everyone, have a small problem trying to converting a dataset in matrix form to an array. Specifically: data include 3D measurement -x,y,z of 59 points in 36 objects. They are stored as a matrix (x) of 2124 rows and 3 columns. What I want to do is to extract each subject's dataset using an array (b). Accordingly, I tried the following command: b<-array(a,c(59,3,36)). The problem is
2006 Jan 26
0
If you want to disconnect a database properly, there is the code:)!!!
...t;, :host => "1.2.3.4", :port => 5432, :database => "db1", :username => "dbuser1", :password => "dbuser1") GenTableAs.set_table_name ''table_no_1'' GenTableAs.reset_column_information() obj1 = GenTableAs.new @col1 = obj1.class.column_names() obj1["colaa"] = 123 obj1["colab"] = "123" obj1.save obj1 = nil GenTableAs.clear_connection # here we disconnect the connection # connection to a new database GenTableAs.establish_connection(:adapter =&...
2005 Jan 11
5
global objects not overwritten within function
Dear useRs, I have a function that creates several global objects with assign("obj",obj,.GlobalEnv), and which I need to run iteratively in another function. The code is similar to f <- function(...) { assign("obj",obj,.GlobalEnv) } fct <- function(...) { for (i in 1:1000) { ... f(...) ...obj... rm(obj) #code fails without this line } } I don't understand
2001 Dec 19
1
Pearson residuals in quasi family
Hi all, This is a very silly question or something escapes me: Let obj a simple gam poisson model. Let >obj<-gam(....,family=poisson) >obj1<-update(obj, family=quasi(link="log", var="mu")) >From summary.glm(obj1) the dispersion parameter is estimated 1.165; In fact it is: > (predict(obj1, se.fit=T)$se.fit[1:5]/predict(obj, se.fit=T)$se.fit[1:5])^2 4 5 6 7 8 1.165767 1....
1998 Jun 25
1
all.equal
I'm not sure what the process is for this, but can I get the following all.equal function put in the R base? Paul Gilbert ____ all.equal <- function(obj1, obj2,...) {UseMethod("all.equal")} all.equal.default <- function(obj1, obj2, tolerance=.Machine$double.eps) {if(mode(obj1) != mode(obj2) ) return("modes differ.") if (length(obj1) != length(obj2) ) return("lengths differ")...
2004 Jan 16
2
reference to objects
Hi, is there a way to reference to a data object without copying it? For example I have a huge matrix called dist and I want two objects obj1 and obj2 to have a memeber dist that points to the matrix, but I don't want, for memory reasons, to copy the matrix twice. As far as I understand the following code will generate three copies of my data: dist <- some_code_that_generates_data obj1$dist <- dist obj2$dist <- dist Thank...
1998 May 13
1
all.equal
I need the function all.equal which is in Splus but not yet in R. Below is a first cut. Comments would be appreciated. Paul Gilbert _______ all.equal <- function(obj1, obj2, ...) {if(mode(obj1) != mode(obj2) ) return("modes differ.") if(class(obj1) != class(obj2)) return("classes differ.") if(! all(unlist(attributes(obj1)) == unlist(attributes(obj2)))) return("attribut...
2010 Mar 05
1
Changing the Prompt for browser()
Is there a way that I can change the prompt for within a browser() call. I often use use code like > with(obj1,browser()) Browse[1]> Is there a way that I can set it so that I can get something like > with(obj1,browser(prompt="obj1")) obj1[1]> I know that prompt is not a valid option for browser, but it would be nice if it were. There is an option('prompt") but that does no...
2010 Mar 05
1
Changing the Prompt for browser()
Is there a way that I can change the prompt for within a browser() call. I often use use code like > with(obj1,browser()) Browse[1]> Is there a way that I can set it so that I can get something like > with(obj1,browser(prompt="obj1")) obj1[1]> I know that prompt is not a valid option for browser, but it would be nice if it were. There is an option('prompt") but that does no...
2006 Jul 07
3
attach and detach question
I have a large R program that I am constantly running over and over again. At the beginning of this program, I create a hige matrix and a huge dataframe but these are constant. What I mean by constant is that, if I run the program over later, I really should just use the old matrix and dataframe ( if they exist ) that were created in a previous run so that the program doesn't have to spend
2010 May 26
1
problem with not in in subseting dataframe
Hi all, I have a problem while subsetting a dataframe that is while I am using *%in%* condition like *stemp<-subset(temp, obj1 %in% obj2,select=c(temp))* this is working and giving results that what ever is there is both *obj1*and *obj2* ** ** but I want to get values which is there in *obj1* but not in *obj2 * can anyone help me how to get those values. i tried with *%o%* but i am not able to get it thanks in advance...
2011 Sep 07
1
access objects
hi, say I have consecutively numbered objects obj1, obj2, ... in my R workspace. I want to acces one of them inside a function, with the number given as an argument. Where can I find help on how to do that? Somebody must have been trying to do this before... Some keywords to start a search are appreciated as well. Here's an example, I hope it...
2001 Oct 01
1
generic default values
I have a generic function test.equal <- function(obj1, obj2, ...) UseMethod("test.equal") however, the only argument that specific methods use is "fuzz" so I would like to change this to test.equal <- function(obj1, obj2, fuzz=???) UseMethod("test.equal") The problem is that some methods use slightly different defau...
2006 Jan 13
1
How to disconnect to a database????
...=> 5432, :database => "gendb", :username => "dbuser", :password => "dbuser") @connected1 = GenTableAs.connection() @removedConnection = GenTableAs.remove_connection() @connected2 = GenTableAs.connection() # should be nil here obj1 = GenTableAs.new obj1["colaa"] = 100 obj1["colab"] = "100" obj1.save # should have raised exception or error here end end #################################################################################### the output of index @connected1: #<ActiveRecord:...
2017 Sep 22
0
Get function implementation for indirect CallInst.
...ample here. For “ call void %3(%class.Base* %1)”, I need to figure out Which implementation is called ( it can be manually figured out that _ZN1A5helloEv (A::hello() is called,how to figure it out in a pass ?) My initial thinking is trace back from "call void %3(%class.Base* %1)” until find %obj1 = alloca %class.A, align 8, but how can I associate %class.A with @_ZTV1A, so I can get the function from @_ZTV1A ? Thanks! ;virtual tables @_ZTV1A = linkonce_odr unnamed_addr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* bitcast ({ i8*, i8*, i8* }* @_ZTI1A to i8*), i8* bitcast (void (%class....