Displaying 20 results from an estimated 10000 matches similar to: "Using bquote to create names a for a list"
2012 Jul 21
2
two questions re: the use of lattice
Dear friends,
I have two questions regarding the use of lattice. First some code:
## begin code
z <- cbind(rep(c("BIC", "ICL", "s_v", "Q_v", "sig-q",
"s_lsk", "s_lML", "s_mlsk", "s_mlML", "s_la8",
"s_haar"), each = 250), rep(c(5, 10, 20, 30, 50), each = 50))
z
2012 May 31
1
Repost: Expressions returned by GlobalEnv functions and package functions
Hello,
(Sorry for the repost, i am resending in plain text)
I have a function 'ewrap' (see below for definition).
It takes 3 expressions and returns another expression e.g.
map <- ewrap({
len <- length(r$addon)
rhcollect(len,1)
})
becomes:
expression({
NULL
result <- mapply(function(.index, k, r) {
{
len <- length(r$addon)
2013 Apr 01
3
expression
Hi all,
I´m using
titt<- expression(paste("R con ventanas de 200 ", italic(datos)))
And it works properly on a plot(...,main=titt,..)
But if I want to add an improvement to avoid typing n on the plot so that
n<-200
titt<- expression(paste("R con ventanas de ",n, italic(datos)))
It doesn´t recognize that n is a "variable" and adds "n" letter
2011 Sep 07
2
Using substitute on a function parameter
Hello,
I would like to write a function where substitute operates on the
parameter, but ...
> Expression = function(o,l) substitute(o, l)
> Expression({x=.(FOO)}, list(FOO=2))
o
How do i get substitute to work on the contents of o.
Regards
Saptarshi
2009 Nov 27
1
Force a variable substitution in expression
Hello,
I have a function that creates an expression object with some variables
substituted e.g
foo <- function(s){
expression({
v <- s
print(v)
})
}
Thus foo returns an expression, however the expression has the symbol 's'
contained within it and thus returns an error when eval'd e.g
x <- foo(10)
eval(x)
Error in eval(expr, envir, enclos) : object 's'
2013 May 13
2
reduce three columns to one with the colnames
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130513/fe848ce7/attachment.pl>
2008 Sep 19
1
Lines between panels in lattice
Hello,
I have a multi-page display each consisting of two-panels above each
other.
I need to draw a line from the top panel to bottom panel. Using
current.vpTree()
i find that "plot1.panel.1.2.vp" and "plot1.panel.1.1.vp" are the top
and bottom ones respectively.
I am using the following code(inspired by Paul Murrell's R Graphics)
to draw a line.
(All the
2009 Jan 05
2
eval using a environment X but resultsin .GlobalEnv
Hello,
Suppose I have an expression, E, which accesses some variables present
in an environment V.
I do this via
eval(E,envir=V)
however all assignments end up in V. I would like the results of
assignments in E to end up in the .GlobalEnv ? Or at least the calling
environment.
Is there a quick way to this instead of iterating over all objects E
and assigning into .GlobalEnv?
Thank you
Saptarshi
2012 Oct 25
3
Expression in legend of plot
I would like to have an expression f^(-1)(x) in a legend of plot. For this I
used expression(f^{-1}(x)), but variable is always in exponent. How could I
change it in order to (x) be in a line, not in exponent?
Thank you for your responses!
--
View this message in context: http://r.789695.n4.nabble.com/Expression-in-legend-of-plot-tp4647393.html
Sent from the R help mailing list archive at
2013 Jun 18
2
find closest value in a vector based on another vector values
Dear All,
would you please provide your thoughts on the following:
let us say I have:
a <-c(1,5,8,15,32,69)
b <-c(8.5,33)
and I would like to extract from "a" the two values that are closest to the values in "b", where the length of this vectors may change but b will allways be shorter than "a". So at the end based on this example I should have the result
2009 Sep 23
2
Crash due to extreme example
Hello,
I was trying this bit of code (i know it is an extreme case)
g=function(r){
if(r==1)
return(list(x=1))
else
return(list(x=g(r-1)))
}
For z=g(500), the code runs but when I print z i.e
>> z
I get
<environment: R_GlobalEnv>
*** caught bus error ***
address 0x1, cause 'non-existent physical address'
Possible actions:
1: abort (with core dump, if enabled)
2008 Nov 30
1
Rserve and creating a list of lists
Hello,
I have some code which generates lattice objects. The function
recieves serialized forms of the lattice objects which it then
unserializes and then adds to an ArrayList<REXP>.
REXPRaw rser = new REXPRaw( target ); //target contains the raw
serialized forms of lattice objects
rconn.assign("temp",rser);
REXP ret =
2012 Sep 12
3
Need help
Hello,
I am brand new in this site as well as in R. Please accept my early apology if it's not the right place to ask such a question.
I have the following equation:
b=[2(1-a)(1+2a)^0.5]/(1+3a)
How can I solve the above equation for 'a' using R?
Thanks in advance.
KD
[[alternative HTML version deleted]]
2008 Oct 06
1
Lattice and Axis height
Hello,
My plots consist of 2 rows, 1 column, many pages
I've managed to selectively turn of strips for the bottom panel and
roll my own strip for the top
par.strip.text = list(lines = c(0,3),cex=0.6)
I have my own custom prepanel function too.
What i'd like to do is turn off the x-axis for the top panel (since on
a given page the xlim is same for both top and bottom panel, but the
2008 Dec 12
1
Writing a Long across the network?
Hello,
I have to write single Long to a server written in java. The server
passes the input as
in.readLong() // it expects to receive 8 bytes
In Python, i can do it by sending struct.pack( "!q", value)
However, I have tried this
writeBin(length(x),con=conn,endian="big") #conn opened in binary
But the response on the server side is wrong, eg. 1 is received as
2009 Aug 14
1
Embed R, and provide a function to user scripts
Hello,
I'm not sure how to go about this. Suppose I have a function
SEXP boo(SEXP x){
//do something
}
Also, I have an executable which embeds R in itself. I would like to provide
a R function to user code to call that calls 'boo' e.g
##user supplied expression that is given to me
x<-1
boo(x)
One way is to create a library with function boo that performs .Call to boo,
but is
2012 Jul 23
3
How to do the same thing for all levels of a column?
Dear all,
I am a R beginner, and I am looking for a way to do the same thing for all
levels of a column in a table.
Basically, I have a bunch of protein sequences composed of different amino
acid residues, and each residue is represented by an uppercase letter. I
want to calculate the ratio of different amino acid residues at each
position of the proteins. Here is an example table:
Proteins
2012 Mar 16
3
Y-axis label on the right hand side in lattice?
Hello,
Is there a way to add ylab on the right hand side also (in lattice)?
Different from the left hand side?
Cheers
Saptarshi
[[alternative HTML version deleted]]
2009 Mar 30
1
Setting the names attribute of a list?
Hello,
I have created a vector with 2 elements(see code below)
I am calling this function many thousands of times (hundreds of
thousands) after some time
i get
*** caught segfault ***
address 0x5, cause 'memory not mapped'
However, if i dont set the R_NamesSymbol, I do not get any such error.
Am I doing this correctly?
Thank you
Saptarshi
==CODE===
// kxp and usar are two SEXP's
2009 Sep 20
1
Return a list from a .Call but segfaults
Hello,
I call a function via .Call passing to it a raw vector(D) and an
integer(I)
The vector is a series K1,KData1, V1,VData1, K2, KData2, ...
where the integer K1 is the length of Data1 and similarly for Ki (wrt
Datai)(similarly for V*) There 2*I such pairs( (Ki,KDatai), (Vi,VDatai))
The numbers Ki(and Vi) are written in network order.
I am returning a list of I elements each element a