[R] define variables from rows of a matrix

2011-08-10 Thread gallon li
I have a following matrix and wish to define a variable based the variable A=matrix(0,5,5) A[1,]=c(30,20,100,120,90) A[2,]=c(40,30,20,50,100) A[3,]=c(50,50,40,30,30) A[4,]=c(30,20,40,50,50) A[5,]=c(30,50,NA,NA,100) A [,1] [,2] [,3] [,4] [,5] [1,] 30 20 100 120 90 [2,] 40 30

Re: [R] How to quickly convert a data.frame into a structure of lists

2011-08-10 Thread Duncan Mackay
Hi Something to get you started ? as.list a data.frame can be regarded as a 2 dimensional array of list vectors df = data.frame(a=1:2,b=2:1,c=4:5,d=9:10) as.list(df[,1:3]) $a [1] 1 2 $b [1] 2 1 $c [1] 4 5 see also http://cran.ms.unimelb.edu.au/doc/contrib/Burns-unwilling_S.pdf Regards

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

2011-08-10 Thread Prof Brian Ripley
On Tue, 9 Aug 2011, Peter Langfelder wrote: 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

[R] subqueries in sqlQuery function (package RODBC)

2011-08-10 Thread andrija djurovic
Hi R users. sorry for missing example and if question is to general but I am wondering if it is possible to execute subqueries in function sqlQuery (package RODBC) with opened connection with Excel or SQL server 2000. I couldn't find any example of this. And if it is possible what should be a

Re: [R] glmnet

2011-08-10 Thread Nick Sabbe
Hi Andra. I wonder how you come about trying to use LASSO without knowing what lambda is. I'd advise you to read up on it. In the help (?glmnet) you can find several paper references, but for a more gentle introduction, you can read http://www-stat.stanford.edu/~tibs/ElemStatLearn/ In a

Re: [R] simple plot question

2011-08-10 Thread Maxim
Hi, thanks a lot for pointing me at conditional plotting! I have to confess that I'm still not really convinced whether this type of philosophy holds true in each and every situation, especially when there appears to be a common sense in literature (even if it is not optimal) to depict such data

Re: [R] [Solved] Re: lavaan: how to analyse residuals of a latent variable

2011-08-10 Thread yrosseel
Maybe this kind of usage of lavaan is not very common, but in order to help others in my situation, is this documented somewhere? My understanding of latent variable analysis is indeed limited, but I did not understand that lavaan worked liked this when I read the documentation. This is not

Re: [R] subqueries in sqlQuery function (package RODBC)

2011-08-10 Thread Prof Brian Ripley
In what sense is this a 'subquery'? It is just an SQL command (write it on one line, no terminating ;, which is not part of the query). On Wed, 10 Aug 2011, andrija djurovic wrote: Hi R users. sorry for missing example and if question is to general but I am wondering if it is possible to

Re: [R] define variables from rows of a matrix

2011-08-10 Thread Eik Vettorazzi
Hi, I was irritated about your printed last row of A, which apart from definition contains a 20. Anyway, how about this: y-x-rep(NA,nrow(A)) #its not clear, whether multiple values of 100 can occur in a single #row, and what to do, when 100 is found before and after 20, so you may #alter the

Re: [R] Different approach to set up Cohen Kappa

2011-08-10 Thread Daniel Malter
The kappa2() function in the irr library takes an n x 2 matrix as input, where the two columns are the ratings by two raters. Let x and y below be the ratings of the two raters: x-sample(c(0,1,2),100,replace=T) x o-sample(c(0,0,0,1),100,replace=T) y-x+o y #Then kappa is computed as:

[R] round() a data frame containing 'character' variables?

