similar to: What is a 'closure'?

Displaying 20 results from an estimated 6000 matches similar to: "What is a 'closure'?"

2012 Jan 18
5
Executable expressions
Given a<-"c(1,2,3,4,5)" How can  I evaluate the variable a to return a (numeric) vector comprising of 1,2,3,4,5? Thanks. [[alternative HTML version deleted]]
2012 Jan 29
2
Data Structure to Code
Given: data(AirPassengers) I get a ts data structure AirPassengers in the workspace. How can I generate the code that can create that structure? That is, given an example of a data structure, is there a way to generate the code that can greate that structure? Alternatively, is there a reference that provides a list of dta structures together with a full list of theor respective attributes?
2012 Jan 16
2
R for Windows: Is there a function/package that enables Win32 API Calls?
I am looking for a means to call Win32 API calls from R for Windows. Is that possible? Thanks. [[alternative HTML version deleted]]
2012 Jan 21
2
How to identify data structure?
data(AirPassengers) brings AirPassengers into the workspace. How can I  idenfity what the structure of AirPassengers is? Is it a data.frame, a table etc. etc. [[alternative HTML version deleted]]
2012 Jan 22
2
R interactive = FALSE
I haven't been able to find an example of using R with interactive = FALSE. How do I start R such that 1. it loads a workspace 2. then starts execution with a function (in that workspace) that I choose 3. exits on completion Thanks. [[alternative HTML version deleted]]
2012 Mar 08
2
Classification by range
Given studentNumbers<-10; subjEnglish<-sample(-1:100,studentNumbers,replace=TRUE); when subEnglish <=0, 'U'                         <=39, 'F'                         <=49 'D'                         <=59, 'C'                         <=69, 'B'                         <=79,'A'                         <=100 'A+' I
2012 Mar 18
2
Removing session variables
If I create a data.frame using session variables as follows: classResults<-data.frame(subjEnglish,gradeEnglish,subjFrench,gradeFrench,row.names=studentName) How can I remove the variables? I tried > rm(names(classResults)) Error in rm(names(classResults)) :   ... must contain names or character strings Also, how can I include the row.names variable. I tried > names(classResults)
2012 Jan 27
2
How to write the entire session to file?
savehistory writes all the executed lines from the session. How can I write everything (executed lines and output) from the active session to a file? Using Edit | Select All then Edit Copy, I can copy everything to the clipboard and write the whole thing to a file manually. If I just used the clipboard, I can paste the whole content into another edittor (for documentation). Is there a way to
2012 Feb 17
1
R's list data structure
Given dayOfWeekName<-c("Mon","Tue","Wed","Thu","Fri","Sat","Sun"); dayOfWeekOrdinal<-c(1,2,3,4,5,6,0); dayOfWeekWorkDay<-c(TRUE,TRUE,TRUE,TRUE,TRUE,FALSE,FALSE); weekProfile<-list(dow=dayOfWeekName,dowI=dayOfWeekOrdinal,dowW=dayOfWeekWorkDay) 1. How can I conditionally get dow, dowI, and dowW from weekProfile?
2012 Feb 20
3
Confused: Inconsistent result?
This is copy & paste from my session: > xyz<-as.vector(c(ls(),as.matrix(lapply(ls(),class)))) > dim(xyz)<-c(length(xyz)/2,2) > > allobj<-function(){ + xyz<-as.vector(c(ls(),as.matrix(lapply(ls(),class)))); + dim(xyz)<-c(length(xyz)/2,2); + return(xyz) + } > xyz       [,1]              [,2]        [1,] "a"               "character"  [2,]
2012 Jan 18
1
R Table
Given a table with colnames and rownames, print(mytable) displays the table nicely formatted. How can I capture all of what is displayed as a character matrix? Thanks. [[alternative HTML version deleted]]
2012 Jan 21
1
Enumerate the class of objects
ls() gives me the vector of objects in the workspace class(objName) gives me the class of objName class(ls()) just returns character as many times as there are objects. How do I get a vector of all objects in the workspace? [[alternative HTML version deleted]]
2012 Jan 29
1
How I assign the result of a plot to a variable?
I can write a plot to a files of a given format using this: x<-sample(c(1:100),10) bmp("c:/mygraph.bmp") plot(x) dev.off() and then show the image file in another application. This application can also display the image from the stream of numbers that define the image. How I can get the plot as a stream of numbers? [[alternative HTML version deleted]]
2012 Mar 07
1
Can a matrix with several rows and columns ...
be sorted by row in ascending/descending order? Given this matrix:  57 91 31 61 16  84  3 99 85 47  21  6 57 91 31  61 16 84  3 99 I want to end with this:  21  6 57 91 31  57 91 31 61 16  61 16 84  3 99  84  3 99 85 47 The 'order' of the sort is: 3 1 4 2 Also, what R expression will give me the 'order'? Thanks. [[alternative HTML version deleted]]
2012 Jan 18
1
Executable Expressions II
Thank you Michael, Sarah and Robin for the answers to my original question. Michael you asked:"But this is rarely a good idea....perhaps you could say a little more about your overall goal and we could direct you to a more "R"-ish solution? " I realise eval (known as execute in one of my other languages) is not a good idea. The background to my question is as follows: Using
2011 Oct 18
9
readRDS and saveRDS
Hi all, Is there any chance that readRDS and saveRDS might one day become read.rds and write.rds? That would make them more consistent with the other reading and writing functions. Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/
2011 Aug 30
2
Non-GPL C (or R) inside of a package
R-devel, I am interested in creating a package that requires non-GPL'd (commercial) C code to work. In essence it is a single .c file with no use of R headers (all .C callable functions). For example's sake: 1 #include <stdio.h> 2 3 void test (int *a) { 4 *a = 101; 5 } The package isn't destined for CRAN, and I realize that this isn't R-legal, but looking for
2012 Feb 10
1
which R package is used for browsing web pages through coding
i know RCurl pakage to retrieve web content,it has limited use, i want interactive package like (in perl--->Mechanize, In java--->Watij,Prowser,HTMLunit,HTTPunit, in Ruby---->Watir ,etc) this modules/packages opens appropriate browser,which can create queries,retrieves output, clicks buttons, fill up form automatically,searches keyword in search engine, Downloads many items from
2012 Mar 06
2
Why aren't row names in a data frame unique?
I expected the row names to be unique but a data frame appears to be able to hold duplicate row names. This makes me thing that there must be circumstances when it is necessary. However, I cannot think of any. Please enlighten me. [[alternative HTML version deleted]]
2012 Mar 01
2
Julia
My purpose in mentioning the Julia language (julialang.org) here is not to start a flame war. I find it to be a very interesting development and others who read this list may want to read about it too. It is still very much early days for this language - about the same stage as R was in 1995 or 1996 when only a few people knew about it - but Julia holds much potential. There is a thread about