similar to: combine elements of a character vector into a character

Displaying 20 results from an estimated 10000 matches similar to: "combine elements of a character vector into a character"

2006 Feb 04
2
saving a character vector
Hi R users I wrote a function that generates some character strings. generate.index<-function(n.item){ for (i in 1:n.item) { for (j in ((i+1):n.item)) { cat("i",formatC(i,digits=2,flag="0"),".",formatC(j,digits=2,flag="0"),"\n",sep="") } } } I
2006 Nov 06
3
CPU or memory
Hi R users Having both a faster CPU and more memory will boost computing power. I was wondering if only adding more memory (1GB -> 2GB) will significantly reduce R computation time? Taka, _________________________________________________________________ Get FREE company branded e-mail accounts and business Web site from Microsoft Office Live
2006 Jul 11
2
0* log(0) should be zero but NaN
Dear R-users >prob <- c(0.5,0.4,0.3,0.1,0.0) >cal <- prob * log(prob,base=2) >cal [1] -0.5000000 -0.5287712 -0.5210897 -0.3321928 NaN Is there any way to change NaN to zero ? I did come up with this by applying Ripley's relpy to my previous question cal <-prob*log(pmax(prob,0.00000001),base=2) Any suggestion ? Thank you Taka
2006 Sep 19
2
looking for some functions to analyze a data set.
Hi R-users I have a data set. There are 10 products and the numbers of people who ranked the products. The format of the data set is productID rank1 rank2 rank3 rank4 rank5 rank6 rank7 rank8 rank9 rank10 ------------------------------------------------------------------------------------------------------- 1 10 2 3 3 6 4 2 5
2006 Feb 05
2
generating strings in a tricky order
Hi R users I like to generate some strings (a character vector) in a special way like If i have 5 variables "002.001", "003.001", "003.002", "004.001", "004.002", "004.003", "005.001", "005.002", "005.003", "005.004" so the created string vector's elements are "002.001",
2006 Feb 18
2
figure out whether 1 is between two numbers
Hi R users I have two variables (X and Y) X <- rnorm(100,.7,.5) Y <- rnorm (100,.3,.1) I like to know whether 1 is between each pair of X and Y or not. Thanks TM
2006 Jun 27
3
looking for a more efficient R code.
Dear R-users I have four simple linear models, which are all in the form of a*X+b The estimated parameter vectors are a <- c(1,2,3,4) b <- c(4,3,2,1) My goal is to draw a plot where x-axis is X (range from -100 to 100) and y-axis is the sum of all four linear models X <- seq(-100,100, length=10000) plot(X, sum of the four linear functions) I started with a function for summing
2006 Aug 10
2
index.cond in xyplot
Dear R-users I have 5 dependent variables (y1 to y5) and one independent variable (x) and 3 conditioning variables (m, n, and 0). Each of the conditioning variables has 2 levels. I created 2*4 panel plots. xyplot(y1+y2+y3+y4+y5 ~ x | m*n*o,layout = c(4,2)) I would like to reorder the 8 panels. I tried to use index.cond (e.g., index.cond = list(c(1,3,2,4,5,7,6,8)) but it didn't work out.
2006 Feb 05
3
reading in a tricky computer program output
Hi R user I need to read in some values from a computer program output. I can't change the output format because the developer of the program doesn't allow to change the format of output. There are two formats. First one looks like this if I have 10 variables, ------------------------------------------------------------------------------------------------------ [ 1]
2006 Feb 07
1
(second round) creating a certain type of matrix
Hi R users Here is what I got with help from Petr Pikal (Thanks Petr Pikal). I modified Petr Pikal's code to a little to meet my purpose. I created a function to generate a matrix generate.matrix<-function(n.variable) { mat<-matrix(0,n.variable,(n.variable/2)/5+1) #matrix of zeroes dd<-dim(mat) # actual dimensions mat[1:(dd[1]/2),1]<-1 #put 1 in first half of first column
2006 Jul 10
2
problem in my code
Dear R-users I wrote a small program for assigning a membership Here is my script sample.size <- 60 x <- rnorm(sample.size, 0, 1) y <- rnorm(sample.size, 0, 1) x.mean <- mean(x) y.mean <- mean(y) membership <- numeric(sample.size) for (i in 1:sample.size) { if ((x[i] < x.mean) && (y[i] < y.mean)) { membership[i]
2007 Jun 29
1
extracting df and MS values from aov
Dear R users, I would like to extract df and Mean Sq values. I tried several things (e.g., str(model1), names(model1)) but I can't find a way to extract these values. I also tried to search using RSiteSearch. Any help will be appreciated. Thanks Taka, model1<-aov(dv~iv.1*iv.2*iv.3) summary(model1) Df Sum Sq Mean Sq iv.1 1 3.200 3.200
2006 Feb 17
1
extracting a element with a name attribute from a list
Hi R users I like to extract (or collect) a numeric element with a name from a list. Is there any way to extract just a numeric element without the name attached to the element. For example, >mylist Mantel-Haenszel chi-squared test with continuity correction data: table(mydata[, x]) Mantel-Haenszel X-squared = 8.3832, df = 1, p-value = 0.003787 alternative hypothesis: true
2005 Oct 25
8
Can anyone please tell me how to strip the white spaces from a character vector?
for example: > a$tic[1:10] [1] "AIR " "ABCB " "ABXA " "ACMR " "ADCT " "ADEX " [7] "ABM " "AFCE " "AG " "ATG " Can anyone please tell me how to strip the white spaces from a$tic? Thanks, Roger [[alternative HTML version deleted]]
2006 Feb 07
1
creating a certain type of matrix
Hi R users I like to generate a certain type of matrix. If there are 10 variables, the matrix will have nrow=10, ncol=((10/2))/5+1. so the resulting matrix's dimension 10 by 2. If there are 50 variables the dimension of the resulting matrix will be 50 by 6. The arrangement of elements of this matrix is important to me and I can't figure out how to arrange elements. If I have 20
2007 Jul 23
3
extraction of vector elements to new list
Dear R-community, I have got a list of vectors and would like to extract the first two elements of each vector to a new list. My list is of the style: my.list = list(c("a", "b", "c"), c("d", "e"), c("f", "g", "h", "i"), ...) #I want: new.list = list(c("a", "b"), c("d",
2007 Aug 28
1
substituting elements in vector according to sample(unique(vector))
Hello! Assuming I have a vector, such as v <- c(1,2,1,2,3,3,1) This vector has three unique elements: 1, 2, and 3. > unique(v) [1] 1 2 3 If I shuffle this vector of unique elements, I get something like this: > sample(unique(v)) [1] 3 2 1 In the vector v I started with, I would now like to replace each element in unique(v) with the corresponding element (i.e. the element with the
2006 Sep 28
2
get index of elements in vector
Hello all Is There a fuction that return a index of a element in vector? like this semantic example: vector = c( 100, 200, 300 ) getINDEX( vector, value = 200 ) Thanks in advance for your attention. Cleber Borges
2005 Sep 13
4
Remove vector elements from another vector
Hello, I have two vectors of different lengths. Fx a <- 1:9; b <- c(4, 5). What is the best way to remove the elements in vector b from vector a so that the result would be a vector with elements c(1,2,3,6,7,8,9)? Best regards, Kalle _________________________________________________________________ Find masser af gode tilbud p?? MSN Shopping http://shopping.msn.dk/
2006 Jan 26
1
DOS command using "system"
HI R users I have one question for using DOS command through "system" I like to delete a file that is located at C:\Program Files\DOSPROGRAM\input.dat I can use a DOS command "del" on Dos prompt like this C:\Documents and Settings> del "C:\Program Files\DOSPROGRAM\input.dat" to delete input.dat file. When I try to do the same thing on R using "system"