Displaying 20 results from an estimated 11000 matches similar to: "parse and eval character vector"
2009 Feb 11
2
error in my previous message
i'm sorry. i had an error in my previous code because i left out a
letter in the rownames.
while fixing that, i also found a solution. so i'm sorry for the
confusion.
below is my fix.
temp2 <- matrix(rnorm(10),nc=1,nrow=10)
rownames(temp2) <-
2009 Feb 11
2
sorting a matrix by the column
this is a bad question but I can't figure it out and i've tried. if i
sort the 2 column
matrix , temp1, by the first column, then things work as expected. But,
if I sort the 1 column matrix, temp2, then it gets turned coerced to a
vector. I realize that I
need to use drop=FALSE but i've put it in a few different places with no
success. Thanks.
temp1 <-
2006 Jan 04
3
matrix math
I am using R 2.1.1 in an windows XP environment.
I have 2 dataframes, temp1 and temp2.
Each dataframe has 20 variables (“cocolumns") and 525 observations (“rows”). All variables are numeric.
I want to create a new dataframe that also has 20 columns and 525 rows. The values in this dataframe should be the sum of the 2 other dataframe.
(i.e. temp1$column
2012 Oct 31
2
Aggregate Table Data into Cell Frequencies
R-help -
I have this set of aggregated tables (sample data below via dput()). And I
would like to have delayValue as the column variables with the "temp"
(temp1, temp2, temp3) values as the row variables. However I would like to
have the temp variables *aggregated into single rows* so that I have the
frequency ("Freq" | counts) of each time each "delayValue" occurs
2010 Nov 19
3
Sweave Dynamic Graph Question
i have a time Series of IBM closing px from 1/1/2000 to today
I want to graph the time serie by dividing the graph by year and month
all the monthly graphs with the same year will go to one page. so from
1/1/2000 to 11/19/2010. i will have
11 pages, and each page will have 12 graphs (jan to dec) except for 2010.
I am able to do it in R, but when i use sweave, I can only print the last
page.
2006 Mar 03
1
NA in eigen()
Hi,
I am using eigen to get an eigen decomposition of a square, symmetric
matrix. For some reason, I am getting a column in my eigen vectors (the
52nd column out of 601) that is a column of all NAs. I am using the option,
symmetric=T for eigen. I just discovered that I do not get this behavior
when I use the option EISPACK=T. With EISPACK=T, the 52nd eigenvector is
(up to rounding error) a
2009 May 28
2
Replace is leaking?
Okay, someone explain this behaviour to me:
Browse[1]> replace(rep(0, 4000), temp1[12] , temp2[12])[3925]
[1] 0.4462404
Browse[1]> temp1[12]
[1] 3926
Browse[1]> temp2[12]
[1] 0.4462404
Browse[1]> replace(rep(0, 4000), 3926 , temp2[12])[3925]
[1] 0
For some reason, R seems to shift indices along when doing this replacement.
Has anyone encountered this bug before? It seems to crop up
2011 Mar 09
2
Anomaly with unique and match
I stumbled onto this working on an update to coxph. The last 6 lines
below are the question, the rest create a test data set.
tmt585% R
R version 2.12.2 (2011-02-25)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)
# Lines of code from survival/tests/singtest.R
> library(survival)
Loading required package: splines
2005 Nov 23
2
vector of permutated products
Given an x-vector with, say, 3 elements, I would like to compute the
following vector of permutated products
(1-x1)*(1-x2)*(1-x3)
(1-x1)*(1-x2)*x3
(1-x1)*x2*(1-x3)
x1*(1-x2)*(1-x3)
(1-x1)*x2*x3
x1*(1-x2)*x3
x1*x2*(1-x3)
x1*x2*x3
Now, I already have the correctly sorted matrix of permutations! So, the
input looks something like:
#input
x<-c(0.3,0.1,0.2)
Nx<-length(x)
Ncomb<-2^Nx
2011 Mar 29
2
List extraction
I have created a list of tables with the same columns but different number of
row.
Example (actual list has ~200 elements):
> temp1<- data.frame(ID=c("Herb","Shrub"),stat=c(4,5),pvalue=c(.03,.04))
> temp2<- data.frame(ID=c("Herb","Shrub",
> "Tree"),stat=c(12,15,13),pvalue=c(.2,0.4,.3))
> L<-list(a=temp1,b=temp2)
> L
$a
2005 Dec 29
1
Problems with calloc function.
Hi all,
I have a C code in Linux, it has 7 pointers and compile e run OK, but when I
run in R happens problems with calloc function, it returns NULL.
###############################################
> int *temp1,*temp2,*temp3,*temp4;
temp1 = (int *)calloc(col,sizeof(int));
if(temp1 == NULL){
printf("\n\n No Memory1!");
exit(1);
}
temp2 = (int *)calloc(col,sizeof(int));
2006 Oct 16
1
Bugs with partial name matching during partial replacement (PR#9299)
This is a rather interesting, but I don't think it is a bug - it is
just things that "you are not supposed to do"... you are assuming
a certain evaluation order of the 4 "$" operators in
" D$ABC[D$M] = D$V[D$M] " as in:
temp1 <- D$M # 2nd and 4th
temp2 <- D$V[temp1] # 3rd
D$ABC[temp1] = temp2 # 1st
What R did was this:
2011 May 14
1
Identify Objects that end with .f (and all caps)
Dear R Helpers,
I am trying to find a way to identify all the objects in my environment
that are all caps and then end with .f. I can do the all caps part pretty
easily, but I have tried a number of variations on the \ and can't get a
recognition of that operator. As a simple example
A.f<-"foo1"
AA.f<-"foo2"
aa.f<-"foo3"
A.a<-"foo4"
ls()
2008 Mar 11
2
persp question
someone sent in a question earlier about doing
something in 3D so i took a stab at it purely
for educational purposes ( i'm not even sure that I understood the question actually ).
Unfortunately, persp gives me an error that I don't understand because it says "object y not found". I'm sending y in as a parameter to persp similar to what ?persp shows in one of oits examples
2015 Jul 09
3
[LLVMdev] New backend help request.
I'm trying to figure out how to map more complex CISC instructions now. For
example on the 68000, you have things like --
add.w (a0)+,(a1)+
So that equates to:
temp1 = load a0
add 2, a0
temp2 = load a1
temp1 = add temp1, temp2
store temp1, a1
add 2, a1
How do I express that in a form for LLVM?
I see things like pre_store and post_store, but I cant find anything in the
way of documentation
2010 Oct 17
4
how to convert string to object?
temp = "~aparch("
temp1 = paste(temp,1, sep = "")
temp2 = paste(temp1,1, sep = ",")
temp3 = paste(temp2, ")",sep = "")
temp 3 is a character but I want to convert to formula object. How do I do
this?
--
View this message in context: http://r.789695.n4.nabble.com/how-to-convert-string-to-object-tp2999281p2999281.html
Sent from the R help mailing
2017 Dec 02
2
source files in temp environment
Hi all,
I often keep code in separate files for organizational purposes, and
source() that code from higher level scripts. One problem is that those
sourced files often create temporary variables that I don't want to keep
around. I could clean up after myself with lots of rm()'s, but that's a
pain, and is messy.
I'm wondering if one solution might be to source the code in a
2010 Oct 07
1
model.frame deficiency
The model.frame function has trouble with a certain type of really long
formula. Here is a test:
tname <- paste('var', 1:50, sep='')
tmat <- matrix(rnorm(500), ncol=50, dimnames=list(NULL, tname))
tdata <- data.frame(tmat)
temp1 <- paste( paste(tname, tname, sep='='), collapse=', ')
temp2 <- paste("~1 + cbind(", temp1, ")")
2012 Mar 29
1
Error, Variable is Missing
Hi, I am writing a function to plot a pdf of a distribution,
GNL.pdf.fn = function(x,mu,sigma,alpha,beta,rho)
{
y = x-rho*mu
cf.fn = function(s){
cplex = complex(1,0,1)
temp1 = alpha*beta*exp(-sigma*s^2/2)
temp2 = (alpha-cplex*s)*(beta+cplex*s)
out = (temp1/temp2)^rho
out
}
temp.fn = function(s){
(Mod(cf.fn(s)))*cos(Arg(cf.fn(s))-s*y)
}
int.fn =
2003 Jan 08
1
Lattice: Plotting two densities on the same plot(s)?
I am trying to plot two density lines on the same graph. Using the
functions on the base package, I would go:
plot(density(x), col = 1)
lines(density(y), col = 2)
And I get two distinct (one-bump) density lines. When I try to do it
using lattice, I get two two-humped lines. (In other words, I think the
smoothing function is taking the next set of data points and smoothing them
in the same