Hi,

keine ahnung. Das liegt jetzt bei Hr. Feld. Frag mal bei ihm nach.

Grüße

Thushyanthan



r-help-requ...@r-project.org wrote:
Send R-help mailing list submissions to
        r-help@r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://stat.ethz.ch/mailman/listinfo/r-help
or, via email, send a message with subject or body 'help' to
        r-help-requ...@r-project.org

You can reach the person managing the list at
        r-help-ow...@r-project.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-help digest..."


Today's Topics:

   1. Define return values of a function (soeren.vo...@eawag.ch)
   2. Re: Define return values of a function (baptiste auguie)
   3. Re: python (Stefan Evert)
   4. Re: other decriptive stats packages (Jakson A. Aquino)
   5. Re: python (Jean Legeande)
   6. Re: "Over-coloring" facets on persp() plot (Duncan Murdoch)
   7. Re: other decriptive stats packages (Tal Galili)
   8. Re: other decriptive stats packages (Tal Galili)
   9. Re: Define return values of a function (David Winsemius)
  10. Re: other decriptive stats packages (Liviu Andronic)
  11. Re: "Over-coloring" facets on persp() plot (David Winsemius)
  12. Re: "Over-coloring" facets on persp() plot (David Winsemius)
  13. How to make a matrix of a number of factors? (Peng Yu)
  14. Repeated measures unbalanced in a split-split design
      (Marcelo Laia)
  15. Re: MASS loading error (Uwe Ligges)
  16. How to make the assignment in a for-loop not affect variables
      outside the loop? (Peng Yu)
  17. Re: How to make a matrix of a number of factors? (baptiste auguie)
  18. Re: Metaplot Axis Annotation (Uwe Ligges)
  19. Re: How to make the assignment in a for-loop not affect
      variables outside the loop? (Uwe Ligges)
  20. Why F value and Pr are not show in summary() of an aov()
      result? (Peng Yu)
  21. Re: how to tell if its better to standardize your data matrix
      first when you do principal (Uwe Ligges)
  22. how do i persuade IT to install R on PCs ?? ...and should I
      ?? (frenchcr)
  23. Computing multivariate normal probabilities. Was: Re: Problem
      with Numerical derivatives (numDeriv) and mvtnorm (Ravi Varadhan)
  24. Re: consecutive numbering of elements in a matrix (Jim Bouldin)
  25. Re: Why F value and Pr are not show in summary() of an aov()
      result? (Sundar Dorai-Raj)
  26. scatter plot & equation (Rofizah Mohammad)
  27. Re: python (Peter Ehlers)
  28. Re: scatter plot & equation (Duncan Murdoch)
  29. Re: consecutive numbering of elements in a matrix
      (David Winsemius)
  30. Re: scatter plot & equation (David Winsemius)
  31. Do you keep an archive of "useful" R code? and if so - how?
      (Tal Galili)
  32. Re: python (Jean Legeande)
  33. Re: how do i persuade IT to install R on PCs ?? ...and should
      I ?? (Marc Schwartz)
  34. contour(): lines & labels in different colours? ( (Ted Harding))
  35. Re: Do you keep an archive of "useful" R code? and if so -
      how? (Marc Schwartz)
  36. Re: how do i persuade IT to install R on PCs ?? ...and should
      I ?? (Ben Bolker)
  37. Re: scatter plot & equation (Rofizah Mohammad)
  38. Re: AKIMA: z values at a set coordinate (Rhelp wanted)
  39. Re: Do you keep an archive of "useful" R code? and if so -
      how? (Tal Galili)
  40. Re: Do you keep an archive of "useful" R code? and if so -
      how? (Barry Rowlingson)
  41. Re: Do you keep an archive of "useful" R code? and if so -
      how? (Marc Schwartz)
  42. Re: Do you keep an archive of "useful" R code? and if so -
      how? (Tal Galili)
  43. Re: consecutive numbering of elements in a matrix (Jim Bouldin)
  44. serialized plot object (2 years later) (Jack Tanner)
  45. Re: consecutive numbering of elements in a matrix
      (Dimitris Rizopoulos)
  46. Re: Do you keep an archive of "useful" R code? and if so -
      how? (Hans-Peter Suter)
  47. Re: Computing multivariate normal probabilities. Was: Re:
      Problem with Numerical derivatives (numDeriv) and mvtnorm
      (stephane Luchini)
  48. mac os X: mprobit fails to install (stephane Luchini)
  49. Re: Do you keep an archive of "useful" R code? and if so -
      how? (Joe King)
  50. Re: Do you keep an archive of "useful" R code? and if so -
      how? (Carlos J. Gil Bellosta)
  51. Re: mac os X: mprobit fails to install (Phil Spector)
  52. Re: how to tell if its better to standardize your data matrix
      first when you do principal (masterinex)
  53. Re: consecutive numbering of elements in a matrix (Jim Bouldin)
  54. Re: mac os X: mprobit fails to install (SL)
  55. How to get the factor level means with interaction term? (Peng Yu)
  56. Re: Do you keep an archive of "useful" R code? and if so -
      how? (Nikhil Kaza)
  57. where is lme() that is referred by aov() help page? (Peng Yu)
  58. Re: where is lme() that is referred by aov() help page?
      (Duncan Murdoch)
  59. Re: mac os X: mprobit fails to install (David Winsemius)
  60. Re: where is lme() that is referred by aov() help page? (Peng Yu)
  61. Re: Spatstat, markcorr, max. radius limited?? (Rolf Turner)
  62. Re: mac os X: mprobit fails to install (stephane Luchini)
  63. Re: where is lme() that is referred by aov() help page?
      (Duncan Murdoch)
  64.  any equivalent SUM IF statement in R (ychu066)
  65. Re: mac os X: mprobit fails to install (David Winsemius)
  66. Re: any equivalent SUM IF statement in R (David Winsemius)
  67. Re: any equivalent SUM IF statement in R (Duncan Murdoch)
  68. Re: contour(): lines & labels in different colours? (Peter Ehlers)
  69. Re: how do i persuade IT to install R on PCs ?? ...and should
      I ?? (RICHARD M. HEIBERGER)
  70. Re: how to tell if its better to standardize your data matrix
      first when you do principal (hadley wickham)
  71. Re: mac os X: mprobit fails to install (Marc Schwartz)
  72.  how to generate balanced sample from two normal distribution
      (gcheer3)
  73. Re: mac os X: mprobit fails to install (SL)
  74. Re: how do i persuade IT to install R on PCs ?? ...and should
      I ?? (stephen's mailinglist account)
  75. Re: contour(): lines & labels in different colours?
      (David Winsemius)
  76. Re: contour(): lines & labels in different colours?
      (Duncan Murdoch)
  77. Re: contour(): lines & labels in different colours?
      (Duncan Murdoch)
  78. Re: contour(): lines & labels in different colours?
      (David Winsemius)
  79. Removing "+" and "?" signs (Steven Kang)
  80. Missing/Incomplete Data Study (helpme)
  81. Re: how do i persuade IT to install R on PCs ?? ...and should
      I ?? (David Winsemius)
  82. optim(,"SANN"...) (lloyd barcza)
  83. Re: contour(): lines & labels in different colours?
      ( (Ted Harding))
  84. Re: MASS loading error (Erin Hodgess)
  85. Re: Removing "+" and "?" signs (jim holtman)
  86. Re: Removing "+" and "?" signs (Rolf Turner)
  87. Re: Removing "+" and "?" signs (Linlin Yan)
  88. Re: Removing "+" and "?" signs (Jorge Ivan Velez)
  89. how to prevent lattic barchart from drawing bar completely to
      the bottom/left of the chart (Dan Kortschak)
  90. Re: Removing "+" and "?" signs (Jorge Ivan Velez)
  91. Re: Removing "+" and "?" signs (David Winsemius)
  92. How to change line width in heatmap.2()? (Peng Yu)
  93. Re: how to prevent lattic barchart from drawing bar
      completely        to the bottom/left of the chart (RICHARD M. HEIBERGER)
  94. Re: contour(): lines & labels in different colours?
      (Duncan Murdoch)
  95. Help about stability analysis in R software!!! (lugobueno)
  96. Re: contour(): lines & labels in different colours?
      (David Winsemius)
  97. Re: how to tell if its better to standardize your data matrix
      first when you do principal (masterinex)
  98. Re: how to generate balanced sample from two normal
      distribution (gcheer3)
  99. Re: How do I change the colour and format for the trelli plot
      ? (ychu066)
  100. Re: How do I change the colour and format for the trelli
      plot ? (ychu066)
  101. Re: Help about stability analysis in R software!!!
      (David Winsemius)
  102. dynlm predict with newdata? (zubin)
  103. Re: Help about stability analysis in R software!!!
      (David Winsemius)
  104. Re: how to tell if its better to standardize your data
      matrix first when you do principal (masterinex)
  105. Re: how to tell if its better to standardize your data
      matrix first when you do principal (masterinex)
  106. change in behavior of contrasts for ordered factors
      (RICHARD M. HEIBERGER)
  107. recognizing variable-names of cast() (package: reshape)
      (David Douterlungne)
  108. Re: recognizing variable-names of cast() (package: reshape)
      (hadley wickham)
  109.  question about brushing in rggobi (chao83)
  110. question about how to generate an orthogonal matrix with a
      known vector (Ted Zhang)
  111. Re: question about how to generate an orthogonal matrix with
      a known vector (RICHARD M. HEIBERGER)
  112. interaction effects in a Linear model (ashok varma)
  113.  Interactions in 'MatchBalance' of the package 'Matching'
      (anna0102)
  114. Re: dynlm predict with newdata? (Achim Zeileis)
  115. Re: Removing "+" and "?" signs (Peter Dalgaard)
  116. FUN argument to return a vector in aggregate function
      (utkarshsinghal)
  117. Downloading clim.pact package (ZABLONE OWITI)
  118. non-intuitive behaviour after type conversion (Alan Kelly)
  119. Re: MASS loading error (Uwe Ligges)
  120. Re: FUN argument to return a vector in aggregate function
      (Jim Lemon)
  121. Odp:  FUN argument to return a vector in aggregate function
      (Petr PIKAL)
  122. Re: Computing multivariate normal probabilities. Was: Re:
      Problem with Numerical derivatives (numDeriv) and mvtnorm
      (Torsten Hothorn)
  123. Re: how to tell if its better to standardize your data
      matrix first when you do principal (Uwe Ligges)
  124. Re: how to tell if its better to standardize your data
      matrix first when you do principal (Uwe Ligges)
  125. Re: Downloading clim.pact package (Uwe Ligges)
  126. Re: HTML help missing? (Antje)
  127. Question about S4 (Hun S. Tesatte)
  128. Re: Question about S4 (Hun S. Tesatte)
  129. Re: MASS loading error (Erin Hodgess)
  130. Re: boxplot question (Antje)
  131. unable to use coplot function with zoo package (e-letter)
  132. Re: Computing multivariate normal probabilities. Was: Re:
      Problem with Numerical derivatives (numDeriv) and mvtnorm (SL)


----------------------------------------------------------------------

Message: 1
Date: Sun, 22 Nov 2009 12:26:33 +0100
From: soeren.vo...@eawag.ch
Subject: [R] Define return values of a function
To: r-help@r-project.org
Message-ID: <1191b6d4-850b-44bd-9af5-636fab523...@eawag.ch>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes

I have created a function to do something:

i <- factor(sample(c("A", "B", "C", NA), 793, rep=T, prob=c(8, 7, 5, 1))) k <- factor(sample(c("X", "Y", "Z", NA), 793, rep=T, prob=c(12, 7, 9, 1)))
mytable <- function(x){
   xtb <- x
   btx <- x
   # do more with x, not relevant here
   cat("The table has been created, see here:\n")
   print(xtb)
   list(table=xtb, elbat=btx)
}
tbl <- table(i, k)
mytable(tbl) # (1)
z <- mytable(tbl) # (2)
str(z) # (3)

(1) Wanted: outputs the string and the table properly. *Unwanted*: outputs the list elements.

(2) and (3) Wanted: outputs the string properly. Wanted: assigns the list properly.

How can I get rid of the *unwanted* part? That is, how do I define what the functions prints and -- on the other hand -- what it returns without printing?

Thanks

S?ren



______________________________________________
R-help@r-project.org 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.

Reply via email to