Displaying 20 results from an estimated 700 matches similar to: "calling a list element from a list name passed to a function"
2007 Aug 17
4
matching elements from two vectors
Hi,
Imagine a vector x with elements (1,2,1,1,3,5,3,3,1) and a vector y with
elements (2,3). I need to find out what elements of x match any of the
elements of y.
Is there a simple command that will return a vector with elements
(F,T,F,F,T,F,T,T,F). Ideally, I would like a solution that works with
dataframe colums as well.
I have tried x==y and it doesn't work.
x==any(y) doesn't work
2010 Aug 20
3
change object name within for loop
Hi,
I am writing a for loop that creates one object, say 'outn' on every
round of the loop. I would like the name of each object to include the
index of the loop as in, for example:
out1, out2, out3, ...
And I would like the naming of the object to take place automatically
as the loop moves through?
Similarly, I would like to be able to call different objects (in1,
in2, in3,
2012 Nov 08
4
Accessing selected elements of a list
Hi,
If I have a vector:
junk <- c(2,0,0,3,0)
and want to access, say, all the elements that are greater than zero. I just do:
junk[which(junk>0)]
Now, If I have a list:
jlist <- list(NULL,c(1,0),NULL,c(1,2,3), NULL)
and want to access all the elements that have length greater than zero, I know how to find the elements with:
which(sapply(jlist,length)>0)
But how do I get a
2007 Aug 21
2
extracting month from date in numeric form
Hi,
Anyone knows what would be a short way of extracting a month from a date in
numeric or integer format?
months("1979-12-20")
returns
"December" in character format.
How could I get 12 in numeric or integer format?
Thanks!
G.
[[alternative HTML version deleted]]
2008 Mar 13
2
joining matrices, vectors, scalars in one object
Hi,
I have:
a <- matrix(c(0,1,0,1),nrow=2)
b <- matrix(c(1,1,1,0,0,0),nrow=3)
c <- 1
d <- c(1,0,1)
And I would like to join them in an object 'thing' so that I can
access a, b, c, or d through an index in a for loop.
For example:
thing[4]
would return
[1] 1 0 1
Note however, that I have many of these 'thing' components. So many
that a command like
thing
2007 Aug 17
1
finding the row(s) for a date in a data frame
Hi,
If I have a data frame A with the following format:
Day1 Day2 Day3 Day4
1 1979-11-02 1979-11-03 1979-11-04 <NA>
2 1979-12-06 <NA> <NA> <NA>
3 1979-12-13 1979-12-14 1979-12-15 1979-12-16
4 1979-12-20 <NA> <NA> <NA>
And a date "1979-12-14", for
2011 Sep 08
3
Density function: Area under density plot is not equal to 1. Why?
Hi, I have a vector 'data' of 58 probability values (bounded between 0 and 1) and want to draw a probability density function of these values. For this, I used the commands:
data <- runif(58)
a <- density(data, from=0, to=1)
plot(a, type="l",lwd=3)
But then, when I try to approximate the area under the plotted curve with the command:
area <- sum(a$y)*(a$x[1]-a$y[2])
2013 Nov 21
2
overlaying 2D grid on randomly distributed points
Hi, I have a cloud of randomly distributed points in 2-dimensional space and want to set up a grid, with a given grid-cell size, that minimizes the distance between my points and the grid nodes. Does anyone know of an R function or toolbox that somehow addresses this problem? This is a problem of optimizing the location of the grid, not a problem of deciding what should be the grid-cell size,
2011 Dec 08
3
[LLVMdev] Adding option to LLVM opt to disable a specific pass from command line
Hello Devang,
answers are interleaved
2011/12/7 Devang Patel <dpatel at apple.com>
> Hello,
>
> On Dec 7, 2011, at 2:07 AM, Seb wrote:
>
> > Hi all,
> >
> > I would like to add an option for LLVM 'opt' to disable a specific
> optimization pass from command line.
> >
> > The idea is to have something like:
> >
> > opt -O2
2012 Dec 10
1
[LLVMdev] issue writing llvm metadata
Hi,
I am looking to write customized metadata to a particular load instruction using LLVM transform pass (A function pass to be specific). I have the following code snippet.
> Value *CI = ConstantInt::get(getGlobalContext(), APInt(8,2));
> ArrayRef<Value*> temp = ArrayRef<Value*>( CI);
> MDNode *Node = MDNode::get(load->getContext(), temp);
>
2008 Mar 15
3
locating minimum value in matrix
Hi,
I have a matrix BEE and want to find the row and column numbers of
the minimum value in that matrix.
The command
which(BEE==min(BEE))
returns only one value which, I take, is the position of the minimum
in a vector with as many elements as the matrix.
Is there a quick and simple way of getting row and column numbers?
Thanks,
Gonçalo
[[alternative HTML version deleted]]
2009 Jan 21
1
finding row and column indices of date in multiple columns of a data frame
Hi,
I have a data.frame SAMPLES with columns:
Site Site# Season Day1 Day2 Day3
Day1, Day2, Day3 are class "Date", the other columns are numeric or
factor.
I have a date "mydate" that may or may not be listed in my data.frame
and I need to find that out.
If "mydate" is there, I want to get the number of the data.frame row
where it occurs.
2007 Oct 15
2
clipping off words inside a vector of strings
Hi,
I have a vector of strings (class character) with 6 elements (length
6). I call it 'names'.
"Graham Chapman"
"John Cleese"
"Terry Gilliam"
"Eric Idle"
"Terry Jones"
"Michael Palin"
And I want to turn it into another vector of strings called
'shortnames' with the same length.
The new vector should look like:
2011 Dec 07
0
[LLVMdev] Adding option to LLVM opt to disable a specific pass from command line
Hello,
On Dec 7, 2011, at 2:07 AM, Seb wrote:
> Hi all,
>
> I would like to add an option for LLVM 'opt' to disable a specific optimization pass from command line.
>
> The idea is to have something like:
>
> opt -O2 -disable-pass=[passname,...]
>
> Do you think it could be useful ?
I have few questions :
- Why (and when) would you us this ?
- Some of the
2011 Dec 07
2
[LLVMdev] Adding option to LLVM opt to disable a specific pass from command line
Hi all,
I would like to add an option for LLVM 'opt' to disable a specific
optimization pass from command line.
The idea is to have something like:
opt -O2 -disable-pass=[passname,...]
Do you think it could be useful ? How should I proceed to develop it and
commit changes to LLVM trunk ?
Thanks for your advices and recommandations.
Best Regards
Seb
-------------- next part
2015 Nov 22
2
[lld] R_MIPS_HI16 / R_MIPS_LO16 calculation
On Sun, Nov 22, 2015 at 1:28 AM, Rui Ueyama <ruiu at google.com> wrote:
> I'm not sure if I understand the semantics of HI16 and LO16 relocations. If
> my understanding is correct, a pair of HI16 and LO16 represents an addend
> AHL. AHL is computed by (AHI<<16) | (ALO&0xFFFF). Can't we apply HI16 and
> LO16 relocations separately and produce the same relocation
2015 Nov 21
2
[lld] R_MIPS_HI16 / R_MIPS_LO16 calculation
On Sat, Nov 21, 2015 at 10:08 AM, Rui Ueyama <ruiu at google.com> wrote:
> On Fri, Nov 20, 2015 at 11:02 PM, Simon Atanasyan <simon at atanasyan.com>
> wrote:
>>
>> On Sat, Nov 21, 2015 at 9:28 AM, Rui Ueyama <ruiu at google.com> wrote:
>> > On Fri, Nov 20, 2015 at 10:13 PM, Simon Atanasyan <simon at atanasyan.com>
>> > wrote:
>>
2015 Nov 21
2
[lld] R_MIPS_HI16 / R_MIPS_LO16 calculation
Hi,
I am working on support R_MIPS_HI16 / R_MIPS_LO16 in the new LLD and
have a couple of questions.
== Q1
In case of MIPS O32 ABI we have to find a matching R_MIPS_LO16
relocation to calculate R_MIPS_HI16 one because R_MIPS_HI16 uses
combined addend (AHI << 16) + (short)ALO where AHI is original
R_MIPS_HI16 addend and ALO is addend of the matching R_MIPS_LO16
relocation [1]. There are two
2009 Aug 21
2
2d color coded line plot
Hi! I'm not experienced very experienced with R and i'm looking for a
way doing plots like in this example
http://www.mathworks.de/matlabcentral/fx_files/23566/2/color_line3.png,
which basically it is a 2d plot in which the 3rd dimension (variable) is
color coded. I have only seen elsewhere that it is possible to color
code dots in a scatter plot and I tried it with success although I
2015 Nov 21
2
[lld] R_MIPS_HI16 / R_MIPS_LO16 calculation
On Sat, Nov 21, 2015 at 9:28 AM, Rui Ueyama <ruiu at google.com> wrote:
> On Fri, Nov 20, 2015 at 10:13 PM, Simon Atanasyan <simon at atanasyan.com>
> wrote:
>>
>> In case of MIPS O32 ABI we have to find a matching R_MIPS_LO16
>> relocation to calculate R_MIPS_HI16 one because R_MIPS_HI16 uses
>> combined addend (AHI << 16) + (short)ALO where AHI is