[R] Read a .sas7bdat file
Hello useRs, I would like to import a data frame in a sas format (.sas7bdat). I have installed foreign library, and tryed to use read.ssd function : read.ssd(these, fus9706.sas7bdat) sh: sas: not found SAS failed. SAS program at /tmp/RtmpPdVSST/file2ae8944a.sas a log and other error products should be in the vicinity ls: file2ae8944a.log: Aucun fichier ou répertoire de ce type NULL Warning message: Le code renvoyé par SAS est 32512 in: read.ssd(these, fus9706.sas7bdat) Is it possible to read this file with R ? Thank you for your help. David [[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] Read a .sas7bdat file
Thank you for your answer. The big problems are : - I don't have SAS - I work on a linux system But, I've just found a solution : - I have downloaded SAS viewer (free) : http://www.sas.com/apps/demosdownloads/sassysview_PROD_8.2_sysdep.jsp?packageID=000176 - I have installed it with Wine. - Then, I can read my sas file and export it into a common format (csv...) This program works perfectly with Wine. Thank you very much. 2007/3/18, Peter Dalgaard [EMAIL PROTECTED]: David Hajage wrote: Hello useRs, I would like to import a data frame in a sas format (.sas7bdat). I have installed foreign library, and tryed to use read.ssd function : read.ssd(these, fus9706.sas7bdat) sh: sas: not found SAS failed. SAS program at /tmp/RtmpPdVSST/file2ae8944a.sas a log and other error products should be in the vicinity ls: file2ae8944a.log: Aucun fichier ou répertoire de ce type NULL Warning message: Le code renvoyé par SAS est 32512 in: read.ssd(these, fus9706.sas7bdat) Is it possible to read this file with R ? Not until SAS or someone else comes up with a description of the file format. Till then, you need SAS itself or one of a couple of special-purpose closed-source conversion tools (Stat/Transfer, DBMS/Copy). Thank you for your help. David [[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] Install bioconductor
Hello useRs, I'm trying to install bioconductor on ubuntu edgy eft and R 2.4.0. I have some error messages during installation, in particular for the package affy : Error: package 'affy' required by 'makecdfenv' could not be found I have tryed to install 'makecdfenv' with the command : getBioC(makecdfenv) But I have this message : Running getBioC version 0.1.8 with R version 2.4.0 Running biocinstall version 1.9.9 with R version 2.4.0 Your version of R requires version 1.9 of Bioconductor. Avis dans install.packages(pkgs = pkgs, repos = repos, dependencies = dependencies, : argument 'lib' is missing: using /usr/local/lib/R/site-library also installing the dependencies 'affy', 'affyio' essai de l'URL ' http://bioconductor.org/packages/1.9/bioc/src/contrib/affy_1.12.1.tar.gz' Content type 'application/x-gzip' length 1370295 bytes URL ouverte == downloaded 1338Kb essai de l'URL ' http://bioconductor.org/packages/1.9/bioc/src/contrib/affyio_1.2.0.tar.gz' Content type 'application/x-gzip' length 57410 bytes URL ouverte == downloaded 56Kb essai de l'URL ' http://bioconductor.org/packages/1.9/bioc/src/contrib/makecdfenv_1.12.0.tar.gz ' Content type 'application/x-gzip' length 3222836 bytes URL ouverte == downloaded 3147Kb * Installing *source* package 'affyio' ... creating cache ./config.cache checking how to run the C preprocessor... cc -E checking for main in -lz... no updating cache ./config.cache creating ./config.status creating src/Makevars ** libs gcc -I/usr/share/R/include -I/usr/share/R/include -fpic -g -O2 -std=gnu99 -c read_abatch.c -o read_abatch.o read_abatch.c:151:18: error: zlib.h: Aucun fichier ou répertoire de ce type read_abatch.c:1244: error: expected declaration specifiers or '...' before 'gzFile' read_abatch.c: In function 'ReadgzFileLine': read_abatch.c:1245: warning: implicit declaration of function 'gzgets' read_abatch.c:1245: error: 'currentFile' undeclared (first use in this function) read_abatch.c:1245: error: (Each undeclared identifier is reported only once read_abatch.c:1245: error: for each function it appears in.) read_abatch.c:1245: warning: comparison between pointer and integer read_abatch.c: At top level: read_abatch.c:1265: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'open_gz_cel_file' read_abatch.c:1306: error: expected ')' before 'my_file' read_abatch.c:1329: error: expected ')' before 'my_file' read_abatch.c: In function 'check_gzcel_file': read_abatch.c:1360: error: 'gzFile' undeclared (first use in this function) read_abatch.c:1360: error: expected ';' before 'currentFile' read_abatch.c:1364: error: 'currentFile' undeclared (first use in this function) read_abatch.c:1364: warning: implicit declaration of function 'open_gz_cel_file' read_abatch.c:1367: warning: implicit declaration of function 'gzAdvanceToSection' read_abatch.c:1368: warning: implicit declaration of function 'gzfindStartsWith' read_abatch.c:1393: warning: implicit declaration of function 'gzclose' read_abatch.c: In function 'read_gzcel_file_intensities': read_abatch.c:1421: error: 'gzFile' undeclared (first use in this function) read_abatch.c:1421: error: expected ';' before 'currentFile' read_abatch.c:1426: error: 'currentFile' undeclared (first use in this function) read_abatch.c:1432: error: too many arguments to function 'ReadgzFileLine' read_abatch.c: In function 'read_gzcel_file_stddev': read_abatch.c:1495: error: 'gzFile' undeclared (first use in this function) read_abatch.c:1495: error: expected ';' before 'currentFile' read_abatch.c:1500: error: 'currentFile' undeclared (first use in this function) read_abatch.c:1506: error: too many arguments to function 'ReadgzFileLine' read_abatch.c: In function 'read_gzcel_file_npixels': read_abatch.c:1579: error: 'gzFile' undeclared (first use in this function) read_abatch.c:1579: error: expected ';' before 'currentFile' read_abatch.c:1584: error: 'currentFile' undeclared (first use in this function) read_abatch.c:1590: error: too many arguments to function 'ReadgzFileLine' read_abatch.c: In function 'gz_apply_masks': read_abatch.c:1669: error: 'gzFile' undeclared (first use in this function) read_abatch.c:1669: error: expected ';' before 'currentFile' read_abatch.c:1678: error: 'currentFile' undeclared (first use in this function) read_abatch.c:1691: error: too many arguments to function 'ReadgzFileLine' read_abatch.c:1715: error: too many arguments to function 'ReadgzFileLine' read_abatch.c: In function 'gz_get_header_info': read_abatch.c:1749: error: 'gzFile' undeclared (first use in this function) read_abatch.c:1749: error: expected ';' before 'currentFile' read_abatch.c:1753: error: 'currentFile' undeclared (first use in this function) read_abatch.c: In function 'gz_get_detailed_header_info': read_abatch.c:1807: error: 'gzFile' undeclared (first use in this function)
Re: [R] Barplot legend position
For example : x=matrix(1:10,2,5) barplot(x,besid=T) legend(topleft, c(left,right), density= c(0,1000)) 2006/10/13, Ingmar Visser [EMAIL PROTECTED]: Dear useRs, I'm trying to create a barplot like so: x=matrix(1:10,2,5) barplot(x,leg=c(left,right),besid=T) The legend is placed in default position topright, however the data are plotted there too. I tried controlling the legend position by adding x=topleft but this results in an error that x matches multiple formal arguments. Leaving out the legend and making a separate call to legend leaves out the colors of bars ... Please advice, Ingmar __ 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. -- David [[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] install R on Sun Blade 2000
Hello useRs, I would like to install R 2.3.1 on a computer : Sun Blade 2000. Is there a precompiled version of R for this computer ? Thank you very much. -- David [[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] Output and Word
thank you Greg Snow for this information ! But I have this message : odfWeave(c:/simple.odt, c:/essai.odt) Setting wd Copying c:/simple.odt Decompressing ODF file using unzip -o C:\DOCUME~1\Maud\LOCALS~1\Temp\RtmpF0hdqb/simple.odt Erreur dans odfWeave(c:/simple.odt, c:/essai.odt) : Error unzipping file De plus : Warning message: unzip introuvable R says that it doesn't find unzip... What is this program ? 2006/7/18, Greg Snow [EMAIL PROTECTED]: Others have suggested using R2HTML (which is a good option). Another option is to use Sweave and specifically the new odfWeave package for R. This works on OpenOffice files rather than word files (but OpenOffice http://www.openoffice.org/ can inport and export word documents). The basic idea is to write your report in OpenOffice (or LaTeX or HTML), but anywhere that you want statisticial output (graphs, tables) you include instead the R code to produce the table, graph, or whatever. Run this file through R (using Sweave or odfWeave) and the resulting file has replaced all the code segments with their output. The documentation with odfWeave has examples. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of sharon snowdon Sent: Monday, July 17, 2006 2:36 PM To: r-help@stat.math.ethz.ch Subject: [R] Output and Word Hi I have just started to have a look at R. I have used most stats software packages and can use perl, visual basic etc. I am interested in how well it handles lots of output e.g. tables or charts. How would you get lots of output most easily and quickly into a Word document? Sharon Snowdon - -- __ 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 __ 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. -- David [[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] Name of a column
Hello, My problem is quite simply, but I didn't find any solution... I have a vector : truc longueur30 longueur40 longueur50 longueur60 longueur70 longueur80 longueur90 34 FALSE FALSE FALSE FALSE TRUE FALSE FALSE I would like to have the name of the column where there is TRUE. colnames(truc) [1] longueur30 longueur40 longueur50 longueur60 longueur70 [6] longueur80 longueur90 truc[truc == T] [1] TRUE colnames(truc[truc == T]) NULL How can I do it ? Thank you for your help. -- David [[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
[R] problem with write.table
Hello, I have a data frame : linkptpn[1:6,] pedigree id fa mo sex status rs3789604 rs3811021 rs1217413 ss38346942 1 1 1 0 0 1 2 2 1 2 0 0 2 2 3 1 3 1 2 2 3 3/3 2/2 3/34/4 4 1 4 1 2 2 3 3/3 2/4 3/32/2 5 2 1 0 0 1 2 6 2 2 0 0 2 3 I would like to use write.table : write.table(linkptpn, /home/biostat/david/genetique/linkptpn.csv) Erreur dans write.table(x, file, nrow(x), p, rnames, sep, eol, na, dec, as.integer(quote), : type 'list' indisponible dans 'EncodeElement' R says that my variables are 'list'. Indeed : apply(linkptpn, 2, class) pedigree id fa mosex status rs3789604 list list list list list list list rs3811021 rs1217413 ss38346942 rs1217388 ss38346943 rs1310182 ss38346944 list list list I would like to transform everything into a pure data.frame. I tried : apply(linkptpn, 2, unlist) or apply(linkptpn, 2, as.data.frame) or linkptpn2 - data.frame(unlist(linkptpn$pedigree), unlist(linkptpn$id), unlist(linkptpn$fa), unlist(linkptpn$mo), unlist(linkptpn$sex), unlist(linkptpn$status), unlist(linkptpn$rs3789604), unlist(linkptpn$rs3811021),unlist( linkptpn$rs1217413), unlist(linkptpn$ss38346942)) But it doesn't work. The first and the second solution gives me another list, and the third doesn't work because of missing data. Do you have any idea to do this ? -- David [[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
[R] reverse variables
Hello useRs, Is there a way to reverse values of 2 variables (like with the language Python) ? : a - 1 b - 2 a, b - b, a More specifically, I have a data frame : famnum generation germain1 germain2 fa mo ptpn1 ptpn2 drb11 drb12 1 2 200 201 101 102 1 1 1 1 2 2 200 201 101 102 0 1 1 1 3 2 200 201 101 102 1 0 1 1 ... I don't want 0 in the seventh column, so I would like to have : famnum generation germain1 germain2 fa mo ptpn1 ptpn2 drb11 drb12 1 2 200 201 101 102 1 1 1 1 2 2 201 200 101 102 1 0 1 1 3 2 200 201 101 102 1 0 1 1 ... I thought that a code like this would work : if (ptpn1 == 0 ptpn2 == 1) { germain1, germain2 - germain2, germain1 ptpn1, ptpn2 - ptpn2, ptpn1 drb11, drb12 - drb12n, drb11 } But R is not Python... Is there a way to do it easyly ? Thank you. -- David [[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
[R] Problem with Sweave
I was trying to use Sweave function. Do you know why the following code in my .Rnw file: results=tex, echo=FALSE= print(xtable(stat.table(list(Couverture du livret = couv), list(n = count(), \\% = percent(couv, floating = F) @ \\ NA = \Sexpr{table(is.na(couv))[2]} gives me this result in my .tex file : % latex table generated in R 2.3.1 by xtable 1.3-2 package % Mon Jun 5 13:24:15 2006 \begin{tabular}{rrr} \hline n \% \\ \hline Plutot negatif 8.00 21.62 \\ Plutot positif 29.00 78.38 \\ \hline \end{tabular}\\ NA = \Sexpr{table( is.na(couv))[2]} and not : NA = 26 (where 26 is the result of table(is.na(couv))[2]) ? I don't understand ! -- David [[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
[R] Load a program from internet
Hello, I know how to load a program from my computer with the command source. example : source(home/david/prog.r) But is it possible to load a program from the internet ? example : source(http://davidblog/prog.r;) -- David [[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
Re: [R] Load a program from internet
ok... I've juste understood that my computer (at work) doesn't let R access to internet... That's why I was wondering if it works ! I've made a function which adds exposed to risk on your survival curve... If you want to try : source(http://pepereblog.free.fr/blog/share/tigeR%202.0.r;) tigeR.graph(aml$time, aml$status, aml$x, tps = seq(0,72, 24), IC = 24, decalIC = 0.5, legend = names(table(aml$x)), main = Survival) tigeR.results(aml$time, aml$status, aml$x, latex = F) It's in french, but you can modify it if you want... Thank you all for your answers, and sorry for my english. 2006/5/29, David Hajage [EMAIL PROTECTED]: and sorry for my english !... 2006/5/29, David Hajage [EMAIL PROTECTED]: thank you. Same result... It doesn't work ! But i will try at home... I'm sure il will work ! Or you can try : I've made a function which adds exposed to risk on your survival curve... source(http://pepereblog.free.fr/blog/share/tigeR%202.0.r ) tigeR.graph(aml$time, aml$status, aml$x, tps = seq(0,72, 24), IC = 24, decalIC = 0.5, legend = names(table(aml$x)), main = Survival) tigeR.results(aml$time, aml$status, aml$x, latex = F) It's in french, but you can modify it if you want... Thank for your response. 2006/5/29, Christian Ritz [EMAIL PROTECTED]: Hi David, try: source(url( http://davidblog/prog.r )) Christian -- David -- David -- David [[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
[R] median of a survfit object
Hello R users ! Here a survfit object : library(survival) essai - aml[aml$x == Maintained,] calc - survfit(Surv(essai$time, 1 - essai$status)) calc Call: survfit(formula = Surv(essai$time, 1 - essai$status)) n events median 0.95LCL 0.95UCL 11 4 103 28 Inf I would like to get the median of the object calc... For example, med - calc$median But it doesn't work... How can I do this ? -- David -- David [[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
Re: [R] median of a survfit object
It works ! thank you ! 2006/5/24, Heinz Tuechler [EMAIL PROTECTED]: see: [R] How to access results of survival analysis Xiaochun Li (06 May 2006) At 15:03 24.05.2006 +0200, David Hajage wrote: Hello R users ! Here a survfit object : library(survival) essai - aml[aml$x == Maintained,] calc - survfit(Surv(essai$time, 1 - essai$status)) calc Call: survfit(formula = Surv(essai$time, 1 - essai$status)) n events median 0.95LCL 0.95UCL 11 4 103 28 Inf I would like to get the median of the object calc... For example, med - calc$median But it doesn't work... How can I do this ? -- David -- David [[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 -- David [[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
[R] mc nemar test
Hello R users, I would like to perform a mc nemar test. There is my data : __ x - matrix(4:1,2,2) x [,1] [,2] [1,]42 [2,]31 __ My population is too small for normal approximation. __ library(concord) mcnemar.mh(x) $statistic [1] 0.2 $p [1] 0.6547208 Warning message: low cell counts - consider binomial test in: mcnemar.mh(x) ___ Do you have an advice to perform this test ? Is there a non-parametric one ? Thank you very much. -- David [[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
[R] Create pdf and postscript files
Hello, I would like to learn how to create a pdf and a postscript file from an R graphic. For example, I tried : plot(1) # example pdf(H:/Perso/essai.pdf) postscript(H:/Perso/essai.ps) But the pdf document created is empty. How do these functions work ? Thank you very much. -- David Hajage Interne de santé publique Institut Curie [[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
Re: [R] Create pdf and postscript files
... I'm so stupid ! Thank you very much. David Hajage Interne de santé publique Institut Curie 2005/12/27, Ronnie Babigumira [EMAIL PROTECTED]: You need to open the pdf/poscript first and then plot...see ?postscript # open the file foo.ps for graphics output postscript(foo.ps) # produce the desired graph(s) dev.off() # turn off the postscript device David Hajage wrote: Hello, I would like to learn how to create a pdf and a postscript file from an R graphic. For example, I tried : plot(1) # example pdf(H:/Perso/essai.pdf) postscript(H:/Perso/essai.ps) But the pdf document created is empty. How do these functions work ? Thank you very much. -- David Hajage Interne de santé publique Institut Curie [[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 -- David [[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
Re: [R] how to change a dataframe with characters to a numeric matrix?
A way to do it : TEST$Y3[TEST$Y3==Z] - NA TEST$Y3 - as.numeric(TEST$Y3) 2005/12/8, zhihua li [EMAIL PROTECTED]: hi netters, i have a dataframe TEST like this: Y1 Y2 Y3 X1 4 7 8 X2 6 2 Z X3 8 0 1 i would like to change it to a numeric matrix, replacing Z with NA Y1 Y2 Y3 X1 4 7 8 X2 6 2 NA X3 8 0 1 i've tried the function data.matrix but it didn't work. is there any easy way to do this? thanks a lot! __ 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 -- David [[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
Re: [R] how to change a dataframe with characters to a numeric matrix?
and then, if you want a matrix and not a data.frame : TEST - as.matrix(TEST) 2005/12/8, David Hajage [EMAIL PROTECTED]: A way to do it : TEST$Y3[TEST$Y3==Z] - NA TEST$Y3 - as.numeric(TEST$Y3) 2005/12/8, zhihua li [EMAIL PROTECTED]: hi netters, i have a dataframe TEST like this: Y1 Y2 Y3 X1 4 7 8 X2 6 2 Z X3 8 0 1 i would like to change it to a numeric matrix, replacing Z with NA Y1 Y2 Y3 X1 4 7 8 X2 6 2 NA X3 8 0 1 i've tried the function data.matrix but it didn't work. is there any easy way to do this? thanks a lot! __ 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.htmlhttp://www.r-project.org/posting-guide.html -- David -- David [[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
Re: [R] R newbie...
Thank you for all your answers... I solved my problem thanks to you all ! david 2005/12/6, paul sorenson [EMAIL PROTECTED]: Return something that can hold more than one value, eg: calculate - function(x, y) { list(a=x+y, b=x-y) } David Hajage wrote: Thank you for your answer. And what if my first function gives 2 results : calculate - function(x,y) { a - x + y b - x - y } How can I use both a and b in a new function ? -- David [[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
[R] R newbie...
Hello, I'm a new user... I have a function : calculate - function(x,y) { z - x + y } I would like to use the result (z) with another function : recalculate - function(...) { a - z^2 } But R says that z does not exist... How can I use z in an another function ? Thank you for your answer... -- David [[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
Re: [R] R newbie...
Thank you for your answer. And what if my first function gives 2 results : calculate - function(x,y) { a - x + y b - x - y } How can I use both a and b in a new function ? 2005/12/6, Sarah Goslee [EMAIL PROTECTED]: First of all, you might try reading the manual. Second, you might try something like this: calculate - function(x,y) { z - x + y z } recalculate(z) { a - z^2 a } z - calculate(x, y) recalculate(z) You need to return some value from your functions, and you need to assign that value to a variable. Sarah -- Sarah Goslee http://www.stringpage.com -- David [[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