Re: [R] How to resample matrices to test for the robustness of their correlation

2012-02-18 Thread chuck.01
see: ?sample library(vegan) ?rrarefy not knowing your data structure, its hard to say. camilleislande wrote Hello I have several populations where I have morphology and diet for each individual. I am interested in the correlation between diet and morphological distances. However the

Re: [R] ggplot rank stack bar automatically.

2012-02-18 Thread vd3000
Hi, Ista, 1. /df.m - transform(df.m, Period = reorder(Period, -1*value)) ggplot(df.m, aes(x = Period, y = value/1e+06, fill = Region)) + geom_bar(stat = identity, position = stack) / I have followed your instruction but I found the sequence did not change. 2. I am looking for the stack

[R] Multiple planes in a scatterplot3d

2012-02-18 Thread kpiratla
I am relatively new to R and scatterplot3d function. I need to draw a 3d scatterplot and then add three different planes (each parallel to xy, yz and zx with varying intercepts) to a 3d scatterplot. I got the plot running and i was also able to produce one plane parallel to xy surface by using the

[R] foreach %do% and %dopar%

2012-02-18 Thread Marcos Larios
Hi everyone, I'm working on a script trying to use foreach %dopar% but without success, so I manage to run the code with foreach %do% and looks like this: The code is part of a MCMC model for projects valuation, returning the most important results (VPN, TIR, EVA, etc.) of the simulation.

Re: [R] assigning NULL to a list element

2012-02-18 Thread Petr Savicky
On Sat, Feb 18, 2012 at 01:51:01AM +, Benilton Carvalho wrote: Hi everyone, For reasons beyond the scope of this message, I'd like to append a NULL element to the end of a list. tmp0 - list(a=1, b=NULL, c=3) append(tmp0, c(d=4)) ## works as expected append(tmp0, c(d=NULL)) ## list

Re: [R] Where command in ctree (party)

2012-02-18 Thread Achim Zeileis
On Fri, 17 Feb 2012, Joseph Wang wrote: I was able to narrow down to a column that has different types using featurefields-c(7, 17, 19, 20, 22, 33, 35, 36, 38, 44:132) flag - rep(0, ncol(data)) for (i in featurefields) { flag[i] - class(data[,i]) != class(validdata[,i]) } A

[R] CI for the median difference

2012-02-18 Thread Vittorio Colagrande
Dear R-group, I have run into a problem in estimating confidence intervals for the median difference. I want to establish a confidence interval at (1- alpha) level for the difference between the medians of two indipendent samples (size n and m), by using the Wilcoxon distribution or

Re: [R] is there a command to withdraw already performed command in R?

2012-02-18 Thread Sarah Goslee
I don't think so, but it's easy enough to rerun your previous commands, especially if you've saved then in a file. Sarah On Feb 17, 2012 11:06 PM, YN Kim y2sile...@gmail.com wrote: Hi all, Is there any command or function to withdraw a command performed already in R? For instance, after

Re: [R] CI for the median difference

2012-02-18 Thread Patrick Breheny
It seems to me that your two approaches are calculating CIs for different quantities. The bootstrap methods are calculating a CI for the difference in medians, while the Wilcoxon approach is calculating a CI for the median of the differences. If this were the mean, those would be the same,

[R] transforming a data frame to matrix

2012-02-18 Thread Adel ESSAFI
Hello orderulcount Group.1 Group.2 Group.3 xV5 7C L 0.0 30 C / L 19 C L 0.2 27 C / L 31 C L 0.4 15 C / L 43 C L 0.6 7 C / L 54 C L 0.8 2 C / L 10 C S 0.0 27 C / S 22 C S

Re: [R] Flexmix new data classification

2012-02-18 Thread loyolite270
Thank you very much for those suggestions, it really helped me a lot. I just got another problem, i want to run flexmix GLM binomial model with huge dataset (say 5 million rows), but the problem is i cant run flexmix with this dataset as a whole in R ( it will crash). So is it fair to run the

