similar to: Help How to use a loop to do pair comparison

Displaying 20 results from an estimated 10000 matches similar to: "Help How to use a loop to do pair comparison"

2009 Jan 09
5
The R Inferno
"The R Inferno" is now on the Burns Statistics website at http://www.burns-stat.com/pages/Tutor/R_inferno.pdf Abstract: If you are using R and you think you're in hell, this is a map for you. Also, I've expanded the outline concerning R on the Burns Statistics 'Links' page. Suggestions (off-list) for additional items are encouraged. Patrick Burns patrick at
2009 Apr 01
4
Variable Wildcard Value
Is there a wildcard value for vector values in r? For instance: > M <- *wildcard > (M==1) TRUE >(M=="peanut butter") TRUE >is.na(M) FALSE thanks, Francis -- Francis Smart (406) 223-8108 cell
2009 Jun 04
4
order() with randomised order in ties?
Hi I want to use order() to get the order of a vector. But I would need a different behavior when ties occur: similar to the parameter ties.method = "random" in the rank() function, I would need to randomise the ties. Is this possible? Example: x <- rep(1:10, 2) order(x) [1] 1 11 2 12 3 13 4 14 5 15 6 16 7 17 8 18 9 19 10 20 order(x) [1] 1 11 2 12 3 13 4 14 5 15
2009 Sep 17
2
r-inferno.pdf with detailed table of contents and bookmarks
Hi, I don't find a r-inferno.pdf that has detailed table of contents and bookmarks. If it is possible, can somebody help generated one and post it on line? Regards, Peng
2009 May 07
2
for loop vectorization
Hi, I am still not familiar with vectorization. Could you help with making this for loop more efficient? The code is trying to make a Q matrix for a multidimensional state space with specific conditions. thanks Mira tmp = 0:(maxvals[1]) for(i in 2:nchars) { tmp <- outer(tmp, 0:(maxvals[i]), FUN="paste", sep=".") } states = tmp stateidx = array(1:length(states),
2009 Mar 28
4
Selecting elements from a vector (a simple question with weird results)
Hello people. I wish to reorder a simple vector of numbers by another vector of the order (and then do the same, but with a data frame rows) I try this (which doesn't work) : > aa <- c(3, 1 ,2 ) > aa[aa] [1] 2 3 1 The same won't work if I try to order a data frame: > data.frame(matrix(c(3,1,2), 3,2))[c(3,1,2),] X1 X2 3 2 2 1 3 3 2 1 1 How should I do this? p.s:
2009 Mar 27
3
nls, convergence and starting values
"in non linear modelling finding appropriate starting values is something like an art"... (maybe from somewhere in Crawley , 2007) Here a colleague and I just want to compare different response models to a null model. This has worked OK for almost all the other data sets except that one (dumped below). Whatever our trials and algorithms, even subsetting data (to check if some singular
2009 Feb 21
2
difference between assignment syntax <- vs =
Hi, Both operators <- and = can be used to make an assignment. My question is: Is there a semantic difference between these two? Some time ago, I remember I have read that because of some reason, one should be given preference over the other - but I cannot remember the source, nor the argument, nor which operator the preferred was. What is the present state ? Is still one version better
2009 Jan 12
2
assign a list using expression?
Dear R-users, I would like to assign elements to a list in the following manner: mylist <- list(a = a, b = b, c = c) To do this I tried myexpr <- expression(a = a, b = b, c = c) mylist <- list( eval(myexpr) ) It ends up by overwriting a when b is assigned and b when c is assigned. Additionally the element of the list does not have a name. Could you tell me why this is the case? Thank
2009 Jun 16
3
The most straightfoward way to write a function that sums over the rows of a matrix
Hello! I am trying to write a function with vector and data.frame parameters that uses the sum() function and values from the rows of the data.frame. I need to pass this function as a parameter to optim(). My starting point is: observs <- data.frame(y, x1, x2, x3) Fn <- function(par, observs) { sum( (y - (par[1] * (x1 + 1) * x2^(-par[2]) * x3^par[3])^2 ) }
2009 Feb 19
2
Use of ifelse for indicating specific rownumber
Hello I have a dataset named "b2" with 1521 rows, in that dataset i have 64 rows containing specific information. the rownumbers with specific info are: + i [1] 22 53 104 127 151 196 235 238 249 250 263 335 344 353 362 370 389 422 458 459 473 492 502 530 561 624 647 651 666 671 [31] 715 784 791 807 813 823 830 841 862 865 1036 1051 1062 1068
2009 Aug 05
3
how import Excel data into R?
Hi I want to import Excel data into R I have used this code data<-read.table("C:\Total_Art_Policies.xls",header=TRUE,sep=";") i have an error msg: Erreur dans file(file, "r") : impossible d'ouvrir la connexion De plus : Warning message: In file(file, "r") : impossible d'ouvrir le fichierĀ 'C:\Total_Art_Policies.xls' : No such file or
2009 Jan 28
2
length of POSIXlt object (PR#13482)
The length() of a POSIXlt object is given as 9 regardless of the actual length. For example: > make.date.time function (year=c(2006,2006),month=c(8,8),day=2:5,hour=13,minute=45) {# convert year, etc., into POSIXlt object # d=as.character(make.date(year,month,day)) t=paste(hour,minute,sep=":") as.POSIXlt(paste(d,t)) } > t=make.date.time() > t [1] "2006-08-02 13:45:00"
2009 Mar 05
3
character string as object name
Can someone please tell me why the following (last line) doesn't work (as I expect it to :-) library(quantmod) a = getSymbols("MSFT",from="2009-3-01") a MSFT eval(as.name(a)) MSFT$MSFT.Adjusted b=paste(a,'$MSFT.Adjusted',sep='') b eval(as.name(b)) Why does this last line not work the way the earlier eval does? Thanks.
2009 Nov 16
4
Where are usages like "== 2L" documented?
Gurus: I keep seeing other people?s code that contain ideas like If (x == 2L) X[-1L] X - 1L I have some idea of what?s going on, but where is the use of concepts like ?2L? documented? Thanks, Bryan ************* Bryan Hanson Acting Chair Professor of Chemistry & Biochemistry DePauw University, Greencastle IN USA
2009 Jan 17
5
changing a range of values
Hi, If I have following vector; x <- c(1,1,1,2,2,3,4,4,5) and I want to change values in the range of 1 to 3 into the value 1, how can I do that? I tried x[x == c(1:3)] <- c(1) but than I get; x [1] 1 1 1 2 1 1 4 4 5 R doesn't change the 2 into a 1. But why?
2009 Jan 29
2
tab characters
Hi all, Working at the R command line, how do I get strings to display e.g. tab or newline characters as they should be displayed, rather than as e.g. \n or \t? e.g.: > x="\t" > x="\t" > x [1] "\t" > print(x) [1] "\t" -- ==================================================== Nicholas J. Matzke Ph.D. student, Graduate Student Researcher
2009 Aug 03
2
Variable names as inputs...
Hi, I have been using R for a bit, but never came across this simple issue... So, I wonder if anyone could give me a hint on it. I have calculated a bunch o models and now need to compare them using AIC(). The issue seem to be that I have placed each output in a list object. So, the question is how to convert a string into variable names. Lets say I have all my models in a variables called :
2008 Oct 01
3
lapply where each list object has multiple parts
Hi. I have a list where each object in the list has multiple parts. I'd like to take the mean of just one part of each object. Is it possible to do this with lapply? If not, can you recommend another function? Thanks. eric > x1 <- c(0,1,2,3) > x2 <- c(7,8) > x3 <- c(2,6,6,8) > x4 <- c(4,8) > > Lst1 <- list(label1 = x1,label2 = x2) > Lst2 <-
2009 Apr 17
1
S+FinMetrics
please !, what is the R equivalents for the S-plus package : S+FinMetrics thanks hassan [[alternative HTML version deleted]]