Browse Source

Archive and R code in separate files

master
Maxime Wack 4 years ago
parent
commit
a707a04806
3 changed files with 140 additions and 11 deletions
  1. +71
    -0
      functions.R
  2. +19
    -11
      notes.org
  3. +50
    -0
      notes.org_archive

+ 71
- 0
functions.R View File

@@ -0,0 +1,71 @@
get_type <- function(object)
{
if (is.list(object))
{
paste0("+",
if(is.data.frame(object)) "D"
else if(isS4(object)) "S"
else "L")
} else
{
paste0(" ",
if(is.function(object)) "f"
else if(is.numeric(object)) "n"
else if(is.character(object)) "c"
else if(inherits(object, "formula")) "F"
else if(is.logical(object)) "l")
}
}

list_objects <- function()
{
noms <- ls(envir = .GlobalEnv)
objects <- lapply(noms, get, envir = .GlobalEnv)
types <- lapply(objects, get_type)

Map(cat, types, noms, "\n") -> nul
}


list_objects()

class(unclass(x)) -> list | other
length(x)
names(x)

default_limit <- 5
current_limit <- default_limit

object_content <- function(x)
{
if (is.list(x))
{
noms <- if (is.null(names(x))) 1:length(x)
else names(x)
list <- ifelse(lapply(x, is.list), "*", "")
printdfleft(data.frame(list = list,
noms = noms))
}
}

object_content(irg)
object_content(irg[["data"]])
object_content(irg[["data"]][[1]])

search() "package:zzz"

list_packages <- function()
printdfleft(data.frame(packages = gsub("^package:", "",
Filter(function(x) grepl("^package:", x),
search()))))

list_packages()

objects("package:zzz")
class("package::zzz")

objects("package:dplyr")

detach("package:zzz")
help("package:zzz")
help("zzz::fun")

+ 19
- 11
notes.org View File

@@ -1,26 +1,34 @@
#+ARCHIVE: ::* Archive
* Tasks
** Create helper functions
*** TODO Define the format to convey all the needed information

| islist | type | pretty name | size ? | canonical name |

** TODO Allow user-defined actions on object at point
* Notes
** Objects
*** List

ls()

*** Content

class(unclass(x)) -> list | other
length(x)
names(x)

** Packages
*** List

search() "package:zzz"

*** Content

objects("package:zzz")
class("package::zzz")

*** Actions

detach("package:zzz")
help("package:zzz")
help("zzz::fun")

** Objects
*** List
ls()

*** Content
class(unclass(x)) -> list | other
length(x)
names(x)
* Archive

+ 50
- 0
notes.org_archive View File

@@ -0,0 +1,50 @@
# -*- mode: org -*-


Archived entries from file /home/maxx/Projects/r-object-browser/notes.org


* DONE Read about defining modes
:PROPERTIES:
:ARCHIVE_TIME: 2019-10-07 Mon 02:11
:ARCHIVE_FILE: ~/Projects/r-object-browser/notes.org
:ARCHIVE_OLPATH: Tasks
:ARCHIVE_CATEGORY: notes
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE" from "TODO" [2019-10-07 Mon 02:11]
:END:
[[info:elisp#Modes][info:elisp#Modes]]

Archived entries from file /home/maxx/Projects/r-object-browser/notes.org


* DONE Create R file with all functions
:PROPERTIES:
:ARCHIVE_TIME: 2019-10-07 Mon 02:11
:ARCHIVE_FILE: ~/Projects/r-object-browser/notes.org
:ARCHIVE_OLPATH: Tasks
:ARCHIVE_CATEGORY: notes
:ARCHIVE_TODO: DONE
:END:
:LOGBOOK:
- State "DONE" from "TODO" [2019-10-07 Mon 02:11]
:END:
It will be injected into the running R session when starting the object browser.

Archived entries from file /home/maxx/Projects/r-object-browser/notes.org


* CANCELED Function to output one tabulated line
:PROPERTIES:
:ARCHIVE_TIME: 2019-10-07 Mon 02:13
:ARCHIVE_FILE: ~/Projects/r-object-browser/notes.org
:ARCHIVE_OLPATH: Tasks/Create helper functions
:ARCHIVE_CATEGORY: notes
:ARCHIVE_TODO: CANCELED
:END:
:LOGBOOK:
- State "CANCELED" from "TODO" [2019-10-07 Mon 02:11] \\
`Map` and `cat` are sufficient
:END:

Loading…
Cancel
Save