similar to: evaluating a vector of characters

Displaying 20 results from an estimated 40000 matches similar to: "evaluating a vector of characters"

2008 Jan 14
3
Listing the data contents of a package
Hi R users, Simply question: On the command line, how do I list the datasets contained within a package, e.g. MASS? I scanned the mailing list history but was unable to find the answer. Thanks in advance. Gregory --------------------------------- [[alternative HTML version deleted]]
2008 Mar 14
2
using nrow to identify one row
Hi fellow R-users, I have run into a problem when trying to identify the number of rows in a matrix. Say we have an arbitrary 5 by 5 matrix called temp: temp <- matrix(norm(25), nrow=5) The problem is that nrow(temp[1,]) returns NULL. I would like it to return 1 because in my larger program I am indexing the rows of large matrices according to another variable and I need to test when the
2010 Sep 10
3
Is there a bisection method in R?
Dear fellow R-users, Is there a function that does the bisection method? I was unable to find one. Thanks in advance. Gregory [[alternative HTML version deleted]]
2008 May 21
2
how to do pairwise sums in a matrix
I am looking for an efficient way to solve the following problem. I have a large matrix of continuous values with a small proportion of missing values. Columns correspond to variables where each variable has two measurements, call them A and B. The matrix is such that the columns are in sequence with respect to the variables. I would like to sum up the two measurements for each variable and each
2005 Jun 25
2
optimization problem in R ... can this be done?
Im trying to ascertain whether or not the facilities of R are sufficient for solving an optimization problem I've come accross. Because of my limited experience with R, I would greatly appreciate some feedback from more frequent users. The problem can be delineated as such: A utility function, we shall call g is a function of x, n ... g(x,n). g has the properties: n > 0, x lies on the
2007 Jul 30
3
Constructing correlation matrices
Greetings, I have a seemingly simple task which I have not been able to solve today and I checked all of the help archives on this and have been unable to find anything useful. I want to construct a symmetric matrix of arbtriray size w/o using loops. The following I thought would do it: p <- 6 Rmat <- diag(p) dat.cor <- rnorm(p*(p-1)/2) Rmat[outer(1:p, 1:p, "<")] <-
2007 Jul 28
8
generating symmetric matrices
Greetings, I have a seemingly simple task which I have not been able to solve today. I want to construct a symmetric matrix of arbtriray size w/o using loops. The following I thought would do it: p <- 6 Rmat <- diag(p) dat.cor <- rnorm(p*(p-1)/2) Rmat[outer(1:p, 1:p, "<")] <- Rmat[outer(1:p, 1:p, ">")] <- dat.cor However, the problem is that the matrix
2010 Jan 27
3
Function for describing segements in sequential data
Dear R-users, Say that I have a sequence of zeroes and ones: x <- c(1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0) The sequences of ones represent segments and I want to report the starting and endpoints of these segments. For example, in 'x', the first segment starts at location 1 and ends at 3, and the second segment starts at location 8 and ends at location 10. Is there an efficient
2009 Oct 06
4
Text editors for Sweave (rnw) files
Hi fellow R-users, Are there any text editors that recognize sweave (.rnw) files? I am running Windows Vista and in the past I used Tinn-R for R files but it (surprisingly) doesn't recognize rnw files and does not do any syntax highlighting for them. Thanks in advance, Greg __________________________________________________________________ Make your browsing faster, safer, and
2006 Jun 24
3
getting the smoother matrix from smooth.spline
Can anyone tell me the trick for obtaining the smoother matrix from smooth.spline when there are non-unique values for x. I have the following code but, of course, it only works when all values of x are unique. ## get the smoother matrix (x having unique values smooth.matrix = function(x, df){ n = length(x); A = matrix(0, n, n); for(i in 1:n){ y = rep(0, n); y[i]=1; yi =
2008 Mar 10
1
How can I sample from a two-dimensional grid of points
Hi everyone, My goal is to sample from a two-dimensional grid. Consider the following example of code: n.grid <- 500 muA.grid <- seq(-4,4, length=n.grid) muB.grid <- seq(-4,4, length=n.grid) mu.p <- matrix(NA, nrow=n.grid, ncol=n.grid) for(i in 1:n.grid){ for(j in 1:n.grid){ mu.p[i,j] <- dnorm(muA.grid[i], 0, 1)*dnorm(muB.grid[j], 0, 0.5) } } mu.p <-
2005 Jul 28
3
using integrate with optimize nested in the integration
Hi guys im having a problem getting R to numerically integrate for some function, say f(bhat)*optimize(G(bhat)), over bhat. Where id like to integrate this over some finite range, so that here as we integrate over bhat optimize would return a different optimum. For instance consider this simple example for which I cannot get R to return the desired result: f <- function(bhat) exp(bhat) g
2007 Nov 21
2
matrix elementwise average with NA's
Hello fellow R users, I have a matrix computation that I imagine should be relatively easy to do, however I cannot figure out a nice way to do it. I have two matrices, for example mat1 <- matrix(c(1:5,rep(NA,5), 6:10), nrow=3, byrow=T) mat2 <- matrix(c(2:6, 6:10, rep(NA,5)), nrow=3, byrow=T) I'd like to compute the element-wise average for non-NA entries. Of course (mat1+mat2)/2
2010 Jul 02
1
Producing residual plots by time for lme object
Fellow R-users, I have a longitudinal data set with missing values in it. I would like to produce a residual plot for each time using panel.xyplot function but I get an error message. Here's a simple example, library(nlme) set.seed(1544) longdata <- data.frame(ID=gl(10,1,50), y=rnorm(50), time = as.numeric(gl(5,10,50)), x = rnorm(50)) longdata$y[5] <- NA longdata$x[35] <- NA
2010 Jul 19
3
specifying column names in a vector of characters and the use?
Hi, What I would like to do is have a data.frame with column names and have these column names stored as strings in another vector. Then I would like to be able to access the data.fram columns via referencing the vector of names. The code below shows the last few executions that failed to retrieve the values for column named X1. Seth >
2005 Oct 23
1
factorizing many columns of a dataframe
Hi guys, I have a large number of columns of a dataframe that I want to apply a common factorization to; the columns are all numeric and the factorization collapses some of these values into common groups (labels). How can I do this systematically? Is there an analog to sapply that can pass columns as vectors to FUN? Thanks in advance, Gregory Gentlemen ---------------------------------
2010 Mar 31
1
strip.custom with strip on left for three conditioning variables
I want to use a strip.custom as with useOuterStrips for three conditioning variables. useOuterStrips restricts this to only two conditioning variables, and I cannot figure out how to write strip.custom properly to do this. library(lattice) mtcars$HP <- equal.count(mtcars$hp) #with two factors x2<-xyplot(mpg ~ disp | HP + factor(cyl), mtcars) useOuterStrips(x2) #with three factors
2005 May 02
1
Re: Long Shorewall Startup Times Revisited
Gregory Pleau wrote: >> >> The problem that you had with LDAP causing long Shorewall startup has >> resurfaced. In your mail to me, you mentioned that you had found that >> the issue was a permissions problem but gave no details. >> >> Would you be so kind as to give me the details so I can pass them on to >> the current sufferer? I notice that you are
2007 Sep 26
2
generate fourth vector based on known correlations
I am trying to generate a fourth vector,z, given three known and fixed vectors, x1,x2,x3 with corresponding known and fixed correlations with themeselves and with z. That is, all correlations are known and prespecified. How can I do this? Thank you, ben
2010 Jul 05
2
Function to compute the multinomial beta function?
Dear R-users, Is there an R function to compute the multinomial beta function? That is, the normalizing constant that arises in a Dirichlet distribution. For example, with three parameters the beta function is Beta(n1,n2,n2) = Gamma(n1)*Gamma(n2)*Gamma(n3)/Gamma(n1+n2+n3) Thanks in advance for any assisstance. Regards, Greg [[alternative HTML version deleted]]