similar to: (unclassified?) Help Question

Displaying 20 results from an estimated 500 matches similar to: "(unclassified?) Help Question"

2010 Aug 03
4
Need help on upper.tri()
HI, I am really messing up to make a symmetrical matrix using upper.tri() & lower.tri() function. Here is my code:   > set.seed(1) > mat = matrix(rnorm(25), 5, 5) > mat            [,1]       [,2]       [,3]        [,4]        [,5] [1,] -0.6264538 -0.8204684  1.5117812 -0.04493361  0.91897737 [2,]  0.1836433  0.4874291  0.3898432 -0.01619026  0.78213630 [3,] -0.8356286  0.7383247
2010 Dec 23
2
R-way to doing this?
Dear friends, hope I could be able to explain my problem through following example. Please consider this: > set.seed(1) > input <- rnorm(10) > input [1] -0.6264538 0.1836433 -0.8356286 1.5952808 0.3295078 -0.8204684 0.4874291 0.7383247 0.5757814 -0.3053884 > tag <- vector(length=10) for(i in 1:10) # if there is any ****error**** in evaluating
2011 Jun 06
2
A Calculation on list object
Hello, I am into some calculation on a list object, therefore requesting the peers if there is any short cut way to so the same calculation. Let say I have following list object: > List <- vector('list', length = 3) > set.seed(1) > List[[1]] <- rnorm(5) > List[[2]] <- rnorm(2) > List[[3]] <- rnorm(7) > List [[1]] [1] -0.6264538 0.1836433 -0.8356286
2010 Sep 03
2
Matrix to list
Dear all, suppose I have following matrix:   > mat <- matrix(rnorm(25), 5) > > mat             [,1]       [,2]        [,3]       [,4]       [,5] [1,]  0.97056228 -1.3278509 -0.73511792  2.1650629 -0.4411997 [2,]  0.58613700 -0.2559899 -1.18334248 -1.4990907  1.8138846 [3,] -1.03333313  2.0227887  0.89622681  0.6483973 -1.5523283 [4,]  0.38968833  0.2490004 -0.02301061 -0.2705150
2005 Mar 04
11
R: simulation
hi all a simple question i want to run simulations in r. i however want the experiments to be repeated at a later time with exactly the same numbers by other users. can i set the random number seed for rnorm in some way? e.g. is there some arguement that goes with rnorm? please supply an example regards Allan
2009 Jun 11
2
How to force R to print 2 decimal places in column of a data.frame?
How to force R to print 2 decimal places in column of a data.frame? I tried to do so: x = inp(format(rounf(inp$Tamanho, 2), nsmall = 2),) where "INP" is data.frame and "Size" is the name of column. But has error: Error in eval.with.vis(expr, envir, enclos) : could not find function "inp" Lesandro Veja quais s?o os assuntos do momento no Yahoo! +Buscados
2009 Jul 01
5
convert tabular time series into a matrix format
Hi, thanks everyone for any help in advance. I found myself dealing with a tabular time-series data formatted each row like [ time stamp, ID, values]. I made a small examples: X = data.frame(t=c(1,1,1,2,2,2,2,3,3,3,4,4,4,5,5),id =
2011 Jan 25
1
NA printing
Hi. I'm writing a print method for an object that includes a numeric matrix for which the lower diagonal elements are not meaningful. So I make the lower diagonal of my matrix NA and print it. But my co-author does not like NA there and wants a dash. I have tried coercing the matrix to character, essentially by M[is.na(M)] <- "-" but this interferes with the pleasing column
2006 Oct 02
1
CCF and ACF
Dear all, given two numeric vectors x and y, the ACF(x) at lag k is cor(x(t),x(t+k)) while the CCF(x,y) at lag k is cor(x(t),y(t-k)). See below for a simple example. > set.seed(1) > x <- rnorm(10) > y <- rnorm(10) > x [1] -0.6264538 0.1836433 -0.8356286 1.5952808 0.3295078 -0.8204684 0.4874291 0.7383247 0.5757814 -0.3053884 > y [1] 1.51178117 0.38984324
2005 Mar 01
6
Help : delete at random
Hello I would like to delete some values at random in a data frame. Does anyone know how I could do? With best regards Caroline
2008 May 09
2
which.max2()
Hello, which.max() only returns one index value, the one for the maximum value. If I want the two index values for the two largest values, is this a decent solution, or is there a nicer/better R'ish way? max2 <-function(v) { m=which.max(v) v[m] = -v[m] m2=which.max(v) result=c(m, m2) result } Seems to work ok. Thanks, Esmail
2009 Jun 22
2
Help on creating a sequence of vectors
I want to create a number of vectors like : vec1 <- rnorm(1) vec2 <- rnorm(2) vec3 <- rnorm(3) and so on........... Here I tried following : for (i in 1:10) paste("vec", i, sep="") <- rnorm(i) However obviously that is not working. Here vectors I need to be seperated i.e I do not want to create a "list". How to modify above code? -- View this
2004 Aug 13
1
How to use the whole dataset (including between events) in Cox model (time-varying covariates) ?
Hello, coxph does not use any information that are in the dataset between event times (or "death times") , since computation only occurs at event times. For instance, removing observations when there is no event at that time in the whole dataset does not change the results: > set.seed(1) > data <- as.data.frame(cbind(start=c(1:5,1:5,1:4),stop=c(2:6,2:6,2:5),status=c(rep(
2005 Sep 30
4
by() processing on a dataframe
I want to calculate a statistic on a number of subgroups of a dataframe, then put the results into a dataframe. (What SAS PROC MEANS does, I think, though it's been years since I used it.) This is possible using by(), but it seems cumbersome and fragile. Is there a more straightforward way than this? Here's a simple example showing my current strategy: > dataset <-
2010 May 13
3
select subset based on another variable
Hi, dear R-helpers, I have a simple question regarding selecting subset of a variable based on another variable. Here is the example: xx=rnorm(10) id=sample(1:10, 10) temp=c(6, 1, 8, 2) Now, all I want is xx's that their id are 6, 1, 8, 2, instead of the position. Any suggestions ? Thank you all your help !! Carrie [[alternative HTML version deleted]]
2011 Feb 02
0
How column names/row names are preserved in matrix calculation?
Can somebody tell me that, if I do some arithmetic calculation over 2 matrices then how the column names and row names are preserved? It seems that, for multiplication, column names and row names of the 2nd matrix are preserved and for additional, there seems not having any explicit rule: > set.seed(1) > dat1 <- matrix(rnorm(25), 5); colnames(dat1) = rownames(dat1) =
2009 Feb 24
4
bigest part of vector
Hi, may be simle question, but a do not find it anywhere. Is there same function like max() ,but giving more results. max() give 1number-maximum I need funcion what give p bigest number. many thanks -- View this message in context: http://www.nabble.com/bigest-part-of-vector-tp22188901p22188901.html Sent from the R help mailing list archive at Nabble.com.
2006 Feb 20
2
formatting results from a function argument
Hello all, I have a simple function which calculates summary statistics of a dataset in terms of a factor (say area). > x = data.frame(Area = c(rep("cleanup", 5), rep("ref", 5)), TcCB = c(rnorm(5)+2, rnorm(5)));x Area TcCB 1 cleanup 2.5829747 2 cleanup 2.6796868 3 cleanup 2.5437094 4 cleanup 2.8453616 5 cleanup 1.1789683 6 ref 1.0140391 7
2009 Jan 23
1
extract certain months toyears (zoo)
Dear useRs and developeRs, In my diploma thesis I work with a daily time series of glacier runoff data. I did already aggregate them to monthly means etc. Now i want to use just the summer values (I am indecisive by now what that means, but let's make it easy and use months like June). Is there a way to extract the data off this zoo into another zoo with frequency=1 ? Do you have
2001 Dec 01
4
Control Panels
Me again... Is it possible to run a control panel in wine? ta. -- ********************************************** Warning: Anti-spam e-mail addy in force. Bring back MST3K!