2011-08-10 Thread Liviu Andronic
Dear all It is difficult to use round(..., digits=2) on a data frame since one has to first take care to remove non-numeric variables such as 'character' or 'factor': head(round(iris, 2)) Error in Math.data.frame(list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, : non-numeric variable in data

Re: [R] round() a data frame containing 'character' variables?

2011-08-10 Thread Dimitris Rizopoulos
One approach is the following: numVars - sapply(iris, is.numeric) iris[numVars] - lapply(iris[numVars], round, digits = 2) head(iris) You can also put it in one lapply() call if you like. I hope it helps. Best, Dimitris On 8/10/2011 11:34 AM, Liviu Andronic wrote: Dear all It is difficult

Re: [R] round() a data frame containing 'character' variables?

2011-08-10 Thread Liviu Andronic
Hello On Wed, Aug 10, 2011 at 11:41 AM, Dimitris Rizopoulos d.rizopou...@erasmusmc.nl wrote: One approach is the following: numVars - sapply(iris, is.numeric) iris[numVars] - lapply(iris[numVars], round, digits = 2) head(iris) That's interesting, but still doesn't do what I need. Since it's

[R] plot 3d info in 2d

2011-08-10 Thread Andrew Halford
Hi Listers, Is it possible to produce an ordination plot in 2d, where bubbles represent the location of sites (this part is easy enough) and the size of the bubbles is proportional to the sites location in 3d space (I am stuck on this option). So sites that are very near the 2d plane of the xy

Re: [R] plot 3d info in 2d

2011-08-10 Thread Paul Hiemstra
On 08/10/2011 10:02 AM, Andrew Halford wrote: Hi Listers, Is it possible to produce an ordination plot in 2d, where bubbles represent the location of sites (this part is easy enough) and the size of the bubbles is proportional to the sites location in 3d space (I am stuck on this option).

Re: [R] plot 3d info in 2d

2011-08-10 Thread S Ellison
Very easy if you note that cex in plot can be a vector. example: x - runif(100) y-runif(100) z-runif(100) #shift and scale z for convenience 9the scaling is based on range 'cos we know this is in [0,1] #your mileage may vary but the principle is ) z.scaled - 0.05 + (z-min(z))/diff(range(z))

Re: [R] subqueries in sqlQuery function (package RODBC)

2011-08-10 Thread andrija djurovic
I thought subqueries in sense of commad inside the command (in my example two select commands). It works as you proposed an I thought in this case (subqueries) that I need different syntax for sqlQury function combining SQL query and paste. But now I have another problem and again sorry if it is

Re: [R] How to get the date of specific value within a zoo object?

2011-08-10 Thread R. Michael Weylandt michael.weyla...@gmail.com
Xts is an extension of zoo that has some other nice features: character subsetting, periodic apply functions, good built in time conversions, etc. More importantly for my work, the authors put a lot of work into making sure it plays well with all of R's many ts classes so I almost always start

Re: [R] How to quickly convert a data.frame into a structure of lists

2011-08-10 Thread Duncan Murdoch
I would use the tapply function (which is designed for the case in which data exists for most pairs of the levels of A and B) or the reshape::sparseby function, or something else in the reshape package. These won't give you exactly the structure you were asking for, but they will separate the

Re: [R] plot 3d info in 2d

2011-08-10 Thread Paul Hiemstra
On 08/10/2011 10:02 AM, Andrew Halford wrote: Hi Listers, Is it possible to produce an ordination plot in 2d, where bubbles represent the location of sites (this part is easy enough) and the size of the bubbles is proportional to the sites location in 3d space (I am stuck on this option).

[R] Source Code glm() question

2011-08-10 Thread Axel Urbiz
Dear List, I'm fairly new in R. I'd like to see how glm() uses the argument family in fitting a model. Specifically, I'd like to see how a glm with a gamma family is fitted. Thanks for any help, Axel. [[alternative HTML version deleted]] __

Re: [R] Source Code glm() question

2011-08-10 Thread ONKELINX, Thierry
Just type glm at the prompt. glm function (formula, family = gaussian, data, weights, subset, na.action, start = NULL, etastart, mustart, offset, control = list(...), model = TRUE, method = glm.fit, x = FALSE, y = TRUE, contrasts = NULL, ...) { call - match.call() if

Re: [R] glmnet

2011-08-10 Thread Patrick Breheny
On 08/10/2011 03:00 AM, Nick Sabbe wrote: Finally, to avoid downward bias, you could run a normal glm with only the variables selected in the previous step. At the cost, of course, of introducing upward bias -- Patrick Breheny Assistant Professor Department of Biostatistics Department of

Re: [R] reflecting a PCA biplot

2011-08-10 Thread Gavin Simpson
On Tue, 2011-08-09 at 22:57 +1000, Andrew Halford wrote: Hi Listers, I am trying to reflect a PCA biplot in the x-axis (i.e. PC1) but am not having much success. In theory I believe all I need to do is multiply the site and species scores for the PC1 by -1, which would effectively flip the

[R] igraph - designing graph plot by attributes

2011-08-10 Thread Gaitan, Andreea
Hi, I'm working on some social networks and I managed to create the graphs with labels and edges weight, but I would also like to change the size of the vertices according to the age of the persons in the network and the shape according to the gender. Now for the age, I have people with ages

[R] Floats in Microsoft Basic format

2011-08-10 Thread taraxacum
Hi all, I need to convert a floating point value from Microsoft Basic format to IEEE format. There's a simple way to achieve this in R or I have to write my own function? (e.g. convert the C code below) thanks t #include string.h/* for strncpy */ int _fmsbintoieee(float *src4, float

[R] Using ANCOVA in R

2011-08-10 Thread January Weiner
Hello, I have a problem with using the following design with ANCOVA in R. There are two groups (control + treatment), each with ten subjects. The subjects show a response that is monitored over time (four time points). For a single given subject, the response can be analysed with linear

[R] Different approach to set up Cohen Kappa

2011-08-10 Thread gavfung
Hi, I just started learning R, and one of the most frequent thing that I need to calculate is cohen kappa in my psychology lab and I figure being able to do inter rater reliability is a great way for me to explore R. There are two different scenario in which I need help with. (By the way, I have

Re: [R] R-help Digest, Vol 102, Issue 10

2011-08-10 Thread fraenzi . korner
Wir sind bis am 20. August in den Ferien und werden keine e-mails beantworten. Bei dringenden Fällen melden Sie sich bei Stefanie von Felten steffi.vonfel...@oikostat.ch We are on vacation until 20. August. In urgent cases, please contact Stefanie von Felten steffi.vonfel...@oikostat.ch

[R] varpart with repeated measures

2011-08-10 Thread VG
Dear all, I would like to do variance partitioning of community dissimilarity matrix (Y) using 4 explanatory tables: X1=environmental characteristics X2=species traits related to dispersal X3=species characteristics (abundances and richnness) X4= xy spatial coordinates The problem is that I have

[R] function runif in for loop

2011-08-10 Thread Johannes Radinger
Hello, I'd like to perform a regression using MCMCregress (MCMCpack). One variable therefore should be a function rather than a variable: I want to use X as an input and X should be defined as a random number between to values. Therefore I want to use the function runif like: X -(1, Xa, Xb) but

Re: [R] round() a data frame containing 'character' variables?

2011-08-10 Thread Jean V Adams
The function format() might serve your needs. format(head(iris), digits=1) Sepal.Length Sepal.Width Petal.Length Petal.Width Species 15 41 0.2 setosa 25 31 0.2 setosa 35 31

[R] rbind/cbind

2011-08-10 Thread Anthony Ching Ho Ng
Dear list, I wonder if there a better way to have rbind/cbind/append to create the first element (if it is empty) instead of doing the following in a loop? for (i in 1:10) { if (i == 1) { aRow = SomeExpression(i) } else { aRow = rbind(aRow,SomeExpression(i)) } } Thanks Anthony

Re: [R] Plotting Ellipses and Points of Matching Colors in an Ordination

2011-08-10 Thread Jean V Adams
Gabe, Since you didn't provide a small example of your data, I can't test out your code. However, I used an example from the ?ordiellipse help page to draw different colored ellipses (using the show.groups= argument) with labels (using the label= argument). Hope this helps. library(vegan)

Re: [R] Loops for repetitive task

2011-08-10 Thread Dennis Murphy
Hi: Try this: ## Function that takes a data frame as input and outputs a data frame: chrSumm - function(d) { # d is a data frame colnames(d) - c(chr,start,end,base1,base2, totalreads,methylation,strand) TR - nrow(d) RG1 - sum(d['totalreads'] = 1) percent -

[R] column names issue with read.csv

2011-08-10 Thread Anthony Ching Ho Ng
Dear List, I wonder why when using read.csv(), if the column name contains a numeric i.e. a stock symbols-0001.HK, it will automatically insert an X character to the column names - X0001.HK. Now I have to manually do a loop and use substring() to remove the X character. Any advice? Thanks

Re: [R] function runif in for loop

2011-08-10 Thread Jean V Adams
Johannes, You have the loop set up right, you just need to add indexing to refer to the looping variable, i. lT - sample(1:10) uT - sample(21:30) X - numeric(length(lT)) for (i in 1:length(lT)) X[i] - runif(1, lT[i], uT[i]) X Note that I changed the name of the result from T to X, because T

Re: [R] column names issue with read.csv

2011-08-10 Thread Jean V Adams
Anthony, See ?make.names for a description of valid names. Here's an excerpt: A syntactically valid name consists of letters, numbers and the dot or underline characters and starts with a letter or the dot not followed by a number. ... The character X is prepended if necessary. There is an

Re: [R] How to quickly convert a data.frame into a structure of lists

2011-08-10 Thread Dennis Murphy
To borrow shamelessly from one of the prominent helpers on this list: What is the problem you're trying to solve?(attribution: Jim Holtman) I have the sense you want to do something over many subsets of your data frame. If so, breaking things up into lists of lists of lists is not

Re: [R] Floats in Microsoft Basic format

2011-08-10 Thread Duncan Murdoch
On 10/08/2011 5:58 AM, taraxacum wrote: Hi all, I need to convert a floating point value from Microsoft Basic format to IEEE format. There's a simple way to achieve this in R or I have to write my own function? (e.g. convert the C code below) You'll need to write your own function. It can be

Re: [R] function runif in for loop

2011-08-10 Thread Duncan Murdoch
On 10/08/2011 7:28 AM, Johannes Radinger wrote: Hello, I'd like to perform a regression using MCMCregress (MCMCpack). One variable therefore should be a function rather than a variable: I want to use X as an input and X should be defined as a random number between to values. Therefore I want

Re: [R] rbind/cbind

2011-08-10 Thread David Winsemius
On Aug 10, 2011, at 9:08 AM, Anthony Ching Ho Ng wrote: Dear list, I wonder if there a better way to have rbind/cbind/append to create the first element (if it is empty) instead of doing the following in a loop? for (i in 1:10) { if (i == 1) { aRow = SomeExpression(i) } else { aRow

Re: [R] rbind/cbind

2011-08-10 Thread ONKELINX, Thierry
Can't you use sapply? sapply(seq_len(10), function(i){SomeExpression(i)}) Best regards, Thierry -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens David Winsemius Verzonden: woensdag 10 augustus 2011 15:50 Aan: Anthony Ching Ho

[R] studentized and standarized residuals

2011-08-10 Thread Jen
Hi, I must be doing something silly here, because I can't get the studentised and standardised residuals from r output of a linear model to agree with what I think they should be from equation form. Thanks in advance, Jennifer x = seq(1,10) y = x + rnorm(10) mod = lm(y~x) rstandard(mod)

Re: [R] Floats in Microsoft Basic format

2011-08-10 Thread Barry Rowlingson
On Wed, Aug 10, 2011 at 2:34 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 10/08/2011 5:58 AM, taraxacum wrote: Hi all, I need to convert a floating point value from Microsoft Basic format to IEEE format. There's a simple way to achieve this in R or I have to write my own function?

[R] useR! 2012 Nashville TN: Your Input Needed

2011-08-10 Thread Frank Harrell
So far we have received over 70 responses to our survey. If you have NOT responded already and are likely to attend useR! 2012, please take the extremely short survey today. The link is below. More information about Nashville may be seen at http://biostat.mc.vanderbilt.edu/UseR-2012 In a day

Re: [R] Floats in Microsoft Basic format

2011-08-10 Thread Duncan Murdoch
On 10/08/2011 10:16 AM, Barry Rowlingson wrote: On Wed, Aug 10, 2011 at 2:34 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 10/08/2011 5:58 AM, taraxacum wrote: Hi all, I need to convert a floating point value from Microsoft Basic format to IEEE format. There's a simple way

[R] Reading XML files masquerading as XL files

2011-08-10 Thread Dennis Fisher
R version 2.13.1 OS X (or Windows) Colleagues, I received a number of files with a .xls extension. These files open in XL and, by all appearances, are XL files. However, it appears to me that the files are actually XML: readLines(dir()[16])[1:10] [1] ?xml version=\1.0\?

Re: [R] studentized and standarized residuals

2011-08-10 Thread Patrick Breheny
On 08/10/2011 10:03 AM, Jen wrote: Hi, I must be doing something silly here, because I can't get the studentised and standardised residuals from r output of a linear model to agree with what I think they should be from equation form. x = seq(1,10) y = x + rnorm(10) mod = lm(y~x) rstandard(mod)

Re: [R] function runif in for loop

2011-08-10 Thread Jean V Adams
Following the suggestion by Duncan Murdoch, this should work for you. X - runif(length(lT), lT, uT) Jean From: Johannes Radinger jradin...@gmx.at To: Jean V Adams jvad...@usgs.gov Cc: r-help@r-project.org Date: 08/10/2011 08:40 AM Subject: Re: [R] function runif in for loop Jean, thank

Re: [R] studentized and standarized residuals

2011-08-10 Thread Jen
Thanks Patrick - at least I know I wasn't being too silly :-) Jen -- View this message in context: http://r.789695.n4.nabble.com/studentized-and-standarized-residuals-tp3732997p3733173.html Sent from the R help mailing list archive at Nabble.com. __

[R] join columns

2011-08-10 Thread Anthony Ching Ho Ng
Dear R-help, I wonder if you could give me some suggestions in how to do a union join of two data frames as follow: - union join the common column, and insert a 0 if one is missing. I made a function to perform the following, and I know it may not that quite welly written, but it works. Any

Re: [R] join columns

2011-08-10 Thread David Winsemius
On Aug 10, 2011, at 11:04 AM, Anthony Ching Ho Ng wrote: Dear R-help, I wonder if you could give me some suggestions in how to do a union join of two data frames as follow: - union join the common column, and insert a 0 if one is missing. I made a function to perform the following, and I

Re: [R] Using ANCOVA in R

2011-08-10 Thread Richard M. Heiberger
January, It looks like you will need an interaction effect, perhaps g - lm( response ~ subject + group*time) Please see the ancova function in the HH package. install.packages(HH) ## if necessary library(HH) ?ancova Rich On Wed, Aug 10, 2011 at 5:15 AM, January Weiner

Re: [R] round() a data frame containing 'character' variables?

2011-08-10 Thread Liviu Andronic
Hello On Wed, Aug 10, 2011 at 2:31 PM, Jean V Adams jvad...@usgs.gov wrote: The function format() might serve your needs. This looks very promising, but yields some strange results. See below: x - data.frame(a=rnorm(10), b=rnorm(10), c=rnorm(10), d=letters[1:10]) x a b

[R] [R-pkgs] New Matrix and lme4: Must reinstall lme4 if got new Matrix

2011-08-10 Thread Martin Maechler
We have released to CRAN a new version of the (recommended) package Matrix, and of package lme4 yesterday. Anyone who gets the new version of Matrix *MUST* re-install lme4 -- if (s)he is using lme4 at all. Technical details about that further below. The fact that yesterday's version number of

Re: [R] studentized and standarized residuals

2011-08-10 Thread Dénes TÓTH
Dear Jen, Actually you can check out what R does by looking at the source. # first type the name of the function rstandard function (model, ...) UseMethod(rstandard) environment: namespace:stats # ?methods will list you the corresponding functions methods(rstandard) [1] rstandard.glm

Re: [R] join columns

2011-08-10 Thread Henrique Dallazuanna
Try this: merge(q1, q2, all = TRUE) On Wed, Aug 10, 2011 at 12:04 PM, Anthony Ching Ho Ng anthony.ch...@gmail.com wrote: Dear R-help, I wonder if you could give me some suggestions in how to do a union join of two data frames as follow: - union join the common column, and insert a 0 if one

Re: [R] round() a data frame containing 'character' variables?

2011-08-10 Thread Jean V Adams
As it says in ?format the digits argument specifies ... how many significant digits are to be used ... enough decimal places will be used so that the smallest (in magnitude) number has this many significant digits ... In your example, the last value in column a is 0.06348058 which is written

[R] RExcel

2011-08-10 Thread Dr. Alireza Zolfaghari
Hi list, I used to work with RExcel in excel 2003. Now in 2007, I tried the same RExcel, but it did not work. I got R version 12. I downloaded/installed the latest version of RExcel 3.2.0 from http://sunsite.univie.ac.at/rcom/. It has added the RExcel add-ins, but when I click on starting R in

[R] spfeml error message

2011-08-10 Thread Darshana Udayanganie
Hello I am trying to learn the spatial panel data analysis (newbie). I have the R version 2.13.1 and I did download the spml package required for the spatial panel data analysis. However, when I tried the analysis, I get the following error message. “could not find function spfeml”. Can

Re: [R] How to quickly convert a data.frame into a structure of lists

2011-08-10 Thread Frederic F
Hello Duncan, Here is a small example to illustrate what I am trying to do. # Example data.frame df=data.frame(A=c(a,a,b,b), B=c(X,X,Y,Z), C=c(1,2,3,4)) # A B C # 1 a X 1 # 2 a X 2 # 3 b Y 3 # 4 b Z 4 ### First way of getting the list structure (ls1) using imbricated lapply loops: # Get

Re: [R] instal tar.gz package on windows

2011-08-10 Thread Lippel, Anna
Hi Duncan, I have tried to install a tar.gz package following your instructions (https://stat.ethz.ch/pipermail/r-help/2008-August/169599.html) but without success. Here are the steps I followed: I installed the last version of Rtools and ran Rcmd INSTALL rJava_0.8-8.tar.gz and got the error

Re: [R] function runif in for loop

2011-08-10 Thread Johannes Radinger
Jean, thank you for your answer. especially the line X - numeric(length(lT)) helped me a lot. Anyway, in my case I'd like to get a dynamic variable or better a function for X. I mean if i try to call X I'd like that this drawing of random number is performed. In the case now if I call X several

Re: [R] function runif in for loop

2011-08-10 Thread Johannes Radinger
Original-Nachricht Datum: Wed, 10 Aug 2011 09:38:38 -0400 Von: Duncan Murdoch murdoch.dun...@gmail.com An: Johannes Radinger jradin...@gmx.at CC: r-help@r-project.org Betreff: Re: [R] function runif in for loop On 10/08/2011 7:28 AM, Johannes Radinger wrote: Hello,

Re: [R] How to quickly convert a data.frame into a structure of lists

2011-08-10 Thread Frederic F
Hello Denis, To borrow shamelessly from one of the prominent helpers on this list: What is the problem you're trying to solve?    (attribution: Jim Holtman) I'm trying to connect two sets of legacy R tools: the output of the first one can be transformed in a data.frame without loss of

Re: [R] scan(file, encoding=?)

2011-08-10 Thread tibi3000
Hi, this command gives you all possible encoding options on your platform: iconvlist() hope it answers your question, T -- View this message in context: http://r.789695.n4.nabble.com/scan-file-encoding-tp840838p3733327.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] RExcel

2011-08-10 Thread David Winsemius
Don't they have their own support mailing list? You should review their documentation for specifics. -- David. On Aug 10, 2011, at 12:24 PM, Dr. Alireza Zolfaghari wrote: Hi list, I used to work with RExcel in excel 2003. Now in 2007, I tried the same RExcel, but it did not work. I got R

Re: [R] How to quickly convert a data.frame into a structure of lists

2011-08-10 Thread Duncan Murdoch
On 10/08/2011 10:30 AM, Frederic F wrote: Hello Duncan, Here is a small example to illustrate what I am trying to do. # Example data.frame df=data.frame(A=c(a,a,b,b), B=c(X,X,Y,Z), C=c(1,2,3,4)) # A B C # 1 a X 1 # 2 a X 2 # 3 b Y 3 # 4 b Z 4 ### First way of getting the list structure

Re: [R] instal tar.gz package on windows

2011-08-10 Thread Duncan Murdoch
On 10/08/2011 11:59 AM, Lippel, Anna wrote: Hi Duncan, I have tried to install a tar.gz package following your instructions (https://stat.ethz.ch/pipermail/r-help/2008-August/169599.html) but without success. Here are the steps I followed: I installed the last version of Rtools and ran Rcmd

Re: [R] function runif in for loop

2011-08-10 Thread Duncan Murdoch
On 10/08/2011 9:40 AM, Johannes Radinger wrote: Jean, thank you for your answer. especially the line X- numeric(length(lT)) helped me a lot. Anyway, in my case I'd like to get a dynamic variable or better a function for X. I mean if i try to call X I'd like that this drawing of random number

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

2011-08-10 Thread Corey Dow-Hygelund
You might want to look into the packages bigmemory and biganalytics. Corey On Tue, Aug 9, 2011 at 8:38 PM, Chris Howden ch...@trickysolutions.com.auwrote: Hi, I’m trying to do a hierarchical cluster analysis in R with a Big Data set. I’m running into problems using the dist() function.

Re: [R] How to quickly convert a data.frame into a structure of lists

2011-08-10 Thread Eik Vettorazzi
Hi Frederic, shouldn't there be an result for the 3rd row as well, eg ls1$b$Y? Maybe this will do what you want? dtf-within(dtf,index-factor(A:B)) tapply(dtf$C,dtf$index,list) Hth. Am 10.08.2011 16:30, schrieb Frederic F: Hello Duncan, Here is a small example to illustrate what I am

Re: [R] How to quickly convert a data.frame into a structure of lists

2011-08-10 Thread William Dunlap
I was going to suggest AB - df[c(A,B)] ls2 - array(split(df$C, AB), dim=sapply(AB, nlevels), dimnames=sapply(AB, levels)) which produces a matrix very similar to what Duncan's by() call produces ls1 - by(df$C, df[,1:2], identity) E.g., ls2[[a,X]] [1] 1 2 ls1[[a,X]] [1] 1 2

Re: [R] function runif in for loop

2011-08-10 Thread Bert Gunter
Duncan et. al: Inline below. On Wed, Aug 10, 2011 at 9:48 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 10/08/2011 9:40 AM, Johannes Radinger wrote: Jean, thank you for your answer. especially the line X- numeric(length(lT)) helped me a lot. Anyway, in my case I'd like to get a

[R] Histograms in R

2011-08-10 Thread lt2
HI everyone, I'm plotting a histogram in R and within that histogram i need to demonstrate the percentage of another variable (Percentage of MutStatus) within the bins plotted inthe histogramI don't know how to do that! Data:Validation_Status Mutation_Status TvarRatio WildtypeNone

Re: [R] Histograms in R

2011-08-10 Thread R. Michael Weylandt
Perhaps you could shade the bars as appropriate? I'm not going to use your data because it's not an easily paste-able but how about this: x = rnorm(100) y = sample(c(A,B),100,replace=T,prob=c(0.7,0.3)) d = data.frame(level = x, status = y) n = 10 # Number of bins breaks = quantile(d$level,

Re: [R] function runif in for loop

2011-08-10 Thread Duncan Murdoch
On 10/08/2011 1:16 PM, Bert Gunter wrote: Duncan et. al: Inline below. On Wed, Aug 10, 2011 at 9:48 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 10/08/2011 9:40 AM, Johannes Radinger wrote: Jean, thank you for your answer. especially the line X- numeric(length(lT)) helped

Re: [R] Histograms in R

2011-08-10 Thread Jean V Adams
Assuming your data is in a data.frame called df, try this: attach(df) TR.groups - cut(TvarRatio, seq(0.07, 0.11, 0.01)) m - table(Mutation_Status, TR.groups) mut.no - dim(m)[1] barplot(m, col=seq(mut.no), xlab=TvarRatio, ylab=Frequency) legend(topleft, dimnames(m)[[1]], fill=seq(mut.no),

[R] Opposite of paste function

2011-08-10 Thread Soyeon Kim
Dear All, I have vn variable vn [1] V300 V376 What I want to get is 300 376 without V and from vn variable. Could you help me about this issue? Thank you, Soyeon [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] Opposite of paste function

2011-08-10 Thread Peter Langfelder
On Wed, Aug 10, 2011 at 11:22 AM, Soyeon Kim yunni0...@gmail.com 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

Re: [R] Opposite of paste function

2011-08-10 Thread Abhijit Dasgupta
or, gsub('V','',vn) On 8/10/2011 2:23 PM, Peter Langfelder wrote: On Wed, Aug 10, 2011 at 11:22 AM, Soyeon Kimyunni0...@gmail.com 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

Re: [R] Opposite of paste function

2011-08-10 Thread Doran, Harold
The see also potion of paste gives you the functions you can use for this -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Soyeon Kim Sent: Wednesday, August 10, 2011 2:22 PM To: r-help@r-project.org Subject: [R] Opposite of

Re: [R] function runif in for loop

2011-08-10 Thread Bert Gunter
Duncan: Yup, you're right. Can't assign, just print. -- Bert On Wed, Aug 10, 2011 at 11:02 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 10/08/2011 1:16 PM, Bert Gunter wrote: Duncan et. al: Inline below. On Wed, Aug 10, 2011 at 9:48 AM, Duncan Murdoch murdoch.dun...@gmail.com  

[R] convert 'list' to 'vector'?

2011-08-10 Thread Liviu Andronic
Dear all How does one convert a non-symmetric list to a vector? See below: x - list() x[[1]] - letters[1:5] x[[2]] - letters[6:10] x[[3]] - letters[11:12] x [[1]] [1] a b c d e [[2]] [1] f g h i j [[3]] [1] k l paste(x) [1] c(\a\, \b\, \c\, \d\, \e\) c(\f\, \g\, \h\, \i\, \j\) [3] c(\k\,

[R] choosing selective data with permutations

2011-08-10 Thread Vikram Chhatre
Hello, I am a R beginner and hoping to obtain some hints or suggestions about using permutations to sort a data set I have. Here is an example dataset: Ind1 11 00 12 15 28 Ind2 21 33 22 67 52 Ind3 22 45 21 22 56 Ind4 11 25 74 77 42 Ind5 41 32 67 45 22 This will

Re: [R] convert 'list' to 'vector'?

2011-08-10 Thread R. Michael Weylandt
unlist() Michael Weylandt On Wed, Aug 10, 2011 at 2:58 PM, Liviu Andronic landronim...@gmail.comwrote: Dear all How does one convert a non-symmetric list to a vector? See below: x - list() x[[1]] - letters[1:5] x[[2]] - letters[6:10] x[[3]] - letters[11:12] x [[1]] [1] a b c d e

[R] xtable - caption missing with float=FALSE

2011-08-10 Thread Zev Ross
Hi, For some reason I'm finding that my table caption is disappearing if I print xtable output with the floating argument set to FALSE. Below is a very simple Sweave file that produces two tables the first has no caption and the second has a caption (if you want to see it

Re: [R] convert 'list' to 'vector'?

2011-08-10 Thread Dimitris Rizopoulos
Check function unlist(). Best, Dimitris On 8/10/2011 8:58 PM, Liviu Andronic wrote: Dear all How does one convert a non-symmetric list to a vector? See below: x- list() x[[1]]- letters[1:5] x[[2]]- letters[6:10] x[[3]]- letters[11:12] x [[1]] [1] a b c d e [[2]] [1] f g h i j [[3]] [1]

Re: [R] convert 'list' to 'vector'?

2011-08-10 Thread Jean V Adams
unlist(x) r-help-boun...@r-project.org wrote on 08/10/2011 01:58:57 PM: [image removed] [R] convert 'list' to 'vector'? Liviu Andronic to: r-help@r-project.org Help 08/10/2011 02:02 PM Sent by: r-help-boun...@r-project.org Dear all How does one convert a non-symmetric

Re: [R] choosing selective data with permutations

2011-08-10 Thread R. Michael Weylandt
To pick random elements to sample, you can just use the sample function sample(1:5,3,replace=T/F) # pick true or false as needed for your data. If you replicate this, you should have no problem. replicate(100,function() return(sample(1:5,3,replace=T/F))) This will be plenty fast, but if you

[R] Clustering Large Applications..sort of

2011-08-10 Thread Ken Hutchison
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 (though it may be sub par for this size of problem, thus doubly

Re: [R] convert 'list' to 'vector'?

2011-08-10 Thread Liviu Andronic
On Wed, Aug 10, 2011 at 9:02 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: unlist() Thanks all! This is perfect, and very R-ish: never where a novice would expect it to be. Cheers Liviu __ R-help@r-project.org mailing list

Re: [R] choosing selective data with permutations

2011-08-10 Thread R. Michael Weylandt
Sorry, that second line of code won't work: do it in 2. f - function() {return(sample(1:5,3,replace=T/F))} replicate(100,f()) Michael On Wed, Aug 10, 2011 at 3:06 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: To pick random elements to sample, you can just use the sample

Re: [R] xtable - caption missing with float=FALSE

2011-08-10 Thread Marc Schwartz
On Aug 10, 2011, at 2:02 PM, Zev Ross wrote: Hi, For some reason I'm finding that my table caption is disappearing if I print xtable output with the floating argument set to FALSE. Below is a very simple Sweave file that produces two tables the first has no caption and the second has a

Re: [R] convert 'list' to 'vector'?

2011-08-10 Thread David Winsemius
On Aug 10, 2011, at 3:10 PM, Liviu Andronic wrote: On Wed, Aug 10, 2011 at 9:02 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: unlist() Thanks all! This is perfect, and very R-ish: never where a novice would expect it to be. Well, since `unlist` is linked in the See Also on the

Re: [R] How to quickly convert a data.frame into a structure of lists

2011-08-10 Thread William Dunlap
Here is code to transform the matrix that by() or array(split()) produces, along with an example of the speed of the various approaches. Using split(), either directly or via by() or tapply(), saves a lot of time. f0 - function(df) { # original code with typos fixed. list_structure -

Re: [R] convert 'list' to 'vector'?

2011-08-10 Thread Liviu Andronic
On Wed, Aug 10, 2011 at 9:32 PM, David Winsemius dwinsem...@comcast.net wrote: Thanks all! This is perfect, and very R-ish: never where a novice would expect it to be. Well, since `unlist` is linked in the See Also on the help page for `list`, I can only hope you meant that in complete jest.

[R] font (charter)

2011-08-10 Thread ivo welch
dear R-experts---can someone please refer me to the latest installation instructions for graphics fonts in R (the pdf device)? (I would like to install the Charter font from the texlive 2011 distribution under OSX.) sincerely, /iaw Ivo Welch (ivo.we...@gmail.com)

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

2011-08-10 Thread Thomas Lumley
Try the flow cytometry clustering functions in Bioconductor. -thomas On Thu, Aug 11, 2011 at 7:07 AM, Ken Hutchison vicvoncas...@gmail.com 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

  1   2   >