similar to: How to call a function defined within another function

Displaying 20 results from an estimated 10000 matches similar to: "How to call a function defined within another function"

2011 Aug 31
3
How to modify the dot-dot-dot argument using level names instead of position
Dear R-users, In the R internals manual, it is said that one can extract the elements of the dot-dot-dot argument using the special symbols ..1 or ..2. It seems to work just fine but I was wondering if there is a way one can extract or modify the content of the dot-dot-dot argument using a level name instead of its position? For instance, assuming that list(...) returns: $a [1] 1 2 3 4 5
2009 Nov 30
3
Question about output from optim
Dear R-users, I am trying to port to R something that I wrote in Matlab to perform model parameter optimization using the Nelder-Mead simplex method (fminsearch). I read the help on ?optim (which seems to be the way to go) as well as a bunch of posts on the topic, but I would like to make sure about something before I spend to much time trying to reproduce something that is not possible. The
2011 Dec 06
2
How to automate the detection of break points for use in cut
Dear R-users, I would like to know if there is a function (in base R or the extension packages) that would automatically detect the break points in a vector x for later use in the cut function. The idea is to determine the boundaries of the n intervals (n>=1) delimiting clusters of data points which could be considered "reasonably" close, given a numerical vector x with unknown
2011 Jan 04
4
Listing of available functions
Dear R-users, Is there a easy way to access to a complete listing of available functions from a R session? The help.start() and ? functions are great, but I feel like they require the user to know the answer in advance (especially with respect to function names)... I could not find a easy way to simply browse through a list of functions and randomly pick one function to see what is does. Is
2011 Apr 19
1
Define ylim in lattice plot based upon panel function output
Dear R-users, By default, the xyplot function automatically defines the axis ranges based upon the content of y and x variables. However, when one includes some calls to other panel.<something> functions in the panel argument, the results might be out of range and not show up in the final graphs (see lower ends of the loess line in the following example). Is there a way one can capture the
2010 Apr 14
2
R package documentation
Dear R users, I am currently writing the documentation for my first package. I have created a short user manual using sweave/pdflatex which is distinct from the manual/summary-of-package-functions created by R CMD CHECK. I was wondering how could I seamlessly combine both documents. Thanks for your help Sebastien [[alternative HTML version deleted]]
2018 Mar 12
7
Equivalent of gtools::mixedsort in R base
Hi, Searching for functions that would order strings that mix characters and numbers in a "natural" way (ie, "a1 a2 a10" instead of "a1 a10 a2"), I found the mixedsort and mixedorder from the gtools package. Problems: 1- mixedorder does not work in a "do.call(mixedorder, mydataframe)" call like the order function does 2- gtools has not been updated in 2.5
2018 Mar 12
0
Equivalent of gtools::mixedsort in R base
split any mixed columns into letter and number columns and then order can be used on that: DF <- data.frame(x = c("a10", "a2", "a1")) o <- do.call("order", transform(DF, let = gsub("\\d", "", x), no = as.numeric(gsub("\\D", "", x)),
2011 Jul 27
1
How to adjust y-axis when using panel.densityplot within histogram function
Hi I would like to superimpose group-specific densityplots on top of an overall histogram using panel.histogram and panel.densityplot. Furthermore, I would like to automatically adjust the range of the y-axis to take into account the ranges of both histogram and densityplot. This last part is where I have a problem. I believe using the prepanel argument of histogram is typically the way to go,
2007 Aug 28
6
Factor levels
Dear R-users, I have found this not-so-recent post in the archives - http://tolstoy.newcastle.edu.au/R/devel/00a/0291.html - while I was looking for a particular way to reorder factor levels. The question addressed by the author was to know if the read.table function could be modified to order the levels of newly created factors "according to the order that they appear in the data
2011 Aug 20
1
Groups and bwplot
Dear R-users, A while ago, Deepayan Sarkar suggested some code that uses the group argument in bwplot to create some 'side-by-side' boxplots (https://stat.ethz.ch/pipermail/r-help/2010-February/230065.html). The example he gave was relatively specific and I wanted to generalize his approach into a function. Unfortunately, I seem to have some issues passing the correct arguments to the
2007 Sep 02
2
Different behavior of mtext
Dear R Users, I am quite surprised to see that mtext gives different results when it is used with 'pairs' and with "plot'. In the two following codes, it seems that the 'at' argument in mtext doesn't consider the same unit system. I would appreciate your comments on this issue. Sebastien ##### Pairs mydata<-data.frame(x=1:10,y=1:10) par(cex.main=1,
2008 May 07
2
Citation in the literature
Hello everyone, Very quick question: How should I cite the use of R in a publication ? Thanks in advance. Sebastien
2009 May 05
2
smoothing spline in package gam
dear all, i have a little question, but it make me torment long time hope you can help me and give some advices , thanks i use smoothing spline in package gam the model > m1=gam(y~ost+wst+park10+sch50+comm+build+suite+y05+y06+y07+y99+y98+s(builarea)+s(age)+s(fl)+s(totfl)+s(cbd)+s(redl)) and summary(m1) can show the "s"(smoothing) variables' Signif. codes.
2008 Jun 02
2
= or <-
Dear R-users, I have written a short VB application to clean and format my R code. Everything works fine except one small issue that I did not expected; it is related the automatic replacement of assignment signs from "=" to "<-". Most functions or arguments seem to accept either = or <-, but some don't (e.g. ls(all=TRUE)). The result is that my supposedly clean
2018 Apr 09
3
Question about subset
Hi, The help page for subset states "subset: logical expression indicating elements or rows to keep: missing values are taken as false." Before I try to re-invent the wheel, I would like to know if one of the base or recommended packages would contain a variant of the subset function that would consider missing values as true. Thanks
2009 Feb 03
2
Numeric class and sasxport.get
Dear R-users, The sasxport.get function (from the Hmisc package) automatically defines the class of imported variables. I have noticed that the class of theoretically numeric variables is simply "labelled", although character variables might end up been defined as "labelled" "Date" or "labelled" "factor". Is there a way to tell sasxport.get to
2009 May 14
1
Problem with viewports, print.trellis and more/newpage
Dear R-users, I have got the following problem. I need to create 4x2 arrays of xyplot's on several pages. The plots are created within a loop and plotted using the print function. It seems that I cannot find the proper grid syntax with my viewports, and the more/newpage arguments. The following script is a simplification but hopefully will suffice to illustrate my problem. Any suggestion
2009 Apr 28
1
Understanding padding in lattice
Dear R-users, I am trying to understand what the different padding arguments in trellis.par.set are exactly controlling the space around lattice plots. I have used the following code as a basis for testing but it did not really help me to visualize how the value of each argument changes the margins and the plotting area. I guess a better way to visualize the effects of these padding items
2009 Aug 01
3
Transparency and trellis device
Dear R-users, I am trying to produce trellis (png, or jpeg) graphs with transparent background, but I cannot manage to make that happen. I tried to play around with themes but to no avail. Any advise on the following example will be greatly appreciated: Thank you Sebastien #### library(lattice) df <- data.frame(a=rep(1:4,4), b=rep(1:4,4), c=rep(1:4,each=4)) settings <- standard.theme()