Displaying 20 results from an estimated 200000 matches similar to: "if a variable is defined"
2011 Feb 23
3
Using string to call/manipulate an object
I am using getSymbols function from quantmod package to get price data from
internet.
Currently I have:
my.ticker <- "IBM"
getSymbols(my.ticker,src="google")
This creates an xts object named my.ticker which contains historical price
data for IBM.
How can I call and manipulating this xts object using my original string
my.ticker?
I want to do:
colnames(my.ticker) <-
2011 Feb 24
2
if statements on vectors
I have two vectors: both have possible values of 1,-1, or 0
trend1 <- c(1,1,1,1,1,1,-1,-1,-1,-1,-1,-1)
trend2 <- c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,)
i want to create a third vector that is conditional upon these two vectors:
if (trend2 == 1 && trend1 == 1) {position <- 1}
elseif (trend2 == -1 && trend1== -1) {position <- 1}
else {position <- 0}
based on this two
2011 Mar 10
2
using lapply
I have a function with the follow signare:
apply.strategy(instr, strat)
where instr and strat are both objects of classes instrument and strategy
respectively.
I want to apply this function to a list that holds objects of the class
instrument.
Currently I am doing this by explicit looping:
for(i in length(instr.list) ) {
apply.strategy(instr.list[[i]], my.strat)
}
Is it possible to
2011 Feb 10
1
accessing members from a data frame
I have a data frame with the following columns:
Date Price Buy Sell
The Buy and Sell variables are binary. They are either zero or 1.
Additionally, they are mutually exclusive. Either Buy is 1, Sell is 1 or
they are both 0. But they are never both 1 for a given observation.
I want to see observations for either either Buy == 1 or Sell ==1 (but not
the ones where Buy == 0 and Sell ==0). How can
2007 Feb 14
4
How to define a multi line comment
Hi All
Is there who knows to define multi line comment? ( in Java we can define by
/* and */ )
Best Regards
Kushan Jayathilake
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To
2008 Nov 20
1
How to convert S4 class slots into data.frame or how to assign variables of type 'Date'
Hi,
I created a class (S4) with some slots like value, date, description
(it's actually a financial transaction class). Now I need a method to
convert this class forth and back into a single row data.frame, where
every slots represents a column. This method looks at the moment like
this:
> setMethod("as.data.frame", "Transaction",
function(x, row.names =
2013 Apr 30
6
[PATCH net-next 2/2] xen-netback: avoid allocating variable size array on stack
Tune xen_netbk_count_requests to not touch working array beyond limit, so that
we can make working array size constant.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
drivers/net/xen-netback/netback.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index
2011 Jan 28
1
arules package question- apriori/S4 object export question
I am new to R( but quickly being awed by the range of this it can accomplish,
you have one more convert to the useR universe). I have successfully
implemented the apriori function and are getting great results. My question
concerns how to export these results. I have read lots about write.csv
functions and exporting data frames and other standard objects. Im having
difficulty working with these S4
2012 Nov 26
1
A problem subsetting a data frame
Hi all,
I have this microarray large microarray data set (ALL) from which I would like to subset or extract a set of data based on a factor ($mol.biol). I looked up some example of subsetting in, picked up two commands and tried both but I got error messages as follows
> testset <- subset(ALL, ALL$mol.biol %in% c("BCR/ABL","ALL1/AF4"))
>> Error in
2006 Jan 03
1
S4 default initialization: unwanted NULL
The default initialization for slots of class "factor" and
"data.frame" gives NULL. This seems odd, since those slots can't ever
be set to NULL by the user. I would expect zero-length instances of
factor and data.frame.
Here is an example:
setClass("FOO", representation(a="factor", b="data.frame", c="numeric"))
[1] "FOO"
2004 Mar 09
5
Adding data.frames together
I have a series of data frames that are identical structurally, i.e. -
made with the same code, but I need to add them together so that they
become one, longer, data frame, i.e. - each of the slot vectors are
increased in length by the length of the added data frame vectors.
So if I have df1 with a slot A so that length(df1$A) = 100 and I have
df2 with a slot A so that length(df2$A)=200 then I
2010 May 17
1
format.data.frame containing S4 class with format method
Hi again,
I must be misunderstanding something fundamental about how an S4 class
stored in a data.frame can be persuaded to print according to a desired
format. The help page says:
format.data.frame formats the data frame column by column, applying the
appropriate method of format for each column.
Here is my class:
> setClass("A",contains="character")
[1] "A"
2020 Jul 10
2
Strange behaviour of methods::slot() when returning a tibble
I have an S4 object class defined in a Bioconductor package which contains multiple slots, some of which are tibbles, whilst others are vectors. If I call
slot(object, name)
where 'name' is an slot that contains a vector, everything works as expected. However, when I call slot(object, name) where 'name' is an slot that contains a tibble I get the following warning:
Warning
2004 Nov 16
1
lme, two random effects, poisson distribution
Hello,
I have a dataset concerning slugs. For each slug, the number of
pumps per one time slot was counted. The number of pumps follows
Bi(30, p) where p is very small, thus could be approximated by
Poisson dist. (# of pumps is very often = 0)
The slugs were observed during 12 time slots which are correlated in
time as AR(1). The time slots are divided into two categories:
Resting time
2012 Mar 14
1
How to extend a slot of a class?
Hej hej,
is there a way to extend the SpatialPointsDataFrame data slot?This is the structure of an object of it:> str(coord)
Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
..@ data :'data.frame': 214 obs. of 2 variables:
.. ..$ location.long: num [1:214] -79.8 -79.8 -79.8 -79.8 -79.8 ...
.. ..$ location.lat : num [1:214] 9.16 9.16 9.16
2002 Sep 18
1
attach()ing User-Defined Classes with Complex Structures
How would you implement attach()ing to a user-defined class with multiple
slots in R?
A primary goal of my software is to hide the data representation from the
user,
allowing them to attach() to my program's complex classes and refer to
their contents by name - THEREBY avoiding having to pass the classes to
every function call.
Also, is it true that attaching to a to a sub-classed list
2007 Dec 04
1
[LLVMdev] Using frameindex in a pattern
Evan Cheng wrote:
>
> On Dec 3, 2007, at 12:53 PM, Vladimir Prus wrote:
>
>>
>> Suppose I have a target that does not have register+constant
>> addressing mode. Then, I have DAG like:
>>
>> (store ..., (frameindex))
>>
>> Targets like SPARC have the following patterns to catch this:
>>
>> def ADDRri : ComplexPattern<i32, 2,
2012 Mar 02
3
[LLVMdev] Stack alignment on X86 AVX seems incorrect
On Fri, Mar 2, 2012 at 11:32 AM, Evandro Menezes <emenezes at codeaurora.org>
wrote:
...
> Figure 3.3 on page 16 of www.x86-64.org/documentation/abi.pdf is not
> normative. See foot note 7 in the same page. Figure 3.4 on page 21
> confirms that the use of a frame-pointer is optional.
>
> So, if one doesn't use ENTER in the prologue and uses RSP to access local
>
2017 Sep 07
3
Unify debug and optimized variable locations with llvm.dbg.addr [was: DW_OP_LLVM_memory]
On Thu, Sep 7, 2017 at 11:11 AM, Robinson, Paul <paul.robinson at sony.com>
wrote:
> Different intrinsics sounds like a good solution to me. J
>
>
>
> So what happens with the case where a variable is registerized but later
> we decide to spill it? Presumably we'd have a dbg.addr to point to the
> spill slot. In past compilers I've used, spill slots were
2008 Jun 07
1
slot(obj, "nosuch") documentation question
Using slot() on object (or "@") and using a nonexistent
slotname returns an error (see example code).
R> setClass("foobar", representation=list(a="numeric"))
[1] "foobar"
R> foobar <- new("foobar", a=5)
R> foobar at a
[1] 5
R> foobar at b
Error: no slot of name "b" for this object of class "foobar"
The details