Re: [R] transforming a data frame to matrix

2012-02-18 Thread Adel ESSAFI
with simpler expressions: if I have a dataframe A B C is it possible de transform it to a matrix where nrow(A) colomns, nrow(B) row and for each value of C, we put the corresponding value in the matrix. Regards Le 18 février 2012 13:57, Adel ESSAFI adeless...@gmail.com a écrit : Hello

[R] Matrix algebra in R to compute coefficients of a linear regression.

2012-02-18 Thread John Sorkin
I am trying to use matrix algebra to get the beta coefficients from a simple bivariate linear regression, y=f(x). The coefficients should be computable using the following matrix algebra: t(X)Y / t(x)X I have pasted the code I wrote below. I clearly odes not work both because it returns a

Re: [R] transforming a data frame to matrix

2012-02-18 Thread John Sorkin
Adel, I don't fully understand your question. Please try to explain what you want to do again. In general to change a data frame to a matrix, all one needs to do is use the as.matrix function. # Create dataframe mydataframe1 - data.frame(x=1:3, y=10:12) mydataframe1 class(mydataframe1) #

Re: [R] transforming a data frame to matrix

2012-02-18 Thread David Winsemius
On Feb 18, 2012, at 8:35 AM, Adel ESSAFI wrote: with simpler expressions: if I have a dataframe A B C is it possible de transform it to a matrix where nrow(A) colomns, nrow(B) row and for each value of C, we put the corresponding value in the matrix. Perhaps: xtabs(C ~ A + B,

Re: [R] Matrix algebra in R to compute coefficients of a linear regression.

2012-02-18 Thread Mark Leeds
Hi John: I don't understand what you're doing ( not saying that it's wrong. I just don't follow it ). Below is code for computing the coefficients using the matrix way I follow. Others may understand what you're doing and be able to fix it so I wouldn't just use below immediately. xprimex -

Re: [R] Matrix algebra in R to compute coefficients of a linear regression.

2012-02-18 Thread John Sorkin
Mark Thank you! John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please

Re: [R] Matrix algebra in R to compute coefficients of a linear regression.

2012-02-18 Thread Berend Hasselman
On 18-02-2012, at 14:36, John Sorkin wrote: I am trying to use matrix algebra to get the beta coefficients from a simple bivariate linear regression, y=f(x). The coefficients should be computable using the following matrix algebra: t(X)Y / t(x)X I have pasted the code I wrote below. I

Re: [R] Matrix algebra in R to compute coefficients of a linear regression.

2012-02-18 Thread John Sorkin
Thank you, John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call

Re: [R] Matrix algebra in R to compute coefficients of a linear regression.

2012-02-18 Thread Frank Harrell
The Wilcoxon test is not related to the difference in medians but rather to the Hodges-Lehmann estimator, which is the median of all possible differences of observations between sample 1 and sample 2. So what's needed is a confidence interval for this estimate, obtainable from inverting the

Re: [R] ggplot rank stack bar automatically.

2012-02-18 Thread Ista Zahn
Hi, Here is what I get before reordering: http://izahn.homedns.org/tmp/barplotOriginal.png and after reordering: http://izahn.homedns.org/tmp/barplotReordered.png Are you saying you get something different? Or that this is not what you were trying to do? Best, Ista On Friday, February 17,

[R] help updating package rJava (on ubuntu)

2012-02-18 Thread Karl Brand
Esteemed useRs and Devs, Attempts to update package:rJava to the latest version have failed. See my code and output below. Notably, as suggested here http://stackoverflow.com/questions/3311940/r-rjava-package-install-failing $ sudo apt-get install r-cran-rjava ran successfully without

Re: [R] assigning NULL to a list element

2012-02-18 Thread Hadley Wickham
On Fri, Feb 17, 2012 at 7:51 PM, Benilton Carvalho beniltoncarva...@gmail.com wrote: Hi everyone, For reasons beyond the scope of this message, I'd like to append a NULL element to the end of a list. tmp0 - list(a=1, b=NULL, c=3) append(tmp0, c(d=4)) ## works as expected append(tmp0,

Re: [R] assigning NULL to a list element

2012-02-18 Thread Benilton Carvalho
Thanks guys... I'm already embarrassed given how simple the solutions are. b On Saturday, 18 February 2012, Hadley Wickham wrote: On Fri, Feb 17, 2012 at 7:51 PM, Benilton Carvalho beniltoncarva...@gmail.com javascript:; wrote: Hi everyone, For reasons beyond the scope of this message,

Re: [R] influence.measures()

2012-02-18 Thread helin_susam
Hi again, I studied with influence measures of logistic regression of some data by using R and SPSS and I get different values of DFFITS and Cook's Distance from SPSS and R outpus, but the coefficients, model formulas and leverage values are the same. Can anyone help me about ; Which is the

Re: [R] help updating package rJava (on ubuntu)

2012-02-18 Thread Simon Urbanek
On Feb 18, 2012, at 10:44 AM, Karl Brand wrote: Esteemed useRs and Devs, Attempts to update package:rJava to the latest version have failed. See my code and output below. Notably, as suggested here http://stackoverflow.com/questions/3311940/r-rjava-package-install-failing $ sudo

Re: [R] Repeated cross-validation for a lm object

2012-02-18 Thread Greg Snow
The validate function in the rms package can do cross validation of ols objects (ols is similar to lm, but with additional information), the default is to do bootstrap validation, but you can specify crossvalidation instead. On Thu, Feb 16, 2012 at 10:44 AM, samuel-rosa

Re: [R] foreach %do% and %dopar%

2012-02-18 Thread ilai
Marcos, Untested because you didn't provide a reproducible example but my guess, the problem is in the local assignment of MCPVMP*. The %do% worked just because it operates in the same (local) environment for all threads. I'll try to clarify with a a self contained example of sourcing a script

Re: [R] Counting value changes

2012-02-18 Thread Pete Brecknock
maris478 wrote Good afternoon, I've encountered a little bit of a problem, would appreciate any help here. I made a small vector consisting of ones and zeros. Something like this x - c(0,1,0,1,0,0,1,0), and all I need is to count how many times 0 becomes 1. Tried various, of what I

Re: [R] Counting value changes

2012-02-18 Thread Petr Savicky
On Sat, Feb 18, 2012 at 11:51:39AM -0800, Pete Brecknock wrote: maris478 wrote Good afternoon, I've encountered a little bit of a problem, would appreciate any help here. I made a small vector consisting of ones and zeros. Something like this x - c(0,1,0,1,0,0,1,0), and all I

Re: [R] Counting value changes

2012-02-18 Thread William Dunlap
I made a small vector consisting of ones and zeros. Something like this x - c(0,1,0,1,0,0,1,0), and all I need is to count how many times 0 becomes 1. Since x consists solely of 0's and 1's this is same as sum(diff(x)==1) # 3 in your example Bill Dunlap Spotfire, TIBCO Software wdunlap

Re: [R] Counting value changes

2012-02-18 Thread jim holtman
try this: x - c(0,1,0,1,0,0,0,0) sum(diff(x) == 1) [1] 2 On Sat, Feb 18, 2012 at 2:51 PM, Pete Brecknock peter.breckn...@bp.com wrote: maris478 wrote Good afternoon, I've encountered a little bit of a problem, would appreciate any help here. I made a small vector consisting of ones

Re: [R] help updating package rJava (on ubuntu)

2012-02-18 Thread Karl Brand
Simon, Thanks for yout fast response. Thing is - i managed to get Version 0.9-1 installed and fully functional. And $ locate jdk returns too many entries to post here, so i'm pretty sure its on the machine. So i'd like to know how i can ensure it's registered in R. This i have no idea

Re: [R] help updating package rJava (on ubuntu)

2012-02-18 Thread Hasan Diwan
On 18 February 2012 13:13, Karl Brand k.br...@erasmusmc.nl wrote: Thanks for yout fast response. Thing is - i managed to get Version 0.9-1 installed and fully functional. And $ locate jdk returns too many entries to post here, so i'm pretty sure its on the machine. What you want to look

Re: [R] foreach %do% and %dopar%

2012-02-18 Thread Marcos Larios
Elai, The - trick is of no use, and sourcing the script within the loop gives me nothing, if i put it in .option all variables are loaded to my workspace; though, they're empty and generates some errors. I'll put a reproducible example: Lets call this script MC: library(foreach) library(doMC)

[R] Plot OctTree

2012-02-18 Thread Jaimin Dave
Hi Everyone, I have csv file which is in following format xmin,xmax,ymin,ymax,zmin,zmax I want to plot 3d graph with all the all octants being displayed as well. Any idea? I have used scatterplot3d package but it does not seem to have anything by which i can draw octants inside cube as well.

[R] R help

2012-02-18 Thread li li
Dear all, I need to generate numbers from multivariate normal with large dimensions (5,000,000). Below is my code and the error I got from R. Sigma in the code is the covariance matrix. Can anyone give some idea on how to take care of this error. Thank you. Hannah m - 500

Re: [R] possibly Error in R version 2.12.1 (2010-12-16)

2012-02-18 Thread Frank Schwidom
How can i file this isssue as an bugreport? On Fri, Feb 03, 2012 at 02:01:02PM +0100, peter dalgaard wrote: On Feb 2, 2012, at 21:24 , Frank Schwidom wrote: Hi, the following Code demonstrates an possibly Error in R (or you can explain me, why this happens, thanks in advance)

Re: [R] svm with GRASS GIS

2012-02-18 Thread giuseppe calamita
Dear Etienne, I'm a colleauge of Gabriele and I'm more into R (but he is more into GRASS). I'll try to explain you what we didi so far 1) Our ASTER images, (B1, B2 and B3) have 8363134 pixels; we made a subset in order to have training data sets: that is, for each band (B1,B2 and B3) 916 pixels

[R] Counting value changes

2012-02-18 Thread maris478
Good afternoon, I've encountered a little bit of a problem, would appreciate any help here. I made a small vector consisting of ones and zeros. Something like this x - c(0,1,0,1,0,0,1,0), and all I need is to count how many times 0 becomes 1. Tried various, of what I thought, methods with

[R] Finicky factor comparison operators

2012-02-18 Thread johnmark
This error occurs because the == comparison operator doesn't allow comparison of ordered and normal factors: /df[df5$close_quarter == as.Date(2011-02-01),]/ Warning message: In /`[.data.frame`(df, df$close_quarter == as.Date(2011-02-01)/, : Incompatible methods (Ops.ordered, Ops.Date) for ==

Re: [R] Finicky factor comparison operators

2012-02-18 Thread R. Michael Weylandt
It's not a matter of unordered ordered factors, but ordered factors and Dates (as the warning says) I can see at least one ambiguity -- should comparison be made from the level or the internal code -- so the warning makes sense to me (though an error might make even more sense). Generally, for

Re: [R] foreach %do% and %dopar%

2012-02-18 Thread Marcos Larios
Elai, Sooo maaanyy thanks... It worked, the problem was with out- foreach I thought foreach wouldn't need to put the results in a variable, this did my day. On Sat, Feb 18, 2012 at 5:57 PM, ila...@gmail.com wrote: Marcos, This worked for me. Can't say why it didn't for you. Did you make sure

Re: [R] Counting value changes

2012-02-18 Thread Sarah Goslee
Just for clarity, I changed your x a bit - in your version, the 0-1 and 1-0 change occurred the same number of times. If all your values are 0 and 1, this will work: x - c(0,1,0,1,0,0,0,1,1,1) table(diff(x)) -1 0 1 2 4 3 sum(diff(x) == 1) [1] 3 If other values can occur, it would need

Re: [R] foreach %do% and %dopar%

2012-02-18 Thread ilaik9
Marcos, This worked for me. Can't say why it didn't for you. Did you make sure to source AFTER you define the variables ? Not doing so is the only reason I can think of why they would be empty. Here I'm running your example (I called the script that needs to be sourced src.R and put it in

Re: [R] possibly Error in R version 2.12.1 (2010-12-16)

2012-02-18 Thread Rolf Turner
On 19/02/12 08:40, Frank Schwidom wrote: How can i file this isssue as an bugreport? Please don't. Peter has just explained to you that this is not a bug, it's a feature. You need to amend your understanding of this, feature; R does not need to be amended. cheers, Rolf Turner

Re: [R] Repeated cross-validation for a lm object

2012-02-18 Thread mxkuhn
The train function in the caret package will do this. The trainControl function would use method =repeatedcv and repeats = 100. On Feb 18, 2012, at 2:15 PM, Greg Snow 538...@gmail.com wrote: The validate function in the rms package can do cross validation of ols objects (ols is similar to

[R] parse .ps files with R?

2012-02-18 Thread Nick Matzke
Hi, Is there a way to parse a postscript (*.ps) file with R (or perhaps with some other command-line utility)? E.g., I have a map in postscript format with lots of features, but I just want to extract the coastline and it's coordinates. Any help very much appreciated! Cheers! Nick --

Re: [R] Counting value changes

2012-02-18 Thread jim holtman
For completeness, if you want to count all possible four transitions: x - c(0,1,0,1,0,0,0,1,1,1,0,0,0,1) # lets keep count of the 4 different transitions that can happen indx - cbind(head(x, -1), tail(x, -1)) %*% c(2, 1) table(indx) # 0=0-0, 1=0-1, 2=1-0, 3=1-1 indx 0 1 2 3 4 4 3 2 On Sat,

Re: [R] parse .ps files with R?

2012-02-18 Thread baptiste auguie
Hi, the grImport package provides some tools for this. HTH, b. On 19 February 2012 16:06, Nick Matzke mat...@berkeley.edu wrote: Hi, Is there a way to parse a postscript (*.ps) file with R (or perhaps with some other command-line utility)? E.g., I have a map in postscript format with

Re: [R] ggplot rank stack bar automatically.

2012-02-18 Thread vd3000
Hi, Ista, I found the graph were same as before recording http://izahn.homedns.org/tmp/barplotOriginal.png Anyway, I will try again, Many thanks. I am now trying to stack it horizontally and found that the axis text overlap each other!! New battle start again. X_X!! VD. -- View this message

Re: [R] ggplot rank stack bar automatically.

2012-02-18 Thread Ista Zahn
Hi VD, The plot should not be the same after reordering. Please show us what you did, and what the result was. Best, Ista On Saturday, February 18, 2012 06:22:00 PM vd3000 wrote: Hi, Ista, I found the graph were same as before recording http://izahn.homedns.org/tmp/barplotOriginal.png

[R] changing names with different character sets

2012-02-18 Thread Erin Hodgess
Dear R People: I'm trying to replicate something that I saw on an R blog. The first step is to load in the .rda file, which is fine. However, some of the names of the columns in the data frame have special characters, accents, and such. How do I get around this on a basic keyboard, please?

Re: [R] changing names with different character sets

2012-02-18 Thread Prof Brian Ripley
On 19/02/2012 07:30, Erin Hodgess wrote: Dear R People: I'm trying to replicate something that I saw on an R blog. The first step is to load in the .rda file, which is fine. However, some of the names of the columns in the data frame have special characters, accents, and such. Most of the