Re: [R] Can R handle a matrix with 8 billion entries?

2011-08-09 Thread Peter Langfelder
> Assuming you need the full distance matrix at one time (which you do not for > hierarchical clustering, itself a highly dubious method for more than a few > hundred points). Apologies if this hijacks the thread, but why is hierarchical clustering "highly dubious for more than a few hundred point

Re: [R] Opposite of paste function

2011-08-10 Thread Peter Langfelder
On Wed, Aug 10, 2011 at 11:22 AM, Soyeon Kim wrote: > Dear All, > > I have vn variable >> vn > [1] "V300" "V376" > What I want to get is > 300 376 as.numeric(substring(vn, 2)) HTH Peter __ R-help@r-project.org mailing list https://stat.ethz.ch/mailma

Re: [R] Clustering Large Applications..sort of

2011-08-10 Thread Peter Langfelder
On Wed, Aug 10, 2011 at 12:07 PM, Ken Hutchison wrote: > Hello all, >   I am using the clustering functions in R in order to work with large > masses of binary time series data, however the clustering functions do not > seem able to fit this size of practical problem. Library 'hclust' is good > (t

Re: [R] gsub wildcard

2011-08-15 Thread Peter Langfelder
On Mon, Aug 15, 2011 at 10:34 AM, Rebecca Gray wrote: > Hello all, > > I have what I think is a simple question but I've been unable to solve it. I > have the following string: > > A[&states=1]:[&rate=2]425, B[&states=3]:[&rate=5]500 > > I would like to combine the two expressions in the [], so th

Re: [R] Leading zeros

2011-08-19 Thread Peter Langfelder
On Fri, Aug 19, 2011 at 9:19 AM, David Winsemius wrote: > > Copying list one what was sent in reply. Anybody have a better solution? > No sure my solution is better, but it avoids the integer conversion and retains the "/". I wrote a function that padds entries of input character vector with zero

Re: [R] gsub for numeric characters in string

2011-08-19 Thread Peter Langfelder
On Fri, Aug 19, 2011 at 11:11 AM, Rebecca Gray wrote: > Dear all, > > I have what is a bit of a confusing question, so I hope that I can explain > clearly. Thank you for your help in advance. > > I would like to do a replacement procedure on several strings, but the way > that I am currently going

Re: [R] display only the top-right half of a correlation matrix?

2011-08-19 Thread Peter Langfelder
On Fri, Aug 19, 2011 at 11:50 AM, Liviu Andronic wrote: > Dear all > Is there an easy way to display only one half (top-right or > bottom-left) of a correlation matrix? > >> require(Hmisc) >> rcorr(as.matrix(mtcars[ , 1:4])) >       mpg   cyl  disp    hp > mpg   1.00 -0.85 -0.85 -0.78 > cyl  -0.85

Re: [R] display only the top-right half of a correlation matrix?

2011-08-19 Thread Peter Langfelder
On Fri, Aug 19, 2011 at 12:32 PM, Liviu Andronic wrote: > On Fri, Aug 19, 2011 at 9:02 PM, Peter Langfelder > wrote: >> Use as.dist: here's an example. >> > Seems promising, but for one issue: I would like to keep the diagonal > and thus specify 'diag=T', b

Re: [R] Compile on Fedora

2011-08-21 Thread Peter Langfelder
On Sun, Aug 21, 2011 at 10:18 AM, Noah Silverman wrote: > Hi, > > I want to create a custom build of R, for my particular machine that will run > as fast as possible. > > CPU: Dual cora AMD 64 bit > > OS: Fedora 15 > > I know there are a lot of options for compile time flags, lapack, blas, > atl

Re: [R] Threads in R

2011-08-22 Thread Peter Langfelder
On Mon, Aug 22, 2011 at 12:39 PM, Immanuel wrote: > Hello all, > > I posted a questions on how to terminate a function call that does not > return after a certain time ( I can not modify the function code) some > time ago. > Since I didn't find a solution I just came up with the idea to run the >

Re: [R] Threads in R

2011-08-22 Thread Peter Langfelder
On Mon, Aug 22, 2011 at 3:12 PM, Immanuel wrote: > Hello, > > thanks for the input. Below is a small example, simpler then expected :) >  I'm just curious why I can't see any output from print(i). > > -- > library(multicore) > > f_long <- function() { >    for (i in 1:1

Re: [R] qnorm?

2011-08-23 Thread Peter Langfelder
How about qnorm(4e-30, lower.tail = FALSE) ? You cannot subtract 4e-30 from 1 and expect to get something else than 1 (exactly). Peter On Tue, Aug 23, 2011 at 10:21 AM, Jim Silverton wrote: > Hi everyone, > I have the following problem. I have some small p-values but when I use > > qnorm(1-4e-

Re: [R] (OT) Puzzled over reinstalling R on new Linux distro...

2011-08-24 Thread Peter Langfelder
On Wed, Aug 24, 2011 at 6:19 PM, Brian Lunergan wrote: > Evening all: > > Redid my home box using VectorLinux (Slackware variation) and now I'm not sure > which game trail to follow to reinstall R. > > Could somebody with more knowledge in this share their thoughts off-list. Just > need a pointer

Re: [R] hclust and cutree: identifying branches as classes

2011-09-12 Thread Peter Langfelder
On Mon, Sep 12, 2011 at 4:59 AM, Laurent Fernandez Soldevila wrote: > Good afternoon, > > > After cuting a hierarchical tree using cutree(), how to check correspondances > between classes and branches? > This is what we do: > > srndpchc <- hclust(dist(srndpc$x[1:1000,1:3]),method="ward") #creatio

Re: [R] reading file in zip archive

2012-05-30 Thread Peter Langfelder
On Wed, May 30, 2012 at 12:47 PM, Iain Gallagher wrote: > Hi Phil > > Thanks, but this still doesn't work. > > > Here's a reproducible example (was wrapping my head around these functions > before). > > x <- as.data.frame(cbind(rep('a',5), rep('b',5))) > y <- as.data.frame(cbind(rep('c',5), rep('

Re: [R] Best way to predict

2012-05-30 Thread Peter Langfelder
On Wed, May 30, 2012 at 4:07 PM, Chris Burns wrote: > I have a huge matrix of unspecified covariates and the corresponding sales > for them.  What is the best way to predict the sales from the covariates? > Don't want to sound rude, but given your very vague problem specifications, the best way s

[R] CRAN: Package WGCNA unavailable for Mac OS

2012-06-01 Thread Peter Langfelder
Hi, not sure this is the right mailing list, but anyway - I maintain the WGCNA package, and was just alerted by a Mac user that it is not available. Looking at the error log at http://www.r-project.org/nosvn/R.check/r-release-macosx-ix86/WGCNA-00check.html reveals checking package dependencies

Re: [R] remove leading slash

2012-06-08 Thread Peter Langfelder
On Fri, Jun 8, 2012 at 10:25 AM, David Winsemius wrote: > > On Jun 8, 2012, at 1:11 PM, Ben quant wrote: > >> Hello, >> >> How do I change this: >>> >>> cnt_str >> >> [1] "\002" "\001" "\102" >> >> ...to this: >>> >>> cnt_str >> >> [1] "2" "1" "102" >> >> Having trouble because of this: >>> >>> nc

Re: [R] wgcna

2012-06-15 Thread Peter Langfelder
On Fri, Jun 15, 2012 at 8:04 AM, Ingezz wrote: > Dear Peter, > > I am trying to apply the WGCNA meta-analysis for two (or more) microarray > datasets-tutorial to my own data. > >> mp=modulePreservation(multiExpr,multiColor,referenceNetworks=1,verbose=3,networkType="signed", >> nPermutations=30,max

Re: [R] How to defeat buffering in Rgui?

2012-06-29 Thread Peter Langfelder
On Fri, Jun 29, 2012 at 10:15 AM, Spencer Graves wrote: > Dear Prof. Ripley: > > >      Thanks for the reply.  Unfortunately, flush.console() seems to lock up > my system.  I tried the following: > > > for(i in 1:1e7){ >    tst <- sin(i) >    if((i%%1e5)==0)cat(i, "") >    if((i%%1e6)==0)cat('\n')

Re: [R] Still have problems with tcltk in R 64 bit

2011-06-14 Thread Peter Langfelder
On Tue, Jun 14, 2011 at 12:47 PM, Adrienne Wootten wrote: > Taking a quick look for it, it seems that they have replaced it with > tcltk2.  I just did the installation with the same version in windows > and it auto loaded the tcltk package and I never installed that > package to begin with.  I wou

Re: [R] "non-numeric argument to binary operator"

2011-06-14 Thread Peter Langfelder
Not sure ho to run the code since nn is not defined. Most likely reason is that the number of unique values in the rows of habs is not the same. That makes the tables produced in the apply command of different length and apply returns a list instead of a matrix, which makes the t() or the division

Re: [R] "non-numeric argument to binary operator"

2011-06-15 Thread Peter Langfelder
Write yourself an alternative function to table, for example like this: tableOfGivenLevels = function(x, levels) { n = length(levels) counts = rep(0, n); names(counts) = levels tab = table(x); counts[match(names(tab), levels)] = tab; counts; } x = sample(c(1:4), 20, replace = TRUE) ta

Re: [R] Help using cutreeHybrid

2011-06-23 Thread Peter Langfelder
On Thu, Jun 23, 2011 at 11:19 AM, Estefania Ruiz Vargas wrote: > I am using the function cutreeHybrid from the package dynamic Tree Cut and I > need a list of the resulting clusters but I do not know how to get it. Hi, I'm the author of the package. The function returns a list whose component '

Re: [R] packages which call functions which run C code...

2011-06-23 Thread Peter Langfelder
On Thu, Jun 23, 2011 at 4:46 PM, Steven Wolf wrote: > I am looking at the function ks.test in the stats package and trying to > figure out why it gives a different result for a p-value than does the > corresponding function in MATLAB.  I am hoping for one of two responses: > > > > 1.       You kno

Re: [R] Unexpected R Behavior: Adding 4 to Large Numbers/IDs Containing Current Year

2011-06-29 Thread Peter Langfelder
You seem to be running into the limits of double-precision - your IDs have 17 "significant" digits which is more than the double precision floating point number can hold without any rounding errors. Since you are using these numbers as IDs, simply keep them as character strings throughout your cod

Re: [R] wgcna

2011-07-06 Thread Peter Langfelder
On Wed, Jul 6, 2011 at 8:27 AM, Raquel Martinez Garcia wrote: > Hi, > > I'm running a tutorial ("Meta-analyses of data from two (or more) microarray > data sets"), which use wgcna package. I have an error in the function > modulePreservation (it is below). > I'm using R2.13 > Can you help me? Do

Re: [R] Intransitive DAG

2011-07-11 Thread Peter Langfelder
On Mon, Jul 11, 2011 at 12:28 PM, Thomas S. Dye wrote: > Aloha all, > > I have an adjacency matrix for an acyclic digraph that contains > transitive relations, e.g. (u,v), (v,w), (u,w).  I want a DAG with only > intransitive relations.  Can someone point me to an R function that will > take my adj

Re: [R] wgcna

2011-07-12 Thread Peter Langfelder
Hi Meeta, yes, there was a bug in the package. Please install the newest version and try again. Best, Peter On Tue, Jul 12, 2011 at 1:20 PM, mistrm wrote: > Hi Peter and Raquel > > I am following the same tutorial and seem to have the same error appear and > I am using 30 permutations (code be

Re: [R] recursive function - finding connections

2011-07-14 Thread Peter Langfelder
Hi Paul, I assume you are using the argument cutoff to specify the p-value below which nodes are considered connected and above which they are not connected. I would use single linkage hierarchical clustering. If you have two groups of nodes and any two nodes between the groups are connected (i.e

Re: [R] recursive function - finding connections

2011-07-14 Thread Peter Langfelder
will run much faster. Peter On Thu, Jul 14, 2011 at 4:58 PM, Peter Langfelder wrote: > Hi Paul, > > I assume you are using the argument cutoff to specify the p-value > below which nodes are considered connected and above which they are > not connected. > > I would use s

Re: [R] scaling advice

2011-07-15 Thread Peter Langfelder
On Fri, Jul 15, 2011 at 2:05 PM, Data Analytics Corp. wrote: >  But then he apparently rescaled this 44x13 > matrix so that the rows all sum to zero and the columns all sum to zero. >  None of the row and column standard deviations are 1.0.  This I can't see > how to do.  How can I rescale the ro

Re: [R] gsub() with unicode and escape character

2011-07-16 Thread Peter Langfelder
Don't know the answer to you first question, but for the \\ see below. On Sat, Jul 16, 2011 at 7:19 PM, Sverre Stausland wrote: > Unrelated to that problem, but related to gsub() is that I can't find > a way for gsub() to interpret the backslash as a character. In regular > expression, \\ should

Re: [R] creating a matrix of ranked column data

2011-07-17 Thread Peter Langfelder
On Sun, Jul 17, 2011 at 11:18 AM, christian krahforst wrote: > I have a data frame (gom) or a matrix of trace metal data and some other > observations from water column samples taken at sea (e.g., 19 samples > (rows), 19 variables) > I can calc. the rank individually from each column of the attach

[R] read.table only reads part of file

2011-07-29 Thread Peter Langfelder
Hi all, I encountered a problem when trying to read in an Illumina chip annotation file. The offending file is large, so I zipped it up and posted it at http://www.genetics.ucla.edu/labs/horvath/CoexpressionNetwork/tmp/ProbeInfo_Expression.txt.bz2 Executing this: annot = read.table(bzfile("Prob

Re: [R] read.table only reads part of file

2011-07-29 Thread Peter Langfelder
On Fri, Jul 29, 2011 at 6:00 PM, Sarah Goslee wrote: > Hi Peter, > > I'm not going to look at your large file on what for me is Friday evening, but > the usual cause of that kind of problem is a single or double quote in the > text. bingo! Setting quote = "" solved the problem. Thanks, Peter

Re: [R] Is a string all blanks?

2011-08-02 Thread Peter Langfelder
On Tue, Aug 2, 2011 at 5:07 PM, John Sorkin wrote: > windows 7 > R 2.12.1 > > Is there any easy way to determine if a sting contains nothing but blanks? I > need to check a series of strings of various length. > > OneBlank <- " " > TwoBlanks <- "  " > ThreeBlanks <- "   " > NoBlanks <- "NoBlanks"

[R] coxph weirdness

2012-07-26 Thread Peter Langfelder
Hi all, I cant' wrap my head around an error from the coxph function (package survival). Here's an example: library(survival) n = 100; set.seed(1); time = rexp(n); event = sample(c(0,1), n, replace = TRUE) covar = data.frame(z = rnorm(n)); model = coxph(Surv(time, event)~ . , data = covar) R g

Re: [R] coxph weirdness

2012-07-26 Thread Peter Langfelder
On Thu, Jul 26, 2012 at 4:19 PM, Thomas Lumley wrote: > YOu need to update the survival package: from its NEWS file > > Changes in version 2.36-14 >A supposedly cosmetic change to coxph in the last release caused > formulas with a "." on the right hand side to fail. Fix this and add a > case

Re: [R] wgcna choice for softpower by scale indepence when combining to datasets

2012-08-01 Thread Peter Langfelder
On Wed, Aug 1, 2012 at 6:30 AM, Ingezz wrote: > Dear Peter, > > I have another question about WGCNA. I am using the package for > meta-analysis to find modules preserved in several datasets. However, I am > unsure how to handle the softpower, because each dataset has its own ideal > scale indepenc

Re: [R] Opinion: Why I find factors convenient to use

2012-08-17 Thread Peter Langfelder
On Fri, Aug 17, 2012 at 11:34 AM, Rui Barradas wrote: > Hello, > > No, factors may use less memory. System dependent? I think it's a 32-bit vs. 64-bit distinction - I get Rui's results on 64-bit Windows and Linux installation, but Bert's result on a 32-bit Linux machine. Peter > >> x <-sample(c

[R] Extracting the name of a function (inverse of match.fun("myFun"))

2012-08-29 Thread Peter Langfelder
Hi all, is there a way to extract the name of a function, i.e. do the reverse of match.fun applied to a character string? I would like to print out the name of a function supplied to another function as an argument. For example: myFunc = function(x) { x+1 } applyFunc = function(fnc, x) { fnc

Re: [R] Extracting the name of a function (inverse of match.fun("myFun"))

2012-08-29 Thread Peter Langfelder
On Wed, Aug 29, 2012 at 3:36 PM, Peter Langfelder wrote: > Hi all, > > is there a way to extract the name of a function, i.e. do the reverse > of match.fun applied to a character string? I would like to print out > the name of a function supplied to another function as an ar

Re: [R] Extracting the name of a function (inverse of match.fun("myFun"))

2012-08-29 Thread Peter Langfelder
On Wed, Aug 29, 2012 at 4:14 PM, William Dunlap wrote: > deparse(substitute(fnc)) will get you part way there. ... > I like to let the user override what substitute might say by > making a new argument out of it: >> applyFunc(function(x)x*10, 1:3) > fnc is function(x) x * 10 > [1] 10 20 30 >> appl

Re: [R] self-defined distance function to be computed on matrix

2012-08-30 Thread Peter Langfelder
On Thu, Aug 30, 2012 at 10:48 AM, zz wrote: > Hello, > > I have a self-defined function to be computed on each column in a matrix. > The basic idea is to ignore the elements that have value of 0 during > computation. > > I should be able to write my own function but it could be computational > exp

Re: [R] Is something wrong wiht draw.circle()?

2012-09-07 Thread Peter Langfelder
On Fri, Sep 7, 2012 at 9:04 AM, Chris82 wrote: > Hey R users, > > I am a little bit confused. > > > require(plotrix) > > plot(0,xlim=c(-10,10),ylim=c(-10,10),type="n",xlab="",ylab="") > draw.circle(0,0,5) > > lines(c(0,0),c(0,5)) > lines(c(0,5),c(0,0)) The culprit are unequal margins. Issue par(

Re: [R] Convert back to lower triangular matrix

2011-11-15 Thread Peter Langfelder
On Tue, Nov 15, 2011 at 2:38 PM, Juliet Ndukum wrote: > Given a vector;> ab = seq(0.5,1, by=0.1)> ab[1] 0.5 0.6 0.7 0.8 0.9 1.0 > The euclidean distance between the vector elements is given by the lower > triangular matrix > dd1 = dist(ab,"euclidean")> dd1    1   2   3   4   52 0.1 >            

Re: [R] if/else scope

2011-11-15 Thread Peter Langfelder
On Tue, Nov 15, 2011 at 3:46 PM, Kevin Burton wrote: > What is wrong with the following? AFAIK the else needs to follow the end brace of if {} on the same line, at least at the main level. Peter > > > > x <- 1:2 > > if(x[1] > 0) > > { > >                if(x[2] > 0) > >                { > >  

Re: [R] Pairwise correlation

2011-11-16 Thread Peter Langfelder
On Wed, Nov 16, 2011 at 8:37 AM, muzz56 wrote: > Dear All, > I am not familiar with R yet I want to use it to perform some task, hence my > posting here. I hope someone can help. > I have a set of data, genes (rows) and samples (columns). I want to do a > Pearson correlation on all the possible pa

Re: [R] Function gives numeric(0) for every input

2011-11-19 Thread Peter Langfelder
Well, you assign numeric(0) or numeric(0)+1, which is still numeric(0). No wonder the return value is always numeric(0). You probably need to replace numeric(0) simply by 0. Numeric(0) does not mean 0, it means a numeric vector of length zero (i.e., empty). HTH, Peter On Sat, Nov 19, 2011 at 6:

Re: [R] count ties after rank?

2011-11-21 Thread Peter Langfelder
On Mon, Nov 21, 2011 at 11:36 AM, Hao, Zhaozhe wrote: > Hello! > >    I need to use Kruskal-Wallis test and post-hoc test (Dunn's test) for my > data. But when I searched around, I only found this function: kruskal.test. > But nothing for Dunn's test. > >    So I started to write one myself.  Bu

Re: [R] R ignores number only with a nine under 10000

2011-11-21 Thread Peter Langfelder
On Mon, Nov 21, 2011 at 7:42 AM, set wrote: > Hello R users, > > I'm trying to replace numerical values in a datamatrix with strings. R does > this except for numbers under 1 starting with a 9 (eg 98, 970, 9504 > etc). This is really weird and I wondered whether someone had encountered > such

Re: [R] Random Forests in R

2011-11-30 Thread Peter Langfelder
On Wed, Nov 30, 2011 at 7:48 PM, Axel Urbiz wrote: > I understand the original implementation of Random Forest was done in > Fortran code. In the source files of the R implementation there is a note > "C wrapper for random forests:  get input from R and drive  the Fortran > routines.". I'm far fro

Re: [R] Imputing data

2011-12-02 Thread Peter Langfelder
On Fri, Dec 2, 2011 at 2:16 PM, khlam wrote: > So I have a very big matrix of about 900 by 400 and there are a couple of NA > in the list. I have used the following functions to impute the missing data > > data(pc) > pc.na<-pc > pc.roughfix <- na.roughfix(pc.na) > pc.narf <- randomForest(pc.na, na

Re: [R] installing several versions of R (2.14 and 2.12.2) on the same system on Ubuntu

2011-12-05 Thread Peter Langfelder
On Mon, Dec 5, 2011 at 11:47 AM, Jannis wrote: > Dear R users, > > > besides the current R 2.14 I would like to install a second version of R > (2.12.2) on my Ubuntu system. The current version is easily installed as a > precompiled package from Cran but I am heavily fighting with the older > v

Re: [R] reading partial data set

2011-12-07 Thread Peter Langfelder
On Wed, Dec 7, 2011 at 6:52 AM, bcdc wrote: > Hi all, > > I'm trying to read a data set into R, but the file is messy, so I have to do > it partially. The whole data is in a .txt file, and the values are separated > by a space. So far ok. The problem is that in this file, not all the lines > have

Re: [R] Is there a way to print branch distances for hclust function?

2011-12-11 Thread Peter Langfelder
On Sun, Dec 11, 2011 at 8:43 PM, kbrownk wrote: > The R function hclust is used to do cluster analysis, but based on R > help I see no way to print the actual fusion distances (that is, the > vertical distances for each connected branch pairs seen in the cluster > dendrogram). > > Any ideas? I'd l

Re: [R] R - Linux_SSH

2011-12-14 Thread Peter Langfelder
On Wed, Dec 14, 2011 at 4:35 AM, Chris Mcowen wrote: > Dear List, > > > > I am unsure if this is the correct list to post to, if it isn't I apologise. > > > > I am using SSH to access a Linux version of R on a remote computer as it > offers more memory and processing power. The model will take 1-2

[R] From Distance Matrix to 2D coordinates

2011-12-15 Thread Peter Langfelder
On Thu, Dec 15, 2011 at 10:08 AM, Lorenzo Isella wrote: > Dear All, > I am struggling with the following problem: I am given a NxN symmetric > matrix P ( P[i,i]=0, i=1...N and P[i,j]>0 for i!=j) which stands for the > relative distances of N points. > I would like use it to get the coordinates of

Re: [R] From Distance Matrix to 2D coordinates

2011-12-15 Thread Peter Langfelder
On Thu, Dec 15, 2011 at 10:47 AM, Lorenzo Isella wrote: > Thanks a lot! > Precisely what I had in mind. > One last question (an extension of the previous one): can this be extended > to points in 3D? Once again, given the distance matrix, can I reconstruct a > set of coordinates (among many possib

Re: [R] Ratio of huge products

2011-12-15 Thread Peter Langfelder
On Thu, Dec 15, 2011 at 10:35 AM, Alberto Magni wrote: > Hello everybody, > > I have to compute something in this form: > > x = prod(a:b) / prod(c:d),    where: a < c and b < d and obviously: a > < b and c < d > > I cannot make assumptions on the relative position of c,b and a,d. > > The problem i

Re: [R] R on the cloud - Windows to Linux

2011-12-20 Thread Peter Langfelder
On Tue, Dec 20, 2011 at 2:22 PM, Whit Armstrong wrote: > Ben, > > You can email me directly if you have problems. > > You can see the build status here: > http://cran.r-project.org/web/checks/check_results_rzmq.html > > I don't use windows at all, so I'm hoping for some help from the > community f

Re: [R] good method of removing outliers?

2011-12-30 Thread Peter Langfelder
On Fri, Dec 30, 2011 at 9:03 AM, Michael wrote: > Happy holidays all! > > I know it's very subjective to determine whether some data is outlier or > not... > > But are there reasonally good and realistic methods of identifying outliers > in R? What kind of data do you have? For simple numeric dat

Re: [R] tcltk on linux/rhel6

2012-01-03 Thread Peter Langfelder
On Tue, Jan 3, 2012 at 4:03 PM, Carl Baribault wrote: > Dear All, > > I've seen posts to the effect that.. > 1) choose.dir is only available for windows, and > 2) tk_choose.dir would be the linux equivalent. > > I'm still having trouble with the subject package on linux/rhel6. > > I've specified -

Re: [R] Remote environments, calling functions

2011-10-17 Thread Peter Langfelder
On Mon, Oct 17, 2011 at 5:28 PM, Tyler Pirtle wrote: > Hi there, > > I'm trying to do something like a migration of an R program. I've got a > function and some variables > in an interactive-session: > > r <- .5 > ## estimatePi references r > estimatePi <- function(seed) { >    set.seed(seed) >  

Re: [R] Discrepancy with p.value from t.test

2011-11-01 Thread Peter Langfelder
On Tue, Nov 1, 2011 at 12:40 PM, Jonathan Thayn wrote: > Sometimes the p.value returned by t.test() is the same that I calculate using > pt() and sometimes it's not. I don't understand the difference. I'm sure > there is a simple explanation but I haven't been able to find it, even after > look

[R] R 2.14.0 installation problem (?)

2011-11-02 Thread Peter Langfelder
Hi all, I downloaded R-2.14.0.tar.gz, unpacked, ran configure with --with-blas="-lgoto2", built, then issued make install rhome=/usr/local/lib/R-2.14.0-goto This produced the following error: [lots of output deleted] make[3]: Entering directory `/home/plangfelder/Download/R-2.14.0/src/modules/

Re: [R] For loop to cycle through datasets of differing lengths

2011-11-03 Thread Peter Langfelder
On Thu, Nov 3, 2011 at 11:41 AM, Schatzi wrote: > I have encountered this problem on several occasions and am not sure how to > handle it. I use for-loops to cycle through datasets. When each dataset is > of equal length, it works fine as I can combine the datasets and have each > loop pick up a d

Re: [R] Reclassify string values

2011-11-03 Thread Peter Langfelder
On Thu, Nov 3, 2011 at 11:59 AM, Zev Ross wrote: > Hi All, > > Is there a simple way to convert a string such as c("A", "B" ,"C", "D") to a > string of c("Group1", "Group1", "Group2", "Group2"). Naturally I could use > the factor function as below but I don't like seeing that warning message > (an

Re: [R] Reclassify string values

2011-11-03 Thread Peter Langfelder
On Thu, Nov 3, 2011 at 1:31 PM, Zev Ross wrote: > Hi Peter, > > Thanks for the response. What you've suggested works fine but I'm looking > for something that is simpler than my solution and avoids the pesky warning > message. Your response avoids the warning message but just as complex (if > not

Re: [R] 12th Root of a Square (Transition) Matrix

2011-11-04 Thread Peter Langfelder
Is it just me or are you confusing the 12th root of a matrix with taking the 12th root of each entry? Because your formula involving the eigenvectors and eigenvalues calculates the 12th root of the matrix, while round(nth_root^12,4) will print out a matrix whose components are powers of 12 of the

Re: [R] 12th Root of a Square (Transition) Matrix

2011-11-04 Thread Peter Langfelder
On Fri, Nov 4, 2011 at 2:37 PM, David Winsemius wrote: > > The 12th (matrix) root of M: e^( 1/n * log(M) ) > >> require(Matrix) >> M1.12 <- expm( (1/12)*logm(M) ) I like this - haven't thought of the matrix algebra functions in Matrix. Thanks, Peter ___

Re: [R] Dunif and Punif

2011-11-07 Thread Peter Langfelder
On Mon, Nov 7, 2011 at 8:49 AM, michele donato wrote: > Hi, > I am trying to use dunif and runif > however, I have two problems: > if I do > > dunif(1:10, min=1, max=10) > > I get 10 values, which summed give me 1. > I understand that the probability is computed as f(x) = 1 / (max-min) > but i

Re: [R] Why does length("") == 1?

2011-11-10 Thread Peter Langfelder
On Thu, Nov 10, 2011 at 4:17 PM, Worik R wrote: > It seems obvious to me that the empty string "" is length 0. You are using the wrong function to find the length of a character string. length() returns the length of the object, and length of (non-NULL) scalars is always 1. If you want the numbe

Re: [R] Converting a string vector with names to a numeric vector with names

2012-03-01 Thread Peter Langfelder
On Thu, Mar 1, 2012 at 12:28 PM, John C Nash wrote: > Not paying close attention to detail, I entered the equivalent of > > pstr<-c("b1=200", "b2=50", "b3=0.3") > > when what I wanted was > > pnum<-c(b1=200, b2=50, b3=0.3) > > There was a list thread in 2010 that shows how to deal with un-named ve

Re: [R] Computing line= for mtext

2012-03-01 Thread Peter Langfelder
Frank, maybe I'm not understanding something right... you say right-justify in the right margin, meaning justify against the very right edge of the plot margin area? Since you're setting your right margin to 5, why not just mtext(s, side=4, las=1, at=5, adj=1, line = 5, cex=1) mtext(s, side=4, la

Re: [R] data frame of strings formatted

2012-03-01 Thread Peter Langfelder
On Thu, Mar 1, 2012 at 8:05 PM, Ben quant wrote: > Hello, > > I have another question > > I have a data frame that looks like this: >                         a          b > 2007-03-31 "20070514" "20070410" > 2007-06-30 "20070814" "20070709" > 2007-09-30 "20071115" "20071009" > 2007-12-31 "2008

Re: [R] Correlation of huge matrix saved as binary file

2012-03-02 Thread Peter Langfelder
I don't think you can speed it up by a whole lot... but you can try a few things, especially if you don't have missing data in the matrix (which you probably don't). The main question is what takes most of the time- the api calls or the cor() call? If it's cor, here's what you can try: 1. Pre-stan

Re: [R] hierarchical clustering of large dataset

2012-03-09 Thread Peter Langfelder
On Thu, Mar 8, 2012 at 4:41 AM, Massimo Di Stefano wrote: > > Hello All, > > i've a set of observations that is in the form : > > a,    b,    c,    d,    e,    f > 67.12,    4.28,    1.7825,    30,    3,    16001 > 67.12,    4.28,    1.7825,    30,    3,    16001 > 66.57,    4.28,    1.355,    30,

Re: [R] hierarchical clustering of large dataset

2012-03-09 Thread Peter Langfelder
On Fri, Mar 9, 2012 at 1:50 PM, Massimo Di Stefano wrote: > Peter, > > really thanks  for your answer. > > > > install.packages("flashClust") > library(flashClust) > data <- read.csv('/Users/epifanio/Desktop/cluster/x.txt') > data <- na.omit(data) > data <- scale(data) >> mydata >                

Re: [R] Matrix negative fraction power

2012-03-11 Thread Peter Langfelder
On Sun, Mar 11, 2012 at 1:46 AM, Ebrahim Jahanshiri wrote: > Dear list, > > I understand that to raise matrix A to power (-1/2) we should use something > like this: > > eigen(A)$vectors%*%diag(1/sqrt(eigen(A)$values))%*%t(eigen(A)$vectors) > > [from previous discussions: > http://r.789695.n4.nabbl

Re: [R] replicating C example from the Extensions Manual problem

2012-03-14 Thread Peter Langfelder
Seems you're missing the required header(s). Can't find the example in the extensions manual but you probably need #include or #include HTH, Peter On Wed, Mar 14, 2012 at 11:03 PM, Erin Hodgess wrote: > Dear R People: > > Here is something that I am sure is very simple.  I'm just trying t

Re: [R] Get Details About Clusters

2012-03-15 Thread Peter Langfelder
On Thu, Mar 15, 2012 at 1:48 PM, A J wrote: > > Hi everybody! > Anybody knows how can I get detalied information about clusters after using > hclust? > The issue is that if I have some items in different clusters, I would like to > get the cluster where each item is placed. > Taking into account

Re: [R] Filling matrices

2012-03-19 Thread Peter Langfelder
On Mon, Mar 19, 2012 at 2:07 PM, David Stevens wrote: > I'm a bit clumsy about many things in R. Here's my problem. I'm trying to > build a square sparse matrix and populate it without looping (bad practice, > right). I have vectors of matched row/column pairs for which the matrix > entries have c

Re: [R] Making Knitr work

2012-03-28 Thread Peter Langfelder
On Wed, Mar 28, 2012 at 9:09 AM, Jessica Streicher wrote: > Might not be the best place to ask, but i could get lucky.. > > I have setup an eclipse environment to write sweave files lately and wanted > to switch to knitr. I could get it to work on easy files, but my earlier > written sweave file

Re: [R] scalar assignment within a vector within function

2012-03-29 Thread Peter Langfelder
On Thu, Mar 29, 2012 at 3:49 PM, Benjamin Caldwell wrote: > Hello, > > I'm trying to create a vector of r^2 values for using a function which I > will run in a "for" loop. Example: > > per<-rnorm(100,.5,.2)^2 > x<-rnorm(100,10,5) > y<-rnorm(100,20,5) > fr<-data.frame(x,y,per) > > test<-rep(0,9) >

Re: [R] Update Packages error

2012-03-29 Thread Peter Langfelder
On Thu, Mar 29, 2012 at 9:41 PM, Jim Silverton wrote: > Anyone knows how to get around this message? I am trying to update some > packages in R but I get the following message I use R for 64 bit windows. > Warning in install.packages(update[instlib == l, "Package"], l, contriburl > = contriburl,  

Re: [R] hclust and plot functions work, cutree does not

2012-04-03 Thread Peter Langfelder
On Tue, Apr 3, 2012 at 2:41 AM, vinod1 wrote: > Sarah, > > .       clust_tree=hclust(as.dist(x),method="complete") > .       plot(clust_tree) > > this produces a dendrogram, whereas > .       clust_tree=hclust(as.dist(x),method="complete") > .        cut = cutree(clust_tree,k=1:5) > .        plot(

Re: [R] how to map microarray probe to gene, homology

2012-04-03 Thread Peter Langfelder
On Tue, Apr 3, 2012 at 7:21 AM, email mail wrote: > Hi: > > I have clustered microarray gene expression data and trying to map between > microarray probe, gene, pathway, gene ontology, and homology for a set of > (affy) microarray probes. Is there any package in R which facilitates this? > I am lo

Re: [R] Error: unexpected '<' in "<" when modifying existing functions

2012-01-13 Thread Peter Langfelder
On Fri, Jan 13, 2012 at 4:57 PM, Rui Esteves wrote: > Hi. > I am trying to modify kmeans function. > It seems that is failing something obvious with the workspace. > I am a newbie and here is my code: >> > Error: unexpected '<' in "<" Do not include the last line it is not part of the functi

Re: [R] Import a text file except its first row

2012-01-16 Thread Peter Langfelder
On Mon, Jan 16, 2012 at 7:54 PM, Chee Chen wrote: > Dear All, > I would like to know how to: > How to import just not the first row of a huge space/tab delimited text file > of sequencing data. > Thanks and regards, > Chee See ?read.table, particularly the argument skip. HTH, Peter __

Re: [R] BLAS

2012-01-17 Thread Peter Langfelder
On Tue, Jan 17, 2012 at 6:06 AM, Scott Raynaud wrote: > I'm setting up an Ubuntu virtual machine that will use 4-Intel Xeon CPU x5650. > I'd like to compile R with a BLAS but the question is whcih one.  Seems > like the only free ones are GotoBLAS which I'm not sure is being maintained > for newer

Re: [R] z-transform each column of a data.frame

2012-01-20 Thread Peter Langfelder
On Fri, Jan 20, 2012 at 9:04 AM, Martin Batholdy wrote: > Hi, > > > I am currently trying to z-transform (that is subtracting the mean and divide > by the standard deviation) multiple columns of a data.frame at the same time. > > > My first approach was: > > x <- data.frame(c(0:10), c(10:20)) > (

Re: [R] Need very fast application of 'diff' - ideas?

2012-01-28 Thread Peter Langfelder
ehm... this doesn't take very many ideas. x = runif(n=10e6, min=0, max=1000) x = round(x) system.time( { y = x[-1] - x[-length(x)] }) I get about 0.5 seconds on my old laptop. HTH Peter On Fri, Jan 27, 2012 at 4:15 PM, Kevin Ummel wrote: > Hi everyone, > > Speed is the key here. > > I ne

Re: [R] Euler identity with complex exp

2012-01-30 Thread Peter Langfelder
Not sure why you think the formula does not hold... but am guessing you think that sin(x) and cos(x) are have values in [-1, 1]? Well that only holds for real x. If you have a complex x, sin(x) and cos(x) are unbounded - indeed, if you can write x=iy and y is real, you can show (up to my own ignora

Re: [R] Euler identity with complex exp

2012-01-30 Thread Peter Langfelder
On Mon, Jan 30, 2012 at 11:43 AM, Joseph Park wrote: > Thanks Michael & Peter. > > Michael's expansion makes sense. > > This is what I expected: > >> a = pi + 0i >> complex( real = cos(Re(a)), imaginary = sin(Im(a)) ) > [1] -1+0i As they say, the error is between the keyboard and the chair. You c

Re: [R] RandomForest ... Always Returning a 1?

2012-02-05 Thread Peter Langfelder
Well, if you look at your data more carefully, you will see that the histogram of y is heavily skewed towards 1 (small values). The 91/625 quantile is still 1 (there are 192 1s). It is therefore not surprising that RF comes up with mostly 1s (in my attempt it came up with two 2s, but that is a bit

Re: [R] .Random.seed not found

2012-02-07 Thread Peter Langfelder
You need to use set.seed() or one of the random number generators to have .Random.seed defined. Also, if you load a previously saved workspace and that workspace had a .Random.seed defined, you will have it defined. HTH Peter On Tue, Feb 7, 2012 at 9:58 AM, Wilkerson, Sylvia (NIH/CIT) [E] wrote

[R] Version control (git, mercurial) for R packages

2012-02-08 Thread Peter Langfelder
Hi all, in particular package developers, I'm exploring using a version control system to keep better track of changes to the packages I maintain. I'm leaning towards git (although mercurial also looks good) but am not sure what is the best way to set up the repository. It seems I can't set the re

Re: [R] Version control (git, mercurial) for R packages

2012-02-09 Thread Peter Langfelder
On Thu, Feb 9, 2012 at 1:46 AM, Gregory Jefferis wrote: > Dear Peter, > > Trying to respond to your original question Thanks for staying on thread :) > > > I have a git repositiory in the root of my packages: > > ie > > package-foo/.git > package-foo/R > package-foo/inst > > Running make check

<    1   2   3   4   5   >