[R] Changing default library
Hallo R experts, I got a question concerning the .libPaths(). if I do the command .libPaths() than the result is /usr/lib/R/library. This is the default folder. I now want to change this one into /home/csc/usr/lib/R/library. I thought it would work with the command .libPaths(/home/csc/usr/lib/R/library). When I than do the command .libPaths() the result is: /usr/lib/R/library /home/csc/usr/lib/R/library. But if I start R the next time the result of the command .libPaths() is again just /usr/lib/R/library. Can anyone help me? Thanks, Corinna [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to run mathematica or c programs in R?
Hallo, I just know a solution if you use MATLAB. Here you need the library R.matlab and there the functions writeMat and readMat. You can download the package on CRAN. Corinna ** Corinna Schmitt, Dipl.Inf.(Bioinformatik) Fraunhofer Institut für Grenzflächen- Bioverfahrenstechnik Nobelstrasse 12, B 3.24 70569 Stuttgart Germany phone: +49 711 9704044 fax: +49 711 9704200 e-mail: [EMAIL PROTECTED] http://www.igb.fraunhofer.de -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Zhang Jian Gesendet: Freitag, 22. Juni 2007 23:26 An: r-help Betreff: [R] How to run mathematica or c programs in R? I have some programs which were writen in mathematica or c language, but I donot know how to use these software. So I want to run them in R. Can I do it ? How to run mathematica or c programs in R? Jian Zhang [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] opening vignetten
Dear R-Users, I have a quite stupid question. I load the GO-package with the command require(GO). Now I want to read the corresponding vignetten but I forgot the command for opening it. Please help me, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] A: R 2.5.0 Help - problems with search
Hallo, I had the same problem. Please install R 2.5.0 again and when you are ask: Startoptions (should be window 3 of installation) then you need to mark YES. In the next Window you do not need to make changes but in the next : Help-Style Here you need to mark HTML-help. Then go on with the installation without anymore changes. This solution will solve the problem, Corinna -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Pietrzykowski, Matthew (GE, Research) Gesendet: Donnerstag, 10. Mai 2007 14:30 An: r-help@stat.math.ethz.ch Betreff: [R] R 2.5.0 Help - problems with search Hello- I recently upgraded from R 2.4.1 to R 2.5.0 and have tried to used the search engine with minimal results. When I enter the command, help.start() My browser opens with the main html interface. When I click the link for the search engine, the search page comes up, but when I enter a search term the result is always undefined. I am looking on my end for browser setting options, but would like to know if there was an error in installation that I am not aware of. Thanks, Matt [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] creating a new column
Hallo, I just now a solution for da data frame. I'm not sure if this is what you want. Just try if it helps. Here an example of my code where I added a column: df - rbind( c(fred,mary,4),c(fred,mary,7), c(fred,mary,9),c(barney,liz,3), c(barney,liz,5)) df - data.frame(df) colnames(df) - c(father,mother,child.age) # adding column df - data.frame(df,weddingdate=c(Dec 12th, 1980,Dec 12th, 1980, Dec 12th, 1980,Apr 9th, 2003, Apr 9th, 2003)) df The R-Gui Result: father mother child.ageweddingdate 1 fred mary 4 Dec 12th, 1980 2 fred mary 7 Dec 12th, 1980 3 fred mary 9 Dec 12th, 1980 4 barneyliz 3 Apr 9th, 2003 5 barneyliz 5 Apr 9th, 2003 Caution: the number of entries in adding column must correspond to the number of rows in your existing data frame df (here 5) Try this soultion, Corinna -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von raymond chiruka Gesendet: Montag, 7. Mai 2007 16:28 An: r Betreff: [R] creating a new column hie l would like to create a 6th column actual surv time from the following data the condition being if censoringTimesurvivaltime then actual survtime =survival time else actual survtime =censoring time the code l used to create the data is s=2 while(s!=0){ n=20 m-matrix(nrow=n,ncol=4) colnames(m)=c(treatmentgrp,strata,censoringTime,survivalTime) for(i in 1:20) m[i,]-c(sample(c(1,2),1,replace=TRUE),sample(c(1,2),1,replace=TRUE),rexp(1,.007),rexp(1,.002)) m-cbind(m,0) m[m[,3]m[,4],5]-1 colnames(m)[5]-censoring print(m) s=s-1 treatmentgrp strata censoringTime survivalTime censoring [1,] 1 1 1.0121591137.80922 0 [2,] 2 2 32.971439 247.21786 0 [3,] 2 1 85.758253 797.04949 0 [4,] 1 1 16.999171 78.92309 0 [5,] 2 1 272.909896 298.21483 0 [6,] 1 2 138.230629 935.96765 0 [7,] 2 2 91.529859 141.08405 0 l keep getting an error message when i try to create the 6th column - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] creating a new column
480.12355 0 11 122 2 15.313303139.19791 0 12 131 2 17.205624641.15764 0 13 142 1 81.753924107.02202 0 14 151 2 60.774221665.27500 0 15 162 1 8.712562142.90775 0 16 171 1 54.542722 1904.88060 0 17 182 2 85.626140214.66811 0 18 192 1 31.257923739.96591 0 19 201 1 85.910141306.14860 0 20 column3=t[,-3] # deleting a column column3 treatmentgrp strata survivalTime censoring actual.surv.time 1 1 2 1070.66287 01 2 1 2 1061.30474 0 100 3 1 2 51.88263 03 4 2 2590.15317 04 5 1 1247.32141 15 6 2 2257.25016 06 7 1 1554.05931 07 8 2 2873.14563 08 9 1 2765.43142 09 101 2 1646.65368 0 10 111 2480.12355 0 11 122 2139.19791 0 12 131 2641.15764 0 13 142 1107.02202 0 14 151 2665.27500 0 15 162 1142.90775 0 16 171 1 1904.88060 0 17 182 2214.66811 0 18 192 1739.96591 0 19 201 1306.14860 0 20 Happy working, Corinna -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Schmitt, Corinna Gesendet: Dienstag, 8. Mai 2007 10:06 An: raymond chiruka; r Betreff: Re: [R] creating a new column Hallo, I just now a solution for da data frame. I'm not sure if this is what you want. Just try if it helps. Here an example of my code where I added a column: df - rbind( c(fred,mary,4),c(fred,mary,7), c(fred,mary,9),c(barney,liz,3), c(barney,liz,5)) df - data.frame(df) colnames(df) - c(father,mother,child.age) # adding column df - data.frame(df,weddingdate=c(Dec 12th, 1980,Dec 12th, 1980, Dec 12th, 1980,Apr 9th, 2003, Apr 9th, 2003)) df The R-Gui Result: father mother child.ageweddingdate 1 fred mary 4 Dec 12th, 1980 2 fred mary 7 Dec 12th, 1980 3 fred mary 9 Dec 12th, 1980 4 barneyliz 3 Apr 9th, 2003 5 barneyliz 5 Apr 9th, 2003 Caution: the number of entries in adding column must correspond to the number of rows in your existing data frame df (here 5) Try this soultion, Corinna -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von raymond chiruka Gesendet: Montag, 7. Mai 2007 16:28 An: r Betreff: [R] creating a new column hie l would like to create a 6th column actual surv time from the following data the condition being if censoringTimesurvivaltime then actual survtime =survival time else actual survtime =censoring time the code l used to create the data is s=2 while(s!=0){ n=20 m-matrix(nrow=n,ncol=4) colnames(m)=c(treatmentgrp,strata,censoringTime,survivalTime) for(i in 1:20) m[i,]-c(sample(c(1,2),1,replace=TRUE),sample(c(1,2),1,replace=TRUE),rexp(1,.007),rexp(1,.002)) m-cbind(m,0) m[m[,3]m[,4],5]-1 colnames(m)[5]-censoring print(m) s=s-1 treatmentgrp strata censoringTime survivalTime censoring [1,] 1 1 1.0121591137.80922 0 [2,] 2 2 32.971439 247.21786 0 [3,] 2 1 85.758253 797.04949 0 [4,] 1 1 16.999171 78.92309 0 [5,] 2 1 272.909896 298.21483 0 [6,] 1 2 138.230629 935.96765 0 [7,] 2 2 91.529859 141.08405 0 l keep getting an error message when i try to create the 6th column - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help
[R] trouble with help
Hallo, I just updated to the new version of R by installing everything new. Now I have a problem with the help command: help.start() updating HTML package listing updating HTML search index If nothing happens, you should open 'Z:\Software\R\R-2.5.0\doc\html\index.html' yourself The browser was started but nothing was displayes. Can anyone help me, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] creating a new column
Hallo, if you work with matrix you can use cbind to add columns. Corinna -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von raymond chiruka Gesendet: Montag, 7. Mai 2007 16:28 An: r Betreff: [R] creating a new column hie l would like to create a 6th column actual surv time from the following data the condition being if censoringTimesurvivaltime then actual survtime =survival time else actual survtime =censoring time the code l used to create the data is s=2 while(s!=0){ n=20 m-matrix(nrow=n,ncol=4) colnames(m)=c(treatmentgrp,strata,censoringTime,survivalTime) for(i in 1:20) m[i,]-c(sample(c(1,2),1,replace=TRUE),sample(c(1,2),1,replace=TRUE),rexp(1,.007),rexp(1,.002)) m-cbind(m,0) m[m[,3]m[,4],5]-1 colnames(m)[5]-censoring print(m) s=s-1 treatmentgrp strata censoringTime survivalTime censoring [1,] 1 1 1.0121591137.80922 0 [2,] 2 2 32.971439 247.21786 0 [3,] 2 1 85.758253 797.04949 0 [4,] 1 1 16.999171 78.92309 0 [5,] 2 1 272.909896 298.21483 0 [6,] 1 2 138.230629 935.96765 0 [7,] 2 2 91.529859 141.08405 0 l keep getting an error message when i try to create the 6th column - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] trouble with help
How can I install the html help? Corinna .de http://www.igb.fraunhofer.de -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Vladimir Eremeev Gesendet: Dienstag, 8. Mai 2007 12:22 An: r-help@stat.math.ethz.ch Betreff: Re: [R] trouble with help Did you try manually opening the file mentioned in the browser (Z:\Software\R\R-2.5.0\doc\html\index.html) ? Does this file exist? Was the html help installed? Schmitt, Corinna wrote: Hallo, I just updated to the new version of R by installing everything new. Now I have a problem with the help command: help.start() updating HTML package listing updating HTML search index If nothing happens, you should open 'Z:\Software\R\R-2.5.0\doc\html\index.html' yourself The browser was started but nothing was displayes. Can anyone help me, Corinna -- View this message in context: http://www.nabble.com/trouble-with-help-tf3708685.html#a10373271 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] trouble with help
Hallo, I found the solution. I installed everything new and in the setup I choose Changing Startoptions and there I could mark html help. It now works, Corinna -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Schmitt, Corinna Gesendet: Dienstag, 8. Mai 2007 13:03 An: Vladimir Eremeev; r Betreff: Re: [R] trouble with help How can I install the html help? Corinna .de http://www.igb.fraunhofer.de -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Vladimir Eremeev Gesendet: Dienstag, 8. Mai 2007 12:22 An: r-help@stat.math.ethz.ch Betreff: Re: [R] trouble with help Did you try manually opening the file mentioned in the browser (Z:\Software\R\R-2.5.0\doc\html\index.html) ? Does this file exist? Was the html help installed? Schmitt, Corinna wrote: Hallo, I just updated to the new version of R by installing everything new. Now I have a problem with the help command: help.start() updating HTML package listing updating HTML search index If nothing happens, you should open 'Z:\Software\R\R-2.5.0\doc\html\index.html' yourself The browser was started but nothing was displayes. Can anyone help me, Corinna -- View this message in context: http://www.nabble.com/trouble-with-help-tf3708685.html#a10373271 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] minimum from matrix
Hallo, I added one row: a=rbind(a,1:4) a [,1] [,2] [,3] [,4] [1,]0120 [2,]2304 [3,]0030 [4,]0350 [5,]1234 And how looks like the command for the minimum of the rows? The result should be minOfRows = 0 0 0 0 1 Thanks, Corinna -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Gabor Csardi Gesendet: Dienstag, 8. Mai 2007 14:03 An: [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Betreff: Re: [R] minimum from matrix apply(a, 2, function(x) min(x[x!=0]) ) should do it. Might need some improvement if all numbers in a column can be zero, try it. Gabor On Tue, May 08, 2007 at 09:50:43AM +0100, [EMAIL PROTECTED] wrote: I have a very large matrix with columns that have some of their entries as zero A small example if a= [,1] [,2] [,3] [,4] [,1] 0 2 0 0 [,2] 1 3 0 3 [,3] 2 0 3 5 [,4] 0 4 0 0 and what to get the minimum number from each column but that number should not be zero. If I use apply (a,2,min) I will get a vector of zeros as the minimum but what I want it for example from column 1 I should get 1 i.e for all the matrix I should get a vector (1,2,3,3). I wonder if someone can give an idea on how to go about it. thanks in advance for your help. Oarabile __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Csardi Gabor [EMAIL PROTECTED]MTA RMKI, ELTE TTK __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] minimum of each row in a matrix
Hallo, I just followed the discussion of the title: minimum from matrix. I have a similar problem. a=matrix(c(0,2, 0, 0, 1, 3, 0, 3, 2, 0, 3, 5, 0, 4, 0, 0),ncol=4) a=rbind(a,1:4) a [,1] [,2] [,3] [,4] [1,]0120 [2,]2304 [3,]0030 [4,]0350 [5,]1234 minOfColumns=apply(a, 2, function(x) min(x[x!=0]) ) minOfColumns [1] 1 1 2 4 maxOfColumns=apply(a, 2, function(x) max(x) ) maxOfColumns [1] 2 3 5 4 How looks like the command for the minimum of the rows? I tried several possibilities with apply but did not get the wanted result. The result should be minOfRows = 0 0 0 0 1 Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] minimum of each row in a matrix
Hi Peter, thanks for the quick help. Yes it does what I want. Thanks, Corinna Von: Peter Konings [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 8. Mai 2007 15:29 An: Schmitt, Corinna Betreff: Re: [R] minimum of each row in a matrix Hi Corinna, does apply(a, 1, min) do what you want? HTH Peter. On 5/8/07, Schmitt, Corinna [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hallo, I just followed the discussion of the title: minimum from matrix. I have a similar problem. a=matrix(c(0,2, 0, 0, 1, 3, 0, 3, 2, 0, 3, 5, 0, 4, 0, 0),ncol=4) a=rbind(a,1:4) a [,1] [,2] [,3] [,4] [1,]0120 [2,]2304 [3,]0030 [4,]0350 [5,]1234 minOfColumns=apply(a, 2, function(x) min(x[x!=0]) ) minOfColumns [1] 1 1 2 4 maxOfColumns=apply(a, 2, function(x) max(x) ) maxOfColumns [1] 2 3 5 4 How looks like the command for the minimum of the rows? I tried several possibilities with apply but did not get the wanted result. The result should be minOfRows = 0 0 0 0 1 Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] decimal values
Hallo, just look ?round. It should help. Corinna -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von elyakhlifi mustapha Gesendet: Freitag, 4. Mai 2007 14:59 An: R-help@stat.math.ethz.ch Betreff: [R] decimal values hello, how can I do to drop decimal after the comma please for example for tthis line print(P) [1] 62.00 1.00 7.661290 5.20 17.10 2.318801 how canI do to keep only 62 1 7.66 5.2 17.12.32 thanks __ ble contre les messages non sollicités [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] searching for special variables
Dear R-Experts, in my program I have a big workspace. Now I want to look for all variables which have the letters 777 in their name (e.g. ask777first) and afterwards I need to delete those variables. How can I reach this aim? Any ideas, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] information extraction
Dear R-experts, I imported successful a workspace from Matlab. The information is stored in the variable data. If I use the command length(data) I get back a number which corresponds to the number of variables which were imported. Here it is 82. Now I only want to know the names of the imported variables to modify my program. Can anyone help me? My knowledge which I tested yet to archive the goal: 1. I know that I can extract the information of a variable with the command data$staine for example. Here I need to know the variable name staine coming from Matlab. But what if I do not know it? 2. The command data[10] just gives me back the information stored in the variable no. 10 but I do not know the name. 3. I am not allowed to make changes in the Matlab code because it just a lizenced program so I need to do it in R. In Matlab I just need to add the code line names=evalin('base','who') and than store the workspace. I could use the variable name in and extract the names with data$names. Has anyone an idea? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] information extraction
Hallo Peter, thank you. It is exact what I wanted. Now I can modify my program. Corinna Von: Peter Konings [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 24. April 2007 10:55 An: Schmitt, Corinna Betreff: Re: [R] information extraction Hi Corinna, names() is what you are looking for, e.g. names(data) names(data)[10] names(data) - a.vector.of.my.own.names BTW, data() is a function in R, so it's better to avoid it as the name of a dataframe. for more information, see the documentation installed with R or one of the contributed documents at http://cran.r-project.org/other-docs.html in particular the R and octave document will be relevant to you as a matlab user. HTH Peter. On 4/24/07, Schmitt, Corinna [EMAIL PROTECTED] wrote: Dear R-experts, I imported successful a workspace from Matlab. The information is stored in the variable data. If I use the command length(data) I get back a number which corresponds to the number of variables which were imported. Here it is 82. Now I only want to know the names of the imported variables to modify my program. Can anyone help me? My knowledge which I tested yet to archive the goal: 1. I know that I can extract the information of a variable with the command data$staine for example. Here I need to know the variable name staine coming from Matlab. But what if I do not know it? 2. The command data[10] just gives me back the information stored in the variable no. 10 but I do not know the name. 3. I am not allowed to make changes in the Matlab code because it just a lizenced program so I need to do it in R. In Matlab I just need to add the code line names=evalin('base','who') and than store the workspace. I could use the variable name in and extract the names with data$names. Has anyone an idea? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] data frame
You can build the data frame with: dat - data.frame(Class=I(Id_TrT1), Levels=I(1), Values=I(2)) new.info - c(Class=Id_Geno, Levels=7 , Values=64208 64209 64210 64211 64212 64213 64214) dat - rbind(dat, new.info) dat new.info - c(Class= Id_Rep , Levels=2 , Values=12) dat - rbind(dat, new.info) dat It works. The R console result can be seen in the attachment. CU, Corinna -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von elyakhlifi mustapha Gesendet: Montag, 23. April 2007 16:02 An: R-help@stat.math.ethz.ch Betreff: [R] data frame hello, I wanna print something like this Class Levels Values Id_TrT1 1 2 Id_Geno764208 64209 64210 64211 64212 64213 64214 Id_Rep 2 12 Is it possible? I have some problem I think taht I should use data.frame with matrix but I'm not sure and perhaps it's false ___ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] WG: data frame
You can build the data frame with: dat - data.frame(Class=I(Id_TrT1), Levels=I(1), Values=I(2)) new.info - c(Class=Id_Geno, Levels=7 , Values=64208 64209 64210 64211 64212 64213 64214) dat - rbind(dat, new.info) dat new.info - c(Class= Id_Rep , Levels=2 , Values=12) dat - rbind(dat, new.info) dat It works. The R console result can be seen in the attachment. CU, Corinna -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von elyakhlifi mustapha Gesendet: Montag, 23. April 2007 16:02 An: R-help@stat.math.ethz.ch Betreff: [R] data frame hello, I wanna print something like this Class Levels Values Id_TrT1 1 2 Id_Geno764208 64209 64210 64211 64212 64213 64214 Id_Rep 2 12 Is it possible? I have some problem I think taht I should use data.frame with matrix but I'm not sure and perhaps it's false ___ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] data frame
Hallo You can build the data frame with: dat - data.frame(Class=I(Id_TrT1), Levels=I(1), Values=I(2)) new.info - c(Class=Id_Geno, Levels=7 , Values=64208 64209 64210 64211 64212 64213 64214) dat - rbind(dat, new.info) dat new.info - c(Class= Id_Rep , Levels=2 , Values=12) dat - rbind(dat, new.info) dat It works. The R console result can be seen in the attachment. CU, Corinna -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von elyakhlifi mustapha Gesendet: Montag, 23. April 2007 16:02 An: R-help@stat.math.ethz.ch Betreff: [R] data frame hello, I wanna print something like this Class Levels Values Id_TrT1 1 2 Id_Geno764208 64209 64210 64211 64212 64213 64214 Id_Rep 2 12 Is it possible? I have some problem I think taht I should use data.frame with matrix but I'm not sure and perhaps it's false ___ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] print command
Dear R-Experts, I have the following command lines: NullPointRevertante=plan1[3,2] #0.859 print(null-pint measurement Revertante: ) print(NullPointRevertante) The result looks like: [1] null-pint measurement Revertante: [1] 0.859 It is ok but I achieve the following outlook: [1] null-pint measurement Revertante: 0.859 How can I achieve this? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] element search
Dear R-experts, I have got an excel file as attached. I imported it successful with the commands: library(RODBC) channel - odbcConnectExcel(data2.xls) tables - sqlTables(channel) # list the names of the spreadsheets name1 - tables[1, TABLE_NAME] # get the name of the 1st spreadsheet plan1 - sqlQuery(channel, sprintf(select * from [%s], name1)) odbcClose(channel) # close it Now I want to store each row in variable. Additionally the result should be a list again so that I can handle each entry for itself. Ideas? Perhaps a list again? Now I want to find on the one hand in each row one special entry and on the other hand I need to get the maximum entry of each row. How can I realize this? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] matrix building with two variables
Dear R-Experts, I have two variables coming from my calculations: Tissues -- WT sun41 Revertante NullPoint -- 0.826 0.871 0.859 Now I want to build a matrix, where row1=Tissues and row2=NullPoint is. How can I realize this? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] plotting command trouble
Dear R-Experts, I have the following command lines: windows() plot(0:60, 0:0.896, type=n, xlab=Zeit [min], ylab=Absorptionsmessung bei 600nm,main=Zellwandstabilität ) dev.off() Can anyone say me why the plot command does not work and how the correct one should look like? Important is: x-axis goes from 0 to 60 and the y-axis from 0 to 0.896! Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] element search
Sorry, I forgot the attachment. Here it is. Thanks, Corinna -Ursprüngliche Nachricht- Von: Schmitt, Corinna Gesendet: Donnerstag, 19. April 2007 12:32 An: 'r-help@stat.math.ethz.ch' Betreff: element search Dear R-experts, I have got an excel file as attached. I imported it successful with the commands: library(RODBC) channel - odbcConnectExcel(data2.xls) tables - sqlTables(channel) # list the names of the spreadsheets name1 - tables[1, TABLE_NAME] # get the name of the 1st spreadsheet plan1 - sqlQuery(channel, sprintf(select * from [%s], name1)) odbcClose(channel) # close it Now I want to store each row in variable. Additionally the result should be a list again so that I can handle each entry for itself. Ideas? Perhaps a list again? Now I want to find on the one hand in each row one special entry and on the other hand I need to get the maximum entry of each row. How can I realize this? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] matrix building with two variables
Thanks. I did read everything I could but could not understand everything. Hopefully with more programming practice it will become more less. Corinna -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Julien Barnier Gesendet: Donnerstag, 19. April 2007 14:02 An: r-help@stat.math.ethz.ch Betreff: Re: [R] matrix building with two variables Now I want to build a matrix, where row1=Tissues and row2=NullPoint is. How can I realize this? ?rbind It seems you ask a lot of questions these times on the list. Maybe you should read the R mailing lists posting guide, it contains useful resources which could help you to find the answers by yourself. http://www.r-project.org/posting-guide.html -- Julien __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plotting command trouble
I know, but it is needed. Any other idea? Corinna Von: Henrique Dallazuanna [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 19. April 2007 14:08 An: Schmitt, Corinna Cc: r-help@stat.math.ethz.ch Betreff: Re: [R] plotting command trouble Hi, the length of the coordinates are different. Try: plot(seq(0,60, l=100), seq(0,0.896, l=100), type=n, xlab=Zeit [min], ylab=Absorptionsmessung bei 600nm,main=Zellwandstabilität ) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O http://maps.google.com/maps?f=qhl=enq=Curitiba,+Brazillayer=ie=UTF8z=18ll=-25.448315,-49.276916spn=0.002054,0.005407t=kom=1 On 4/19/07, Schmitt, Corinna [EMAIL PROTECTED] wrote: Dear R-Experts, I have the following command lines: windows() plot(0:60, 0:0.896, type=n, xlab=Zeit [min], ylab=Absorptionsmessung bei 600nm,main=Zellwandstabilität ) dev.off() Can anyone say me why the plot command does not work and how the correct one should look like? Important is: x-axis goes from 0 to 60 and the y-axis from 0 to 0.896! Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] element search
Thanks fort he good hint. It works. Corinna Von: Peter Konings [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 19. April 2007 14:10 An: Schmitt, Corinna Betreff: Re: [R] element search Hi Corinna, the R mailing list software strips off almost all binary attachments, so your excel file won't make it to the mailing list. Regarding your query: you could use the apply function on the resulting dataframe, like this: apply(plan1, 1, max, na.rm = TRUE) apply(plan1, 1, your.own.function.to.select.a.certain.value, options.to.your.own.function) see ?apply for more information. HTH Peter. On 4/19/07, Schmitt, Corinna [EMAIL PROTECTED] wrote: Sorry, I forgot the attachment. Here it is. Thanks, Corinna -Ursprüngliche Nachricht- Von: Schmitt, Corinna Gesendet: Donnerstag, 19. April 2007 12:32 An: ' r-help@stat.math.ethz.ch mailto:r-help@stat.math.ethz.ch ' Betreff: element search Dear R-experts, I have got an excel file as attached. I imported it successful with the commands: library(RODBC) channel - odbcConnectExcel( data2.xls) tables - sqlTables(channel) # list the names of the spreadsheets name1 - tables[1, TABLE_NAME] # get the name of the 1st spreadsheet plan1 - sqlQuery(channel, sprintf(select * from [%s], name1)) odbcClose(channel) # close it Now I want to store each row in variable. Additionally the result should be a list again so that I can handle each entry for itself. Ideas? Perhaps a list again? Now I want to find on the one hand in each row one special entry and on the other hand I need to get the maximum entry of each row. How can I realize this? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plotting command trouble
Thanks. I will try it. Perhaps it works. Corinna -Ursprüngliche Nachricht- Von: Jim Lemon [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 19. April 2007 15:16 An: Schmitt, Corinna Betreff: Re: [R] plotting command trouble Schmitt, Corinna wrote: I know, but it is needed. Any other idea? Hi Corinna, When you display a scatterplot, each X value must have a corresponding Y value. Otherwise where do you put the point? I think you may mean that you need 61 X values upon which you can plot 61 Y values. If you just want a sequence from 0 to 0.896 with 61 values: seq(0,0.896,length=61) This will plot with 0:60 as X values, or you can just use: plot(seq(0,0.896,length=61)) Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] division of decimal number
Dear R-Experts, how can I divide the number 0.285 with 2. I need a function. Result: 0.285 / 2 = 0.1425 Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] importing excel-file
Dear R-experts, It is a quite stupid question but please help me. I am very confuced. I am able to import normal txt ant mat-files to R but unable to import .xls-file I do not understand the online help. Can please anyone send me the corresponding command lines? The .xls-file is attached. In my file we use commas for the decimal format (example: 0,712), changes might be needed. Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] if/else construct
Dear R-Experts, Since Monday I try to write the right if/else construct for the program. I was not successful yet. Important is the order of the if-cases! The code is running with the 2 if-cases. An if/else construction would look better, so can any one help me with the right if/else construction? Thanks, Corinna Program: userInput - function() { print() ANSWER - readline(Should the current workspace of R be deleted (y/n)? ) print(ANSWER) ANSWER } deletingDecision = userInput() yes - c(y) no - c(n) noAnswer - c(Current R workspace was not deleted!) # first if if (deletingDecision == no) { print(Current R workspace was not deleted!) } # second if if (deletingDecision == yes) { rm(list=ls(all=TRUE)) print(Current R workspace was deleted!) } __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] pattern
Dear R-experts, I have the following function: userInput - function() { ANSWER - readline(saving place of the data (example Z:/Software/test.mat)? ) x = c(.mat) endingTest = x %in% ANSWER print (endingTest) if (endingTest == ??) cat (saving place not accepted\n) else cat(Thank you! The current workspace will be stored in: ,ANSWER,\n\n) print(ANSWER ) } filename = userInput() Before I enter the if loop I must test if the text stored in ANSWER has the pattern .mat. If yes than endingTest = TRUE else endingTest = FALSE. Another problem is the last codeline. Later on in my program I need the userinput to ad it to another variable. How can I manage this. I get the following error message: saving place of the data (example Z:/Software/test.mat)? Z:/data.mat [1] FALSE Thank you! The current workspace will be stored in: Z:/data.mat [1] Z:/data.mat Error in as.vector(x, mode) : cannot change into vector Thanks, Corinna __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Matlab import
Dear R-Experts, here again a question concerning matlab. With the command matrixM=[1 2 3;4 5 6] a matrix under Matlab was constructed. It was than stored with the command save('matrixM.txt','matrixM'). Now I tried to import the data in R with the help of the command Z=matrix(scan(Z:/Software/R-Programme/matrixM.txt)) An error occurred. The result should be a matrix with the entries as mentioned above. Perhaps I made already an error in matlab. Has any one got an idea how to import the data and store it in R. In R I want to make further calculations with the matrix. I just installed R.matlab but could not find an example with could help me. Thanks, Corinna MATLAB 5.0 MAT-file, Platform: PCWIN, Created on: Tue Apr 10 13:17:44 2007 IM 3 xãc``p b6 æÒ À å31331;çeVøÅAjYX [n|__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] WG: Matlab import
Dear R-Experts, here again a question concerning matlab. With the command matrixM=[1 2 3;4 5 6] a matrix under Matlab was constructed. It was than stored with the command save('matrixM.txt','matrixM'). now I found my error in the matlab command for storing the data in a txt file. You need to write save('test.dat','matrixM','-ascii') the result is the new attached file test.dat. Now I tried to import the data in R with the help of the command Z=matrix(scan(Z:/Software/R-Programme/matrixM.txt)) An error occurred. I could import the file to R with the command Z=matrix(scan(Z:/Software/R-Programme/test.dat,n=2*3),2,3,byrow=TRUE) But this is a spezial case. I specified the number of columns and rows. How can I do this import without knowing those information? Has any one got an idea how to import the data and store it in R. In R I want to make further calculations with the matrix. I just installed R.matlab but could not find an example with could help me. Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Matlab import
Hallo, I've used Henrik Bengtsson's R.matlab package several times to successfully read in matlab data files. It's normally as easy as: library(R.matlab) mats - readMat(matrixM.txt) - Tom I have imported this package, too. And tried your commands with the new txt-file as mentioned in my last mail to the mailing list. I get the following error command: mats = readMat(Z:/Software/R-Programme/test.dat) Error in if (version == 256) { : Argument hat Länge 0 Zusätzlich: Warning message: Unknown endian: . Will assume Bigendian. in: readMat5Header(this, firstFourBytes = firstFourBytes) What did I wrong? Please check my txt-file which was constructed with the matlab command save('test.dat','matrixM','-ascii') Thanks, Corinna Schmitt, Corinna wrote: Dear R-Experts, here again a question concerning matlab. With the command matrixM=[1 2 3;4 5 6] a matrix under Matlab was constructed. It was than stored with the command save('matrixM.txt','matrixM'). Now I tried to import the data in R with the help of the command Z=matrix(scan(Z:/Software/R-Programme/matrixM.txt)) An error occurred. The result should be a matrix with the entries as mentioned above. Perhaps I made already an error in matlab. Has any one got an idea how to import the data and store it in R. In R I want to make further calculations with the matrix. I just installed R.matlab but could not find an example with could help me. Thanks, Corinna MATLAB 5.0 MAT-file, Platform: PCWIN, Created on: Tue Apr 10 13:17:44 2007 �IM���3���xãc``p�b6 æÒ À å31331;çeVøÅAjYX �[n| __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Matlab-import-tf3552511.html#a9918327 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Matlab import
Hallo, With readMat, don't use the -ascii option (which you didn't have in your first posting). I've never tried reading matlab's ascii format. In any case, readMat reads matlab's binary format. - Tom I did the saving again without 'ascii' option but the import also did not work. I get the following error message: library(R.matlab) mats - readMat(Z:/Software/R-Programme/test2.dat) Fehler in list(readMat(Z:/Software/R-Programme/test2.dat) = environment, : [2007-04-10 14:57:52] Exception: Tag type not supported: miCOMPRESSED at throw(Exception(...)) at throw.default(Tag type not supported: , tag$type) at throw(Tag type not supported: , tag$type) at readMat5DataElement(this) at readMat5(con, firstFourBytes = firstFourBytes, maxLength = maxLength) at readMat.default(Z:/Software/R-Programme/test2.dat) at readMat(Z:/Software/R-Programme/test2.dat) Any further idea, Corinna Schmitt, Corinna wrote: Hallo, I've used Henrik Bengtsson's R.matlab package several times to successfully read in matlab data files. It's normally as easy as: library(R.matlab) mats - readMat(matrixM.txt) - Tom I have imported this package, too. And tried your commands with the new txt-file as mentioned in my last mail to the mailing list. I get the following error command: mats = readMat(Z:/Software/R-Programme/test.dat) Error in if (version == 256) { : Argument hat Länge 0 Zusätzlich: Warning message: Unknown endian: . Will assume Bigendian. in: readMat5Header(this, firstFourBytes = firstFourBytes) What did I wrong? Please check my txt-file which was constructed with the matlab command save('test.dat','matrixM','-ascii') Thanks, Corinna Schmitt, Corinna wrote: Dear R-Experts, here again a question concerning matlab. With the command matrixM=[1 2 3;4 5 6] a matrix under Matlab was constructed. It was than stored with the command save('matrixM.txt','matrixM'). Now I tried to import the data in R with the help of the command Z=matrix(scan(Z:/Software/R-Programme/matrixM.txt)) An error occurred. The result should be a matrix with the entries as mentioned above. Perhaps I made already an error in matlab. Has any one got an idea how to import the data and store it in R. In R I want to make further calculations with the matrix. I just installed R.matlab but could not find an example with could help me. Thanks, Corinna MATLAB 5.0 MAT-file, Platform: PCWIN, Created on: Tue Apr 10 13:17:44 2007 �IM���3���xãc``p�b6 æÒ À å31331;çeVøÅAjYX �[n| __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Matlab-import-tf3552511.html#a9918327 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Matlab-import-tf3552511.html#a9918787 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] reading of a matrix
Dear R-experts, I still have problems with the reading of a matrix. Input: matrixData6.txt A-Paar B-Paar C-Paar D-Paar E-Paar A 1 3 5 7 9 B 2 4 6 8 10 R-commands: y=read.table(file=Z:/Software/R-Programme/matrixData6.txt) y Result: A.Paar B.Paar C.Paar D.Paar E.Paar A 1 3 5 7 9 B 2 4 6 8 10 If you look into the txt-file you can recognize that the column names are not the same. Why? If I add in the txt-file the line MyData: infront of all followed by a newline. The R-command as above response an error. How can I read the modified input and get the following result: MyData: A.Paar B.Paar C.Paar D.Paar E.Paar A 1 3 5 7 9 B 2 4 6 8 10 Another stupid question might be hows can I change the column and row names after I made read.table? I want to have the following result, for example: MyData: G H I J K M 1 3 5 7 9 N 2 4 6 8 10 I studied all manuals I could find and the help but could not understand the examples or interpret it right for my case. Thanks for help, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] reading of a matrix
Thank you very much. It realizes the things I want. Thanks a lot, Corinna -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Vladimir Eremeev Gesendet: Donnerstag, 5. April 2007 13:25 An: r-help@stat.math.ethz.ch Betreff: Re: [R] reading of a matrix Schmitt, Corinna wrote: I still have problems with the reading of a matrix. Input: matrixData6.txt A-Paar B-Paar C-Paar D-Paar E-Paar A 1 3 5 7 9 B 2 4 6 8 10 R-commands: y=read.table(file=Z:/Software/R-Programme/matrixData6.txt) y Result: A.Paar B.Paar C.Paar D.Paar E.Paar A 1 3 5 7 9 B 2 4 6 8 10 If you look into the txt-file you can recognize that the column names are not the same. Why? Using _ in variable names was illegal earlier (now this rule seems to be relaxed). read.table has converted names. You could try to change them back (UNTESTED) names(y) - gsub(., _, names(y)), Schmitt, Corinna wrote: If I add in the txt-file the line MyData: infront of all followed by a newline. The R-command as above response an error. How can I read the modified input and get the following result: MyData: A.Paar B.Paar C.Paar D.Paar E.Paar A 1 3 5 7 9 B 2 4 6 8 10 You could name your variable MyData: MyData-read.table( ) MyData Schmitt, Corinna wrote: Another stupid question might be hows can I change the column and row names after I made read.table? I want to have the following result, for example: MyData: G H I J K M 1 3 5 7 9 N 2 4 6 8 10 I studied all manuals I could find and the help but could not understand the examples or interpret it right for my case. Thanks for help, Corinna names(MyData)-c(G,H,I,J,K) row.names(MyData)-c(M,N) -- View this message in context: http://www.nabble.com/reading-of-a-matrix-tf3530874.html#a9854003 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] package for Matlab
Hallo, does a package for Matlab exist in R? If yes, where can I find it and how can I install it under R? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] package for Matlab
Hallo, here again my modified information: does a package for Matlab exist in R? I'm using Windows. I know that there exist one for UNIX. Does one exist for Windows? If yes, where can I find it and how can I install it under R? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] package for Matlab
Dear Tobias, the first packet was succesfull installed. Please check the link for the last packet again. I get the following error message if I try to install it: CC - http://odin.mdacc.tmc.edu/~roebuck/R; install.packages(rwt, dependencies = TRUE, CRAN = MDACC) Error in install.packages(rwt, dependencies = TRUE, CRAN = MDACC) : unbenutzte(s) Argument(e) (CRAN = http://odin.mdacc.tmc.edu/~roebuck/R;) Thanks, Corinna -Ursprüngliche Nachricht- Von: Tobias Verbeke [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 5. April 2007 16:01 An: Schmitt, Corinna Cc: r-help@stat.math.ethz.ch Betreff: Re: [R] package for Matlab Schmitt, Corinna wrote: Hallo, does a package for Matlab exist in R? To read and write MAT files, there is the R.matlab package: http://cran.r-project.org/src/contrib/Descriptions/R.matlab.html This package also enables bidirectional communication between R and Matlab. An alternative package with similar functionality (but not on CRAN and according to its home page not yet functional on platforms other than UNIX) is RMatlab http://www.omegahat.org/RMatlab/ To ease translation of Matlab code, there is the matlab package: http://cran.r-project.org/src/contrib/Descriptions/matlab.html HTH, Tobias If yes, where can I find it and how can I install it under R? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Tobias Verbeke - Consultant Business Decision Benelux Rue de la révolution 8 1000 Brussels - BELGIUM +32 499 36 33 15 [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] package for Matlab
Dear R-experts, Thanks for the help. I just istalled everything and will test it after Easter. Happy Easter, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Reasons to Use R
Dear Mr. Isella, I just started my PhD Thesis. I need to work with R. Good sources are Bioconductor (www.bioconductor.org). It is a DB based on R-programming. Another institute which has good experiences with R is the HKI in Jena, Germany. Perhaps you can contact Mrs. Radke to get more information or speakers for your workshop. Both parties are mainly for bioinformatics methods but perhaps can help you. A good reason to use R is that computations are much quicker and you can import/export from many other programs or languages files. Happy Easter, C.Schmitt ** Corinna Schmitt, Dipl.Inf.(Bioinformatik) Fraunhofer Institut für Grenzflächen- Bioverfahrenstechnik Nobelstrasse 12, B 3.24 70569 Stuttgart Germany phone: +49 711 9704044 fax: +49 711 9704200 e-mail: [EMAIL PROTECTED] http://www.igb.fraunhofer.de -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Lorenzo Isella Gesendet: Donnerstag, 5. April 2007 17:02 An: r-help@stat.math.ethz.ch Betreff: [R] Reasons to Use R Dear All, The institute I work for is organizing an internal workshop for High Performance Computing (HPC). I am planning to attend it and talk a bit about fluid dynamics, but there is also quite a lot of interest devoted to data post-processing and management of huge data sets. A lot of people are interested in image processing/pattern recognition and statistic applied to geography/ecology, but I would like not to post this on too many lists. The final aim of the workshop is understanding hardware requirements and drafting a list of the equipment we would like to buy. I think this could be the venue to talk about R as well. Therefore, even if it is not exactly a typical mailing list question, I would like to have suggestions about where to collect info about: (1)Institutions (not only academia) using R (2)Hardware requirements, possibly benchmarks (3)R clusters, R multiple CPU machines, R performance on different hardware. (4)finally, a list of the advantages for using R over commercial statistical packages. The money-saving in itself is not a reason good enough and some people are scared by the lack of professional support, though this mailing list is simply wonderful. Kind Regards Lorenzo Isella __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] pattern search
Dear R-experts, I'm looking for an easy possibility for pattern search. I have got a string and a special pattern. I would like to know if the pattern appears in the string, if yes where does it appear (position) and the number of appearance. Example: Text = c(If the sun shines, no clouds should be seen in the sky!) SearchPattern = c(the) NumberOfAppearance = 0 NumberOfLetters = 0 -- NumberOfAppearance should be 2 in the end How can I get the string length (=number of letters stored in Text)? Has anyone a good idea? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Device drivers - pdf()
Hallo R-experts, I produced a R graphic with the help of the following commands: plot(0:4,0:4, type = n, xlab = X-Werte, ylab = Y-Werte) points(rnorm(100), rnorm(100), col = black) locator(2, type= l) locator(2, type = l, col = red) I could display this graphic by using windows() before entering those commands. Now I want to save this graphic as PDF file. I studied the online-help and the manuals extensively but could not find a solution. Can anyone tell me the corresponding command in detail? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Device drivers - png()/jpeg()
Hallo R-experts, I produced a R graphic with the help of the following commands: plot(0:4,0:4, type = n, xlab = X-Werte, ylab = Y-Werte) points(rnorm(100), rnorm(100), col = black) locator(2, type= l) locator(2, type = l, col = red) I could display this graphic by using windows() before entering those commands. Now I want to save this graphic as PNG file and JPEG file. I studied the online-help and the manuals extensively but could not find a solution. Can anyone tell me the corresponding command in detail? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Device drivers - png()/jpeg()
Thank you for the good ideas. It's working. CU, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Device drivers - pdf()
Thank you for the good ideas. It's working. CU, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] math-operations
Hallo R-experts, for a function I need to work with the commands div and mod known from Pascal and Ruby. The only help I know is ceiling() and floor() in R. Do div and mod exist? When yes please send me a little example. In Pascal-Syntax I want: 513 div 100 = 5 513 mod 100 = 13 How can I get this in R-syntax? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] math-operations
Thanks, it works. Corinna -Ursprüngliche Nachricht- Von: Guazzetti Stefano [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 30. März 2007 15:41 An: Schmitt, Corinna; r-help@stat.math.ethz.ch Betreff: R: [R] math-operations I guess you need %% and %/% try 513 %/% 100 [1] 5 513 %% 100 [1] 13 ?%% Stefano -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] conto di Schmitt, Corinna Inviato: venerdì 30 marzo 2007 15.34 A: r-help@stat.math.ethz.ch Oggetto: [R] math-operations Hallo R-experts, for a function I need to work with the commands div and mod known from Pascal and Ruby. The only help I know is ceiling() and floor() in R. Do div and mod exist? When yes please send me a little example. In Pascal-Syntax I want: 513 div 100 = 5 513 mod 100 = 13 How can I get this in R-syntax? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] equivalent datatypes
Hallo, can anyone help me with datatypes? Which datatypes from R are equivalent to the following ones from C? C datatypes: - double array - struct array - cell array - char array - logical array Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Import of a workspace into R
Hallo, Sorry for more details before but I was in a hurry. One workspace comes from Matlab and one should come from Bioconductor. At the moment I can just work with the Matlab-workspace. I just know that the data is stored in an Excel-File -- I have a table. I know that there exists an RMatlab packet but I could not found any near information or description of it. Can anyone help me or give me additional papers or Links? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Listing function
Thank you very much, folks. I had read the paper Introduction to R but sometimes I had problems with the examples. Now I can solve all my problems with the help of your ideas. Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] matrix construction
Hallo, can anyone tell me how I can create a matrix in R? I have two arrays A = c(0:3), B=c(0:3). C should be the matrix. I just found the description that a matrix is just an array with two substricpts. Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Listing function
Hallo, I build a list by the following way: Lst = list(name=Fred, wife=Mary, no.children=3, cild.ages=c(4,7,9)) I know how I can extract the information one by one. But now I want to add a new entry which looks like name=Barney, wife=Liz, no.children=2, cild.ages=c(3,5) How can I add this information to Lst without overwriting the first entry? How can I then extract the corresponding information if I have both entries in Lst? Thanks for helping, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Listing function displayed as a table
Hallo, good idea it is working. A new question appears: How can I display the entries in a table like name wife no.children child.ages FredMary3 4,7,9 Barney Liz 2 3,5 Thanks, Corinna -Ursprüngliche Nachricht- Von: Michael T. Mader [mailto:[EMAIL PROTECTED] Gesendet: Montag, 26. März 2007 15:32 An: Schmitt, Corinna; r-help@stat.math.ethz.ch Betreff: Re: [R] Listing function Lst - list() Lst[[1]] - list(name=Fred, wife=Mary, no.children=3, cild.ages=c(4,7,9)) Lst[[2]] - list(name=Barney, wife=Liz, no.children=2, cild.ages=c(3,5)) I.e. a list of lists Regards Michael Schmitt, Corinna wrote: Hallo, I build a list by the following way: Lst = list(name=Fred, wife=Mary, no.children=3, cild.ages=c(4,7,9)) I know how I can extract the information one by one. But now I want to add a new entry which looks like name=Barney, wife=Liz, no.children=2, cild.ages=c(3,5) How can I add this information to Lst without overwriting the first entry? How can I then extract the corresponding information if I have both entries in Lst? Thanks for helping, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Michael T. Mader Institute of Stem Cell Research GSF - National Research Center for Environment and Health Ingolstaedter Landstrasse 1 D-85764 Neuherberg 0049-89-3187-3683 Program testing can be quite effective for showing the presence of bugs, but is hopelessly inadequate for showing their absence. E. W. Dijkstra __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Listing function - new possibility
I think your solution is more comfortable. But what do you do if an new entry consists of 4 children? How can you modify the old result of rbind()? Is ther a possibility to save the childrens ages in one table entry? Thanks, Corinna -Ursprüngliche Nachricht- Von: Dimitris Rizopoulos [mailto:[EMAIL PROTECTED] Gesendet: Montag, 26. März 2007 15:38 An: Schmitt, Corinna Cc: r-help@stat.math.ethz.ch Betreff: Re: [R] Listing function maybe it'd be better to use a data.frame(), e.g., dat - data.frame(name = I(Fred), wife = I(Mary), no.children = 3, cild.ages1 = 4, cild.ages2 = 7, cild.ages3 = 9) ## new.info - c(name = Barney, wife = Liz, no.children=2, cild.ages1 = 3, cild.ages2 = 5, cild.ages3 = NA) rbind(dat, new.info) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Schmitt, Corinna [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Monday, March 26, 2007 3:26 PM Subject: [R] Listing function Hallo, I build a list by the following way: Lst = list(name=Fred, wife=Mary, no.children=3, cild.ages=c(4,7,9)) I know how I can extract the information one by one. But now I want to add a new entry which looks like name=Barney, wife=Liz, no.children=2, cild.ages=c(3,5) How can I add this information to Lst without overwriting the first entry? How can I then extract the corresponding information if I have both entries in Lst? Thanks for helping, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Binary information convert into hexadecimal
Hallo, I just started with programming with R. I have the following problem: Given is binary information and should be translated into integer and afterwards into hexadecimal: 0 0 0001 1 1 0010 2 2 0011 3 3 0100 4 4 0101 5 5 0110 6 6 0111 7 7 1000 8 8 1001 9 9 1010 10 A 1011 11 B 1100 12 C 1101 13 D 1110 14 E 15 F I found a similar function for translating an integer vector into characters and back to integer (z=0:9; digits=as.character(z); d=as.integer(digits)). My idea was to make a kind of case-task as I know from RUBY. But there should exits an easier way. Can anyone help me? Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.