[R] is there "colNA" for a image? (i.e. How to set the color of NAs or background in an image)

2012-08-03 Thread Camilo Mora
Hi everyone, I am using a layout of two images, one of which is an image of a raster. In this one image I am using a color palette to show the gradient of temperature in the world.By default the color of the continents (which I set to NA in the raster) appears as white. I would like the N

Re: [R] Head or Tails game

2012-08-03 Thread arun
Hi, system.time({ set.seed(111) colSums(matrix(sample(c(-1, 1), 40*1, TRUE), ncol = 1)) }) user  system elapsed   0.032   0.012   0.041  system.time({  set.seed(112)  list1<-vector("list",1)  for(i in 1:1){   list1[[i]]<-sample(c(-1,1),40,replace=TRUE)}   dat1<-do.call(rbind,la

Re: [R] Head or Tails game

2012-08-03 Thread arun
HI, You could try this: set.seed(112) list1<-vector("list",1000) for(i in 1:1000){  list1[[i]]<-sample(c(-1,1),40,replace=TRUE)}  dat1<-do.call(rbind,lapply(list1,function(x) sum(x))) dat2<-matrix(dat1,ncol=20,byrow=TRUE) head(dat2)  #    [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,

Re: [R] Head or Tails game

2012-08-03 Thread darnold
Wow! Some great responses! I am getting some great responses. I've only read David, Michael, and Dennis thus far, leading me to develop this result before reading further. lead <- function(x) { n <- length(x) count <- 0 if (x[1] >= 0) count <- count + 1 for (i in 2:n) { if (x[i] > 0 |

Re: [R] Head or Tails game

2012-08-03 Thread Jeff Newmiller
Two possible solutions below. On Fri, 3 Aug 2012, darnold wrote: Hi, Reading about a "Heads and Tails" game in http://www.dartmouth.edu/~chance/teaching_aids/books_articles/probability_book/amsbook.mac.pdf Introduction to Probability (Example 1.4, pp. 5-8). You toss a coin 40 times. If heads,

Re: [R] Head or Tails game

2012-08-03 Thread William Dunlap
Use a loop to run over the 10,000 reps and in each rep use rle(x>=0) to look at the runs of nonnegative numbers, postprocessing its output a bit to count them. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-

[R] lme4 / HLM question

2012-08-03 Thread Jeff
I'm hoping that this is a relatively easy question for someone familiar with the lme4 package. I'm accustomed to using HLM software and writing a simple 2 level [null] equation like this: L1 - Yij = b0 + e L2 - b0 = B00 + u0 The following command in R provides results that ar

Re: [R] Head or Tails game

2012-08-03 Thread Michael Weylandt
On Aug 3, 2012, at 9:14 PM, darnold wrote: > David, > > set.seed(123) # always good to make reproducible > winnings <- sum(sample(c(-1,1), 1, replace=TRUE)) > > Unfortunately, that's not the game. The game requires 40 flips of a coin. > > Then you have to play the game 10,000 times. >

Re: [R] Head or Tails game

2012-08-03 Thread darnold
David, set.seed(123) # always good to make reproducible winnings <- sum(sample(c(-1,1), 1, replace=TRUE)) Unfortunately, that's not the game. The game requires 40 flips of a coin. Then you have to play the game 10,000 times. D. -- View this message in context: http://r.789695.n4.nabb

Re: [R] Head or Tails game

2012-08-03 Thread David Winsemius
On Aug 3, 2012, at 5:55 PM, darnold wrote: Hi, Reading about a "Heads and Tails" game in http://www.dartmouth.edu/~chance/teaching_aids/books_articles/probability_book/amsbook.mac.pdf Introduction to Probability (Example 1.4, pp. 5-8). You toss a coin 40 times. If heads, Peter wins $1, tails

Re: [R] How to concatenate a several rows according with a column ?

2012-08-03 Thread arun
Hi, You could also use ddply. Though, the output format differs a bit from aggregate(). dat1<-read.table(text="    a    b c d   E001234  TSA    IP234   like_domain   E001234  TSB    IP234   like_domain      E001234  TSC    IP234   like_

[R] Head or Tails game

2012-08-03 Thread darnold
Hi, Reading about a "Heads and Tails" game in http://www.dartmouth.edu/~chance/teaching_aids/books_articles/probability_book/amsbook.mac.pdf Introduction to Probability (Example 1.4, pp. 5-8). You toss a coin 40 times. If heads, Peter wins $1, tails, he loses $1. I think I can do that ok with:

Re: [R] SEM standardized path coefficients

2012-08-03 Thread John Fox
Dear Allen, There's enough wrong here that it's easier for me just to fix it. First, if you're going to fit to a raw moment matrix, then (unless you want to do regression through the origin), you'll need to specify an intercept: --- snip - > df <- read.csv('NDVI_lep_data.csv', heade

Re: [R] Recursive function calls

2012-08-03 Thread R. Michael Weylandt
On Fri, Aug 3, 2012 at 5:41 PM, Gene Leynes wrote: > Ah yes, good point. > > this was easy enough to write, it doesn't lose dimensions, and there's no > unnecessary complexity... unless you're passing in data frames, in which > you'll have to recombine them. > > trim = function(x) gsub("^[[:space:

Re: [R] Recursive function calls

2012-08-03 Thread Gene Leynes
Ah yes, good point. this was easy enough to write, it doesn't lose dimensions, and there's no unnecessary complexity... unless you're passing in data frames, in which you'll have to recombine them. trim = function(x) gsub("^[[:space:]]+|[[:space:]]+$", "", x) trimmer = function(x){ if(is.list(x))

[R] SEM standardized path coefficients

2012-08-03 Thread Hurlbert, Allen Hartley
Hello, I have conducted an SEM in which the resultant standardized path coefficients are much higher than would be expected from the raw correlation matrix. To explore further, I stripped the model down to a simple bivariate relationship between two variables (NDVI, and species richness), where

Re: [R] Can't Run "Conjoint" Package - Could not find function "caFactorialDesign"?

2012-08-03 Thread Vik Rubenfeld
Got it. Thanks so much for your help, Michael and Sarah! Best, -Vik On Aug 3, 2012, at 11:50 AM, R. Michael Weylandt wrote: > On Fri, Aug 3, 2012 at 1:34 PM, Sarah Goslee wrote: >> On Fri, Aug 3, 2012 at 2:23 PM, R. Michael Weylandt >> wrote: >>> With conjoint_1.33 and rather up to date depe

Re: [R] add vectors to multiple objects

2012-08-03 Thread David Winsemius
On Aug 3, 2012, at 2:11 PM, R. Michael Weylandt wrote: On Fri, Aug 3, 2012 at 2:53 PM, John linux-user > wrote: Maybe what I previously posted was not clear enough or something else. All vectors L1,L2.. and objects (e.g. a.list, b.list, c.list) already exit or easily to be created in a works

Re: [R] Writing Faroes lettsers in text and plot ?

2012-08-03 Thread Prof Brian Ripley
On 03/08/2012 18:08, kfl wrote: I need to write Faroese letters in plain tekst and in plots. How can I do this ? http://en.wikipedia.org/wiki/Faroese_language Faroese_language Where is the difficulty? Without the 'at a minimum' information asked for in the posting guide, we really have no i

Re: [R] How to concatenate a several rows according with a column ?

2012-08-03 Thread Jean V Adams
tgodoy wrote on 08/03/2012 12:00:24 PM: > > Hi, I'm a new user or R and I try to concatenate a several rows according > with the value in a column. > > this is my data.frame and I want to concatenate my data.frame according with > the column "b" and make a new data.frame with the information

Re: [R] Multiple Comparisons-Kruskal-Wallis-Test: kruskal{agricolae} and kruskalmc{pgirmess} don't yield the same results although they should do (?)

2012-08-03 Thread peter dalgaard
On Aug 3, 2012, at 18:49 , David L Carlson wrote: > Generally multiple comparisons are conducted after a test for a significant > difference among any of the groups. For your data > >> kruskal.test(x[,1]~x[,2]) > >Kruskal-Wallis rank sum test > > data: x[, 1] by x[, 2] > Kruskal-Wal

Re: [R] Recursive function calls

2012-08-03 Thread Hadley Wickham
> It's nice that R keeps the base function list short enough that you can > look at it, but it would be nice to have a few more convenience functions > included, especially ones that mirror common functions, like "trim" > sum(sapply(search(), function(x) length(ls(x [1] 2376 Over two thousand

Re: [R] replacement has length zero. In addition: Warning message: In max(i) : no non-missing arguments to max; returning -Inf

2012-08-03 Thread Sarah Goslee
On Fri, Aug 3, 2012 at 5:14 PM, Yolande Tra wrote: >> i=10 >> thisStamp <- as.POSIXct(strptime(diveCond$timestamp[i], "%Y-%m-%d >> %H:%M:%S")) >> thisStamp > [1] "2008-08-11 14:12:00 EDT" >> ind <- which.min( abs(index(regCond_all) - thisStamp )) >> >> ind > [1] 506 >> diveCond$r_wvht[i] > [1] 0

Re: [R] Printing contents of a variable

2012-08-03 Thread Ted Harding
On 03-Aug-2012 20:46:56 R. Michael Weylandt wrote: > On Fri, Aug 3, 2012 at 3:39 PM, darnold wrote: >> All, >> >> Can someone explain why this does not print the contents of x when I source >> this file? >> >> CoinTosses <- function(n,print=TRUE) { >> x <- sample(c(0,1), n, replace=TRUE) >> y

Re: [R] outlier detection

2012-08-03 Thread R. Michael Weylandt
On Fri, Aug 3, 2012 at 3:41 PM, Lakevia INGRAM wrote: > I have a large set of data from an experiment in which each individual has > trials 1-40 with approx. 150 points sampled every 0.1 sec within each trial. > Each trial is a column and the rows are organized by time. I know there is a > cod

Re: [R] Recursive function calls

2012-08-03 Thread R. Michael Weylandt
On Fri, Aug 3, 2012 at 3:36 PM, Gene Leynes wrote: > Rui, > Yes, that's exactly it, thanks!! > I wouldn't have thought of the "is.atomic". I was going after a series of > tests for dimension and is.list. > > One other helpful function that I haven't seen anyone mention this far is ? rapply [= r

Re: [R] replacement has length zero. In addition: Warning message: In max(i) : no non-missing arguments to max; returning -Inf

2012-08-03 Thread Yolande Tra
> i=10 > thisStamp <- as.POSIXct(strptime(diveCond$timestamp[i], "%Y-%m-%d %H:%M:%S")) > thisStamp [1] "2008-08-11 14:12:00 EDT" > ind <- which.min( abs(index(regCond_all) - thisStamp )) > > ind [1] 506 > diveCond$r_wvht[i] [1] 0 > regCond_all$WVHT[ind] WVHT 2008-08-11 14:22:0

[R] Parallel runs of an external executable with snow in local

2012-08-03 Thread Xavier Portell/UPC
Hi everyone, I'm aiming to run an external executable (say filetorun.EXE) in parallel. The external executable collect needed data from a file, say "input.txt" and, in turn,generates several output files, say "output.txt". I need to generate "input.txt", run the executable and keep "input.txt"

Re: [R] add vectors to multiple objects

2012-08-03 Thread R. Michael Weylandt
On Fri, Aug 3, 2012 at 2:53 PM, John linux-user wrote: > Maybe what I previously posted was not clear enough or something else. All > vectors L1,L2.. and objects (e.g. a.list, b.list, c.list) already exit or > easily to be created in a workspace. Do not worry about those. The key > question is

[R] How to concatenate a several rows according with a column ?

2012-08-03 Thread tgodoy
Hi, I'm a new user or R and I try to concatenate a several rows according with the value in a column. this is my data.frame and I want to concatenate my data.frame according with the column "b" and make a new data.frame with the information in the others columns. >table1 a

Re: [R] replacement has length zero. In addition: Warning message: In max(i) : no non-missing arguments to max; returning -Inf

2012-08-03 Thread Sarah Goslee
This runs, so there must be something else going on that you haven't told us about. diveCond <- structure(list(dive_id = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), timestamp = c("2008-08-06 08:49:00", "2008-08-06 10:03:00", "2008-08-06 10:25:00", "2008-08-08 09:42:00", "2008-08-08 10:53:00", "2008-08-08 1

Re: [R] Recursive function calls

2012-08-03 Thread Gene Leynes
Rui, Yes, that's exactly it, thanks!! I wouldn't have thought of the "is.atomic". I was going after a series of tests for dimension and is.list. @ R. Michael Weylandt Good point! Also, thanks for mentioning stringr. I always forget about that one. It's nice that R keeps the base function list

Re: [R] replacement has length zero. In addition: Warning message: In max(i) : no non-missing arguments to max; returning -Inf

2012-08-03 Thread arun
Hi, Here, I am getting the error:  for(i in 1:dim(diveCond)[1]){  thisStamp <- as.POSIXct(strptime(diveCond$timestamp[i], "%Y-%m-%d  %H:%M:%S"))  ind <- which.min( abs(index(regCond_all) - thisStamp ))  diveCond$r_wvht[i] <- regCond_all$WVHT[ind]  diveCond$r_dpd[i] <- regCond_all$DPD[ind]  diveCo

[R] outlier detection

2012-08-03 Thread Lakevia INGRAM
I have a large set of data from an experiment in which each individual has trials 1-40 with approx. 150 points sampled every 0.1 sec within each trial. Each trial is a column and the rows are organized by time.  I know there is a code to take out single outliers within a certain trial by using t

Re: [R] add vectors to multiple objects

2012-08-03 Thread John linux-user
Maybe what I previously posted was not clear enough or something else. All vectors L1,L2.. and objects (e.g. a.list, b.list, c.list) already exit or easily to be created in a workspace. Do not worry about those. The key question is how to systematically append/assign these vectors to many object

[R] Writing Faroes lettsers in text and plot ?

2012-08-03 Thread kfl
I need to write Faroese letters in plain tekst and in plots. How can I do this ? http://en.wikipedia.org/wiki/Faroese_language Faroese_language -- View this message in context: http://r.789695.n4.nabble.com/Writing-Faroes-lettsers-in-text-and-plot-tp4639074.html Sent from the R help mailing

Re: [R] naiveBayes() error 'attempt to set an attribute on NULL'

2012-08-03 Thread Ivan7
This error occurs when one of your categorical variables in data has only NA values, and it seems to deal well with numercial NA in most cases. As a solution you can set all such variables to a single constant - this wont affect prediction result -- View this message in context: http://r.7896

Re: [R] Recursive function calls

2012-08-03 Thread Gene Leynes
Burt, This is a general problem that I have faced many times, and I'm looking for the best practices for creating an function with a built in iterator. I know that others exist, but I couldn't think of their names off the top of my head... the ones I could remember have the iterator built in at t

Re: [R] replacement has length zero. In addition: Warning message: In max(i) : no non-missing arguments to max; returning -Inf

2012-08-03 Thread Yolande Tra
> dput(head(diveCond, 10)) structure(list(dive_id = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), timestamp = c("2008-08-06 08:49:00", "2008-08-06 10:03:00", "2008-08-06 10:25:00", "2008-08-08 09:42:00", "2008-08-08 10:53:00", "2008-08-08 12:42:00", "2008-08-11 10:10:00", "2008-08-11 11:01:00", "2008-08-11 11:

Re: [R] Printing contents of a variable

2012-08-03 Thread William Dunlap
> Source()-ing turns off the auto-printing that normally happens at the > command line. This is a feature, because source()ing is often used to > set up things automatically behind the scenes that most folks don't > need. > > If you want to force a print, put in a print() command explicitly. Or

Re: [R] replacement has length zero. In addition: Warning message: In max(i) : no non-missing arguments to max; returning -Inf

2012-08-03 Thread Sarah Goslee
When i == 10, what is ind? diveCond$r_apt[10] regCond_all$APD[ind] Providing a subset is unhelpful. I gave you explicit dput() code to use; that's how we need data to be provided. I've given you various suggestions; if you don't implement them then there's not much point in me trying to help. Sa

Re: [R] replacement has length zero. In addition: Warning message: In max(i) : no non-missing arguments to max; returning -Inf

2012-08-03 Thread Yolande Tra
I have tried 1 and 2. Then for i=10, the error came back > i=1 > thisStamp <- as.POSIXct(strptime(diveCond$timestamp[1], "%Y-%m-%d %H:%M:%S")) > ind <- which.min( abs(index(regCond_all) - thisStamp )) > diveCond$r_wvht[1]<- regCond_all$WVHT[ind] > diveCond$r_dpd[1]<- regCond_all$DPD[ind] > diveCond

Re: [R] Recursive function calls

2012-08-03 Thread Hadley Wickham
On Fri, Aug 3, 2012 at 12:19 PM, Rui Barradas wrote: > Hello, > > This seems to work. > > trim2 <- function(x) { > if(is.atomic(x)) > > gsub("^[[:space:]]+|[[:space:]]+$", "", x) > else > sapply(x, function(y) trim2(y)) > } > Using sapply is a bit dangerous here. Compare:

Re: [R] Printing a summary

2012-08-03 Thread William Dunlap
Many such functions (e.g., lm and summary.lm) return an object of a certain class and supply a separate print method to print it nicely. Then you can compute something and print it when you want to. Autoprinting takes care of the common case where you want it printed right after it is computed. E.

Re: [R] Printing contents of a variable

2012-08-03 Thread R. Michael Weylandt
On Fri, Aug 3, 2012 at 3:39 PM, darnold wrote: > All, > > Can someone explain why this does not print the contents of x when I source > this file? > > CoinTosses <- function(n,print=TRUE) { > x <- sample(c(0,1), n, replace=TRUE) > y <- x > y[y==0] <- "T" > y[y==1] <- "H" > p <- sum(x)/n

[R] Printing contents of a variable

2012-08-03 Thread darnold
All, Can someone explain why this does not print the contents of x when I source this file? CoinTosses <- function(n,print=TRUE) { x <- sample(c(0,1), n, replace=TRUE) y <- x y[y==0] <- "T" y[y==1] <- "H" p <- sum(x)/n p } x <- CoinTosses(40) x On the other hand, if I source this fi

Re: [R] Printing a summary

2012-08-03 Thread Sarah Goslee
Hi, I find it better to return a named list so that users can do what they want with the results rather than just looking at them, which is all your approach allows. That's not incompatible with printing the results to the screen as well: CoinTosses <- function(n, verbose=TRUE) { x <- sample(

Re: [R] Printing a summary

2012-08-03 Thread R. Michael Weylandt
On Fri, Aug 3, 2012 at 3:34 PM, darnold wrote: > All, > > Is this typical of how people will print a summary of results? > > CoinTosses <- function(n) { > x <- sample(c(0,1), n, replace=TRUE) > y <- x > y[y==0] <- "T" > y[y==1] <- "H" > numHeads <- sum(x) > numTails <- n-sum(x) > p <

Re: [R] replacement has length zero. In addition: Warning message: In max(i) : no non-missing arguments to max; returning -Inf

2012-08-03 Thread Sarah Goslee
Yolande, Please send your message to the R-help email list too, not just to me. On Fri, Aug 3, 2012 at 4:28 PM, Yolande Tra wrote: > Here is the description > I am trying to build the data diveCond from two datasets diveData_2008, > diveData_2009 and RegCond_all. How would I dput each data for

[R] Printing a summary

2012-08-03 Thread darnold
All, Is this typical of how people will print a summary of results? CoinTosses <- function(n) { x <- sample(c(0,1), n, replace=TRUE) y <- x y[y==0] <- "T" y[y==1] <- "H" numHeads <- sum(x) numTails <- n-sum(x) p <- numHeads/n cat(cat(y,sep=""),"\n") cat("Number of heads: ", numH

Re: [R] optim() for ordered logit model with parallel regression assumption

2012-08-03 Thread R. Michael Weylandt
On Wed, Aug 1, 2012 at 4:34 PM, Xu Jun wrote: > Thanks Michael. Now I switched my approach after doing some google. > Following are my new codes: > > ### > library(foreign) > readin <- read.dta("ordfile.dta", convert.factors=FALSE) > myvars <- c("

Re: [R] replacement has length zero. In addition: Warning message: In max(i) : no non-missing arguments to max; returning -Inf

2012-08-03 Thread Sarah Goslee
On Fri, Aug 3, 2012 at 4:04 PM, Yolande Tra wrote: > I am sorry I forgot to mention it in the code. > library(xts) has the function index. That's useful. But here's your first problem: thisStamp <- as.POSIXct(strptime(diveCond$timestamp[i], "%Y-%m-%d %H:%M:%S")) You just created diveCond as a d

Re: [R] Correlating different sets of variables?

2012-08-03 Thread R. Michael Weylandt
That's really not what my previous post asked for (nor does it look like R at all in your photo!) All I can suggest is you put your data in some sort of matrix structure and look at the ?cor and ?cor.test functions. Note that summary count statistics are often not enough to discern correlation st

Re: [R] replacement has length zero. In addition: Warning message: In max(i) : no non-missing arguments to max; returning -Inf

2012-08-03 Thread Yolande Tra
After replacing it to u > for(i in 1:dim(diveCond)[1]){ + thisStamp <- as.POSIXct(strptime(diveCond$timestamp[i], "%Y-%m-%d %H:%M:%S")) + ind <- which.min( abs(index(u) - thisStamp )) + diveCond$r_wvht[i]<- u$WVHT[ind] + diveCond$r_dpd[i]<- u$DPD[ind] + diveCond$r_apt[i] <- u$APD[ind] + diveCond$

Re: [R] replacement has length zero. In addition: Warning message: In max(i) : no non-missing arguments to max; returning -Inf

2012-08-03 Thread Sarah Goslee
Hi Yolande, What's index() ? I get > ind <- which.min( abs(index(regCond_all) - thisStamp )) Error in which.min(abs(index(regCond_all) - thisStamp)) : could not find function "index" There's probably an easier way to do whatever you're trying to accomplish, but I'm afraid I can't tell what th

[R] replacement has length zero. In addition: Warning message: In max(i) : no non-missing arguments to max; returning -Inf

2012-08-03 Thread Yolande Tra
Hi, Here is my data, the first 10 rows > u=regCond_all[1:10,] > dput(u) structure(c(999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 1.9, 2, 1.97, 1.99, 1.83, 1.78, 1.6, 1.52, 1.52, 1.36, 10.53, 9.88, 9.88, 10.53, 10

Re: [R] Recursive function calls

2012-08-03 Thread Rui Barradas
Hello, This seems to work. trim2 <- function(x) { if(is.atomic(x)) gsub("^[[:space:]]+|[[:space:]]+$", "", x) else sapply(x, function(y) trim2(y)) } # Tests trim2(tempobj) trim2(tempvec) trim2(templist) trim2(tempdf) # Extra test templistlist <- list(templist, list(temp

Re: [R] add vectors to multiple objects

2012-08-03 Thread David Winsemius
On Aug 3, 2012, at 8:19 AM, John linux-user wrote: Hi David, Thanks for response, but my key question still remains unsolved. That is, how to add many vectors (L1,L2,L3) to many list objects (a.list, b.list) in a workspace? listObjects=ls(pattern=".list") #for example, a.list, b

Re: [R] Can't Run "Conjoint" Package - Could not find function "caFactorialDesign"?

2012-08-03 Thread R. Michael Weylandt
On Fri, Aug 3, 2012 at 1:34 PM, Sarah Goslee wrote: > On Fri, Aug 3, 2012 at 2:23 PM, R. Michael Weylandt > wrote: >> With conjoint_1.33 and rather up to date dependencies, I don't see >> caFactorialDesign and neither does getAnywhere(). > > The function is present in conjoint 1.34, the current v

Re: [R] Can't Run "Conjoint" Package - Could not find function "caFactorialDesign"?

2012-08-03 Thread Sarah Goslee
On Fri, Aug 3, 2012 at 2:40 PM, Vik Rubenfeld wrote: > Here is the output of sessionInfo(): > >> sessionInfo() > R version 2.15.1 (2012-06-22) > Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) > > locale: > [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 > > attached base pack

Re: [R] Can't Run "Conjoint" Package - Could not find function "caFactorialDesign"?

2012-08-03 Thread Vik Rubenfeld
Here is the output of sessionInfo(): > sessionInfo() R version 2.15.1 (2012-06-22) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods

Re: [R] Can't Run "Conjoint" Package - Could not find function "caFactorialDesign"?

2012-08-03 Thread Sarah Goslee
On Fri, Aug 3, 2012 at 2:23 PM, R. Michael Weylandt wrote: > With conjoint_1.33 and rather up to date dependencies, I don't see > caFactorialDesign and neither does getAnywhere(). The function is present in conjoint 1.34, the current version on CRAN. Rarely do I have to remind respondents to upd

Re: [R] how to get a date variable from a dataset

2012-08-03 Thread R. Michael Weylandt
Hi arunkumar, I've asked you many times to work on providing reproducible examples -- I'll direct you to this page again which describes how to do so: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example without one, there's not much anyone can do, but inher

Re: [R] length of variable in mlogit

2012-08-03 Thread R. Michael Weylandt
On Fri, Aug 3, 2012 at 11:49 AM, Lee van Cleef wrote: > Hi Michael, > > many thanks for your comment. > > Below the original data as imported from Stata format. Hi Lee, I apologize for being intransigent (well, no -- I actually don't) but could you provide your data using dput() as asked? Best,

Re: [R] Recursive function calls

2012-08-03 Thread R. Michael Weylandt
Note that this is a common enough case that Hadley provides for it with the str_trim() function in his stringr package. Best, Michael On Fri, Aug 3, 2012 at 12:02 PM, Bert Gunter wrote: > "Recursively loop over an object" is a pretty meaningless phrase, > since it depends entirely on the structu

Re: [R] Can't Run "Conjoint" Package - Could not find function "caFactorialDesign"?

2012-08-03 Thread R. Michael Weylandt
With conjoint_1.33 and rather up to date dependencies, I don't see caFactorialDesign and neither does getAnywhere(). Vik, do you have a citation that suggests this function exists? The closest I find is gen.factorial() in the AlgDesign package. The findFn function in the sos library might also be

Re: [R] how to identify values from a column of a dataframe, and insert them in other data.frame with the corresponding id?

2012-08-03 Thread John Kane
Hi Nerea, For some reason your post is badl garbled and close to imposible to read. Perhaps you need to check your text encoding? Also to send sample data it is better to use the dput() command. Do dput(myfile) and then paste the results into your email Sorry not to be of more help. John Kane

Re: [R] Can't Run "Conjoint" Package - Could not find function "caFactorialDesign"?

2012-08-03 Thread Sarah Goslee
Hi, On Fri, Aug 3, 2012 at 1:57 PM, Vik Rubenfeld wrote: > Thanks very much for this info, Sarah! > > I have used library(conjoint). Here are the commands used: > >> library(conjoint) >> experiment = expand.grid( > + price = c("low", "medium", "high"), > + variety = c("black", "green", "red"), >

Re: [R] Can't Run "Conjoint" Package - Could not find function "caFactorialDesign"?

2012-08-03 Thread Vik Rubenfeld
Thanks very much for this info, Sarah! I have used library(conjoint). Here are the commands used: > library(conjoint) > experiment = expand.grid( + price = c("low", "medium", "high"), + variety = c("black", "green", "red"), + kind = c("bags", "granulated", "leafy"), + aroma = c("yes", "no")) > de

Re: [R] Can't Run "Conjoint" Package - Could not find function "caFactorialDesign"?

2012-08-03 Thread Sarah Goslee
Hi Vik, You don't need to post to nabble and to the R-help list. Just skip the nabble step! Have you loaded the package with: library(conjoint) # not Conjoint before you try to use any of its functions? Sarah On Fri, Aug 3, 2012 at 1:23 PM, Vik Rubenfeld wrote: > I'm trying to run the "Con

[R] Can't Run "Conjoint" Package - Could not find function "caFactorialDesign"?

2012-08-03 Thread Vik Rubenfeld
I'm trying to run the "Conjoint" package, and I receive the error: Error: could not find function "caFactorialDesign" I'm running R version 2.15.1 on Mac OS X. I have installed the "Conjoint" package with the "Install Dependencies" checkbox checked. I have clicked the "Update All" button

Re: [R] How to adjust legend in a plot?

2012-08-03 Thread Eloi Mercier
Hi, It would be useful to have more information and a reproducible example. For instance : 1. Why such margin at the left side ? 2. Why do you have the same problem when you plot the legend at the bottom ? Have you tried to define the exact (x,y) location ? 3. Why do you say cex doesn't affect

[R] Can't Run "Conjoint" Package - could not find function "caFactorialDesign"?

2012-08-03 Thread VikR
I'm trying to install and run the "Conjoint" package, and I get the error: Error: could not find function "caFactorialDesign" I'm running R 2.15.1 on Mac OS X. I have installed the package "Conjoint" with the "Install Dependencies" checkbox checked. I have clicked the "Update All" button in

Re: [R] Plotting Where People Live on a U.S. Map

2012-08-03 Thread Lopez, Dan
Thank you! Dan From: Sarah Goslee [mailto:sarah.gos...@gmail.com] Sent: Thursday, August 02, 2012 5:51 PM To: Lopez, Dan Cc: R help (r-help@r-project.org) Subject: Re: [R] Plotting Where People Live on a U.S. Map Hi Dan, For question 1, yes you'll need geographic coordinates. I thinknit's possib

Re: [R] Recursive function calls

2012-08-03 Thread Bert Gunter
"Recursively loop over an object" is a pretty meaningless phrase, since it depends entirely on the structure of the object. For example, a character vector is an object, and there is no need for any sort of recursion to do what you want for it. The following regex example trims trailing "spaces" (

Re: [R] all duplicated wanted

2012-08-03 Thread arun
Hi Weijia, Try this: dat1<-read.table(text=" ID  AGE GENER LDL 1    25    M  137 1    25    M  125 2    34    F    108 3    30    F  150 3    30    F    147 3    30    F    165 ",sep="",header=TRUE,stringsAsFactors=FALSE) subset(dat1,!is.na(match(AGE,

Re: [R] length of variable in mlogit

2012-08-03 Thread Lee van Cleef
Hi Michael, many thanks for your comment. Below the original data as imported from Stata format. I deleted some columns with explaining variables because they were unnecessary and working; the model has several explaining variables with generic regression coefficients. pid Choice V7.Ch 1

Re: [R] Multiple Comparisons-Kruskal-Wallis-Test: kruskal{agricolae} and kruskalmc{pgirmess} don't yield the same results although they should do (?)

2012-08-03 Thread David L Carlson
Generally multiple comparisons are conducted after a test for a significant difference among any of the groups. For your data > kruskal.test(x[,1]~x[,2]) Kruskal-Wallis rank sum test data: x[, 1] by x[, 2] Kruskal-Wallis chi-squared = 11.0098, df = 10, p-value = 0.3568 There are no

Re: [R] how to identify values from a column of a dataframe, and insert them in other data.frame with the corresponding id?

2012-08-03 Thread Jessica Streicher
?merge and ?unique might help however: why is calee_id a floating point number? Ids are usually stuff thats close to a factor, integers, strings and the like, you know stuff that has a value that isn't dependant on precision. Floating points might just complicate things.. On 03.08.2012, at 12

Re: [R] Density plots

2012-08-03 Thread Ayyappa Chaturvedula
I am sorry either naivety with group. I will follow the instructions from now. Regards, Ayyappa On Aug 3, 2012, at 12:18 PM, "David L Carlson" wrote: > How about providing the data for at least one subject/8 occasions using > dput(dataframe)? This line at the bottom of your message: "provide >

[R] Recursive function calls

2012-08-03 Thread Gene Leynes
My apologies, I know that this is not a new problem, but I'm not sure how to find the answer I want to recursively loop over an object and trim trailing white space. When I use this function on a list of data.frame I get output like this: [1] "c(\" many spaces \", \" many spaces \")" "c(\"

Re: [R] enquiry

2012-08-03 Thread Erdal Karaca
Yep, you are right, this works: readCell <- function(workbook, sheetName, i, j) { pos <- getSheetPos(workbook, sheetName) readWorksheet(workbook, pos, startRow=i, endRow=i, startCol=j, endCol=j, header=FALSE)[[1]] } 2012/7/17 Rui Barradas > Hello, > > Sorry, but I'm not at my computer and will

Re: [R] metafor- interpretation of moderators test for raw proportions

2012-08-03 Thread cpanderson
Wolfgang, Thanks for your quick response. You are correct- indeed I had inadvertently left out that i had set intercept = FALSE in rma. Following your suggestions, I get the following results: Test of Moderators (coefficient(s) 2,3): QM(df = 2) = 0.2207, p-val = 0.8955 Model Results:

[R] [mvtnorm] fast computation of multinormal cdf

2012-08-03 Thread cchevalier
Hello, I'm trying to use the pmvnorm function of the mvtnorm to compute the CDF of the multinormal distribution in rather high dimension (say 100, but 1000 would be nice). To accelerate the calculations I want to decrease the precision of the numerical integration, through the GenzBretz() argumen

[R] Plm package

2012-08-03 Thread athens
I am interested in estimating a panel model with time fixed effects, random cross-sectional effects and AR(1) error. I am using the plm package. I would be grateful if you could give me some guidance on how to do it in R. Thanks in advance. -- View this message in context: http://r.789695.n4.na

Re: [R] bivariate normal

2012-08-03 Thread cchevalier
Hello, The package pbivnorm will solve your problem. http://cran.r-project.org/web/packages/pbivnorm/index.html -- View this message in context: http://r.789695.n4.nabble.com/bivariate-normal-tp4638159p4639048.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Density plots

2012-08-03 Thread David L Carlson
How about providing the data for at least one subject/8 occasions using dput(dataframe)? This line at the bottom of your message: "provide commented, minimal, self-contained, reproducible code" is important. Nothing you sent allows us to reproduce what you are doing and suggest ways to improve it.

Re: [R] Sum two Vectors of different length

2012-08-03 Thread arun
Hi, Please check this link: (http://r.789695.n4.nabble.com/calculations-with-vectors-of-unequal-length-td3477848.html) A.K. - Original Message - From: Alaios To: R help Cc: Sent: Friday, August 3, 2012 9:13 AM Subject: [R] Sum two Vectors of different length Dear all, in one part of

Re: [R] all duplicated wanted

2012-08-03 Thread arun
HI, If you want both the duplicated IDs and nonduplicated IDs to be printed,   ID <- sample(1:10, 10, replace=TRUE)  ID # [1] 3 7 5 8 1 5 4 6 7 2 ID[!duplicated(ID)] #[1] 3 7 5 8 1 4 6 2  ID2<-c(4,4,4,3,4,1,2,5,7,4,3,2,5,9,8,12,"A1","A2","A1","B1")  ID2[!duplicated(ID2)] # [1] "4"  "3"  "1"  "

Re: [R] add vectors to multiple objects

2012-08-03 Thread John linux-user
Hi David, Thanks for response, but my key question still remains unsolved. That is, how to add many vectors (L1,L2,L3) to many list objects (a.list, b.list) in a workspace? listObjects=ls(pattern=".list") #for example,  a.list, b.list... for (object in listObjects){ #how to sign v

Re: [R] Formatting numbers for display

2012-08-03 Thread arun
HI, I modified the code, thanks to Tejas.  Now, the results look like fun1<-function(x)  ifelse(x>10^7,gsub("\\d)[.].*","\\1",x),ifelse(x<10^7 & x>1,formatC(x,width=length(x),format="fg",digits=8,flag="",drop0trailing=FALSE),sprintf("%.3f",x))) fun1(VALUES)  [1] "123456789"    "12345678" "

Re: [R] Bivariate normal integral

2012-08-03 Thread cchevalier
The package pbivnorm will certainly solve your problem. It allows a vectorized call to the cdf of the bivariate normal distribution. -- View this message in context: http://r.789695.n4.nabble.com/Bivariate-normal-integral-tp4571018p4639041.html Sent from the R help mailing list archive at Nabbl

[R] how to get a date variable from a dataset

2012-08-03 Thread arunkumar1111
Hi I have a find the class of each variable of the data set which is given as input. I can able to find the string and the numeric variable. Not able to find if the variable is date or not Can any one help me. - Thanks in Advance Arun -- View this message in context: http://r.78

[R] how to identify values from a column of a dataframe, and insert them in other data.frame with the corresponding id?

2012-08-03 Thread Nerea Lezama
Hello, I’d like to do next, see if you could help me please: I have a csv called “datuak” with a id called “calee_id” and a colunm called “poids”. I have another csv called “datuak2” with the same id called “calee_id”, (although there are “calee_id” that are in “d

Re: [R] Question regarding behaviour of package {plspm}

2012-08-03 Thread ArthurDentDK
Hey Arne I don't know about the rounding, but you shouldn't be concerned with the calculation of Q^2. In the line where a value is assigned to RSS, the value is assigned to h+1 as shown here: RSS[h + 1, ] = colSums((Y.old - t.new %*% t(c.new))^2) i.e. the programmer is messing wi

[R] MANOVA with repeated measures in R

2012-08-03 Thread angelo.arc...@virgilio.it
Dear list member, I deperately need an help in performing a MANOVA in R, but I encountered some problems both in the design and in the synthax with R. I conducted a listening experiment in which 16 participants had to rate the audio stimuli along 5 scales representing an emotion (sad, te

Re: [R] Comparing two gff/gtf files : de novo transcripts v/s reference

2012-08-03 Thread ib
did u try CummeRbund? http://compbio.mit.edu/cummeRbund/ best, ib -- View this message in context: http://r.789695.n4.nabble.com/Comparing-two-gff-gtf-files-de-novo-transcripts-v-s-reference-tp3934629p4639032.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] scatterplot x axis specifications

2012-08-03 Thread ClaraM
I had the same problem and was struggling to find the right codethat was so helpful, Sarah. thanks! -- View this message in context: http://r.789695.n4.nabble.com/scatterplot-x-axis-specifications-tp4630952p4639031.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] Spatial regression

2012-08-03 Thread DanielFV
Thank you for your reply. I have used the normalized residuals for my variograms, and although the values of the semivariogram are lower, the shape and steepness of the curve is exactly the same. Any potential test that could help me justifying any improvement on the model other than merely repor

[R] Density plots

2012-08-03 Thread Ayyappa Chaturvedula
Dear group, I need help on two problems: 1. I am trying to plot density plots for each individual in 8 occasions. I can do this by subject wiht the code below: par(mfrow=c(4,2)) plot(density(all8scenarios$SIMCONC[all8scenarios$ID==1&all8scenarios$WSEQ==0])) plot(density(all8scenarios$SIMCONC[all

  1   2   >