ote:
> On 12/11/2015 6:41 PM, Julio Sergio Santana wrote:
>
>> I have to store (in a file) an R object that was created with is name as
>> a string of characters, as follows:
>>
>> : nn <- "xxx"
>> : assign(nn, 5)
>> : xxx
>>
I have to store (in a file) an R object that was created with is name as
a string of characters, as follows:
: nn <- "xxx"
: assign(nn, 5)
: xxx
[1] 5
I don't want to store the object nn but the object xxx. I tried the
following two expressions but none of them worked:
: save(ge
I have a particular need to divide the device space to draw different plots
and texts, so I decided to use split.screen using a matrix to define the
different space partitions.
My code and explanation is as follows:
# -- START OF R CODE
dirGraf <- "TEST/" # A directory to put the resul
I need to add a legend with three entries that should
contain a greek letter (lambda). I learnt that it is
possible using the function expression. So I need to
build the expressions from the lambdas vector, and I
simply cannot do it. This is the uggly result I got:
x <- 0:20
cc <- c("yellow
Julio Sergio Santana gmail.com> writes:
> ...
> Producer <- function(f) function(x) 1/f(x)
>
Counsulting a previous post, I got to the solution, I just need to rewrite
the function Producer forcing it to eavaluate its argument, as follows
Producer <- function(f) {f
Let's say I define a simple list of functions, as follows
lf <- list(
function(x) x+5,
function(x) 2*x
)
Then I can take any individual function from the list and
use it with any value, as it is shown:
lf[[1]](3)
[1] 8
lf[[2]](3)
[1] 6
this gives me
Julio Sergio Santana gmail.com> writes:
>
> I'm trying to establish a connection to a pair of fifos in R, one
represents
> the input stream of a process and the other one the output of the same
> process. The problem is that R behaves very different when running the
&g
I'm trying to establish a connection to a pair of fifos in R, one represents
the input stream of a process and the other one the output of the same
process. The problem is that R behaves very different when running the
commands directly in the interpreter than when running via a script file.
He
Greg Snow <538280 gmail.com> writes:
>
> The take home message that you should be learning from your struggles
> is to "Not Use The 'assign' Function!" and "Do Not Use Global
> Variables Like This".
>
> R has lists (and environments) that make working with objects that are
> associated with eac
Julio Sergio Santana gmail.com> writes:
>
> I have a data frame whose first colum contains the names of the variables
> and whose second colum contains the values to assign to them:
>
>: kkk <- data.frame(vars=c("var1", "var2", "var
David Winsemius comcast.net> writes:
> So what happens if you try this:
>
> mapply(assign, kkk$vars, kkk$vals, MoreArgs = list(envir = .GlobalEnv)
>
Yes, it works in certain situations, as well as the equivalent code:
kkk <- data.frame(vars=c("var1", "var2", "var3"),
I have a data frame whose first colum contains the names of the variables
and whose second colum contains the values to assign to them:
: kkk <- data.frame(vars=c("var1", "var2", "var3"),
vals=c(10, 20, 30), stringsAsFactors=F)
If I do
: assign(kkk$vars[1], kkk$vals
Hi,
A model gives me as output a netCDF file which I read with ncdf package. The
output consists of three similar matrices: one contains the variable value,
and the other two, the longitude and latitude coordinates. I need to do a
contour graph with such information, however, the R contour funct
t;uno dos tres", "cuatro cinco", "seis")
> #get individual word count within quotes
> res1<-unlist(lapply(strsplit(vec1, " "),length))
> res1
> #[1] 3 2 1
>
> #get whole word count
> length(unlist(strsplit(vec1, " ")))
> #[1] 6
Hi,
I'm trying to use pipes in R. By now, I could launch the linux command "wc"
(to count words from a text), but
I don't know how to capture the results, say in a vector of chars...
Here is the R code I'm trying:
:> f <- pipe("wc", open="w")
:> writeLines(c("uno dos tres", "cuatro cinco", "seis")
I wonder if there exists some kind of inverse of the "names" primitive in
R. Let me explain what do I mean:
If I create a list:
-> li <- list(a=1, b=2, c=3, d=4)
then I can have:
-> names(li)
[1] "a" "b" "c" "d"
which is, I guess, some kind of vector, since
-> typeof(names(li))
[1] "char
I'm trying to build up a user inteface using the R tcltk component. Since the
documentation for this R library is scarce and poor, I have decided to use
only the .Tcl function to pass commands to the tcl interpreter. So I wrote
my
first very simple tcltk program, hoping to run it from inside R a
17 matches
Mail list logo