Hello, I am trying to use 'R' for K-means simulatio, could you please advise me how I can read my data into a two dimesional array? Or is there any method which directly reads the excell file? Please let me know asap. Regards Skanda Kallur Cogito, Ergo Sum! Rene Descartes
A common approach for getting data into R from Excel is to save the spreadsheet as a CSV file and then read it into R using read.csv. CRAN contains references to other means of directly linking Excel and R. You may find the CSV approach good enough. Regards, Andrew C. Ward CAPE Centre Department of Chemical Engineering The University of Queensland Brisbane Qld 4072 Australia andreww at cheque.uq.edu.au Quoting "Skanda Kallur; MEngg" <s2112930 at student.rmit.edu.au>:> Hello, > > I am trying to use 'R' for K-means simulatio, could you please advise me how > I can read my data into a two dimesional array? Or is there any method which > directly reads the excell file? Please let me know asap. > > Regards > > Skanda Kallur > > > > > > Cogito, Ergo Sum! Rene Descartes > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >
Subject: separator = TAB in write.table X-Mailer: VM 7.00 under 21.4 (patch 6) "Common Lisp" XEmacs Lucid Reply-To: fjmolina at lbl.gov FCC: /home/f/.xemacs/mail/sent How can I choose my separator to be TAB in functions like write.table ()?
sep = "\t" Francisco J Molina wrote:> Subject: separator = TAB in write.table > X-Mailer: VM 7.00 under 21.4 (patch 6) "Common Lisp" XEmacs Lucid > Reply-To: fjmolina at lbl.gov > FCC: /home/f/.xemacs/mail/sent > > > How can I choose my separator to be TAB in functions like write.table ()? > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >
write.table(df, file = "filename", sep = "\t") At 11:55 AM 3/10/2003 -0800, Francisco J Molina wrote:>Subject: separator = TAB in write.table >X-Mailer: VM 7.00 under 21.4 (patch 6) "Common Lisp" XEmacs Lucid >Reply-To: fjmolina at lbl.gov >FCC: /home/f/.xemacs/mail/sent > > >How can I choose my separator to be TAB in functions like write.table ()? > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help >With best wishes and kind regards I am Sincerely, Corey A. Moffet Support Scientist University of Idaho Northwest Watershed Research Center 800 Park Blvd, Plaza IV, Suite 105 Boise, ID 83712-7716 (208) 422-0718
greetings, I am having problems with getting R to recognise the Package "mvtnorm". specifically it will pick up the existence of the packabe but will not acknowledge the exostence of its functions. does anybody have any ideas, or has encouneterd the same problem? thank you, colin
> greetings, > > I am having problems with getting R to recognise the Package "mvtnorm". > specifically it will pick up the existence of the packabe but will not > acknowledge the exostence of its functions. >what exactly is the problem? You should be able to say R> install.packages("mvtnorm") R> library(mvtnorm) and run some examples with R> example(pmvt) best, Torsten> does anybody have any ideas, or has encouneterd the same problem? > > thank you, > > colin > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > >
Hi, can someone tell me, if there is a function in R for the modulo operator? bye
Searching for Arithmetic shows %% as an infix operator Oezlem Gengaslan wrote:>Hi, > > can someone tell me, if there is a function in R for the modulo operator? > >bye > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > >
Has anyone allocated more than one Gig of memory for R under Windows? When I try the diagnostic tells me I am decreasing memory and the memory size value is a very large negative number. I suspect the problem may be a signed integer that overflows. Is 1 G a hard limit for memory allocation in R under Windows? Michael D. Ward University of Washington Seattle, WA, 98195-3530
Dear Colleagues! Could you please tell me a command to remove a row or collumn from a matrix, to gain from e.g.: 1 2 3 4 5 6 7 8 9 0 e.g.: 1 3 4 5 6 8 9 0 Thank you in advance.
On Wed, Mar 19, 2003 at 08:11:02PM +0100, volkswirt at gmx.net wrote:> Dear Colleagues! > Could you please tell me a command to remove a row or collumn from a > matrix, to gain from e.g.: > 1 2 3 4 5 > 6 7 8 9 0 > > e.g.: > 1 3 4 5 > 6 8 9 0 >If mm is your matrix, mm[,-2] will do the above. This is detailed further in "An Introduction to R", section 2.7 (R-intro.pdf). Cheers Jason -- Indigo Industrial Controls Ltd. 64-21-343-545 jasont at indigoindustrial.co.nz
> A <- array(1:6, dim=c(2,3))> A[,-2] [,1] [,2] [1,] 1 5 [2,] 2 6 Is this what you want? Spencer Graves volkswirt at gmx.net wrote:> Dear Colleagues! > Could you please tell me a command to remove a row or collumn from a > matrix, to gain from e.g.: > 1 2 3 4 5 > 6 7 8 9 0 > > e.g.: > 1 3 4 5 > 6 8 9 0 > > Thank you in advance. > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
-- ==================================== Wagner Silva wagner at comp.ufla.br Bacharel em Ci?ncia da Computa??o Universidade Federal de Lavras
Hi, In 1.6.2 at least, when constructing a sequence of dates with seq and the by argument inherits from difftime, the "units" attribute seems to be ignored. E.g. try str <- strptime("23/3/2003 06:00:00","%d/%m/%Y %H:%M:%S") end <- strptime("23/3/2003 06:02:00","%d/%m/%Y %H:%M:%S") step <- strptime("23/3/2003 06:01:00","%d/%m/%Y %H:%M:%S") - strptime("23/3/2003 06:00:00","%d/%m/%Y %H:%M:%S") seq(str,end,step) A possible fix is to replace the lines if (inherits(by, "difftime")) { by <- unclass(by) } in seq.POSIXt with if (inherits(by, "difftime")) { by <- switch(attr(by, "units"), secs = by, mins = 60 * by, hours = 60 * 60 * by, days = 60 * 60 * 24 * by, weeks = 60 * 60 * 24 * 7 * by) } as in "-.POSIXt", but this may not be the best solution. I can't really see the point of representing difftime objects in terms of different units, given POSIXct is always stored as seconds. Would it be better to move the whole "unit" business into a print method, more or less as it is for POSIXct? Simon. ---
Hi there, Thank you in advance for your help. I need to do the following: 1. Take one file from excell and one from SPSS and with the data calculate: ESTIMATED N= SUM {1/PI(i)}; PI is the proportion ESTIMATED T(Y)= SUM {Yi/PI(i)}; i belongs to the sample. GINMi=[SUMi{(Yi/PI(i))*[1/PI(i)+SUMj(2/PI(j)]}]/[(2*ESTIMATED N*ESTIMATED T)]. i belongs to M (1000,etc.) times, WHERE j=i+1 WE HAVE ONLY ONE VARIABLE Y, BUT WITH THE FIRST POSITION i AND THE NEXT j, IN THE ASCENDING ORDER. And last to get the errors as: E1= [SUMi {|GINP-GINMi |}]/[M] ; i belongs M E2= SQRT[SUMi {|GINP-GINMi |}]/[M]; i belongs TO M Thanks, Cesar Ortega
Try the following function: student.exercise <- function (i.think.so = TRUE) { if (i.think.so) { cat("Hmmm...how many marks do I get for answering this?\n") } else { cat("Sorry, my mistake\n") } } On Tue, Mar 25, 2003 at 12:50:11PM +0100, Cesar Ortega wrote:> Hi there, > > Thank you in advance for your help. > > I need to do the following: > > 1. Take one file from excell and one from SPSS and with the data > calculate: > > ESTIMATED N= SUM {1/PI(i)}; PI is the proportion > ESTIMATED T(Y)= SUM {Yi/PI(i)}; i belongs to the sample. > > GINMi=[SUMi{(Yi/PI(i))*[1/PI(i)+SUMj(2/PI(j)]}]/[(2*ESTIMATED > N*ESTIMATED T)]. i belongs to M (1000,etc.) times, WHERE j=i+1 > > WE HAVE ONLY ONE VARIABLE Y, BUT WITH THE FIRST POSITION i AND THE > NEXT j, IN THE ASCENDING ORDER. > > And last to get the errors as: > > E1= [SUMi {|GINP-GINMi |}]/[M] ; i belongs M > > E2= SQRT[SUMi {|GINP-GINMi |}]/[M]; i belongs TO M > > Thanks, > > Cesar Ortega > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help-- Dave Whiting Dar es Salaam, Tanzania
How can I remove all rows/collumns from a matrix that fulfill a certain condition? For instance: remove all negative elements from a [n,1]-matrix. I intended to write a function for this aim, but it does not work. Despite that it may help to get my point, when I ad it: kratek<-function(eine) { halt<-0 for(index in 1:dim(eine)[1]) { if(eine[(index-halt),1]<=0) { eine<-eine[-(index-halt),] halt<-halt+1 } } eine } Thank You in advance!
volkswirt at gmx.net writes:> How can I remove all rows/collumns from a matrix that fulfill a certain > condition? For instance: remove all negative elements from a [n,1]-matrix. > I intended to write a function for this aim, but it does not work. Despite > that it may help to get my point, when I ad it: > > kratek<-function(eine) > { > halt<-0 > for(index in 1:dim(eine)[1]) > { > if(eine[(index-halt),1]<=0) > { > eine<-eine[-(index-halt),] > halt<-halt+1 > } > } > eine > }Like this? m <- matrix(rnorm(20),ncol=2) m[6,1]<-NA m[-which(m[,1]<=0),] (Notice that this is not the same as m[m[,1]>0,] as soon as NA''s are involved). -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /''_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
At 04:41 PM 3/31/2003 +0200, volkswirt at gmx.net wrote:>How can I remove all rows/collumns from a matrix that fulfill a certain >condition? For instance: remove all negative elements from a [n,1]-matrix. >I intended to write a function for this aim, but it does not work. Despite >that it may help to get my point, when I ad it: > >kratek<-function(eine) >{ >halt<-0 >for(index in 1:dim(eine)[1]) >{ >if(eine[(index-halt),1]<=0) >{ >eine<-eine[-(index-halt),] >halt<-halt+1 >} >} >eine >} >I''m not entirely sure that I understand what you want, but perhaps the following will help: Given a matrix A, the command A[,apply(A, 2, function(x) all(x>=0))] will remove columns with negative elements, and A[apply(A, 1, function(x) all(x>=0)),] will remove rows with negative elements. Does that help? John ----------------------------------------------------- John Fox Department of Sociology McMaster University Hamilton, Ontario, Canada L8S 4M4 email: jfox at mcmaster.ca phone: 905-525-9140x23604 web: www.socsci.mcmaster.ca/jfox -----------------------------------------------------
Can someone point out for me where to find a package to do principal component analysis for Affy data, if existing? Thanks, Yongde Yongde Bao, Ph.D Biomolecular Research Facility Department of Microbiology University of Virginia School of Medicine Charlottesville, VA 22908 E-mail: yb8d at virginia.edu Voice mail: 434-982-2551, 434-924-2553 FAX: 434-982-2514
Hi Yongde, you do not need a special version of PCA for Affy data, a generic implementation, e.g. mva::princomp, should do. Best regards Wolfgang ------------------------------------- Wolfgang Huber http://www.dkfz.de/mga/whuber Division of Molecular Genome Analysis German Cancer Research Center Heidelberg, Germany ------------------------------------- On Tue, 1 Apr 2003, Yongde Bao wrote:> Can someone point out for me where to find a package to do principal > component analysis for Affy data, if existing? > Thanks, Yongde > > Yongde Bao, Ph.D > Biomolecular Research Facility > Department of Microbiology > University of Virginia School of Medicine > Charlottesville, VA 22908 > > E-mail: yb8d at virginia.edu > Voice mail: 434-982-2551, 434-924-2553 > FAX: 434-982-2514 >
On Wednesday 02 Apr 2003 6:43 am, Yongde Bao wrote:> Can someone point out for me where to find a package to do principal > component analysis for Affy data, if existing?http://www.stat.uni-muenchen.de/~strimmer/rexpress.html mva, multiv best wishes Ido
>On Wednesday 02 Apr 2003 6:43 am, Yongde Bao wrote: >> Can someone point out for me where to find a package to do principal >> component analysis for Affy data, if existing? > >http://www.stat.uni-muenchen.de/~strimmer/rexpress.html > >mva, multivSee also the function dui.pca of the ade4 package. Sincerely. -- St?phane DRAY --------------------------------------------------------------- Biom?trie et Biologie ?volutive - Equipe "?cologie Statistique" Universite Lyon 1 - Bat 711 - 69622 Villeurbanne CEDEX - France Tel : 04 72 43 27 56 Fax : 04 78 89 27 19 04 72 43 27 57 E-mail : dray at biomserv.univ-lyon1.fr --------------------------------------------------------------- Web http://www.steph280.freesurf.fr/ ---------------------------------------------------------------
or function rda() in package vegan for that matter [fitting rda without constraints == pca] Gavin %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [T] +44 (0)20 7679 5522 ENSIS Research Fellow [F] +44 (0)20 7679 7565 ENSIS Ltd. & ECRC [E] gavin.simpson at ucl.ac.uk UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/ 26 Bedford Way [W] http://www.ucl.ac.uk/~ucfagls/ London. WC1H 0AP. %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Stephane Dray Sent: 04 April 2003 08:23 To: r-help at stat.math.ethz.ch Subject: Re: [R]>On Wednesday 02 Apr 2003 6:43 am, Yongde Bao wrote: >> Can someone point out for me where to find a package to do principal >> component analysis for Affy data, if existing? > >http://www.stat.uni-muenchen.de/~strimmer/rexpress.html > >mva, multivSee also the function dui.pca of the ade4 package. Sincerely. -- St?phane DRAY --------------------------------------------------------------- Biom?trie et Biologie ?volutive - Equipe "?cologie Statistique" Universite Lyon 1 - Bat 711 - 69622 Villeurbanne CEDEX - France Tel : 04 72 43 27 56 Fax : 04 78 89 27 19 04 72 43 27 57 E-mail : dray at biomserv.univ-lyon1.fr --------------------------------------------------------------- Web http://www.steph280.freesurf.fr/ --------------------------------------------------------------- ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help