./PaxHeaders.29945/dataframe-1.2.00000644000000000000000000000013213147547161013300 xustar0030 mtime=1503579761.877618362 30 atime=1503579761.961619538 30 ctime=1503579761.961619538 dataframe-1.2.0/0000755000175000017500000000000013147547161013373 5ustar00olafolaf00000000000000dataframe-1.2.0/PaxHeaders.29945/INDEX0000644000000000000000000000013213147547161014012 xustar0030 mtime=1503579761.877618362 30 atime=1503579761.877618362 30 ctime=1503579761.961619538 dataframe-1.2.0/INDEX0000644000175000017500000000406013147547161014165 0ustar00olafolaf00000000000000dataframe >> Data manipulation toolbox similar to R data.frame Dataframe @dataframe/abs @dataframe/acosh @dataframe/acos @dataframe/all @dataframe/and @dataframe/angle @dataframe/any @dataframe/arg @dataframe/asinh @dataframe/asin @dataframe/atanh @dataframe/atan @dataframe/bsxfun @dataframe/cat @dataframe/ceil @dataframe/char @dataframe/columns @dataframe/conj @dataframe/cosh @dataframe/cos @dataframe/cumprod @dataframe/cumsum @dataframe/dataframe @dataframe/display @dataframe/end @dataframe/eq @dataframe/erfc @dataframe/erfcx @dataframe/erfinv @dataframe/erf @dataframe/exp @dataframe/expm1 @dataframe/find @dataframe/finite @dataframe/fix @dataframe/floor @dataframe/fold @dataframe/gamma @dataframe/ge @dataframe/gt @dataframe/horzcat @dataframe/imag @dataframe/index @dataframe/inv @dataframe/ipermute @dataframe/isbool @dataframe/iscell @dataframe/iscellstr @dataframe/ischar @dataframe/isempty @dataframe/isfield @dataframe/isinf @dataframe/islogical @dataframe/ismatrix @dataframe/isna @dataframe/isnan @dataframe/isnumeric @dataframe/isscalar @dataframe/isvector @dataframe/kron @dataframe/ldivide @dataframe/le @dataframe/lgamma @dataframe/log10 @dataframe/log1p @dataframe/log2 @dataframe/log @dataframe/lt @dataframe/max @dataframe/min @dataframe/minus @dataframe/mldivide @dataframe/mrdivide @dataframe/mtimes @dataframe/ndims @dataframe/ne @dataframe/not @dataframe/nth_element @dataframe/numel @dataframe/or @dataframe/permute @dataframe/plus @dataframe/power @dataframe/private @dataframe/prod @dataframe/rdivide @dataframe/real @dataframe/repmat @dataframe/reshape @dataframe/roundb @dataframe/round @dataframe/rows @dataframe/signum @dataframe/sinh @dataframe/sin @dataframe/size @dataframe/sort @dataframe/sqrt @dataframe/strncmp @dataframe/subsasgn @dataframe/subsindex @dataframe/subsref @dataframe/sum @dataframe/summary @dataframe/sumsq @dataframe/tanh @dataframe/tan @dataframe/times @dataframe/uminus @dataframe/uplus @dataframe/vertcat @dataframe/xor dataframe-1.2.0/PaxHeaders.29945/Makefile0000644000000000000000000000013213147547161014660 xustar0030 mtime=1503579761.877618362 30 atime=1503579761.877618362 30 ctime=1503579761.961619538 dataframe-1.2.0/Makefile0000644000175000017500000002030713147547161015035 0ustar00olafolaf00000000000000## Copyright 2015-2016 Carnë Draug ## Copyright 2015-2016 Oliver Heimlich ## Copyright 2017 Julien Bect ## Copyright 2017 Olaf Till ## ## Copying and distribution of this file, with or without modification, ## are permitted in any medium without royalty provided the copyright ## notice and this notice are preserved. This file is offered as-is, ## without any warranty. ## Some basic tools (can be overriden using environment variables) SED ?= sed TAR ?= tar GREP ?= grep CUT ?= cut TR ?= tr ## Note the use of ':=' (immediate set) and not just '=' (lazy set). ## http://stackoverflow.com/a/448939/1609556 package := $(shell $(GREP) "^Name: " DESCRIPTION | $(CUT) -f2 -d" " | \ $(TR) '[:upper:]' '[:lower:]') version := $(shell $(GREP) "^Version: " DESCRIPTION | $(CUT) -f2 -d" ") ## This are the paths that will be created for the releases. Using ## $(realpath ...) avoids problems with symlinks. target_dir := $(realpath .)/target release_dir := $(target_dir)/$(package)-$(version) release_tarball := $(target_dir)/$(package)-$(version).tar.gz html_dir := $(target_dir)/$(package)-html html_tarball := $(target_dir)/$(package)-html.tar.gz installation_dir := $(target_dir)/.installation package_list := $(installation_dir)/.octave_packages install_stamp := $(installation_dir)/.install_stamp ## These can be set by environment variables which allow to easily ## test with different Octave versions. ifndef OCTAVE OCTAVE := octave endif OCTAVE := $(OCTAVE) --no-gui --silent --no-history --norc MKOCTFILE ?= mkoctfile ## Command used to set permissions before creating tarballs FIX_PERMISSIONS ?= chmod -R a+rX,u+w,go-w,ug-s ## Detect which VCS is used vcs := $(if $(wildcard .hg),hg,$(if $(wildcard .git),git,unknown)) ifeq ($(vcs),hg) release_dir_dep := .hg/dirstate endif ifeq ($(vcs),git) release_dir_dep := .git/index endif ## .PHONY indicates targets that are not filenames ## (https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html) .PHONY: help ## make will display the command before runnning them. Use @command ## to not display it (makes specially sense for echo). help: @echo "Targets:" @echo " dist - Create $(release_tarball) for release." @echo " html - Create $(html_tarball) for release." @echo " release - Create both of the above and show md5sums." @echo " install - Install the package in $(installation_dir), where it is not visible in a normal Octave session." @echo " check - Execute package tests." @echo " doctest - Test the help texts with the doctest package." @echo " run - Run Octave with the package installed in $(installation_dir) in the path." @echo " clean - Remove everything made with this Makefile." ## ## Recipes for release tarballs (package + html) ## .PHONY: release dist html clean-tarballs clean-unpacked-release ## To make a release, build the distribution and html tarballs. release: dist html md5sum $(release_tarball) $(html_tarball) @echo "Upload @ https://sourceforge.net/p/octave/package-releases/new/" @echo " and note the changeset the release corresponds to" ## dist and html targets are only PHONY/alias targets to the release ## and html tarballs. dist: $(release_tarball) html: $(html_tarball) ## An implicit rule with a recipe to build the tarballs correctly. %.tar.gz: % $(TAR) -c -f - --posix -C "$(target_dir)/" "$(notdir $<)" | gzip -9n > "$@" clean-tarballs: @echo "## Cleaning release tarballs (package + html)..." -$(RM) $(release_tarball) $(html_tarball) @echo ## Create the unpacked package. ## ## Notes: ## * having ".hg/dirstate" (or ".git/index") as a prerequesite means it is ## only rebuilt if we are at a different commit. ## * the variable RM usually defaults to "rm -f" ## * having this recipe separate from the one that makes the tarball ## makes it easy to have packages in alternative formats (such as zip) ## * note that if a commands needs to be run in a specific directory, ## the command to "cd" needs to be on the same line. Each line restores ## the original working directory. $(release_dir): $(release_dir_dep) -$(RM) -r "$@" ifeq (${vcs},hg) hg archive --exclude ".hg*" --type files "$@" endif ifeq (${vcs},git) git archive --format=tar --prefix="$@/" HEAD | $(TAR) -x $(RM) "$@/.gitignore" endif ## Don't fall back to run the supposed necessary contents of ## 'bootstrap' here. Users are better off if they provide ## 'bootstrap'. Administrators, checking build reproducibility, can ## put in the missing 'bootstrap' file if they feel they know its ## necessary contents. ifneq (,$(wildcard src/bootstrap)) cd "$@/src" && ./bootstrap && $(RM) -r "autom4te.cache" endif ## Uncomment this if your src/Makefile.in has these targets for ## pre-building something for the release (e.g. documentation). # cd "$@/src" && ./configure && $(MAKE) prebuild && \ # $(MAKE) distclean && $(RM) Makefile ## ${FIX_PERMISSIONS} "$@" run_in_place = $(OCTAVE) --eval ' pkg ("local_list", "$(package_list)"); ' \ --eval ' pkg ("load", "$(package)"); ' html_options = --eval 'options = get_html_options ("octave-forge");' ## Uncomment this for package documentation. # html_options = --eval 'options = get_html_options ("octave-forge");' \ # --eval 'options.package_doc = "$(package).texi";' $(html_dir): $(install_stamp) $(RM) -r "$@"; $(run_in_place) \ --eval ' pkg load generate_html; ' \ $(html_options) \ --eval ' generate_package_html ("$(package)", "$@", options); '; $(FIX_PERMISSIONS) "$@"; clean-unpacked-release: @echo "## Cleaning unpacked release tarballs (package + html)..." -$(RM) -r $(release_dir) $(html_dir) @echo ## ## Recipes for installing the package. ## .PHONY: install clean-install octave_install_commands = \ ' llist_path = pkg ("local_list"); \ mkdir ("$(installation_dir)"); \ load (llist_path); \ local_packages(cellfun (@ (x) strcmp ("$(package)", x.name), local_packages)) = []; \ save ("$(package_list)", "local_packages"); \ pkg ("local_list", "$(package_list)"); \ pkg ("prefix", "$(installation_dir)", "$(installation_dir)"); \ pkg ("install", "-local", "-verbose", "$(release_tarball)"); ' ## Install unconditionally. Maybe useful for testing installation with ## different versions of Octave. install: $(release_tarball) @echo "Installing package under $(installation_dir) ..." $(OCTAVE) --eval $(octave_install_commands) touch $(install_stamp) ## Install only if installation (under target/...) is not current. $(install_stamp): $(release_tarball) @echo "Installing package under $(installation_dir) ..." $(OCTAVE) --eval $(octave_install_commands) touch $(install_stamp) clean-install: @echo "## Cleaning installation under $(installation_dir) ..." -$(RM) -r $(installation_dir) @echo ## ## Recipes for testing purposes ## .PHONY: run doctest check ## Start an Octave session with the package directories on the path for ## interactice test of development sources. run: $(install_stamp) $(run_in_place) --persist ## Test example blocks in the documentation. Needs doctest package ## https://octave.sourceforge.io/doctest/index.html doctest: $(install_stamp) $(run_in_place) --eval 'pkg load doctest;' \ --eval "targets = '$(shell (ls inst; ls src | $(GREP) .oct) | $(CUT) -f2 -d@ | $(CUT) -f1 -d.)';" \ --eval "targets = strsplit (targets, ' '); doctest (targets);" ## Test package. #octave_test_commands = \ #' dirs = {"inst", "src"}; \ # dirs(cellfun (@ (x) ! isdir (x), dirs)) = []; \ # if (isempty (dirs)) error ("no \"inst\" or \"src\" directory"); exit (1); \ # else __run_test_suite__ (dirs, {}); endif ' # ## the following works, too, but provides no overall summary output as ## __run_test_suite__ does: ## ## else cellfun (@runtests, horzcat (cellfun (@ (dir) ostrsplit (([~, dirs] = system (sprintf ("find %s -type d", dir))), "\n\r", true), dirs, "UniformOutput", false){:})); endif ' check: $(install_stamp) $(run_in_place) --eval 'dataframe_test' ## ## CLEAN ## .PHONY: clean clean: clean-tarballs clean-unpacked-release clean-install @echo "## Removing target directory (if empty)..." -rmdir $(target_dir) @echo @echo "## Cleaning done" @echo dataframe-1.2.0/PaxHeaders.29945/inst0000644000000000000000000000013213147547161014120 xustar0030 mtime=1503579761.925619034 30 atime=1503579761.961619538 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/0000755000175000017500000000000013147547161014350 5ustar00olafolaf00000000000000dataframe-1.2.0/inst/PaxHeaders.29945/dataframe_test.m0000644000000000000000000000013213147547161017336 xustar0030 mtime=1503579761.925619034 30 atime=1503579761.925619034 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/dataframe_test.m0000644000175000017500000002156313147547161017520 0ustar00olafolaf00000000000000%# -*- mode: Octave -*- %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . %# this file is mostly identical to 'dataframe', except that fragments %# can be easily extracted and run in interactive mode. x = dataframe(randn(3, 3), 'rownames', (7:-1:5).'); x(1:3, 1) = 3; x(1:3, 1) = (4:6).'; assert(x.array(2, 1), 5) x(1, 1:3) = 3; x(1, 1:3) = (4:6).'; assert(x.array(1, 2), 5) assert(isempty(x.rowidx), false) x.types(2) ='single'; assert(class(x.array(1, 2)), 'single') x=dataframe('data_test.csv'); assert(isna(x.array(9, 4))) # remove rownames x.rownames = []; assert(size(x.rownames), [0 0]) # remove a column through '.' access y = x; y.DataName = []; if (strcmp (genvarname ('_A'), 'x_A')) assert(size(y(:, 'x_IBIAS_')), [10 1]) else assert(size(y(:, '_IBIAS_')), [10 1]) end assert(size(y), [10 6]) y = repmat([false true], 10, 1); y(4) = true; z = x(:, ["VBIAS"; "Freq"])==[-5.4 300e3]; assert(z.array(:, :), y) assert(find(all(z, 2)), 4) assert(sum(x(:, 'VBIAS')).array(), -51) assert(cumsum(x(:, 'VBIAS')).array(), cumsum(x.array(:, 'VBIAS'))) assert(sum(x(:, 5:6), 2).array(), sum(x.array(:, 5:6), 2)) assert(cumsum(x(:, 5:6), 2).array(), cumsum(x.array(:, 5:6), 2)) assert(nth_element(x.array(:, 4:6), 2:3), nth_element(x(:, 4:6), 2:3).array) y = x{}; assert(size(y), [10 7]) y = x{[2 5], [2 7]}; assert(y, {-5.8, "E"; -5.2, "C"}) y = x{}([2 5], [2 7]); assert(y, {-5.8, "E"; -5.2, "C"}) y = x{1:2, 1:2}(4); assert(y, {-5.8}) # remove a column through (:, name) access y = x; y(:, "DataName") = []; assert(size(y), [10 6]) # create an empty dataframe y = dataframe([]); assert(isempty(y), true) y = x.df(:, 2:6); Y = 2*pi*double(y.Freq).*y.C+y.GOUT; z = dataframe(y,{{'Y'; Y}}); assert(size(z), [10 6]) assert(abs(z(1, "Y") - Y(1)).array, 0) # direct matrix setting through struct access y.Freq=[(1:10).' (10:-1:1).']; # verify the "end" operator on the third dim assert(y.array(2, 2, end), 9) # direct setting through 3D matrix y(:, ["C"; "G"], 1:2) = repmat(y(:, ["C"; "G"]), [1 1 2]); y(4:5, 4:5) = NaN; # test if any(size(x) != [10 7]), error('x: wrong input size') endif if any(size(y) != [10 5 2]), error('y: wrong input size') endif # THIS MAY NOT CHANGE! numel is called by subsasgn and interfere # if not returning 1 assert(numel(x), 1) assert(numel(x, ':'), 70) assert(numel(x, ':', 'Freq'), 10) assert(numel(x, ':', [1 3 5]), 30) assert(numel(x, ':', [1 3 5]), 30) assert(numel(x, x(:, "OK_") == 'A', ["C"; "G*"]), 4) # test simple slices assert(x.VBIAS(1:6), (-6:.2:-5).') assert(x.array(6:10, 2), (-5:.2:-4.2).') assert(x.array(6, "OK_"), 'B') assert(x.array(2, logical([0 0 1 1])), x.array(2, 3:4)) assert(size(y.array(:, :, :)), [10 5 2]) assert(size(y.array(:, :)), [10 10]) assert(size(y.array(:, 2, 2)), [10 1]) assert(size(y.array(:, 2)), [10 1]) assert(y.C(4:5), [NaN NaN]) myerr = false; errmsg = 'Line 90: Accessing dataframe past limits'; try x(1, 8) myerr = true; catch end if (myerr) error (errmsg); end errmsg = 'Line 97: Accessing dataframe past limits'; try x(11, 1) myerr = true; catch end if (myerr) error (errmsg); end errmsg = 'Line 104: Accessing dataframe past limits'; try x(1, logical(ones(1, 8))) myerr = true; catch end if (myerr) error (errmsg); end errmsg = 'Line 111: Accessing dataframe with unknown column name'; try x.types{"FReq*"} myerr = true; catch end if (myerr) error (errmsg); end # test #!! removed -- output format may only be specified before selection # select one column # assert(x(1:3, 1).cell(:), x.cell(1:3)(:)) # assert(x(33:35).cell.', x(33:35).cell(:)) # select two columns assert(x.cell(1:10, 2:3)(:), x.cell(11:30)(:)) errmsg = 'Line 126: Concatenating column of incompatible types'; try x(:); myerr = true; catch end if (myerr) error (errmsg); end errmsg = 'Line 133: Concatenating column of incompatible types'; try x.dataframe(:); myerr = true; catch end if (myerr) error (errmsg); end errmsg = 'Line 140: Illegal access'; try x.dataframe.cell myerr = true; catch end if (myerr) error (errmsg); end # test # test modifying column type x.types("Freq") = 'uint32'; x.types(2) = 'single'; # downclassing must occur ! assert(class(x.array(1, ["Freq"; "C"])), 'uint32') # upclassing must occur ! assert(class(x.as.double(1, ["Freq"; "C"])), 'double') errmsg = 'Line 154: Incorrect internal field sub-referencing'; try x.types{"Freq"} myerr = true; catch end if (myerr) error (errmsg); end # error errmsg='line :mixing different types") # removed: this now works, but downclassing to int # x([12:18 22:28 32:38]); errmsg = 'Line 164: non-square access'; try x.dataframe([22:28 32:37]); myerr = true; catch end if (myerr) error (errmsg); end errmsg = 'Line 171: non-square access'; try x.cell([1:19]); myerr = true; catch end if (myerr) error (errmsg); end errmsg = 'Line 176: single-dimension name access'; try x('Freq'); myerr = true; catch end if (myerr) error (errmsg); end # test # complex access x(x(:, "OK_") == '?', ["C"; "G*"]) = NaN; assert(x.array(4, 5:6), [NaN NaN]) # extract values y = x.dataframe(x(:, "OK_") =='A', {"Freq", "VB*", "C", "G"}); # comparison using cell output class, because assert use (:) assert(y.cell(:, 2:3), x.cell([1 7], ["VB*"; "C"])) assert(x.array((33:35).'), x.array(3:5, 4)) # test further dereferencing assert(x.array(:, "C")(2:4), x.array(2:4, "C")) # complex modifications through cell access z = dataframe(x, {"VB*", {"Polarity" ,"Sense"; ones(12,2), zeros(10,2)}}); assert(size(z), [12 9 2]) assert(z.Sense(11:12, :), NA*ones(2, 2)) assert(size(struct(z).x_over{2}, 2) - size(struct(x).x_over{2}, 2), 2) x = dataframe(randn(3, 3)); y = x.array; xl = x > 0; yl = y > 0; a = zeros(size(yl)); b = a; a(xl) = 1; b(yl) = 1; assert(a, b) [a, b] = sort(y(:)); y = reshape(b, 3, 3); x = dataframe(y); a = zeros(size(yl)); b = a; a(x) = 10:-1:2; b(y) = 10:-1:2; assert(a, b) x = dataframe(randn(3, 3)); y = randn(3, 3); z = dataframe(y); assert((x+y(1)).array, x.array+y(1)) assert((y(1)+x).array, y(1)+x.array) assert((x+y).array, x.array+y) assert((y+x).array, y+x.array) assert((x+z).array, x.array+z.array) assert((bsxfun(@plus, x, z(1,:))).array, bsxfun(@plus, x.array, z.array(1,:))) assert((bsxfun(@plus, x, z(:,1))).array, bsxfun(@plus, x.array, z.array(:,1))) assert((bsxfun(@minus,z(1,:),x)).array, bsxfun(@minus,z.array(1,:),x.array)) assert((bsxfun(@minus,z(:,1),x)).array, bsxfun(@minus,z.array(:,1),x.array)) assert((x > 0).array, x.array > 0) assert((0 > x).array, 0 > x.array) assert((x > y).array, x.array > y); assert((y > x).array, y > x.array); assert((x > z).array, x.array > z.array) assert((x*y(1)).array, x.array*y(1)) assert((y(1)*x).array, y(1)*x.array) assert((x.*y).array, x.array.*y) assert((y.*x).array, y.*x.array) assert((z.*x).array, z.array.*x.array) assert((x*y).array, x.array*y) assert((y*x).array, y*x.array) assert((x*z).array, x.array*z.array) assert((x/y(1)).array, x.array/y(1)) assert((x./y).array, x.array./y) assert((y./x).array, y./x.array) assert((z./x).array, z.array./x.array) assert((x/y).array, x.array/y) assert((y/x).array, y/x.array) assert((x/z).array, x.array/z.array) # left division is a bit more complicated assert((x(1, 1)\y).array, x.array(1, 1)\y, sqrt(eps)) assert((x(:, 1)\y).array, x.array(:, 1)\y, sqrt(eps)) assert((x(:, 1:2)\y).array, x.array(:, 1:2)\y, sqrt(eps)) assert((x\y).array, x.array\y, sqrt(eps)) assert((y\x).array, y\x.array, sqrt(eps)) assert((x\z).array, x.array\z.array, sqrt(eps)) x=dataframe(randn(4, 3, 2)); y=randn(4, 3, 2); z=dataframe(y); assert((abs(sum(center(x)) < sqrt(eps)).array)) assert((x+y).array, x.array+y) assert((y+x).array, y+x.array) assert((x+z).array, x.array+z.array) assert((bsxfun(@plus,x,z(1,:,:))).array, bsxfun(@plus,x.array,z.array(1,:,:))) assert((bsxfun(@plus,x,z(:,1,:))).array, bsxfun(@plus,x.array,z.array(:,1,:))) assert((bsxfun(@plus,z(1,:,:),x)).array, bsxfun(@plus,z.array(1,:,:),x.array)) assert((bsxfun(@plus,z(:,1,:),x)).array, bsxfun(@plus,z.array(:,1,:),x.array)) [a, b] = sort(x(:)); b = b(b <= 9); x = dataframe(reshape((1:9)(b), [3 3])); y = reshape((1:9)(b), [3 3]); z = dataframe(y); assert(x(x(:)), y(x(:))) assert(x(y(:)), y(y(:))) z= x(x); assert(z.array, y(x)) z = x(y); assert(z.array, y(y)) disp('All tests passed'); dataframe-1.2.0/inst/PaxHeaders.29945/dataframe0000644000000000000000000000013213147547161016044 xustar0030 mtime=1503579761.925619034 30 atime=1503579761.925619034 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/dataframe0000644000175000017500000002244213147547161016223 0ustar00olafolaf00000000000000%# -*- mode: Octave -*- %!shared a, b, x, xl, y, yl, Y, z %! x=dataframe(randn(3, 3), 'rownames', (7:-1:5).'); %! x(1:3, 1) = 3; %! x(1:3, 1) = (4:6).'; %!assert(x.array(2, 1), 5) %! x(1, 1:3) = 3; %! x(1, 1:3) = (4:6).'; %!assert(x.array(1, 2), 5) %!assert(isempty(x.rowidx), false) %! x.types(2) ='single'; %!assert(class(x.array(1, 2)), 'single') %! x=dataframe('data_test.csv'); %!assert(isna(x.array(9, 4))) %! # remove rownames %! x.rownames = []; %!assert(size(x.rownames), [0 0]) %! # remove a column through '.' access %! y = x; y.DataName = []; %! if (strcmp (genvarname ('_A'), 'x_A')) %! assert(size(y(:, 'x_IBIAS_')), [10 1]) %! else %! assert(size(y(:, '_IBIAS_')), [10 1]) %! end %!assert(size(y), [10 6]) %! y = repmat([false true], 10, 1); %! y(4) = true; %! z = x(:, ["VBIAS"; "Freq"])==[-5.4 300e3]; %!assert(z.array(:, :), y) %!assert(find(all(z, 2)), 4) %!assert(sum(x(:, 'VBIAS')).array(), -51) %!assert(cumsum(x(:, 'VBIAS')).array(), cumsum(x.array(:, 'VBIAS'))) %!assert(sum(x(:, 5:6), 2).array(), sum(x.array(:, 5:6), 2)) %!assert(cumsum(x(:, 5:6), 2).array(), cumsum(x.array(:, 5:6), 2)) %!assert(nth_element(x.array(:, 4:6), 2:3), nth_element(x(:, 4:6), 2:3).array) %! y = x{}; %!assert(size(y), [10 7]) %! y = x{[2 5], [2 7]}; %!assert(y, {-5.8, "E"; -5.2, "C"}) %! y = x{}([2 5], [2 7]); %!assert(y, {-5.8, "E"; -5.2, "C"}) %! y = x{1:2, 1:2}(4); %!assert(y, {-5.8}) %! # remove a column through (:, name) access %! y = x; y(:, "DataName") = []; %!assert(size(y), [10 6]) %! # create an empty dataframe %! y = dataframe([]); %!assert(isempty(y), true) %! y = x.df(:, 2:6); %! Y = 2*pi*double(y.Freq).*y.C+y.GOUT; %! z = dataframe(y,{{'Y'; Y}}); %!assert(size(z), [10 6]) %!assert(abs(z(1, "Y") - Y(1)).array, 0) %! # direct matrix setting through struct access %! y.Freq=[(1:10).' (10:-1:1).']; %! # verify the "end" operator on the third dim %!assert(y.array(2, 2, end), 9) %! # direct setting through 3D matrix %! y(:, ["C"; "G"], 1:2) = repmat(y(:, ["C"; "G"]), [1 1 2]); %! y(4:5, 4:5) = NaN; %!test %! if any(size(x) != [10 7]), %! error('x: wrong input size') %! endif %! if any(size(y) != [10 5 2]), %! error('y: wrong input size') %! endif %! # THIS MAY NOT CHANGE! numel is called by subsasgn and interfere %! # if not returning 1 %!assert(numel(x), 1) %!assert(numel(x, ':'), 70) %!assert(numel(x, ':', 'Freq'), 10) %!assert(numel(x, ':', [1 3 5]), 30) %!assert(numel(x, ':', [1 3 5]), 30) %!assert(numel(x, x(:, "OK_") == 'A', ["C"; "G*"]), 4) %! # test simple slices %!assert(x.VBIAS(1:6), (-6:.2:-5).') %!assert(x.array(6:10, 2), (-5:.2:-4.2).') %!assert(x.array(6, "OK_"), 'B') %!assert(x.array(2, logical([0 0 1 1])), x.array(2, 3:4)) %!assert(size(y.array(:, :, :)), [10 5 2]) %!assert(size(y.array(:, :)), [10 10]) %!assert(size(y.array(:, 2, 2)), [10 1]) %!assert(size(y.array(:, 2)), [10 1]) %!assert(y.C(4:5), [NaN NaN]) %!error error("Accessing past limits") %! x(1, 8) %! x(11, 1) %! x(1, logical(ones(1, 7))) %! x.types{"FReq*"} %! x(1, :) %!test %! #!! removed -- output format may only be specified before selection %! #select one column %! #assert(x(1:3, 1).cell(:), x.cell(1:3)(:)) %! #assert(x(33:35).cell.', x(33:35).cell(:)) %! #select two columns %!assert(x.cell(1:10, 2:3)(:), x.cell(11:30)(:)) %!error error("Complex accesses"); %! x(:); %! x.dataframe(:); %! x.dataframe.cell %!test %! # test modifying column type %! x.types("Freq") = 'uint32'; x.types(2) = 'single'; %! # downclassing must occur ! %!assert(class(x.array(1, ["Freq"; "C"])), 'uint32') %! # upclassing must occur ! %!assert(class(x.as.double(1, ["Freq"; "C"])), 'double') %!error error("Incorrect internal field sub-referencing") %! x.types{"Freq"} %!error error("mixing different types") %! x([12:18 22:28 32:38]); %!error error("non-square access") %! x.dataframe([22:28 32:37]); %! x.cell([1:19]); %!error error("Single-dimension name access") %! x("Freq"); %!test %! # complex access %! x(x(:, "OK_") == '?', ["C"; "G*"]) = NaN; %!assert(x.array(4, 5:6), [NaN NaN]) %! # extract values %! y = x.dataframe(x(:, "OK_") =='A', {"Freq", "VB*", "C", "G"}); %! #comparison using cell output class, because assert use (:) %!assert(y.cell(:, 2:3), x.cell([1 7], ["VB*"; "C"])) %!assert(x.array((33:35).'), x.array(3:5, 4)) %! #test further dereferencing %!assert(x.array(:, "C")(2:4), x.array(2:4, "C")) %! # complex modifications through cell access %! z = dataframe(x, {"VB*", {"Polarity" ,"Sense"; ones(12,2), zeros(10,2)}}); %!assert(size(z), [12 9 2]) %!assert(z.Sense(11:12, :), NA*ones(2, 2)) %!assert(size(struct(z).x_over{2}, 2) - size(struct(x).x_over{2}, 2), 2) %! x = dataframe(randn(3, 3)); y = x.array; %! xl = x > 0; yl = y > 0; %! a = zeros(size(yl)); b = a; %! a(xl) = 1; b(yl) = 1; %!assert(a, b) %! [a, b] = sort(y(:)); y = reshape(b, 3, 3); x = dataframe(y); %! a = zeros(size(yl)); b = a; %! a(x) = 10:-1:2; b(y) = 10:-1:2; %!assert(a, b) %! x = dataframe(randn(3, 3)); y = randn(3, 3); z = dataframe(y); %!assert((x+y(1)).array, x.array+y(1)) %!assert((y(1)+x).array, y(1)+x.array) %!assert((x+y).array, x.array+y) %!assert((y+x).array, y+x.array) %!assert((x+z).array, x.array+z.array) %!assert((bsxfun(@plus, x, z(1,:))).array, bsxfun(@plus, x.array, z.array(1,:))) %!assert((bsxfun(@plus, x, z(:,1))).array, bsxfun(@plus, x.array, z.array(:,1))) %!assert((bsxfun(@minus,z(1,:),x)).array, bsxfun(@minus,z.array(1,:),x.array)) %!assert((bsxfun(@minus,z(:,1),x)).array, bsxfun(@minus,z.array(:,1),x.array)) %!assert((x > 0).array, x.array > 0) %!assert((0 > x).array, 0 > x.array) %!assert((x > y).array, x.array > y); %!assert((y > x).array, y > x.array); %!assert((x > z).array, x.array > z.array) %!assert((x*y(1)).array, x.array*y(1)) %!assert((y(1)*x).array, y(1)*x.array) %!assert((x.*y).array, x.array.*y) %!assert((y.*x).array, y.*x.array) %!assert((z.*x).array, z.array.*x.array) %!assert((x*y).array, x.array*y) %!assert((y*x).array, y*x.array) %!assert((x*z).array, x.array*z.array) %!assert((x/y(1)).array, x.array/y(1)) %!assert((x./y).array, x.array./y) %!assert((y./x).array, y./x.array) %!assert((z./x).array, z.array./x.array) %!assert((x/y).array, x.array/y) %!assert((y/x).array, y/x.array) %!assert((x/z).array, x.array/z.array) % # left division is a bit more complicated %!assert((x(1, 1)\y).array, x.array(1, 1)\y,sqrt(eps)) %!assert((x(:, 1)\y).array, x.array(:, 1)\y, sqrt(eps)) %!assert((x(:, 1:2)\y).array, x.array(:, 1:2)\y, sqrt(eps)) %!assert((x\y).array, x.array\y, sqrt(eps)) %!assert((y\x).array, y\x.array, sqrt(eps)) %!assert((x\z).array, x.array\z.array, sqrt(eps)) % x=dataframe(randn(4, 3, 2)); y=randn(4, 3, 2); z=dataframe(y); %!assert((abs(sum(center(x)) < sqrt(eps)).array)) %!assert((x+y).array, x.array+y) %!assert((y+x).array, y+x.array) %!assert((x+z).array, x.array+z.array) %!assert((bsxfun(@plus,x,z(1,:,:))).array, bsxfun(@plus,x.array,z.array(1,:,:))) %!assert((bsxfun(@plus,x,z(:,1,:))).array, bsxfun(@plus,x.array,z.array(:,1,:))) %!assert((bsxfun(@plus,z(1,:,:),x)).array, bsxfun(@plus,z.array(1,:,:),x.array)) %!assert((bsxfun(@plus,z(:,1,:),x)).array, bsxfun(@plus,z.array(:,1,:),x.array)) %! [a, b] = sort(x(:)); b = b(b <= 9); %! x=dataframe(reshape((1:9)(b), [3 3])); %! y = reshape((1:9)(b), [3 3]); z = dataframe(y); %!assert(x(x(:)), y(x(:))) %!assert(x(y(:)), y(y(:))) %! z= x(x); %!assert(z.array, y(x)) %! z = x(y); %!assert(z.array, y(y)) %!demo %! x=dataframe('data_test.csv') %! disp("Access as a struct: x.VBIAS(1:6)") %! x.VBIAS(1:6) %! pause; disp("Access as a matrix: x(6, 'OK')") %! x(6, "OK?") %! pause; disp("Removing the row names: x.rownames = []"); %! x.rownames = [] %! pause; disp("Modifying column type: x.types['Freq']='uint32'"); %! x.types("Freq")='uint32' %! pause; disp("Partial extract"); %! disp("y = x(x(:, 'OK.') == 'A'|x(:, ""OK?"") == 'B', {'Freq', 'VB*', 'C', 'G'}") %! y = x(x(:, 'OK.') == 'A'|x(:, "OK?") == 'B', {'Freq', 'VB*', 'C', 'G'}) %! disp("y.rownames = char({'low', 'med', 'med', 'high'})"); %! y.rownames = char({'low', 'med', 'med', 'high'}) %! pause; disp("Partial modification of one column") %! disp("y.Freq('med')=[290e3; 310e3]") %! y.Freq('med') = [290e3; 310e3] %! pause; disp('Complex access'); %! disp("y.C('med')([2 1])"); %! y.C('med')([2 1]) %! pause; disp('Print stats about a dataframe: summary(y)'); %! summary(y) %!demo %! disp('Modifying a dataframe from a cell array') %! RHS={ 'don''t care', 'idx', 'Vb', 'freq', 'Ib', 'C', 'status', 'comment' %! 'yes', uint16(5), single(3.2), 10000, 1e-11, 6e-13, 'bla', '@' %! 'no', uint16(16), 4, 12000, 2e-11, 4e-13, 7, 'X'}; %! disp("Resetting a dataframe: x=dataframe([])"); %! x = dataframe([]); %! x(:, :) = RHS %! disp("Overwriting the second line") %! RHS{1, 2} = "idg"; RHS{3, 1}= "No!"; %! disp("'x(2, :) = RHS(1:2, :)' will produce two warnings") %! disp("Notice that only the second line content will change"); %! disp("x(2, :) = RHS(1:2, :)") %! x(2, :) = RHS(1:2, :) %! pause; disp('same effect, but skipping first column'); %! disp("x(1, :) = RHS([1 3], 2:end)"); %! x(1, []) = RHS([1 3], 2:end) %!demo %! disp("same game, but using row indexes.") %! disp("Notice the first field name is empty") %! RHS= { '', 'idx', 'Vb', 'freq', 'Ib', 'C', 'status', 'comment' %! 5, uint32(16), 5.3, 11000, 3e-12, 5e-12, "may", "8th"}; %! disp("x= dataframe(RHS)") %! x = dataframe(RHS) %! pause; disp("The same effect is achieved by assigning to an empty dataframe") %! x = dataframe([]); %! x(:, :) = RHS dataframe-1.2.0/inst/PaxHeaders.29945/@dataframe0000644000000000000000000000013213147547161016144 xustar0030 mtime=1503579761.925619034 30 atime=1503579761.961619538 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/0000755000175000017500000000000013147547161016374 5ustar00olafolaf00000000000000dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/round.m0000644000000000000000000000013213147547161017526 xustar0030 mtime=1503579761.917618922 30 atime=1503579761.917618922 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/round.m0000644000175000017500000000161613147547161017705 0ustar00olafolaf00000000000000function resu = round(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@round, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/log1p.m0000644000000000000000000000013213147547161017421 xustar0030 mtime=1503579761.901618698 30 atime=1503579761.901618698 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/log1p.m0000644000175000017500000000161613147547161017600 0ustar00olafolaf00000000000000function resu = log1p(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@log1p, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/isscalar.m0000644000000000000000000000013213147547161020200 xustar0030 mtime=1503579761.897618642 30 atime=1503579761.897618642 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/isscalar.m0000644000175000017500000000177213147547161020362 0ustar00olafolaf00000000000000function resu = isscalar(df) %# function resu = isscalar(df) %# returns true if the dataframe can be converted to a vector %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = ismatrix (df) & (length (find (df.x_cnt > 1)) < 1); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/sort.m0000644000000000000000000000013213147547161017366 xustar0030 mtime=1503579761.917618922 30 atime=1503579761.917618922 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/sort.m0000644000175000017500000001073413147547161017546 0ustar00olafolaf00000000000000function [resu, idx] = sort(df, varargin) %# -*- texinfo -*- %# @deftypefn {Loadable Function} {[@var{s}, @var{i}] =} sort (@var{x}) %# @deftypefnx {Loadable Function} {[@var{s}, @var{i}] =} sort (@var{x}, @var{dim}) %# @deftypefnx {Loadable Function} {[@var{s}, @var{i}] =} sort (@var{x}, @var{mode}) %# @deftypefnx {Loadable Function} {[@var{s}, @var{i}] =} sort (@var{x}, @var{dim}, @var{mode}) %# Return a copy of @var{x} with the elements arranged in increasing %# order. For matrices, @code{sort} orders the elements in each column. %# %# For example: %# %# @example %# @group %# sort ([1, 2; 2, 3; 3, 1]) %# @result{} 1 1 %# 2 2 %# 3 3 %# %# @end group %# @end example %# %# The @code{sort} function may also be used to produce a matrix %# containing the original row indices of the elements in the sorted %# matrix. For example: %# %# @example %# @group %# [s, i] = sort ([1, 2; 2, 3; 3, 1]) %# @result{} s = 1 1 %# 2 2 %# 3 3 %# @result{} i = 1 3 %# 2 1 %# 3 2 %# @end group %# @end example %# %# If the optional argument @var{dim} is given, then the matrix is sorted %# along the dimension defined by @var{dim}. The optional argument @code{mode} %# defines the order in which the values will be sorted. Valid values of %# @code{mode} are `ascend' or `descend'. %# %# For equal elements, the indices are such that the equal elements are listed %# in the order that appeared in the original list. %# %# The @code{sort} function may also be used to sort strings and cell arrays %# of strings, in which case the dictionary order of the strings is used. %# %# The algorithm used in @code{sort} is optimized for the sorting of partially %# ordered lists. %# @end deftypefn %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . %# %# $Id$ %# if (~isa (df, 'dataframe')) resu = []; return; end dim = []; mode = []; vout= varargin; indi = 1; while (indi <= length (varargin)) if (isnumeric (varargin{indi})) if (~isempty (dim)) print_usage ('@dataframe/sort'); resu = []; return else dim = varargin{indi}; if (3 == dim) vout(indi) = 2; end end else if (~isempty (mode)) print_usage ('@dataframe/sort'); resu = []; return else sort = varargin{indi}; end end indi = indi + 1; end; if (isempty (dim)) dim = 1; end %# pre-assignation resu = struct (df); switch(dim) case {1} for indi = (1:resu.x_cnt(2)) [resu.x_data{indi}, idx(:, indi, :)] = sort ... (resu.x_data{indi}(:, resu.x_rep{indi}), varargin{:}); resu.x_data{indi} = squeeze (resu.x_data{indi}); resu.x_rep{indi} = 1:size(resu.x_data{indi}, 2); end if (all ([1 == size(idx, 2) 1 == size(idx, 3)])) if (size (resu.x_ridx, 1) == resu.x_cnt(1)) resu.x_ridx = resu.x_ridx(idx, :); end if (~isempty (resu.x_name{1, 1})) resu.x_name{1, 1} = resu.x_name{1, 1}(idx); resu.x_over{1, 1} = resu.x_over{1, 1}(idx); end else %# data where mixed resu.x_ridx = idx; resu.x_name{1, 1} = []; resu.x_over{1, 1} = []; end case {2} error ('Operation not implemented'); case {3} for indi = (1:resu.x_cnt(2)) [resu.x_data{1, indi}, idx(:, indi)] = sort (resu.x_data{1, indi}, vout(:)); end otherwise error ('Invalid dimension %d', dim); end dummy = dbstack (); if (any (strmatch ('quantile', {dummy.name}))) resu = df_whole (resu); else resu = dataframe (resu); end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/isnumeric.m0000644000000000000000000000013213147547161020375 xustar0030 mtime=1503579761.897618642 30 atime=1503579761.897618642 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/isnumeric.m0000644000175000017500000000245613147547161020557 0ustar00olafolaf00000000000000function resu = isnumeric(df) %# function resu = isnumeric(df) %# returns true if the dataframe contains only numeric columns %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . df_is_num = isnumeric(df.x_data{1}); df_is_char = ischar(df.x_data{1}); for indi = df.x_cnt(2):-1:2, df_is_num = df_is_num & isnumeric(df.x_data{indi}); df_is_char = df_is_char & ischar(df.x_data{indi}); end resu = isnumeric(zeros(0, class(sum(cellfun(@(x) zeros(1, class(x(1))),... df.x_data))))); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/fix.m0000644000000000000000000000013013147547161017163 xustar0029 mtime=1503579761.88961853 29 atime=1503579761.88961853 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/fix.m0000644000175000017500000000161213147547161017340 0ustar00olafolaf00000000000000function resu = fix(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@fix, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/permute.m0000644000000000000000000000013213147547161020060 xustar0030 mtime=1503579761.905618754 30 atime=1503579761.905618754 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/permute.m0000644000175000017500000000652413147547161020242 0ustar00olafolaf00000000000000function resu = permute(df, perm) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = dataframe (); if (length (df.x_cnt) >= length (perm)) resu.x_cnt = df.x_cnt(perm); else resu.x_cnt = [df.x_cnt 1](perm); end if (ndims (df.x_ridx) < 3) resu.x_ridx = permute (df.x_ridx, [min(perm(1), 2) min(perm(2:end))]); else resu.x_ridx = permute (df.x_ridx, perm); end if (size (resu.x_ridx, 1) < resu.x_cnt(1)) %# adjust index size, if required resu.x_ridx(end+1:resu.x_cnt(1), :, :) = NA; end if (2 == perm(1)), resu.x_name{1} = df.x_name{2}; resu.x_over{1} = df.x_over{2}; indc = length (resu.x_name{1}); indi = resu.x_cnt(1) - indc; if (indi > 0) %# generate a name for the new row(s) dummy = cstrcat (repmat ('_', indi, 1), ... strjust (num2str (indc + (1:indi).'), 'left')); resu.x_name{1}(indc + (1:indi)) = cellstr (dummy); resu.x_over{1}(1, indc + (1:indi)) = true; end else resu.x_name{1} = df.x_name{1}; resu.x_over{1} = df.x_over{1}; end if (2 == perm(2)) resu.x_name{2} = df.x_name{2}; resu.x_over{2} = df.x_over{2}; else resu.x_name{2} = df.x_name{1}; resu.x_over{2} = df.x_over{1}; end if (isempty (resu.x_name{2})), indc = 0; else indc = length (resu.x_name{2}); end indi = resu.x_cnt(2) - indc; if (indi > 0) %# generate a name for the new column(s) dummy = cstrcat (repmat ('_', indi, 1), ... strjust (num2str (indc + (1:indi).'), 'left')); resu.x_name{2}(indc + (1:indi)) = cellstr (dummy); resu.x_over{2}(1, indc + (1:indi)) = true; end if (2 ~= perm(2)), %# recompute the new type dummy = zeros (0, class (sum (cellfun (@(x) zeros (1, class(x(1))),... df.x_data)))); resu.x_type(1:resu.x_cnt(2)) = class (dummy); dummy = permute (df_whole(df), perm); for indi = (1:resu.x_cnt(2)) resu.x_data{indi} = squeeze (dummy(:, indi, :)); resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); end else %# 2 == perm(2) if (1 == perm(1)) %# blank operation resu.x_type = df.x_type; resu.x_data = df.x_data; resu.x_rep = df.x_rep; else for indi = (1:resu.x_cnt(2)) unfolded = df.x_data{indi}(:, df.x_rep{indi}); resu.x_data{indi} = permute (unfolded, [2 1]); resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); resu.x_type{indi} = df.x_type{indi}; end end end resu.x_src = df.x_src; resu.x_header = df.x_header; resu.x_cmt = df.x_cmt; end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/isnan.m0000644000000000000000000000013213147547161017507 xustar0030 mtime=1503579761.897618642 30 atime=1503579761.897618642 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/isnan.m0000644000175000017500000000161613147547161017666 0ustar00olafolaf00000000000000function resu = isnan(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@isnan, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/eq.m0000644000000000000000000000013213147547161017004 xustar0030 mtime=1503579761.885618474 30 atime=1503579761.885618474 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/eq.m0000644000175000017500000000174213147547161017163 0ustar00olafolaf00000000000000function resu = eq(A, B); %# function resu = eq(A, B) %# Implements the '==' operator when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_func(@eq, A, B); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/rationale.txt0000644000000000000000000000013213147547161020740 xustar0030 mtime=1503579761.913618866 30 atime=1503579761.913618866 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/rationale.txt0000644000175000017500000001224313147547161021115 0ustar00olafolaf000000000000001) Context I was recently performing I-V measurements of a MOS (Metal-Oxide-Semiconductor) structure. A full set of measurements contained a DC biaising voltage, a AC frequency, a small signal capacitance and conductance. I had to change a few times the measurement device configuration, so sometimes the sweeping occured first on frequency, then on voltage, sometimes in the reverse order. To make it short, I had to deal with many input files with inconsistent columns order. The code to identify this order quickly became clumsy. The idea of a dataframe is to implement a mix between matrix and cells. Its' like a matrix, where each column contains elements of the same type. Unlike a matrix, columns type may be dissimilar. Also, each colum MUST have a name, and rows MAY have a name. Moreover, to make it easy to interface with databases, each row must have an unique identifier. The goal is to make possible to use constructs like y(:, ["Fr*"; "VB*"; "C";"G"]) where y is the dataframe, and column selection is based on regexp. This way, the translation between names and indexes uses all the power of regexpes. 2) Implementation a dataframe is a class containing the following members: _cnt = [0 0] : row count, column count, ... nth dimension count _name = cell(1, 2) : row names, column names, ... _ridx = [] : a unique Id for each row _data = cell(0, 0) : a container for each column _type = cell(0, 0) : the type of each column The constructor can be used as - no argument: convert the whole workspace to a dataframe (TBD) - one null argument: return an empty dataframe - one numeric or cell argument: transform it to a dataframe; tries to infer column names from the name of the input argument. - one char array with more than one line: uses it as rownames - one single line char array: take it as the name of a file to read data from. Expected format is csv, try to be carefull with quoted/unquoted strings, also tries to remove trailing and leading spaces from string entries. Do not try to cope with things such as separator INSIDE quoted strings. -supplemental arguments may occur either as pairs (string, value), either as vectors. In the first case, the string contains an optional parameter whose value is contained in the next argument. In the second case, the argument is right-appended to the dataframe. Valid optional parameters are - rownames: a character array with the row names - unquot: a logical to indicate if strings must be unquoted, default=true - seeked: a string which must occur in the first row to start considering values. Previous lines are skipped. 3) Access (reading) - like a single matrix: df(:, 3); df(3, :). If all the results are of the same type, returns a matrix, otherwise a dataframe. This behavior can be inhibited by having the last argument set to 'dataframe': df(3, 3, 'dataframe') will return a one-by-one dataframe - by columnames: df(:, ["Fr*"; "VB*"; "C";]) will try to match a columname beginning by "F" followed by an optional 'r', thus 'F', 'Fréquence' and 'Freqs'; then a columname starting by "V" with an optional "B", like f.i. "VBias", then a columname with is the exact string 'C'. - by rownames: same principle - either member selector may also be logical: df(df.OK=='A', ['C';'G']) - as a struct: either use one of the column name (df.C), either use one of the allowed accessor for internal fields: "rownames", "colnames", "rowcnt", "colcnt", "rowidx", "types". Direct access to the members like y._type is allowed, but should be restricted to class members and friends. "types" accept both numeric and strings arguments, the latter being converter to column order based upon columns name. - as a cell: TODO: define how to fill the cell array with all the fields. 4) Modifying - as a matrix, using '()': use the same syntax as reading: df(3, 'Fr*') = 200 df(df.OK=='?', ['C'; 'G']) = NaN; Note that removing elements may only occur on a full row of colum basis. Removing a single element is not allowed. - as a struct: either access a columname, as df.C = []; either accessing the internal fields through entry points 'rownames' and 'colnames', where care is taken to adapt the strings width in order to make them compatibles. The entry point "types", with arguments numeric or strings, has the effect to cast whole column(s) to a new type: df.types{[3 5]} = 'uint16' df.type{"Freq"} = "uint32" - as a cell: TBD 5) other overloaded functions: display, size, numel, cat. The latter has to be thoroughfully tested. In particular, I've put the restriction that horizontal cat requires that the row indexes are the same for both elems. For vertical cat, how should we proceed ? Require uniqueness of row indexes, and sorting ? Other ? 6) to be done: - the 'load' function is in fact contained inside the constructor; maybe we should have a specific load function ? - be able to load a dataframe from a URI specification - write a simple 'save' function - adding data to a dataframe: R doesn't seems to allow adding rows to a data.frame, should we follow it ? - add test cases - implement a 'factor' class for categorised data - make all functions below statistics/ dataframe compatible Pascal Dupuis Louvain-la-Neuve, July First, 2010. dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/mtimes.m0000644000000000000000000000013213147547161017675 xustar0030 mtime=1503579761.901618698 30 atime=1503579761.901618698 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/mtimes.m0000644000175000017500000000216313147547161020052 0ustar00olafolaf00000000000000function resu = mtimes(A, B); %# function resu = mtimes(A, B) %# Implements the '*' operator when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . try resu = df_func (@mtimes, A, B, false, [true false]); catch disp (lasterr ()); error ('Operator * problem for %s vs. %s', class(A), class(B)); end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/imag.m0000644000000000000000000000013213147547161017314 xustar0030 mtime=1503579761.893618586 30 atime=1503579761.893618586 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/imag.m0000644000175000017500000000161413147547161017471 0ustar00olafolaf00000000000000function resu = imag(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@imag, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/plus.m0000644000000000000000000000013213147547161017362 xustar0030 mtime=1503579761.905618754 30 atime=1503579761.905618754 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/plus.m0000644000175000017500000000212713147547161017537 0ustar00olafolaf00000000000000function resu = plus(A, B); %# function resu = plus(A, B) %# Implements the '+' operator when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . try resu = df_func (@plus, A, B); catch disp (lasterr ()); error('Operator + problem for %s vs. %s', class(A), class(B)); end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/xor.m0000644000000000000000000000013213147547161017207 xustar0030 mtime=1503579761.925619034 30 atime=1503579761.925619034 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/xor.m0000644000175000017500000000174413147547161017370 0ustar00olafolaf00000000000000function resu = xor(A, B); %# function resu = xor(A, B) %# Implements the '??' operator when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_func(@xor, A, B); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/log.m0000644000000000000000000000013213147547161017160 xustar0030 mtime=1503579761.901618698 30 atime=1503579761.901618698 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/log.m0000644000175000017500000000161213147547161017333 0ustar00olafolaf00000000000000function resu = log(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@log, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/any.m0000644000000000000000000000013213147547161017166 xustar0030 mtime=1503579761.877618362 30 atime=1503579761.877618362 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/any.m0000644000175000017500000000171213147547161017342 0ustar00olafolaf00000000000000function resu = any(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (~isa (df, 'dataframe')) resu = []; return; end resu = df_mapper2 (@any, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/bsxfun.m0000644000000000000000000000013213147547161017704 xustar0030 mtime=1503579761.881618418 30 atime=1503579761.881618418 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/bsxfun.m0000644000175000017500000000266513147547161020070 0ustar00olafolaf00000000000000function resu = bsxfun(func, A, B) %# function resu = bsxfun(func, A, B) %# Implements a wrapper around internal bsxfun %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . try [A, B, resu] = df_basecomp (A, B, true, @bsxfun); for indi = (1:max (A.x_cnt(2), B.x_cnt(2))) indA = min (indi, A.x_cnt(2)); indB = min (indi, B.x_cnt(2)); Au = A.x_data{indA}(:, A.x_rep{indA}); Bu = B.x_data{indB}(:, B.x_rep{indB}); resu.x_data{indi} = bsxfun(func, Au, Bu); resu.x_rep{indi} = 1:size(resu.x_data{indi}, 2); end resu = df_thirddim (resu); catch disp (lasterr ()); error ('bsxfun: non-compatible dimensions') end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/cat.m0000644000000000000000000000013213147547161017146 xustar0030 mtime=1503579761.881618418 30 atime=1503579761.881618418 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/cat.m0000644000175000017500000001617513147547161017333 0ustar00olafolaf00000000000000function resu = cat(dim, A, varargin) %# function resu = cat(dim, A, varargin) %# This is the concatenation operator for a dataframe object. 'Dim' %# has the same meaning as ordinary cat. Next arguments may be %# dataframe, vector/matrix, or two elements cells. First one is taken %# as row/column name, second as data. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . try NA = NA; catch NA = NaN; end if (~isa (A, 'dataframe')), A = dataframe (A); end switch dim case 1 resu = A; for indi = (1:length (varargin)) B = varargin{indi}; if (~isa (B, 'dataframe')) if (iscell (B) && 2 == length (B)) B = dataframe (B{2}, 'rownames', B{1}); else B = dataframe (B, 'colnames', inputname(2+indi)); end end if (resu.x_cnt(2) ~= B.x_cnt(2)) error ('Different number of columns in dataframes'); end %# do not duplicate empty names if (~isempty (resu.x_name{1}) || ~isempty (B.x_name{1})) if (length (resu.x_name{1}) < resu.x_cnt(1)) resu.x_name{1}(end+1:resu.x_cnt(1), 1) = {''}; end if (length (B.x_name{1}) < B.x_cnt(1)) B.x_name{1}(end+1:B.x_cnt(1), 1) = {''}; end resu.x_name{1} = vertcat (resu.x_name{1}(:), B.x_name{1}(:)); resu.x_over{1} = [resu.x_over{1} B.x_over{1}]; end resu.x_cnt(1) = resu.x_cnt(1) + B.x_cnt(1); if (size (resu.x_ridx, 2) < size (B.x_ridx, 2)) resu.x_ridx(:, end+1:size(B.x_ridx, 2)) = NA; elseif (size (resu.x_ridx, 2) > size (B.x_ridx, 2)) B.x_ridx(:, end+1:size(resu.x_ridx, 2)) = NA; end resu.x_ridx = [resu.x_ridx; B.x_ridx]; %# find data with same column names dummy = A.x_over{2} & B.x_over{2}; indA = true (1, resu.x_cnt(2)); indB = true (1, resu.x_cnt(2)); for indj = (1:resu.x_cnt(2)) if (dummy(indj)) indk = strmatch (resu.x_name{2}(indj), B.x_name{2}, 'exact'); if (~isempty (indk)) indk = indk(1); if (~strcmp (resu.x_type{indj}, B.x_type{indk})) error ('Trying to mix columns of different types'); end end else indk = indj; end resu.x_data{indj} = [resu.x_data{indj}; B.x_data{indk}]; indA(indj) = false; indB(indk) = false; end if (any (indA) || any (indB)) error ('Different number/names of columns in dataframe'); end end case 2 resu = A; for indi = (1:length (varargin)) B = varargin{indi}; if (~isa (B, 'dataframe')) if (iscell (B) && 2 == length (B)) B = dataframe (B{2}, 'colnames', B{1}); else B = dataframe (B, 'colnames', inputname(2+indi)); end B.x_ridx = resu.x_ridx; %# make them compatibles end if (resu.x_cnt(1) ~= B.x_cnt(1)) error ('Different number of rows in dataframes'); end if (any(resu.x_ridx(:) - B.x_ridx(:))) error ('dataframes row indexes not matched'); end resu.x_name{2} = vertcat (resu.x_name{2}, B.x_name{2}); resu.x_over{2} = [resu.x_over{2} B.x_over{2}]; resu.x_data(resu.x_cnt(2)+(1:B.x_cnt(2))) = B.x_data; resu.x_type(resu.x_cnt(2)+(1:B.x_cnt(2))) = B.x_type; resu.x_cnt(2) = resu.x_cnt(2) + B.x_cnt(2); end case 3 resu = A; for indi = (1:length (varargin)) B = varargin{indi}; if (~isa (B, 'dataframe')) if (iscell (B) && 2 == length (B)), B = dataframe (B{2}, 'rownames', B{1}); else B = dataframe (B, 'colnames', inputname(indi+2)); end end if (resu.x_cnt(1) ~= B.x_cnt(1)) error ('Different number of rows in dataframes'); end if (resu.x_cnt(2) ~= B.x_cnt(2)), error ('Different number of columns in dataframes'); end %# to be merged against 3rd dim, rownames must be equals, if %# non-empty. Columns are merged based upon their name; columns %# with identic content are kept. if (size(resu.x_ridx, 2) < size(B.x_ridx, 2)) resu.x_ridx(:, end+1:size(B.x_ridx, 2)) = NA; elseif (size(resu.x_ridx, 2) > size(B.x_ridx, 2)) B.x_ridx(:, end+1:size(resu.x_ridx, 2)) = NA; end resu.x_ridx = cat (3, resu.x_ridx, B.x_ridx); %# find data with same column names indA = true (1, resu.x_cnt(2)); indB = true (1, resu.x_cnt(2)); dummy = A.x_over{2} & B.x_over{2}; for indj = (1:resu.x_cnt(2)) if (dummy(indj)) indk = strmatch (resu.x_name{2}(indj), B.x_name{2}, 'exact'); if (~isempty (indk)), indk = indk(1); if (~strcmp (resu.x_type{indj}, B.x_type{indk})), error('Trying to mix columns of different types'); end end else indk = indj; end if (all ([isnumeric(resu.x_data{indj}) isnumeric(B.x_data{indk})])), %# iterate over the columns of resu and B op1 = resu.x_data{indj}; op2 = B.x_data{indk}; for ind2 = (1:columns (op2)) indr = false; for ind1 = (1:columns (op1)) if (all (abs (op1(:, ind1) - op2(:, ind2)) <= eps)), resu.x_rep{indj} = [resu.x_rep{indj} ind1]; indr = true; break; end end if (~indr), %# pad in the second dim resu.x_data{indj} = [resu.x_data{indj}, B.x_data{indk}]; resu.x_rep{indj} = [resu.x_rep{indj} 1+length(resu.x_rep{indj})]; end end else resu.x_data{indj} = [resu.x_data{indj} B.x_data{indk}]; resu.x_rep{indj} = [resu.x_rep{indj} 1+length(resu.x_rep({indj}))]; end indA(indj) = false; indB(indk) = false; end if (any (indA) || any (indB)) error ('Different number/names of columns in dataframe'); end end resu = df_thirddim (resu); otherwise error ('Incorrect call to cat'); end %# disp ('End of cat'); keyboard end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/lgamma.m0000644000000000000000000000013213147547161017635 xustar0030 mtime=1503579761.901618698 30 atime=1503579761.901618698 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/lgamma.m0000644000175000017500000000162013147547161020007 0ustar00olafolaf00000000000000function resu = lgamma(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@lgamma, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/angle.m0000644000000000000000000000013213147547161017465 xustar0030 mtime=1503579761.877618362 30 atime=1503579761.877618362 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/angle.m0000644000175000017500000000161613147547161017644 0ustar00olafolaf00000000000000function resu = angle(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@angle, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/tanh.m0000644000000000000000000000013213147547161017331 xustar0030 mtime=1503579761.925619034 30 atime=1503579761.925619034 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/tanh.m0000644000175000017500000000161413147547161017506 0ustar00olafolaf00000000000000function resu = tanh(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@tanh, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/end.m0000644000000000000000000000013213147547161017145 xustar0030 mtime=1503579761.885618474 30 atime=1503579761.885618474 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/end.m0000644000175000017500000000226313147547161017323 0ustar00olafolaf00000000000000function resu = end(df, k, n) %# function resu = end(df, k, n) %# This is the end operator for a dataframe object, returning the %# maximum number of rows or columns %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . try if k < 3, resu = df.x_cnt(k); else resu = max(cellfun(@length, df.x_rep)); end catch error('incorrect call to end, index greater than number of dimensions'); end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/numel.m0000644000000000000000000000013213147547161017517 xustar0030 mtime=1503579761.905618754 30 atime=1503579761.905618754 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/numel.m0000644000175000017500000001003113147547161017665 0ustar00olafolaf00000000000000function resu = numel(df, varargin) %# function resu = numel(df, varargin) %# This is numel operator for a dataframe object. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = prod (df.x_cnt); if (nargin > 1) if (1 == length (varargin)) %# vector-like access if (':' == varargin{1}) return; end if (islogical (varargin{1})) dummy = numel (varargin{1}) if (dummy > resu) dummy = sprintf ('%d out of bound %d', dummy, resu); error (['A(I): index out of bounds;' dummy]); end resu = sum (varargin{1}(:)); return; end iw = varargin{1}(:) > resu; if (any (iw)) iw = find (iw); iw = iw(1); dummy = sprintf ('%d out of bound %d', varargin{1}(iw), resu); error (['A(I): index out of bounds;' dummy]); end resu = numel (varargin{1}); return; end %# multi-argument access -- iterate over args resu = 1; for indi = (1: length (varargin)) if (':' == varargin{indi}) resu = resu * df.x_cnt(indi); continue; end if (indi > length (df.x_cnt)) dummy = 1; else dummy = df.x_cnt(indi); end if (islogical (varargin{indi})) iw = find (varargin{indi}); if (any (iw) > df.x_cnt(indi)) switch (indi) case 1 dummy = ... sprintf ('row index out of bounds; value %d out of bound %d', iw, dummy); case 2 dummy = ... sprintf ('column index out of bounds; value %d out of bound %d', iw, dummy); case 3 dummy = ... sprintf ('page index out of bounds; value %d out of bound %d', iw, dummy); end if (length (varargin) <= 2) dummy = ['A(I, J): ', dummy]; else dummy = ['A(I, J, ...): ', dummy]; end error (dummy); end resu = resu * length (iw); else switch class (varargin{indi}) case {'char'} [indc, ncol] = df_name2idx (df.x_name{indi}, varargin{indi}, df.x_cnt(indi), indi); resu = resu * ncol; otherwise iw = varargin{indi} > dummy; if (any (iw)) iw = find (iw); iw = iw(1); switch (indi) case 1 dummy = ... sprintf ('row index out of bounds; value %d out of bound %d', varargin{indi}(iw), dummy); case 2 dummy = ... sprintf ('column index out of bounds; value %d out of bound %d', varargin{indi}(iw), dummy); case 3 dummy = ... sprintf ('page index out of bounds; value %d out of bound %d', varargin{indi}(iw), dummy); end if (length (varargin) <= 2) dummy = ['A(I, J): ', dummy]; else dummy = ['A(I, J, ...): ', dummy]; end error (dummy); end resu = resu * length (varargin{indi}); end end end else %# This is just plain silly: numel is called by generic subsasgn, %# returning anything > 1 means troubles resu = 1; end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/subsindex.m0000644000000000000000000000013213147547161020403 xustar0030 mtime=1503579761.921618978 30 atime=1503579761.921618978 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/subsindex.m0000644000175000017500000000241613147547161020561 0ustar00olafolaf00000000000000function resu = subsindex(df, base) %# function resu = subsindex(df) %# This function convert a dataframe to an index. Do not expect a %# meaningfull result when mixing numeric and logical columns. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if nargin < 2, base = 1.0; else base = base - 1.0; end %# extract all values at once dummy = df_whole(df); if isa(dummy, 'logical'), resu = sort(find(dummy)-base); %# resu = dummy - base; else resu = dummy - base; end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/sqrt.m0000644000000000000000000000013213147547161017370 xustar0030 mtime=1503579761.921618978 30 atime=1503579761.917618922 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/sqrt.m0000644000175000017500000000161413147547161017545 0ustar00olafolaf00000000000000function resu = sqrt(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@sqrt, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/conj.m0000644000000000000000000000013213147547161017330 xustar0030 mtime=1503579761.881618418 30 atime=1503579761.881618418 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/conj.m0000644000175000017500000000161413147547161017505 0ustar00olafolaf00000000000000function resu = conj(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@conj, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/rdivide.m0000644000000000000000000000013213147547161020025 xustar0030 mtime=1503579761.913618866 30 atime=1503579761.913618866 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/rdivide.m0000644000175000017500000000215113147547161020177 0ustar00olafolaf00000000000000function resu = rdivide(A, B); %# function resu = rdivide(A, B) %# Implements the dotted '\' operator when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . try resu = df_func (@rdivide, A, B); catch disp (lasterr ()); error ('Operator ./ problem for %s vs. %s', class(A), class(B)); end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/ne.m0000644000000000000000000000013213147547161017001 xustar0030 mtime=1503579761.905618754 30 atime=1503579761.905618754 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/ne.m0000644000175000017500000000174213147547161017160 0ustar00olafolaf00000000000000function resu = ne(A, B); %# function resu = ne(A, B) %# Implements the '~=' operator when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_func (@ne, A, B); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/reshape.m0000644000000000000000000000013213147547161020026 xustar0030 mtime=1503579761.917618922 30 atime=1503579761.917618922 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/reshape.m0000644000175000017500000000207013147547161020200 0ustar00olafolaf00000000000000function resu = reshape(df, varargin) %# function resu = reshape(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . dummy = horzcat (varargin{:}); if (any (dummy ~= df.x_cnt)), error ('Function not yet implemented on dataframe'); else resu = df; %# blank operation end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/log10.m0000644000000000000000000000013213147547161017321 xustar0030 mtime=1503579761.901618698 30 atime=1503579761.901618698 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/log10.m0000644000175000017500000000161613147547161017500 0ustar00olafolaf00000000000000function resu = log10(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@log10, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/prod.m0000644000000000000000000000013213147547161017343 xustar0030 mtime=1503579761.913618866 30 atime=1503579761.913618866 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/prod.m0000644000175000017500000000171413147547161017521 0ustar00olafolaf00000000000000function resu = prod(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (~isa (df, 'dataframe')) resu = []; return; end resu = df_mapper2 (@prod, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/sumsq.m0000644000000000000000000000013213147547161017547 xustar0030 mtime=1503579761.921618978 30 atime=1503579761.921618978 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/sumsq.m0000644000175000017500000000171513147547161017726 0ustar00olafolaf00000000000000function resu = sumsq(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (~isa (df, 'dataframe')) resu = []; return; end resu = df_mapper2(@sumsq, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/exp.m0000644000000000000000000000013013147547161017171 xustar0029 mtime=1503579761.88961853 29 atime=1503579761.88961853 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/exp.m0000644000175000017500000000161213147547161017346 0ustar00olafolaf00000000000000function resu = exp(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@exp, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/fold.m0000644000000000000000000000013013147547161017321 xustar0029 mtime=1503579761.88961853 29 atime=1503579761.88961853 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/fold.m0000644000175000017500000000602013147547161017474 0ustar00olafolaf00000000000000function resu = fold(df, dim, indr, indc) %# function resu = fold(df, S, RHS) %# The purpose is to fold a dataframe. Part from (1:indr-1) doesn't %# move, then content starting at indr is moved into the second, %# third, ... sheet. To be moved, there must be equality of rownames, %# if any, and of fields contained in indc. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . switch dim case 1 [indr, nrow] = df_name2idx (df.x_name{1}, indr, df.x_cnt(1), 'row'); [indc, ncol] = df_name2idx (df.x_name{2}, indc, df.x_cnt(2), 'column'); if (indr(1) > 1) slice_size = indr(1) - 1; %# we can't use directly resu = df(1:slice_size, :, :) S.type = '()'; S.subs = { 1:slice_size, ':', ':', 'dataframe'}; resu = subsref (df, S); %# how many columns for each slice targets = cellfun (@length, df.x_rep); %# a test function to determine if the location is free for indj = (1:df.x_cnt(2)) if (any (indj == indc)) continue; end switch (df.x_type{indj}) case { 'char' } testfunc{indj} = @(x, indr, indc) ... ~isna (x{indr, indc}); otherwise testfunc{indj} = @(x, indr, indc) ... ~isna (x(indr, indc)); end end for indi = (indr) %# where does this line go ? where = find (df.x_data{indc}(1:slice_size, 1) ... == df.x_data{indc}(indi, 1)); if (~isempty (where)) %# transfering one line -- loop over columns for indj = (1:df.x_cnt(2)) if (any (indj == indc)) continue; end if (testfunc{indj}(resu.x_data{indj}, where, targets(indj))) %# add one more sheet resu = df_pad(resu, 3, 1, indj); targets(indj) = targets(indj) + 1; end %# transfer field stop resu.x_data{indj}(where, targets(indj)) = ... df.x_data{indj}(indi, 1); end %# update row index resu.x_ridx(where, max(targets)) = df.x_ridx(indi); else disp ('line 65: FIXME'); keyboard; end end else disp ('line 70: FIXME '); keyboard end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/real.m0000644000000000000000000000013213147547161017322 xustar0030 mtime=1503579761.917618922 30 atime=1503579761.917618922 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/real.m0000644000175000017500000000161413147547161017477 0ustar00olafolaf00000000000000function resu = real(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@real, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/kron.m0000644000000000000000000000013213147547161017350 xustar0030 mtime=1503579761.897618642 30 atime=1503579761.897618642 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/kron.m0000644000175000017500000000173513147547161017531 0ustar00olafolaf00000000000000function resu = kron(A, B) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (isa(A, 'dataframe')), A = df_whole(A); end if (isa(B, 'dataframe')), B = df_whole(B); end resu = kron(A, B); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/cosh.m0000644000000000000000000000013213147547161017333 xustar0030 mtime=1503579761.885618474 30 atime=1503579761.885618474 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/cosh.m0000644000175000017500000000161413147547161017510 0ustar00olafolaf00000000000000function resu = cosh(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@cosh, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/ismatrix.m0000644000000000000000000000013213147547161020237 xustar0030 mtime=1503579761.897618642 30 atime=1503579761.897618642 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/ismatrix.m0000644000175000017500000000230113147547161020406 0ustar00olafolaf00000000000000function resu = ismatrix(df) %# function resu = ismatrix(df) %# returns true if the dataframe can be converted to a matrix %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . df_is_num = isnumeric(df.x_data{1}); df_is_char = ischar(df.x_data{1}); for indi = df.x_cnt(2):-1:2, df_is_num = df_is_num & isnumeric(df.x_data{indi}); df_is_char = df_is_char & ischar(df.x_data{indi}); end resu = df_is_num | df_is_char; end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/ldivide.m0000644000000000000000000000013213147547161020017 xustar0030 mtime=1503579761.897618642 30 atime=1503579761.897618642 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/ldivide.m0000644000175000017500000000215213147547161020172 0ustar00olafolaf00000000000000function resu = ldivide(A, B); %# function resu = ldivide(A, B) %# Implements the dotted '\' operator when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . try resu = df_func (@ldivide, A, B); catch disp (lasterr ()); error ('Operator .\\ problem for %s vs. %s', class(A), class(B)); end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/acosh.m0000644000000000000000000000013213147547161017474 xustar0030 mtime=1503579761.877618362 30 atime=1503579761.877618362 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/acosh.m0000644000175000017500000000161613147547161017653 0ustar00olafolaf00000000000000function resu = acosh(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@acosh, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/log2.m0000644000000000000000000000013213147547161017242 xustar0030 mtime=1503579761.901618698 30 atime=1503579761.901618698 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/log2.m0000644000175000017500000000161413147547161017417 0ustar00olafolaf00000000000000function resu = log2(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@log2, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/sinh.m0000644000000000000000000000013213147547161017340 xustar0030 mtime=1503579761.917618922 30 atime=1503579761.917618922 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/sinh.m0000644000175000017500000000161413147547161017515 0ustar00olafolaf00000000000000function resu = sinh(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@sinh, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/isinf.m0000644000000000000000000000013213147547161017507 xustar0030 mtime=1503579761.897618642 30 atime=1503579761.897618642 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/isinf.m0000644000175000017500000000161613147547161017666 0ustar00olafolaf00000000000000function resu = isinf(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@isinf, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/lt.m0000644000000000000000000000013213147547161017016 xustar0030 mtime=1503579761.901618698 30 atime=1503579761.901618698 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/lt.m0000644000175000017500000000174313147547161017176 0ustar00olafolaf00000000000000function resu = lt(A, B); %# function resu = minus(A, B) %# Implements the '<' operator when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_func(@lt, A, B); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/sum.m0000644000000000000000000000013213147547161017203 xustar0030 mtime=1503579761.921618978 30 atime=1503579761.921618978 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/sum.m0000644000175000017500000000171213147547161017357 0ustar00olafolaf00000000000000function resu = sum(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (~isa (df, 'dataframe')) resu = []; return; end resu = df_mapper2 (@sum, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/acos.m0000644000000000000000000000013213147547161017324 xustar0030 mtime=1503579761.877618362 30 atime=1503579761.877618362 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/acos.m0000644000175000017500000000161413147547161017501 0ustar00olafolaf00000000000000function resu = acos(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@acos, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/vertcat.m0000644000000000000000000000013213147547161020047 xustar0030 mtime=1503579761.925619034 30 atime=1503579761.925619034 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/vertcat.m0000644000175000017500000000210013147547161020213 0ustar00olafolaf00000000000000function resu = vertcat(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . %# do the conversion now, in order not to loose inputnames for indi = (1:length (varargin)) varargin{indi} = dataframe (varargin{indi}, 'colnames', inputname(1+indi));, end resu = cat (1, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/finite.m0000644000000000000000000000013013147547161017653 xustar0029 mtime=1503579761.88961853 29 atime=1503579761.88961853 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/finite.m0000644000175000017500000000162013147547161020027 0ustar00olafolaf00000000000000function resu = finite(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@finite, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/or.m0000644000000000000000000000013213147547161017017 xustar0030 mtime=1503579761.905618754 30 atime=1503579761.905618754 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/or.m0000644000175000017500000000174013147547161017174 0ustar00olafolaf00000000000000function resu = or(A, B); %# function resu = or(A, B) %# Implements the '|' operator when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_func(@or, A, B); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/subsasgn.m0000644000000000000000000000013213147547161020224 xustar0030 mtime=1503579761.921618978 30 atime=1503579761.921618978 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/subsasgn.m0000644000175000017500000001734113147547161020405 0ustar00olafolaf00000000000000function df = subsasgn(df, S, RHS) %# function df = subsasgn(df, S, RHS) %# This is the assignement operator for a dataframe object, taking %# care of all the housekeeping of meta-info. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (isnull (df)) error ('dataframe subsasgn: first argument may not be empty'); end switch (S(1).type) case '{}' error ('Invalid dataframe as cell assignement'); case '.' %# translate the external to internal name switch (S(1).subs) case 'rownames' if (~isnull (RHS) && isempty (df.x_name{1})) df.x_name{1}(1:df.x_cnt(1), 1) = {''}; df.x_over{1}(1, 1:df.x_cnt(1)) = true; end [df.x_name{1}, df.x_over{1}] = df_strset ... (df.x_name{1}, df.x_over{1}, S(2:end), RHS); return case 'rowidx' if (1 == length (S)) df.x_ridx = RHS; else df.x_ridx = feval (@subsasgn, df.x_ridx, S(2:end), RHS); end return case 'colnames' if (isnull (RHS)) error ('Colnames can''t be nulled'); end [df.x_name{2}, df.x_over{2}] = df_strset ... (df.x_name{2}, df.x_over{2}, S(2:end), RHS, '_'); df.x_name{2} = genvarname (df.x_name{2}); return case 'types' if (isnull (RHS)) error ('Types can''t be nulled'); end if (1 == length (S)) %# perform explicit cast on each column switch (RHS) case {'char'} for indj = (1:df.x_cnt(2)) if (isnumeric (df.x_data{indj}) || islogical (df.x_data{indj})) df.x_data(indj) = cellfun (@(x) cellstr (num2str(x, '%f')), ... df.x_data(indj), 'UniformOutput', false); end end otherwise df.x_data = cellfun (@(x) cast (x, RHS), df.x_data, 'UniformOutput', false); end df.x_data = cellfun (@(x) cast (x, RHS), df.x_data, 'UniformOutput', false); df.x_type(1:end) = RHS; else if (~strcmp (S(2).type, '()')) error ('Invalid internal type sub-access, use () instead'); end if (length (S) > 2 || length (S(2).subs) > 1) error('Types can only be changed as a whole'); end if (~isnumeric(S(2).subs{1})) [indj, ncol, S(2).subs{1}] = df_name2idx ... (df.x_name{2}, S(2).subs{1}, df.x_cnt(2), 'column'); else indj = S(2).subs{1}; ncol = length (indj); end switch (RHS) case {'char'} if (isnumeric (df.x_data{indj}) || islogical (df.x_data{indj})) df.x_data(indj) = cellfun (@(x) cellstr (num2str(x, '%f')), ... df.x_data(indj), 'UniformOutput', false); end otherwise df.x_data(indj) = cellfun (@(x) cast (x, RHS), df.x_data(indj), 'UniformOutput', false); end df.x_type(indj) = {RHS}; end return case 'source' if (length (S) > 1) df.x_src = feval (@subsasgn, df.x_src, S(2:end), RHS); else df.x_src = RHS; end return case 'header' if (length (S) > 1) df.x_header = feval (@subsasgn, df.x_header, S(2:end), RHS); else df.x_header = RHS; end return case 'comment' if (length (S) > 1) df.x_cmt = feval (@subsasgn, df.x_cmt, S(2:end), RHS); else df.x_cmt = RHS; end return otherwise if (~ischar (S(1).subs)) error ('Congratulations. I didn''t see how to produce this error'); end %# translate the name to column [indc, ncol] = df_name2idx (df.x_name{2}, S(1).subs, ... df.x_cnt(2), 'column', true); if (isempty (indc)) %# dynamic allocation df = df_pad (df, 2, 1, class (RHS)); indc = df.x_cnt(2); ncol = 1; df.x_name{2}(end) = S(1).subs; df.x_name{2} = genvarname(df.x_name{2}); df.x_over{2}(end) = false; end if (length (S) > 1) if (1 == length (S(2).subs)), %# add column reference S(2).subs{2} = indc; else S(2).subs(2:3) = {indc, S(2).subs{2}}; end else %# full assignement S(2).type = '()'; S(2).subs = { '', indc, ':' }; if (ndims (RHS) < 3) if (isnull (RHS)) S(2).subs = {':', indc}; elseif (1 == size (RHS, 2)) S(2).subs = { '', indc }; elseif (1 == ncol && 1 == size (df.x_data{indc}, 2)) %# force the padding of the vector to a matrix S(2).subs = {'', indc, [1:size(RHS, 2)]}; end end end %# do we need to 'rotate' RHS ? if (1 == ncol && ndims (RHS) < 3 ... && size (RHS, 2) > 1) RHS = reshape (RHS, [size(RHS, 1), 1, size(RHS, 2)]); end df = df_matassign (df, S(2), indc, ncol, RHS); end case '()' [indr, nrow, S(1).subs{1}] = df_name2idx (df.x_name{1}, S(1).subs{1}, ... df.x_cnt(1), 'row'); if (isempty (indr) && df.x_cnt(1) > 0) %# this is not an initial assignment df = df; return; end if (any (indr < 1)) %# assigning line '0' -> this is a no-op df = df; return; end if (length (S(1).subs) > 1) if (~isempty (S(1).subs{2})) [indc, ncol, S(1).subs{2}] = ... df_name2idx (df.x_name{2}, S(1).subs{2}, df.x_cnt(2), 'column'); %# if (isempty (indc) && df.x_cnt(2) > 0) %# this is not an initial assignment %# df = df; return; else [indc, ncol] = deal ([]); end else mz = max (cellfun (@length, df.x_rep)); [fullindr, fullindc, fullinds] = ind2sub ([df.x_cnt(1:2) mz], indr); indr = unique( fullindr); indc = unique (fullindc); inds = unique (fullinds); ncol = length (indc); if (any (inds > 1)) S(1).subs{3} = inds; end end %# avoid passing ':' as selector on the two first dims if (~isnull (RHS)) S(1).subs{1} = indr; S(1).subs{2} = indc; end df = df_matassign (df, S, indc, ncol, RHS); end %# disp ('end of subsasgn'); keyboard end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/inv.m0000644000000000000000000000013213147547161017173 xustar0030 mtime=1503579761.893618586 30 atime=1503579761.893618586 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/inv.m0000644000175000017500000000327013147547161017350 0ustar00olafolaf00000000000000function [resu, rcond] = inv(df); %# function [x, rcond] = inv(df) %# Overloaded function computing the inverse of a dataframe. To %# succeed, the dataframe must be convertible to an square array. Row %# and column meta-information are exchanged. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (length (df.x_cnt) > 2 || (df.x_cnt(1) ~= df.x_cnt(2))) error ('Dataframe is not square'); end %# quick and dirty conversion [dummy, rcond] = inv (horzcat (df.x_data{:})); resu = df_allmeta(df); [resu.x_name{2}, resu.x_name{1}] = deal (resu.x_name{1}, resu.x_name{2}); [resu.x_over{2}, resu.x_over{1}] = deal (resu.x_over{1}, resu.x_over{2}); if (isempty (resu.x_name{2})), resu.x_name{2} = cellstr (repmat('_', resu.x_cnt(2), 1)); resu.x_over{2} = ones (1, resu.x_cnt(2)); end for indi = (resu.x_cnt(1):-1:1) resu.x_data{indi} = dummy(:, indi); end resu.x_type(:) = class (dummy); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/and.m0000644000000000000000000000013213147547161017141 xustar0030 mtime=1503579761.877618362 30 atime=1503579761.877618362 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/and.m0000644000175000017500000000174313147547161017321 0ustar00olafolaf00000000000000function resu = and(A, B); %# function resu = and(A, B) %# Implements the '&' operator when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_func(@and, A, B); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/isna.m0000644000000000000000000000013213147547161017331 xustar0030 mtime=1503579761.897618642 30 atime=1503579761.897618642 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/isna.m0000644000175000017500000000161413147547161017506 0ustar00olafolaf00000000000000function resu = isna(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@isna, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/cumprod.m0000644000000000000000000000013213147547161020050 xustar0030 mtime=1503579761.885618474 30 atime=1503579761.885618474 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/cumprod.m0000644000175000017500000000162313147547161020225 0ustar00olafolaf00000000000000function resu = cumprod(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper2(@cumprod, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/find.m0000644000000000000000000000013013147547161017315 xustar0029 mtime=1503579761.88961853 29 atime=1503579761.88961853 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/find.m0000644000175000017500000000401013147547161017465 0ustar00olafolaf00000000000000function varargout = find(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . switch nargout case {0, 1} resu = []; mz = max (cellfun (@length, df.x_rep)); for indc = (1:df.x_cnt(2)) [indr, inds] = feval (@find, df.x_data{indc}(:, df.x_rep{indc})); %# create a vector the same size as indr dummy = indr; dummy(:) = indc; resu = [resu; sub2ind([df.x_cnt(1:2) mz], indr, dummy, inds)]; end varargout{1} = sort (resu); case 2 nz = 0; idx_i = []; idx_j = []; for indc = (1:df.x_cnt(2)) [dum1, dum2] = feval (@find, df.x_data{indc}(:, df.x_rep{indc})); idx_i = [idx_i; dum1]; idx_j = [idx_j; nz + dum2]; nz = nz + df.x_cnt(1)*length (df.x_rep{indc}); end varargout{1} = idx_i; varargout{2} = idx_j; case 3 nz = 0; idx_i = []; idx_j = []; val = []; for indc = (1:df.x_cnt(2)) [dum1, dum2, dum3] = feval (@find, df.x_data{indc}(:, df.x_rep{indc})); idx_i = [idx_i; dum1]; idx_j = [idx_j; nz + dum2]; val = [val; dum3]; nz = nz + df.x_cnt(1)*length (df.x_rep{indc}); end varargout{1} = idx_i; varargout{2} = idx_j; varargout{3} = val; otherwise print_usage ('find'); end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/atanh.m0000644000000000000000000000013213147547161017472 xustar0030 mtime=1503579761.881618418 30 atime=1503579761.881618418 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/atanh.m0000644000175000017500000000161613147547161017651 0ustar00olafolaf00000000000000function resu = atanh(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@atanh, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/tan.m0000644000000000000000000000013213147547161017161 xustar0030 mtime=1503579761.925619034 30 atime=1503579761.925619034 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/tan.m0000644000175000017500000000161213147547161017334 0ustar00olafolaf00000000000000function resu = tan(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@tan, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/sin.m0000644000000000000000000000013213147547161017170 xustar0030 mtime=1503579761.917618922 30 atime=1503579761.917618922 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/sin.m0000644000175000017500000000161213147547161017343 0ustar00olafolaf00000000000000function resu = sin(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@sin, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/repmat.m0000644000000000000000000000013213147547161017667 xustar0030 mtime=1503579761.917618922 30 atime=1503579761.917618922 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/repmat.m0000644000175000017500000000371213147547161020045 0ustar00olafolaf00000000000000function resu = repmat(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df; idx = horzcat (varargin{:}); %# for the second dim, use either 1 either the 3rd one dummy = idx; if (length (dummy) > 2) dummy(2) = []; else dummy(2) = 1; end %# operate on first dim if (idx(1) > 1) resu = df_mapper (@repmat, df, [idx(1) 1]); if (~isempty (df.x_name{1})), resu.x_name{1} = feval (@repmat, df.x_name{1}, [idx(1) 1]); resu.x_over{1} = feval (@repmat, df.x_over{1}, [idx(1) 1]); end resu.x_cnt(1) = resu.x_cnt(1) * idx(1); end if (dummy(2) > 1) for indi = (1:resu.x_cnt(2)) resu.x_rep{indi} = feval (@repmat, resu.x_rep{indi}, [1 dummy(2)]); end end %# operate on ridx resu.x_ridx = feval (@repmat, resu.x_ridx, idx); %# operate on second dim if (length (idx) > 1 && idx(2) > 1) resu.x_data = feval (@repmat, resu.x_data, [1 idx(2)]); resu.x_name{2} = feval (@repmat, df.x_name{2}, [idx(2) 1]); resu.x_over{2} = feval (@repmat, df.x_over{2}, [1 idx(2)]); resu.x_type = feval (@repmat, df.x_type, [1 idx(2)]); resu.x_cnt(2) = resu.x_cnt(2) * idx(2); end resu = df_thirddim (resu); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/erfinv.m0000644000000000000000000000013013147547161017666 xustar0029 mtime=1503579761.88961853 29 atime=1503579761.88961853 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/erfinv.m0000644000175000017500000000162013147547161020042 0ustar00olafolaf00000000000000function resu = erfinv(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@erfinv, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/gamma.m0000644000000000000000000000013013147547161017457 xustar0029 mtime=1503579761.88961853 29 atime=1503579761.88961853 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/gamma.m0000644000175000017500000000161613147547161017640 0ustar00olafolaf00000000000000function resu = gamma(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@gamma, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/gt.m0000644000000000000000000000013213147547161017011 xustar0030 mtime=1503579761.893618586 30 atime=1503579761.893618586 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/gt.m0000644000175000017500000000174013147547161017166 0ustar00olafolaf00000000000000function resu = gt(A, B); %# function resu = gt(A, B) %# Implements the '>' operator when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_func(@gt, A, B); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/islogical.m0000644000000000000000000000013213147547161020345 xustar0030 mtime=1503579761.897618642 30 atime=1503579761.897618642 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/islogical.m0000644000175000017500000000173413147547161020525 0ustar00olafolaf00000000000000function resu = islogical(df) %# function resu = islogical(df) %# returns true if all the columns are boolean %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = all (strcmp (df.x_type, 'logical')); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/roundb.m0000644000000000000000000000013213147547161017670 xustar0030 mtime=1503579761.917618922 30 atime=1503579761.917618922 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/roundb.m0000644000175000017500000000162013147547161020042 0ustar00olafolaf00000000000000function resu = roundb(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@roundb, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/erf.m0000644000000000000000000000013013147547161017151 xustar0029 mtime=1503579761.88961853 29 atime=1503579761.88961853 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/erf.m0000644000175000017500000000161213147547161017326 0ustar00olafolaf00000000000000function resu = erf(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@erf, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/ischar.m0000644000000000000000000000013213147547161017650 xustar0030 mtime=1503579761.893618586 30 atime=1503579761.893618586 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/ischar.m0000644000175000017500000000216713147547161020031 0ustar00olafolaf00000000000000function resu = ischar(df) %# function resu = ischar(df) %# This is ischar() operator for a dataframe object. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = false & true; return ## %# explicitelly applies the func over the rows ## for indj = (1:df.x_cnt(2)) ## resu = resu & ischar (df.x_data(indj)); ## end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/iscellstr.m0000644000000000000000000000013213147547161020403 xustar0030 mtime=1503579761.893618586 30 atime=1503579761.893618586 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/iscellstr.m0000644000175000017500000000214613147547161020561 0ustar00olafolaf00000000000000function resu = iscellstr(df) %# function resu = iscellstr(df) %# This is iscellstr() operator for a dataframe object. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = true; %# explicitelly applies the func over the rows for indj = (1:df.x_cnt(2)) resu = resu & iscellstr (df.x_data{indj}); end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/ge.m0000644000000000000000000000013213147547161016772 xustar0030 mtime=1503579761.893618586 30 atime=1503579761.893618586 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/ge.m0000644000175000017500000000174113147547161017150 0ustar00olafolaf00000000000000function resu = ge(A, B); %# function resu = ge(A, B) %# Implements the '>=' operator when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_func(@ge, A, B); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/rows.m0000644000000000000000000000013213147547161017371 xustar0030 mtime=1503579761.917618922 30 atime=1503579761.917618922 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/rows.m0000644000175000017500000000167013147547161017550 0ustar00olafolaf00000000000000function resu = rows(df) %# function resu = rows(df) %# returns the number of rows of a dataframe %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df.x_cnt(1); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/summary.m0000644000000000000000000000013213147547161020074 xustar0030 mtime=1503579761.921618978 30 atime=1503579761.921618978 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/summary.m0000644000175000017500000000724313147547161020255 0ustar00olafolaf00000000000000function resu = summary(df) %# function resu = summary(df) %# This function prints a nice summary of a dataframe, on a %# colum-by-column basis. For continuous varaibles, returns basic %# statistics; for discrete one (char, factors, ...), returns the %# occurence count for each element. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . dummy = df.x_type; resu = []; for indi = (1:length (dummy)) switch dummy{indi} case {'char' 'factor'} [sval, sidxi, sidxj] = unique (df.x_data{:, indi}); %# compute their occurences sidxj = hist (sidxj, min(sidxj):max(sidxj)); %# generate a column with unique values. The regexp is used to %# call disp and re-format the output over many lines. resuR = strjust (char (regexp (disp (char (sval)), '.*', 'match', ... 'dotexceptnewline')), 'right'); resuR = horzcat (resuR, repmat (':', size(resuR, 1), 1)); %# put the name above all resuR = strjust (char ([deblank(df.x_name{1, 2}(indi, :)); resuR]), ... 'right'); %# generate a column with a blank line and the values resuR = horzcat (resuR, repmat (' ', size(resuR, 1), 1), strjust (char (' ', regexp (disp (sidxj.'), '.*', ... 'match', ... 'dotexceptnewline')), ... 'right'),... repmat (' ', size(resuR, 1), 1)); otherwise s = df.x_data{:, indi}; if (ismatrix (s)) %# matrix => collate every observation together s = statistics (s(:)); else s = statistics (s); end s = s([1:3 6 4:5]); %# generate a column with name and fields name resuR = strjust ([deblank(df.x_name{1, 2}{indi, :}); 'Min. :'; '1st Qu.:'; 'Median :'; 'Mean :'; '3rd Qu.:'; 'Max. :'], 'right'); %# generate a column with a blank line and the values resuR = horzcat (resuR, repmat (' ', size(resuR, 1), 1), strjust (char (' ', regexp (disp (s), '.*', ... 'match', ... 'dotexceptnewline')), ... 'right'),... repmat (' ', size(resuR, 1), 1)); end resu = horzcat_pad (resu, resuR); end end function resu = horzcat_pad(A, B) %# small auxiliary function to cat horizontally tables of different height dx = size (A, 1) - size (B, 1); if (dx < 0) %# pad A A = strvcat (A, repmat (' ', -dx, size(A, 2))); elseif (dx > 0) B = strvcat (B, repmat (' ', dx, size(B, 2))); end resu = horzcat (A, B); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/le.m0000644000000000000000000000013213147547161016777 xustar0030 mtime=1503579761.897618642 30 atime=1503579761.897618642 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/le.m0000644000175000017500000000174113147547161017155 0ustar00olafolaf00000000000000function resu = le(A, B); %# function resu = le(A, B) %# Implements the '<=' operator when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_func(@le, A, B); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/power.m0000644000000000000000000000013213147547161017533 xustar0030 mtime=1503579761.905618754 30 atime=1503579761.905618754 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/power.m0000644000175000017500000000161613147547161017712 0ustar00olafolaf00000000000000function resu = power(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@power, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/isvector.m0000644000000000000000000000013213147547161020235 xustar0030 mtime=1503579761.897618642 30 atime=1503579761.897618642 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/isvector.m0000644000175000017500000000177313147547161020420 0ustar00olafolaf00000000000000function resu = isvector(df) %# function resu = isvector(df) %# returns true if the dataframe can be converted to a vector %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = ismatrix (df) & (length (find (df.x_cnt > 1)) <= 1); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/floor.m0000644000000000000000000000013013147547161017516 xustar0029 mtime=1503579761.88961853 29 atime=1503579761.88961853 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/floor.m0000644000175000017500000000161613147547161017677 0ustar00olafolaf00000000000000function resu = floor(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@floor, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/isfield.m0000644000000000000000000000013213147547161020016 xustar0030 mtime=1503579761.893618586 30 atime=1503579761.893618586 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/isfield.m0000644000175000017500000000561113147547161020174 0ustar00olafolaf00000000000000function [resu, idx] = isfield(df, name, strict) %# -*- texinfo -*- %# @deftypefn {Function File} [@var{resu}, @var{idx}] = isfield %# (@var{df}, @var{name}, @var{strict}) %# Return true if the expression @var{df} is a dataframe and it %# includes an element matching @var{name}. If @var{name} is a cell %# array, a logical array of equal dimension is returned. @var{idx} %# contains the column indexes of number of fields matching %# @var{name}. To enforce strict matching instead of regexp matching, %# set the third argument to 'true'. %# @end deftypefn %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (~isa (df, 'dataframe')) resu = false; return; end if (nargin < 2 || nargin > 3) print_usage (); resu = false; return; end if (2 == nargin) strict = false; end if (isa (name, 'char')) if (strict) %# use strmatch to get indexes for indi = (size (name, 1):-1:1) dummy = strmatch (name(indi, :), df.x_name{2}, 'exact'); resu(indi, 1) = ~isempty (dummy); for indj = (1:length (dummy)) idx(indi, indj) = dummy(indj); end end else for indi = (size (name, 1):-1:1) try dummy = df_name2idx (df.x_name{2}, name(indi, :), ... df.x_cnt(2), 'column'); resu(indi, 1) = ~isempty (dummy); for indj = (1:length (dummy)) idx(indi, indj) = dummy(indj); end catch resu(indi, 1) = false; idx(indi, 1) = 0; end end end elseif (isa (name, 'cell')) if (strict) %# use strmatch to get indexes for indi = (size (name, 1):-1:1) dummy = strmatch (name{indi}, df.x_name{2}, 'exact'); resu{indi, 1} = ~isempty (dummy); idx{indi, 1} = dummy; end else for indi = (length (name):-1:1) try dummy = df_name2idx (df.x_name{2}, name{indi}, ... df.x_cnt(2), 'column'); keyboard resu{indi, 1} = ~isempty (dummy); idx{indi, 1} = dummy; catch resu{indi, 1} = false; cnt{indi, 1} = 0; end end end end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/char.m0000644000000000000000000000013213147547161017314 xustar0030 mtime=1503579761.881618418 30 atime=1503579761.881618418 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/char.m0000644000175000017500000000257513147547161017500 0ustar00olafolaf00000000000000function resu = char(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . [count1, count2, count3] = size (df); resu = ''; for indk = (1:count3) %# iterate on a column by column basis for indj = (1:count2) if (length (df.x_rep{indj}) >= indk) dummy = char (df.x_data{indj}(:, df.x_rep{indj}(indk))); if (isempty (dummy)) dummy = repmat (' ', [count1 1]); end resu = strvcat (resu, dummy); else resu = strvcat (resu, repmat ('NA', [count1 1])); end end end if (nargin > 1) resu = vertcat (resu, varargin{:}); end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/times.m0000644000000000000000000000013213147547161017520 xustar0030 mtime=1503579761.925619034 30 atime=1503579761.925619034 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/times.m0000644000175000017500000000214313147547161017673 0ustar00olafolaf00000000000000function resu = times(A, B); %# function resu = times(A, B) %# Implements the dotted '*' operator when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . try resu = df_func (@times, A, B); catch disp (lasterr ()); error ('Operator .* problem for %s vs. %s', class(A), class(B)); end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/columns.m0000644000000000000000000000013213147547161020057 xustar0030 mtime=1503579761.881618418 30 atime=1503579761.881618418 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/columns.m0000644000175000017500000000170313147547161020233 0ustar00olafolaf00000000000000function resu = columns(df) %# function resu = columns(df) %# returns the number of columns of a dataframe %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df.x_cnt(end); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/not.m0000644000000000000000000000013213147547161017177 xustar0030 mtime=1503579761.905618754 30 atime=1503579761.905618754 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/not.m0000644000175000017500000000161213147547161017352 0ustar00olafolaf00000000000000function resu = not(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@not, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/strncmp.m0000644000000000000000000000013213147547161020065 xustar0030 mtime=1503579761.921618978 30 atime=1503579761.921618978 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/strncmp.m0000644000175000017500000000257013147547161020244 0ustar00olafolaf00000000000000function resu = strncmp(A, B, n); %# function resu = strncmp(A, B, n) %# Implements the strncmp func when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (isa (A, 'dataframe')) resu = logical (zeros (size (A))); for indc = (1:A.x_cnt(2)) indr = feval (@strncmp, A.x_data{indc}(:, A.x_rep{indc}), B, n); resu(:, indc, A.x_rep{indc}) = indr; end else resu = logical (zeros (size (B))); for indc = (1:B.x_cnt(2)) indr = feval (@strncmp, A, B.x_data{indc}(:, B.x_rep{indc}), n); resu(:, indc, B.x_rep{indc}) = indr; end end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/all.m0000644000000000000000000000013213147547161017147 xustar0030 mtime=1503579761.877618362 30 atime=1503579761.877618362 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/all.m0000644000175000017500000000171213147547161017323 0ustar00olafolaf00000000000000function resu = all(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (~isa (df, 'dataframe')) resu = []; return; end resu = df_mapper2 (@all, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/signum.m0000644000000000000000000000013213147547161017701 xustar0030 mtime=1503579761.917618922 30 atime=1503579761.917618922 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/signum.m0000644000175000017500000000162013147547161020053 0ustar00olafolaf00000000000000function resu = signum(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@signum, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/cos.m0000644000000000000000000000013213147547161017163 xustar0030 mtime=1503579761.885618474 30 atime=1503579761.881618418 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/cos.m0000644000175000017500000000161213147547161017336 0ustar00olafolaf00000000000000function resu = cos(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@cos, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/min.m0000644000000000000000000000013213147547161017162 xustar0030 mtime=1503579761.901618698 30 atime=1503579761.901618698 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/min.m0000644000175000017500000000161513147547161017340 0ustar00olafolaf00000000000000function resu = min(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper2(@min, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/uplus.m0000644000000000000000000000013213147547161017547 xustar0030 mtime=1503579761.925619034 30 atime=1503579761.925619034 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/uplus.m0000644000175000017500000000173313147547161017726 0ustar00olafolaf00000000000000function resu = uplus(df); %# function resu = uplus(df) %# Implements the unitary '+' operator for a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@uplus, df); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/isbool.m0000644000000000000000000000013213147547161017666 xustar0030 mtime=1503579761.893618586 30 atime=1503579761.893618586 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/isbool.m0000644000175000017500000000172613147547161020047 0ustar00olafolaf00000000000000function resu = isbool(df) %# function resu = isbool(df) %# returns true if all the columns are boolean %% Copyright (C) 2009-2012 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = all (strcmp (df.x_type, 'logical')); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/horzcat.m0000644000000000000000000000013213147547161020051 xustar0030 mtime=1503579761.893618586 30 atime=1503579761.893618586 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/horzcat.m0000644000175000017500000000200413147547161020220 0ustar00olafolaf00000000000000function resu = horzcat(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . for indi = (1:length (varargin)) varargin{indi} = dataframe (varargin{indi}, 'colnames', inputname(1+indi));, end resu = cat (2, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/asinh.m0000644000000000000000000000013213147547161017501 xustar0030 mtime=1503579761.881618418 30 atime=1503579761.881618418 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/asinh.m0000644000175000017500000000161613147547161017660 0ustar00olafolaf00000000000000function resu = asinh(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@asinh, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/private0000644000000000000000000000013213147547161017616 xustar0030 mtime=1503579761.913618866 30 atime=1503579761.961619538 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/private/0000755000175000017500000000000013147547161020046 5ustar00olafolaf00000000000000dataframe-1.2.0/inst/@dataframe/private/PaxHeaders.29945/df_strjust.m0000644000000000000000000000013213147547161022240 xustar0030 mtime=1503579761.913618866 30 atime=1503579761.913618866 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/private/df_strjust.m0000644000175000017500000000214113147547161022411 0ustar00olafolaf00000000000000function [a, b] = df_strjust(a, b) %# small auxiliary function: make two char arrays the same width %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 2, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . indi = size (a, 2) - size (b, 2); if (indi < 0) a = horzcat (repmat (' ', size (a, 1), -indi), a); elseif indi > 0, b = horzcat (repmat (' ', size (b, 1), indi), b); end end dataframe-1.2.0/inst/@dataframe/private/PaxHeaders.29945/df_strset.m0000644000000000000000000000013213147547161022046 xustar0030 mtime=1503579761.913618866 30 atime=1503579761.913618866 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/private/df_strset.m0000644000175000017500000000457413147547161022233 0ustar00olafolaf00000000000000function [x, over] = df_strset(x, over, S, RHS, pad = ' ') %# x = df_strset(x, over, S, RHS, pad = ' ') %# replaces the strings in cellstr x at indr by strings at y. Adapt %# the width of x if required. Use x 'over' attribute to display a %# message in case strings are overwritten. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 2, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . %# adjust x size, if required if (isnull (RHS)) %# clearing if (isempty (S)) x = cell (0, 1); over = zeros (1, 0); return end dummy = S; dummy(1).subs(2:end) = []; over = builtin ('subsasgn', over, dummy, true); else if (isempty (S)) %# complete overwrite if (ischar (RHS)) RHS = cellstr (RHS); end nrow = length (RHS); if (any(~over(nrow))) warning ('going to overwrite names'); end x(1:nrow) = RHS; over(1:nrow) = false; if (nrow < length (x)) x(nrow+1:end) = {pad}; end return else dummy = S(1); dummy.subs(2:end) = []; % keep first dim only if (any (~builtin ('subsref', over, dummy))) warning ('going to overwrite names'); end over = builtin ('subsasgn', over, dummy, false); end end %# common part if (ischar (RHS) && length (S(1).subs) > 1) %# partial accesses to a char array dummy = char (x); dummy = builtin ('subsasgn', dummy, S, RHS); if (isempty(dummy)) x = cell (0, 1); over = zeros (1, 0); return end if (size (dummy, 1) == length (x)) x = cellstr (dummy); return end %# partial clearing gone wrong ? retry RHS = { RHS }; end x = builtin ('subsasgn', x, S, RHS); end dataframe-1.2.0/inst/@dataframe/private/PaxHeaders.29945/df_colmeta.m0000644000000000000000000000013013147547161022144 xustar0029 mtime=1503579761.90961881 29 atime=1503579761.90961881 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/private/df_colmeta.m0000644000175000017500000000276513147547161022333 0ustar00olafolaf00000000000000function resu = df_colmeta(df) %# function resu = df_colmeta(df) %# Returns a new dataframe, initalised with the meta-information %# about columns from the source, but with empty data %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 2, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = dataframe (); resu.x_cnt(2) = df.x_cnt(2); resu.x_name{2} = df.x_name{2}; resu.x_over{2} = df.x_over{2}; resu.x_type = df.x_type; if (~isempty (df.x_ridx)) if (size (df.x_ridx, 2) >= resu.x_cnt(2)), resu.x_ridx = df.x_ridx(1, :, :); else resu.x_ridx = df.x_ridx(1, 1, :); end end %# init it with the right orientation resu.x_data = cell (size (df.x_data)); resu.x_rep = cell (size (df.x_rep)); resu.x_src = df.x_src; resu.x_cmt = df.x_cmt; end dataframe-1.2.0/inst/@dataframe/private/PaxHeaders.29945/df_mapper.m0000644000000000000000000000013013147547161022004 xustar0029 mtime=1503579761.90961881 29 atime=1503579761.90961881 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/private/df_mapper.m0000644000175000017500000000241013147547161022156 0ustar00olafolaf00000000000000function resu = df_mapper(func, df, varargin) %# resu = df_mapper(func, df) %# small interface to iterate some func over the elements of a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 2, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_allmeta(df); resu.x_data = cellfun(@(x) feval(func, x, varargin{:}), df.x_data, ... 'UniformOutput', false); resu.x_rep = df.x_rep; %# things didn't change resu.x_type = cellfun(@(x) class(x(1)), resu.x_data, 'UniformOutput', false); resu = df_thirddim(resu); end dataframe-1.2.0/inst/@dataframe/private/PaxHeaders.29945/df_cow.m0000644000000000000000000000013013147547161021310 xustar0029 mtime=1503579761.90961881 29 atime=1503579761.90961881 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/private/df_cow.m0000644000175000017500000000442513147547161021472 0ustar00olafolaf00000000000000function [df, S] = df_cow(df, S, col) %# function [resu, S] = df_cow(df, S, col) %# Implements Copy-On-Write on dataframe. If one or more columns %# specified in inds is aliased to another one, duplicate it and %# adjust the repetition index to remove the aliasing %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 2, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (length (col) > 1) error ('df_cow must work on a column-by-column basis'); end if (1 == length (S.subs)), inds = 1; else inds = S.subs{2}; end if (~isnumeric(inds)) if (~strcmp (inds, ':')) error ('Unknown sheet selector %s', inds); end inds = 1:length (df.x_rep(col)); end for indi = (inds(:).') dummy = df.x_rep{col}; dummy(indi) = 0; df.x_rep{col}(indi); [t1, t2] = ismember (ans(:), dummy); for indj = (t2(find (t2))) %# Copy-On-Write %# determines the index for the next column t1 = 1 + max (df.x_rep{col}); %# duplicate the touched column df.x_data{col} = horzcat (df.x_data{col}, ... df.x_data{col}(:, df.x_rep{col}(indj))); if (indi > 1) %# a new column has been created df.x_rep{col}(indi) = t1; else %# update repetition index aliasing this one df.x_rep{col}(find (dummy == indi)) = t1; end end end %# reorder S if (length (S.subs) > 1) if (S.subs{2} ~= 1 || length (S.subs{2}) > 1), %# adapt sheet index according to df_rep S.subs{2} = df.x_rep{col}(S.subs{2}); end end df = df_thirddim (df); end dataframe-1.2.0/inst/@dataframe/private/PaxHeaders.29945/df_whole.m0000644000000000000000000000013213147547161021640 xustar0030 mtime=1503579761.913618866 30 atime=1503579761.913618866 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/private/df_whole.m0000644000175000017500000000304413147547161022014 0ustar00olafolaf00000000000000function resu = df_whole(df); %# function resu = df_whole(df) %# Generate a full matrix from a column-compressed version of a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 2, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . inds = max (cellfun (@length, df.x_rep)); resu = df.x_data{1}(:, df.x_rep{1}); if (inds > 1) resu = reshape (resu, df.x_cnt(1), 1, []); if (1 == size (resu, 3)) resu = repmat (resu, [1 1 inds]); end end if (df.x_cnt(2) > 1) resu = repmat (resu, [1 df.x_cnt(2)]); for indi = (2:df.x_cnt(2)) dummy = df.x_data{indi}(:, df.x_rep{indi}); if (inds > 1) dummy = reshape (dummy, df.x_cnt(1), 1, []); if (1 == size (dummy, 3)), dummy = repmat (dummy, [1 1 inds]); end end resu(:, indi, :) = dummy; end end end dataframe-1.2.0/inst/@dataframe/private/PaxHeaders.29945/df_thirddim.m0000644000000000000000000000013213147547161022326 xustar0030 mtime=1503579761.913618866 30 atime=1503579761.913618866 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/private/df_thirddim.m0000644000175000017500000000224613147547161022505 0ustar00olafolaf00000000000000function [df] = df_thirddim(df) %# function [resu] = df_thirddim(df) %# This is a small helper function which recomputes the third dim each %# time a change may have occured. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 2, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . %# sanity check dummy = max (cellfun (@length, df.x_rep)); if (dummy ~= 1), df.x_cnt(3) = dummy; elseif (length (df.x_cnt) > 2), df.x_cnt = df.x_cnt(1:2); end end dataframe-1.2.0/inst/@dataframe/private/PaxHeaders.29945/df_matassign.m0000644000000000000000000000013013147547161022506 xustar0029 mtime=1503579761.90961881 29 atime=1503579761.90961881 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/private/df_matassign.m0000644000175000017500000005205013147547161022665 0ustar00olafolaf00000000000000function df = df_matassign(df, S, indc, ncol, RHS, trigger) %# auxiliary function: assign the dataframe as if it was a matrix %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 2, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . try NA = NA; catch NA = NaN; end if (isempty (RHS)) if (1 == ncol) if (sum (~strcmp (S.subs, ':')) > 2) error('A null assignment can only have one non-colon index.'); end elseif (sum (~strcmp (S.subs, ':')) > 1) error('A null assignment can only have one non-colon index.'); end if (strcmp (S.subs(1), ':')) %# removing column/matrix RHS = S; RHS.subs(2) = []; for indi = (indc) unfolded = df.x_data{indi}(:, df.x_rep{indi}); unfolded = feval (@subsasgn, unfolded, RHS, []); df.x_data{indi} = unfolded; if (~isempty (unfolded)) df.x_rep(indi) = 1:size (unfolded, 2); end end %# remove empty elements indi = cellfun ('isempty', df.x_data); if (any (indi)) %# nothing left, remove this column df.x_cnt(2) = df.x_cnt(2) - sum (indi); indi = ~indi; %# vector of kept data df.x_name{2} = df.x_name{2}(indi); df.x_over{2} = df.x_over{2}(indi); df.x_type = df.x_type(indi); df.x_data = df.x_data(indi); df.x_rep = df.x_rep(indi); end if (size (df.x_ridx, 3) > 1) df.x_ridx(:, indc, :) = []; end elseif (strcmp (S.subs(2), ':')) %# removing rows indr = S.subs{1}; if (~isempty (df.x_name{1})) df.x_name{1}(indr, :) = []; df.x_over{1}(indr) = []; end df.x_ridx(indr, :, :) = []; %# to remove a line, iterate on each column df.x_data = cellfun (@(x) feval(@subsasgn, x, S, []), ... df.x_data, 'UniformOutPut', false); if (isa (indr, 'char')) df.x_cnt(1) = 0; else df.x_cnt(1) = df.x_cnt(1) - length (indr); end end df = df_thirddim (df); return; end %# char array are problematic, convert to cellstr if (ischar (RHS) && ismatrix (RHS)) RHS = cellstr (RHS); end indc_was_set = ~isempty (indc); if (~indc_was_set) %# initial dataframe was empty ncol = size (RHS, 2); indc = 1:ncol; end %# iscell(dataframe) returns true. Beware. ispurecell = iscell (RHS) & ~isa (RHS, 'dataframe'); indr = S.subs{1, 1}; indr_was_set = ~isempty (indr); %# initial dataframe was empty ? if (~indr_was_set || strcmp (indr, ':')) if (ispurecell) nrow = max (sum (cellfun ('size', RHS, 1), 1)); else if (isvector (RHS)) if (0 == df.x_cnt(1)) nrow = size (RHS, 1); else nrow = df.x_cnt(1); %# limit to df numbner of rows end else %# deduce limit from RHS nrow = size (RHS, 1); end end indr = 1:nrow; elseif (~isempty (indr)) if (~isnumeric (indr)) %# translate row names to row index [indr, nrow] = df_name2idx (df.x_name{1}, indr, df.x_cnt(1), 'row'); S.subs{1, 1} = indr; else nrow = length (indr); end end if (length (S.subs) > 2) inds = S.subs{1, 3}; else inds = []; end rname = cell(0, 0); rname_width = max (1, size (df.x_name{2}, 2)); ridx = []; cname = rname; ctype = rname; if (ispurecell) if ((length (indc) == df.x_cnt(2) && size (RHS, 2) >= df.x_cnt(2)) ... || 0 == df.x_cnt(2) || isempty (S.subs{1}) || isempty (S.subs{2})) %# providing too much information -- remove extra content if (size (RHS, 1) > 1) %# at this stage, verify that the first line doesn't contain %# chars only; use them for column names dummy = cellfun ('class', ... RHS(1, ~cellfun ('isempty', RHS(1, :))), ... 'UniformOutput', false); dummy = strcmp (dummy, 'char'); if (all (dummy)) if (length (df.x_over{2}) >= max (indc) ... && ~all (df.x_over{2}(indc)) && ~isempty (S.subs{2})) warning('Trying to overwrite colum names'); end cname = RHS(1, :).'; RHS = RHS(2:end, :); if (~indr_was_set) nrow = nrow - 1; indr = 1:nrow; else %# we know indr, there is no reason that RHS(:, 1) contains %# row names. if (isempty (S.subs{2})) %# extract columns position from columns names [indc, ncol, S.subs{2}, dummy] = ... df_name2idx (df.x_name{2}, cname, df.x_cnt(2), 'column'); if (length (dummy) ~= sum (dummy)) warning ('Not all RHS column names used'); cname = cname(dummy); RHS = RHS(:, dummy); end end end end %# at this stage, verify that the first line doesn't contain %# chars only; use them for column types dummy = cellfun ('class', ... RHS(1, ~cellfun ('isempty', RHS(1, :))), ... 'UniformOutput', false); dummy = strcmp (dummy, 'char'); if (all (dummy)) if (length (df.x_over{2}) >= max (indc) ... && ~all (df.x_over{2}(indc))) warning ('Trying to overwrite colum names'); end if (sum (~cellfun ('isempty', RHS(1, indc))) == ncol) ctype = RHS(1, :); end RHS = RHS(2:end, :); if (~indr_was_set) nrow = nrow - 1; indr = 1:nrow; end end end %# more elements than df width -- try to use the first two as %# row index and/or row name if (size (RHS, 1) > 1) dummy = all (cellfun ('isnumeric', ... RHS(~cellfun ('isempty', RHS(:, 1)), 1))); else if (0 == size (RHS, 1)) dummy = false; else dummy = isnumeric (RHS{1, 1}); end end dummy = dummy && (~isempty (cname) && size (cname{1}, 2) < 1); if (dummy) ridx = cell2mat (RHS(:, 1)); %# can it be converted to a list of unique numbers ? if (length (unique (ridx)) == length (ridx)) ridx = RHS(:, 1); RHS = RHS(:, 2:end); if (length (df.x_name{2}) == df.x_cnt(2) + ncol) %# columns name were pre-filled with too much values df.x_name{2}(end) = []; df.x_over{2}(end) = []; if (size (RHS, 2) < ncol) ncol = size (RHS, 2); indc = 1:ncol; end elseif (~indc_was_set) ncol = ncol - 1; indc = 1:ncol; end if (~isempty (cname)) cname = cname(2:end); end if (~isempty (ctype)) ctype = ctype(2:end); end else ridx = []; end end if (size (RHS, 2) > df.x_cnt(2)) %# verify the the first row doesn't contain chars only, use them %# for row names dummy = cellfun ('class', ... RHS(~cellfun ('isempty', RHS(:, 1)), 1), ... 'UniformOutput', false); dummy = strcmp (dummy, 'char') ... && (~isempty (cname) && size (cname{1}, 2) < 1); if (all (dummy)) if (length (df.x_over{1}) >= max (indr) ... && ~all (df.x_over{1}(indr))) warning('Trying to overwrite row names'); else rname = RHS(:, 1); end rname_width = max ([1; cellfun('size', rname, 2)]); RHS = RHS(:, 2:end); if (length (df.x_name{2}) == df.x_cnt(2) + ncol) %# columns name were pre-filled with too much values df.x_name{2}(end) = []; df.x_over{2}(end) = []; if (size (RHS, 2) < ncol) ncol = size (RHS, 2); indc = 1:ncol; end elseif (~indc_was_set) ncol = ncol - 1; indc = 1:ncol; end if (~isempty (cname)) cname = cname(2:end); end if (~isempty (ctype)) ctype = ctype(2:end); end end end end end %# perform row resizing if columns are already filled if (~isempty (indr) && isnumeric(indr)) if (max (indr) > df.x_cnt(1) && size (df.x_data, 2) == df.x_cnt(2)) df = df_pad (df, 1, max (indr)-df.x_cnt(1), rname_width); end end if (ispurecell) %# we must pad on a column-by-column basis %# verify that each cell contains a non-empty vector, and that sizes %# are compatible %# dummy = cellfun ('size', RHS(:), 2); %# if any (dummy < 1), %# error('cells content may not be empty'); %# end %# dummy = cellfun ('size', RHS, 1); %# if any (dummy < 1), %# error('cells content may not be empty'); %# end %# if any (diff(dummy) > 0), %# error('cells content with unequal length'); %# end %# if 1 < size (RHS, 1) && any (dummy > 1), %# error('cells may only contain scalar'); %# end if (size (RHS, 2) > indc) if (size (cname, 1) > indc) ncol = size (RHS, 2); indc = 1:ncol; else if (debug_on_error ()) keyboard; end end end %# try to detect and remove bottom garbage eff_len = zeros (nrow, 1); if (size (RHS, 1) > 1) for indi = (indr) eff_len(indi, 1) = sum (~cellfun ('isempty', RHS(indi, :))); end indi = nrow; while (indi > 0) if (eff_len(indi) < 1) nrow = nrow - 1; indr(end) = []; RHS(end, :) = []; indi = indi - 1; if (~indr_was_set && isempty (df.x_name{1, 1})) df.x_cnt(1) = nrow; df.x_ridx(end) = []; end else break; end end clear eff_len; end %# the real assignement if (1 == size (RHS, 1)) %# each cell contains one vector extractfunc = @(x) RHS{x}; idxOK = logical(indr); else %# use cell2mat to pad on a column-by-column basis extractfunc = @(x) cell2mat (RHS(:, x)); end indj = 1; S.subs(2) = []; if (length (S.subs) < 2) S.subs{2} = 1; end for indi = (1:ncol) if (indc(indi) > df.x_cnt(2)) %# perform dynamic resizing one-by-one, to get type right if (isempty (ctype) || length (ctype) < indc(indi)) df = df_pad (df, 2, indc(indi)-df.x_cnt(2), class (RHS{1, indj})); else df = df_pad (df, 2, indc(indi)-df.x_cnt(2), ctype{indj}); end end if (max (inds) > length (df.x_rep{indc(indi)})) df = df_pad (df, 3, max (inds)-length (df.x_rep{indc(indi)}), ... indc(indi)); end if (nrow == df.x_cnt(1)) %# whole assignement try if (size (RHS, 1) <= 1) switch df.x_type{indc(indi)} case {'char'} %# use a cell array to hold strings dummy = cellfun (@num2str, RHS(:, indj), ... 'UniformOutput', false); case {'double'} dummy = extractfunc (indj); otherwise dummy = cast (extractfunc (indj), df.x_type{indc(indi)}); end else %# keeps indexes in sync as cell elements may be empty idxOK = ~cellfun ('isempty', RHS(:, indj)); %# intialise dummy so that it can receive 'anything' dummy = []; switch (df.x_type{indc(indi)}) case {'char'} %# use a cell array to hold strings dummy = cellfun (@num2str, RHS(:, indj, :), ... 'UniformOutput', false); case {'double'} dummy(idxOK, :) = extractfunc (indj); dummy(~idxOK, :) = NA; otherwise dummy(idxOK, :) = extractfunc (indj); dummy(~idxOK, :) = NA; dummy = cast(dummy, df.x_type{indc(indi)}); end end catch fprintf (2, 'Something went wrong while converting colum %d\n', indj); fprintf (2, 'Error was: %s\n', lasterr ()); keyboard; dummy = unique (cellfun (@class, RHS(:, indj), ... 'UniformOutput', false)); if (any (strmatch ('char', dummy, 'exact'))) fprintf (2, 'Downclassing to char\n'); %# replace the actual column, of type numeric, by a char df.x_type{indc(indi)} = 'char'; dummy = RHS(:, indj); for indk = (size (dummy, 1):-1:1) if (~isa ('char', dummy{indk})) if (isinteger (dummy{indk})) dummy(indk) = mat2str (dummy{indk}); elseif (isa ('logical', dummy{indk})) if (dummy{indk}) dummy(indk) = 'true'; else dummy{indk} = 'false'; end elseif (isnumeric (dummy{indk})) dummy(indk) = mat2str (dummy{indk}, 6); end end end else dummy = ... sprintf ('Assignement failed for colum %d, of type %s and length %d,\nwith new content\n%s', ... indj, df.x_type{indc(indi)}, length (indr), disp (RHS(:, indj))); keyboard error (dummy); end if (debug_on_error ()) keyboard; end end if (size (dummy, 1) < df.x_cnt(1)) dummy(end+1:df.x_cnt(1), :) = NA; end else %# partial assignement -- extract actual data and update dummy = df.x_data{indc(indi)}; if (size (RHS, 1) > 0) %# pad content try switch (df.x_type{indc(indi)}) case {'char'} %# use a cell array to hold strings dummy(indr, 1) = cellfun(@num2str, RHS(:, indj), ... 'UniformOutput', false); case {'double'} dummy(indr, :) = extractfunc (indj); otherwise dummy(indr, :) = cast(extractfunc (indj), df.x_type{indc(indi)}); end catch dummy = ... sprintf ('Assignement failed for colum %d, of type %s and length %d,\nwith new content\n%s', ... indj, df.x_type{indc(indi)}, length (indr), disp (RHS(:, indj))); error (dummy); end end end [df, S] = df_cow (df, S, indc(indi)); if (isempty (inds)) df.x_data{indc(indi)} = dummy; df.x_rep{indc(indi)} = 1:size (dummy, 2); else fillfunc = @(x, S, y) feval (@subsasgn, x, S, dummy); try df.x_data{indc(indi)} = fillfunc (df.x_data{indc(indi)}, S, indi); catch disp (lasterr ()); disp ('line 439'); keyboard end end %# df.x_rep{indc(indi)} = 1:size (dummy, 2); indj = indj + 1; end else %# RHS is either a numeric, either a df if (any (indc > min (size (df.x_data, 2), df.x_cnt(2)))) df = df_pad (df, 2, max (indc-min (size (df.x_data, 2), df.x_cnt(2))), ... class(RHS)); end if (~isempty (inds) && isnumeric(inds) && any (inds > 1)) for indi = (1:ncol) if (max (inds) > length (df.x_rep{indc(indi)})) df = df_pad (df, 3, max (inds)-length (df.x_rep{indc(indi)}), ... indc(indi)); end end end if (isa (RHS, 'dataframe')) %# block-copy index S.subs(2) = 1; if (any (~isna(RHS.x_ridx))) df.x_ridx = feval (@subsasgn, df.x_ridx, S, RHS.x_ridx); end %# skip second dim and copy data S.subs(2) = []; Sorig = S; for indi = (1:ncol) [df, S] = df_cow (df, S, indc(indi)); if (strcmp (df.x_type(indc(indi)), RHS.x_type(indi))) try df.x_data{indc(indi)} = feval (@subsasgn, df.x_data{indc(indi)}, S, ... RHS.x_data{indi}(:, RHS.x_rep{indi})); catch disp (lasterr ()); disp('line 445 ???'); keyboard end else df.x_data{indc(indi)} = feval (@subsasgn, df.x_data{indc(indi)}, S, ... cast (RHS.x_data{indi}(:, RHS.x_rep{indi}),... df.x_type(indc(indi)))); end S = Sorig; end if (~isempty (RHS.x_name{1})) df.x_name{1}(indr) = genvarname(RHS.x_name{1}(indr)); df.x_over{1}(indr) = RHS.x_over{1}(indr); end if (~isempty (RHS.x_src)) if (~any (strcmp (cellstr(df.x_src), cellstr(RHS.x_src)))) df.x_src = vertcat(df.x_src, RHS.x_src); end end if (~isempty (RHS.x_cmt)) if (~any (strcmp (cellstr(df.x_cmt), cellstr(RHS.x_cmt)))) df.x_cmt = vertcat(df.x_cmt, RHS.x_cmt); end end else %# RHS is homogenous, pad at once if (isvector (RHS)) %# scalar - vector if (isempty (S.subs)) fillfunc = @(x, y) RHS; else %# ignore 'column' dimension -- force colum vectors -- use a %# third dim just in case if (isempty (S.subs{1})) S.subs{1} = ':'; end S.subs(2) = []; if (length (S.subs) < 2) S.subs{2} = 1; end if (ncol > 1 && length (RHS) > 1) %# set a row from a vector fillfunc = @(x, S, y) feval (@subsasgn, x, S, RHS(y)); else fillfunc = @(x, S, y) feval (@subsasgn, x, S, RHS); end end Sorig = S; for indi = (1:ncol) try lasterr(''); dummy= 'df_cow'; [df, S] = df_cow (df, S, indc(indi)); dummy = 'fillfunc'; df.x_data{indc(indi)} = fillfunc (df.x_data{indc(indi)}, S, indi); S = Sorig; catch disp (lasterr ()); disp ('line 499 '); keyboard end %# catch %# if ndims(df.x_data{indc(indi)}) > 2, %# %# upstream forgot to give the third dim %# dummy = S; dummy.subs(3) = 1; %# df.x_data{indc(indi)} = fillfunc(df.x_data{indc(indi)}, \ %# dummy, indi); %# else %# rethrow(lasterr()); %# end %# end end else %# 2D - 3D matrix S.subs(2) = []; %# ignore 'column' dimension if (isempty (S.subs{1})) S.subs{1} = indr; end %# rotate slices in dim 1-3 to slices in dim 1-2 fillfunc = @(x, S, y) feval (@subsasgn, x, S, squeeze(RHS(:, y, :))); Sorig = S; for indi = (1:ncol) [df, S] = df_cow (df, S, indc(indi)); df.x_data{indc(indi)} = fillfunc (df.x_data{indc(indi)}, S, indi); S = Sorig; end end if (indi < size (RHS, 2) && ~isa (RHS, 'char')) warning (' not all columns of RHS used'); end end end %# delayed row padding -- column padding occured before if (~isempty (indr) && isnumeric (indr)) if (max (indr) > df.x_cnt(1) && size (df.x_data, 2) < df.x_cnt(2)) df = df_pad (df, 1, max (indr)-df.x_cnt(1), rname_width); end end %# adjust ridx and rnames, if required if (~isempty (ridx)) dummy = df.x_ridx; if (1 == size (RHS, 1)) dummy(indr) = ridx{1}; else dummy(indr) = vertcat(ridx{indr}); end if (length (unique (dummy)) ~= length (dummy)) %# || ... %# any (diff(dummy) <= 0), error('row indexes are not unique or not ordered'); end df.x_ridx = dummy; end if (~isempty (rname) && (length (df.x_over{1}) < max (indr) || ... all (df.x_over{1}(indr)))) df.x_name{1}(indr, 1) = genvarname(rname); df.x_over{1}(1, indr) = false; end if (~isempty (cname) && (length (df.x_over{2}) < max (indc) || ... all (df.x_over{2}(indc)))) if (length (cname) < ncol) cname(end+1:ncol) = {'_'}; end cname(cellfun (@isempty, cname)) = 'unnamed'; try df.x_name{2}(indc, 1) = genvarname (cname); catch %# there was a problem with genvarname. dummy = sum (~cellfun ('isempty', cname)); if (1 == dummy) dummy = strsplit(cname{1}, ' ', true); if (length (dummy) == ncol) df.x_name{2}(indc, 1) = dummy; else disp ('line 575 '); keyboard end else disp ('line 578 '); keyboard end end df.x_over{2}(1, indc) = false; end df = df_thirddim (df); end dataframe-1.2.0/inst/@dataframe/private/PaxHeaders.29945/df_func.m0000644000000000000000000000013013147547161021453 xustar0029 mtime=1503579761.90961881 29 atime=1503579761.90961881 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/private/df_func.m0000644000175000017500000002146413147547161021637 0ustar00olafolaf00000000000000function resu = df_func(func, A, B, itercol=true, whole=logical([0 0])); %# function resu = df_func(func, A, B, whole) %# Implements an iterator to apply some func when at %# least one argument is a dataframe. The output is a dataframe with %# the same metadata, types may be altered, like f.i. double=>logical. %# When itercol is 'true', the default, LHS is iterated by columns, %# otherwise by rows. 'Whole' is a two-elements logical vector with %# the meaning that LHS and or RHS must be iterated at once or not %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 2, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . [A, B, resu] = df_basecomp (A, B, itercol, func); itercol = itercol(1); %# drop second value if (isa (B, 'dataframe')) if (~isa (A, 'dataframe')), if (isscalar (A)), for indi = (resu.x_cnt(2):-1:1) switch resu.x_type{indi} case 'char' resu.x_data{indi} = feval (func, A, char (B.x_data{indi})); otherwise resu.x_data{indi} = feval (func, A, B.x_data{indi}); end end resu.x_rep = B.x_rep; else if (whole(1) && ~whole(2)) for indi = (resu.x_cnt(2):-1:1) switch resu.x_type{indi} case 'char' resu.x_data{indi} = feval (func, A, ... char (B.x_data{indi}(:, B.x_rep{indi}))); otherwise resu.x_data{indi} = feval (func, A, ... B.x_data{indi}(:, B.x_rep{indi})); end resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); end elseif (itercol && ~whole(2)), for indi = (resu.x_cnt(2):-1:1) switch resu.x_type{indi} case 'char' resu.x_data{indi} = feval (func, squeeze (A(:, indi, :)), ... char (B.x_data{indi}(:, B.x_rep{indi}))); otherwise resu.x_data{indi} = feval (func, squeeze (A(:, indi, :)), ... B.x_data{indi}(:, B.x_rep{indi})); end resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); end elseif (~whole(2)), warning ('no 3D yet'); for indi = (resu.x_cnt(2):-1:1) switch resu.x_type{indi} case 'char' resu.x_data{indi} = feval (func, A(indi, :), char (B.x_data{indi})); otherwise resu.x_data{indi} = feval (func, A(indi, :), B.x_data{indi}); end end else dummy = feval (func, A, df_whole (B)); for indi = (resu.x_cnt(2):-1:1) %# store column-wise resu.x_data{indi} = squeeze (dummy(:, indi, :)); resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); resu.x_type{indi} = class (dummy); end end end else if (itercol) for indi = (resu.x_cnt(2):-1:1) switch resu.x_type{indi} case 'char' resu.x_data{indi} = feval ... (func, char (A.x_data{indi}(:, A.x_rep{indi})), ... char (B.x_data{indi}(B.x_rep{indi}))); otherwise resu.x_data{indi} = feval ... (func, A.x_data{indi}(:, A.x_rep{indi}), ... B.x_data{indi}(:, B.x_rep{indi})); end resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); end else %# itercol is false dummy = df_whole(A); if (whole(1)) for indi = (resu.x_cnt(2):-1:1) switch resu.x_type{indi} case 'char' resu.x_data{indi} = feval (func, dummy, ... char (B.x_data{indi}(:, B.x_rep{indi}))); otherwise resu.x_data{indi} = feval (func, dummy, ... B.x_data{indi}(:, B.x_rep{indi})); end resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); end elseif (~whole(2)) for indi = (resu.x_cnt(2):-1:1) switch resu.x_type{indi} case 'char' resu.x_data{indi} = squeeze ... (feval (func, dummy(indi, :, :),... char (B.x_data{indi}(:, B.x_rep{indi})))); otherwise resu.x_data{indi} = squeeze ... (feval (func, dummy(indi, :, :), ... B.x_data{indi}(:, B.x_rep{indi}))); end resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); end else dummy = feval (func, dummy, df_whole(B)); for indi = (resu.x_cnt(2):-1:1) %# store column-wise resu.x_data{indi} = squeeze (dummy(:, indi, :)); resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); resu.x_type{indi} = class (dummy); end end end end else %# B is not a dataframe if (isscalar (B)) for indi = (resu.x_cnt(2):-1:1) switch resu.x_type{indi} case 'char' resu.x_data{indi} = feval (func, char (A.x_data{indi}), B); otherwise resu.x_data{indi} = feval (func, A.x_data{indi}, B); end end resu.x_rep = A.x_rep; else if (itercol) if (whole(2)) for indi = (resu.x_cnt(2):-1:1) switch resu.x_type{indi} case 'char' unfolded = char (A.x_data{indi}(:, A.x_rep{indi})); otherwise unfolded = A.x_data{indi}(:, A.x_rep{indi}); end resu.x_data{indi} = squeeze (feval (func, unfolded, B)); resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); end else for indi = (resu.x_cnt(2):-1:1) switch resu.x_type{indi} case 'char' unfolded = char (A.x_data{indi}(:, A.x_rep{indi})); otherwise unfolded = A.x_data{indi}(:, A.x_rep{indi}); end resu.x_data{indi} = feval (func, unfolded, ... squeeze (B(:, indi, :))); resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); end end else dummy = df_whole(A); if (whole(1)) for indi = (columns (B):-1:1) resu.x_data{indi} = squeeze (feval(func, dummy, B(:, indi, :))); resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); end else if (~whole(2)) for indi = (resu.x_cnt(1):-1:1) resu.x_data{indi} = squeeze (feval (func, dummy(indi, :, :), ... B(:, indi, :))); resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); end else for indi = (resu.x_cnt(1):-1:1) %# in place computation dummy(indi, :, :) = feval (func, dummy(indi, :, :), B); end for indi = (resu.x_cnt(2):-1:1) %# store column-wise resu.x_data{indi} = squeeze (dummy(:, indi, :)); resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); end end end %# verify that sizes match, this is required for '\' resu.x_cnt(2) = length (resu.x_data); resu.x_cnt(1) = max (cellfun ('size', resu.x_data, 1)); if (length (resu.x_ridx) < resu.x_cnt(1)), if (1 == length (resu.x_ridx)) resu.x_ridx(end+1:resu.x_cnt(1), 1) = resu.x_ridx(1); else resu.x_ridx(end+1:resu.x_cnt(1), 1) = NA; end end if (length (resu.x_name{2}) < resu.x_cnt(2)), if (1 == length (resu.x_name{2})), resu.x_name{2}(end+1:resu.x_cnt(2), 1) = resu.x_name{2}; resu.x_over{2}(end+1:resu.x_cnt(2), 1) = resu.x_over{2}; else resu.x_name{2}(end+1:resu.x_cnt(2), 1) = '_'; resu.x_over{2}(end+1:resu.x_cnt(2), 1) = true; end end end end end resu.x_type = cellfun (@class, resu.x_data, 'UniformOutput', false); resu = df_thirddim (resu); end dataframe-1.2.0/inst/@dataframe/private/PaxHeaders.29945/struct2df.m0000644000000000000000000000013213147547161021771 xustar0030 mtime=1503579761.913618866 30 atime=1503579761.913618866 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/private/struct2df.m0000644000175000017500000000335713147547161022154 0ustar00olafolaf00000000000000function df = struct2df(x, varargin) %# function df = struct2df(x, varargin) %# This function converts an ordinary structure into a dataframe. %# Fieldnames are taken as columns names %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 2, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . names = fieldnames (x); if (isscalar (x)) rowcount = structfun (@(x) size(x, 1), x); df = cell(1+max (rowcount), length (names)); df(1, :) = names; for indi = (length (names) : -1 : 1) if (isa (x.(names{indi}), 'cell')) df(1+(1:rowcount(indi)), indi) = x.(names{indi}); else dummy = mat2cell (x.(names{indi}), repmat (1, [rowcount(indi) 1], 1)); df(1+(1:rowcount(indi)), indi) = dummy; endif endfor else rowcount = size (x, 1); df = cell (1 + rowcount, length (names)); df(1, :) = names; for indi = (length (names) : -1 : 1) for indj = (1:rowcount) df(1+indj, indi) = x(indj).(names{indi}); endfor endfor endif df = dataframe (df); end dataframe-1.2.0/inst/@dataframe/private/PaxHeaders.29945/df_name2idx.m0000644000000000000000000000013213147547161022231 xustar0030 mtime=1503579761.913618866 30 atime=1503579761.913618866 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/private/df_name2idx.m0000644000175000017500000001200613147547161022403 0ustar00olafolaf00000000000000function [idx, nelem, subs, mask] = df_name2idx(names, subs, count, dimname, missingOK); %# This is a helper routine to translate rownames or columnames into %# real index. Input: names, a char array, and subs, a cell array as %# produced by subsref and similar. This routine can also detect %# ranges, two values separated by ':'. On output, subs is %# 'sanitised' from names, and is either a vector, either a single ':' %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 2, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (nargin < 5) missingOK = false; end %# regexp idea of 'word boundary' changed between 3.6 and 3.7 persistent wbs wbe; if (isempty (wbs)) if (isempty ( regexp ('This is a test', '\'))) [wbs, wbe] = deal ('\b'); else wbs = '\<'; wbe = '\>'; end end if (isempty (subs)) %# not caring about rownames ? Avoid generating an error. idx = []; nelem = 0; return end if (~isa (dimname, 'char')) switch dimname case 1 dimname = 'row'; case 2 dimname = 'column'; case 3 dimname = 'page'; otherwise error ('Unknown dimension %d', dimname); end end if (isa (subs, 'char')), orig_name = subs; if (1 == size (subs, 1)) if (strcmp(subs, ':')) %# range operator idx = 1:count; nelem = count; return end end subs = cellstr (subs); else if (~isvector(subs)) %# yes/no ? %# error('Trying to access column as a matrix'); end switch (class (subs)) case {'cell'} orig_name = char (subs); case {'dataframe'} orig_name = 'elements indexed by a dataframe'; otherwise orig_name = num2str (subs); end end if (isa (subs, 'cell')) subs = subs(:); idx = []; mask = logical (zeros (size (subs, 1), 1)); %# translate list of variables to list of indices for indi = (1:size (subs, 1)) %# regexp doesn't like empty patterns if (isempty (subs{indi})) continue; end %# convert from standard pattern to regexp pattern subs{indi} = regexprep (subs{indi}, '([^\.\\])(\*|\?)', '$1.$2'); %# quote repetition ops at begining of line, otherwise the regexp %# will stall forever/fail subs{indi} = regexprep (subs{indi}, ... '^([\*\+\?\{\}\|])', '\\$1'); %# detect | followed by EOL subs{indi} = regexprep (subs{indi}, '([^\\])\|$', '$1\\|'); if (0 == index (subs{indi}, ':')) %# if there's no special operator, make match strict if (isempty (regexp (subs{indi}, '[\.\*\+\?\{\}\(\)\[\]\^\$\\]'))) subs{indi} = [wbs subs{indi} wbe]; end for indj = (1:min (length (names), count)) %# sanity check if (~isempty (regexp (names{indj}, subs{indi}))) idx = [idx indj]; mask(indi) = true; dummy = true; end end else dummy = strsplit (subs{indi}, ':'); ind_start = 1; if (~isempty (dummy{1})) ind_start = sscanf (dummy{1}, '%d'); if (isempty (ind_start)) ind_start = 1; for indj = (1:min(length (names), count)) %# sanity check if (~isempty (regexp (names{indj}, subs{indi}))), ind_start = indj; break; %# stop at the first match end end end end if (isempty (dummy{2}) || strcmp (dummy{2}, 'end')) ind_stop = count; else ind_stop = sscanf(dummy{2}, '%d'); if (isempty (ind_stop)) ind_stop = 1; for indj = (min (length (names), count):-1:1) %# sanity check if (~isempty (regexp (names{indj}, subs{indi}))) ind_stop = indj; break; %# stop at the last match end end end end idx = [idx ind_start:ind_stop]; end end if (isempty (idx) && ~missingOK) dummy = sprintf ('Unknown %s name while searching for %s', ... dimname, orig_name); error (dummy); end elseif (isa (subs, 'logical')) idx = 1:length (subs(:)); idx = reshape (idx, size (subs)); idx(~subs) = []; mask = subs; elseif (isa (subs, 'dataframe')) idx = subsindex (subs, 1); else idx = subs; end subs = idx; nelem = length (idx); end dataframe-1.2.0/inst/@dataframe/private/PaxHeaders.29945/df_mapper2.m0000644000000000000000000000013013147547161022066 xustar0029 mtime=1503579761.90961881 29 atime=1503579761.90961881 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/private/df_mapper2.m0000644000175000017500000001022113147547161022237 0ustar00olafolaf00000000000000function resu = df_mapper2(func, df, varargin) %# resu = df_mapper2(func, df) %# small interface to iterate some vector func over the elements of a %# dataframe. This one is specifically adapted to all functions where %# the first argument, if numeric, is 'dim'. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 2, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . dim = []; resu = []; vout = varargin; %# take care of constructs as min(x, [], dim); sum(x, 2, 'native') for indi = (nargin-2:-1:1) if (isscalar (varargin{indi})) if (isnumeric (varargin{indi})) dim = varargin{indi}; %# the 'third' dim is the second on stored data if (3 == dim) vout(indi-2) = 2; end end end break; end if (isempty (dim)) %# iterates on the first non-singleton dim dim = find (df.x_cnt > 1)(1); end switch (dim) case {1} resu = df_colmeta (df); %# don't copy all the information for indi = (1:df.x_cnt(2)) resu.x_data{indi} = feval (func, df.x_data{indi}(:, df.x_rep{indi}), ... vout{:}); resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); end resu.x_cnt(1) = max (cellfun ('size', resu.x_data, 1)); if (resu.x_cnt(1) == df.x_cnt(1)) %# the func was not contracting resu.x_ridx = df.x_ridx; resu.x_name{1} = resu.x_name{1}; resu.x_over{1} = resu.x_over{1}; else %# select the first value if (~isempty (resu.x_name{1})) resu.x_name{1} = resu.x_name{1}(1); end if (~isempty (resu.x_over{1})) resu.x_over{1} = resu.x_over{1}(1); end end case {2} switch func case @sum contract = true; func = @plus; case @cumsum contract = false; func = @plus; case @prod contract = true; func = @times; case @cumprod contract = false; func = @times; case @any contract = true; func = @or; case @all contract = true; func = @and; otherwise error ('Operation not implemented'); end if (contract) resu = df_allmeta (df, [df.x_cnt(1) 1]); else resu = df_allmeta(df); end resu.x_data{1} = df.x_data{1}(:, df.x_rep{1}); resu.x_rep{1} = df.x_rep{1}; if (contract) for indi = (2:df.x_cnt(2)) %# this call is 'unfolding' resu.x_data{1} = feval (func, resu.x_data{1}(:, df.x_rep{1}), ... df.x_data{indi}(:, df.x_rep{indi})); resu.x_rep{1} = 1:size (resu.x_data{1}, 2); end else for indi = (2:df.x_cnt(2)) resu.x_data{indi} = feval (func, resu.x_data{indi-1}(:, df.x_rep{indi-1}), ... df.x_data{indi}(:, df.x_rep{indi})); resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); end end %# type may have changed resu.x_type = cellfun(@(x) class(x(1)), resu.x_data, 'UniformOutput', false); case {3} resu = df_allmeta(df); for indi = (1:df.x_cnt(2)) resu.x_data{indi} = feval (func, df.x_data{indi}(:, df.x_rep{indi}), ... vout{:}); resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); end otherwise error ('Invalid dimension %d', dim); end resu = df_thirddim (resu); end dataframe-1.2.0/inst/@dataframe/private/PaxHeaders.29945/df_allmeta.m0000644000000000000000000000013213147547161022141 xustar0030 mtime=1503579761.905618754 30 atime=1503579761.905618754 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/private/df_allmeta.m0000644000175000017500000000701513147547161022317 0ustar00olafolaf00000000000000function resu = df_allmeta(df, dim = []) %# function resu = df_allmeta(df, dim = []) %# Returns a new dataframe, initalised with the all the %# meta-information but with empty data %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 2, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = dataframe (); if (isempty (dim)) dim = df.x_cnt(1:2); else dim = dim(1:2); %# ignore third dim, if any end %# this is unnecessary: if passed a dim, just use it. %# resu.x_cnt(1:2) = min (dim, df.x_cnt(1:2)); resu.x_cnt(1:2) = dim; if (~isempty (df.x_name{1})) if (df.x_cnt(1) >= resu.x_cnt(1)) resu.x_name{1} = df.x_name{1}(1:resu.x_cnt(1)); resu.x_over{1} = df.x_over{1}(1:resu.x_cnt(1)); else dummy = floor (resu.x_cnt(1) / df.x_cnt(1)); resu.x_name{1} = repmat (df.x_name{1}(1:df.x_cnt(1)), 1, dummy); resu.x_over{1} = repmat (df.x_over{1}(1:df.x_cnt(1)), 1, dummy); if (length (resu.x_name{1}) != dim(1)) if (~isempty (other)) if (isa (other, 'dataframe')) if (length (other.x_name{1}) >= dim(1)) resu.x_name{1} = other.x_name{1}(1:resu.x_cnt(1)); resu.x_over{1} = other.x_over{1}(1:resu.x_cnt(1)); end end end end end end if (~isempty (df.x_name{2})) if (df.x_cnt(2) >= resu.x_cnt(2)) resu.x_name{2} = df.x_name{2}(1:resu.x_cnt(2)); resu.x_over{2} = df.x_over{2}(1:resu.x_cnt(2)); else dummy = floor (resu.x_cnt(2) / df.x_cnt(2)); resu.x_name{2} = repmat (df.x_name{2}(1:df.x_cnt(2)), 1, dummy); resu.x_over{2} = repmat (df.x_over{2}(1:df.x_cnt(2)), 1, dummy); if (length (resu.x_name{2}) != dim(2)) dummy = repmat ('X', resu.x_cnt(2), 1); dummy = cstrcat (dummy, strjust (num2str ((1:resu.x_cnt(2))(:)), 'left')); resu.x_name{2} = cellstr (dummy); resu.x_over{2} = true (ones (resu.x_cnt(2), 1)); end end end if (~isempty (df.x_ridx)) if (size (df.x_ridx, 2) >= resu.x_cnt(2)), resu.x_ridx = df.x_ridx(1:resu.x_cnt(1), :, :); else resu.x_ridx = df.x_ridx(1:resu.x_cnt(1), 1, :); end end %# init it with the right orientation resu.x_data = cell (size (df.x_data, 1), min (dim(2), size (df.x_data, 2))); resu.x_rep = cell (size (resu.x_data)); %# type 'char' must get through resu.x_type = cellstr (repmat ('unknown', resu.x_cnt(2), 1)).'; if (df.x_cnt(2) >= resu.x_cnt(2)) for indi = (1:resu.x_cnt(2)) switch df.x_type{indi} case 'char' resu.x_type{indi} = 'char'; end end else for indi = (1:df.x_cnt(2)) switch df.x_type{indi} case 'char' resu.x_type = cellstr (repmat ('char', resu.x_cnt(2), 1)).'; end end end resu.x_src = df.x_src; resu.x_cmt = df.x_cmt; end dataframe-1.2.0/inst/@dataframe/private/PaxHeaders.29945/df_check_char_array.m0000644000000000000000000000013013147547161023770 xustar0029 mtime=1503579761.90961881 29 atime=1503579761.90961881 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/private/df_check_char_array.m0000644000175000017500000000274113147547161024151 0ustar00olafolaf00000000000000function resu = df_check_char_array(x, nelem, required) %# auxiliary function: pad a char array to some width %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 2, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (2 == nargin) required = [nelem 1]; end if (nelem < required(1)) error ('Too many elements to assign'); end %# a zero-length element is still considered as a space by char if (isempty (x)) x = ' '; end if (size (x, 1) < max (required(1), nelem)) %# pad vertically dummy = repmat (' ', nelem-size (x, 1), 1); resu = char (x, dummy); else resu = x; end if (size (resu, 2) < required(2)) %# pad horizontally dummy = repmat (' ', nelem, required(2)-size (resu, 2)); resu = horzcat (resu, dummy); end end dataframe-1.2.0/inst/@dataframe/private/PaxHeaders.29945/df_pad.m0000644000000000000000000000013213147547161021266 xustar0030 mtime=1503579761.913618866 30 atime=1503579761.913618866 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/private/df_pad.m0000644000175000017500000001661513147547161021452 0ustar00olafolaf00000000000000function df = df_pad(df, dim, n, coltype) %# function resu = df_pad(df, dim, n, coltype = []) %# given a dataframe, insert n rows or columns, and adjust everything %# accordingly. Coltype is a supplemental argument: %# dim = 1 => not used %# dim = 2 => type of the added column(s) %# dim = 3 => index of columns receiving a new sheet (default: all) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 2, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (nargin < 4), coltype = []; end try NA = NA; catch NA = NaN; end switch dim case 1 if (~isempty (df.x_name{1})), if (length (df.x_name{1}) < df.x_cnt(1)+n) %# generate a name for the new row(s) df.x_name{1}(df.x_cnt(1)+(1:n), 1) = {'_'}; df.x_over{1}(1, df.x_cnt(1)+(1:n), 1) = true; end end %# complete row indexes: by default, row number. if (isempty (df.x_ridx)) (1:n); dummy = ans(:); else dummy = vertcat (df.x_ridx, repmat (size (df.x_ridx, 1)+(1:n).', ... 1, size (df.x_ridx, 2))); end df.x_ridx = dummy; %# pad every line for indi = (1:min (size (df.x_data, 2), df.x_cnt(2))) neff = n + df.x_cnt(1) - size (df.x_data{indi}, 1); if (neff > 0) m = max(1, size (df.x_data{indi}, 2)); switch df.x_type{indi} case {'char'} %# there is no 'string NA' dummy = {}; dummy(1:neff, 1:m) = 'NA'; dummy = vertcat (df.x_data{indi}, dummy); case { 'double'} dummy = vertcat (df.x_data{indi}, repmat (NA, neff, m)); %# there is no 'NA' with logical values, avoid casting error case {'logical'} dummy = vertcat (df.x_data{indi}, repmat (false, neff, m)); otherwise dummy = cast (vertcat (df.x_data{indi}, repmat (NA, neff, m)), ... df.x_type{indi}); end df.x_data{indi} = dummy; if (isempty (df.x_rep{indi})) df.x_rep{indi} = 1; end end end df.x_cnt(1) = df.x_cnt(1) + n; case 2 %# create new columns if (isempty (coltype)) error ('df_pad: dim equals 2, and coltype undefined'); end if (length (n) > 1) %#second value is an offset indc = n(2); n = n(1); if (indc < df.x_cnt(2)), %# shift to the right df.x_name{2}(n + (indc+1:end)) = df.x_name{2}(indc+1:end); df.x_over{2}(n + (indc+1:end)) = df.x_over{2}(indc+1:end); dummy = cstrcat (repmat ('_', n, 1), ... strjust (num2str(indc + (1:n).'), 'left')); df.x_name{2}(indc + (1:n)) = cellstr (dummy); df.x_over{2}(indc + (1:n)) = true; df.x_type(n+(indc+1:end)) = df.x_type(indc+1:end); df.x_type(indc + (1:n)) = NA; df.x_data(n + (indc+1:end)) = df.x_data(indc+1:end); df.x_rep(n + (indc+1:end)) = df.x_rep(indc+1:end); df.x_data(indc + (1:n)) = NA; df.x_rep(indc + (1:n)) = 1; end else %# add new values after the last column indc = min (size (df.x_data, 2), df.x_cnt(2)); end if (~isa (coltype, 'cell')) coltype = {coltype}; end if (isscalar (coltype) && n > 1) coltype = repmat (coltype, 1, n); end for indi = (1:n) switch coltype{indi} case {'char'} dummy = {repmat(NA, df.x_cnt(1), 1) }; dummy(:, 1) = '_'; case { 'double'} dummy = repmat (NA, df.x_cnt(1), 1); case {'logical'} %# there is no NA in logical type dummy = repmat (false, df.x_cnt(1), 1); otherwise try dummy = cast (repmat (NA, df.x_cnt(1), 1), coltype{indi}); catch %# There was an issue -- transfer coltype to data if (indc+indi > df.x_cnt(2)) dummy = {coltype{indi}}; coltype{indi} = 'char'; if (df.x_cnt(1) < 1) %# nothing defined yet -- pad with one line df.x_type{indc+indi} = coltype{indi}; df = df_pad (df, 1, 1); end else dummy = sprintf ('Trying to change type of column %d, which was %s, to %s', ... indc+indi, df.x_type{indi}, coltype{indi}); error (dummy); end end end df.x_data{indc+indi} = dummy; df.x_rep{indc+indi} = 1; df.x_type{indc+indi} = coltype{indi}; end if (size (df.x_data, 2) > df.x_cnt(2)), df.x_cnt(2) = size (df.x_data, 2); end if (length (df.x_name{2}) < df.x_cnt(2)), %# generate a name for the new column(s) dummy = cstrcat (repmat ('_', n, 1), ... strjust (num2str (indc + (1:n).'), 'left')); df.x_name{2}(indc + (1:n)) = cellstr (dummy); df.x_over{2}(1, indc + (1:n)) = true; end case 3 if (n <= 0) return; end if (isempty (coltype)), coltype = 1:df.x_cnt(2); end dummy = max (n+cellfun (@length, df.x_rep(coltype))); if (size (df.x_ridx, 2) < dummy), df.x_ridx(:, end+1:dummy) = NA; end for indi = (coltype) switch df.x_type{indi} case {'char'} if (isa (df.x_data{indi}, 'char')) %# pure char dummy = horzcat (df.x_data{indi}(:, df.x_rep{indi}), ... repmat({NA}, df.x_cnt(1), 1)); keyboard else dummy = horzcat (df.x_data{indi}(:, df.x_rep{indi}), ... repmat({NA}, df.x_cnt(1), 1)); end case {'double'} dummy = horzcat (df.x_data{indi}(:, df.x_rep{indi}), ... repmat (NA, df.x_cnt(1), 1)); case {'logical'} %# there is no logical 'NA' -- fill empty elems with false dummy = horzcat (df.x_data{indi}(:, df.x_rep{indi}), ... repmat (false, df.x_cnt(1), 1)); otherwise dummy = cast (horzcat (df.x_data{indi}(:, df.x_rep{indi}), ... repmat (NA, df.x_cnt(1), 1)), ... df.x_type{indi}); end df.x_data{indi} = dummy; df.x_rep{indi} = [df.x_rep{indi} length(df.x_rep{indi})+ones(1, n)]; try assert (size(df.x_data{indi}, 2), max(df.x_rep{indi})) catch keyboard end end df = df_thirddim (df); otherwise error ('Invalid dimension in df_pad'); end end dataframe-1.2.0/inst/@dataframe/private/PaxHeaders.29945/df_basecomp.m0000644000000000000000000000013013147547161022311 xustar0029 mtime=1503579761.90961881 29 atime=1503579761.90961881 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/private/df_basecomp.m0000644000175000017500000001554413147547161022477 0ustar00olafolaf00000000000000function [A, B, C] = df_basecomp(A, B, itercol=true, func=@plus); %# function [A, B, C] = df_basecomp(A, B, itercol) %# Basic size and metadata compatibility verifications for %# two-arguments operations on dataframe. Returns a scalar, a matrix, %# or a dataframe. Cell arrays are converted to df. Third output %# contains a merge of the metadata. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 2, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (1 == length (itercol)) strict = false; else strict = itercol(2); itercol = itercol(1); end if (~isa (A, 'dataframe')) if (iscell (A)) A = dataframe (A); end end if (~isa (B, 'dataframe')) if (iscell (B)) B = dataframe (B); end end switch (func2str (func)) case 'bsxfun' %# bsxfun compatibility rule: if there is at least one singleton %# dim, the smallest is repeated to reach the size of the %# greatest. Otherwise, all dims must be equal. if (any (size (A)(1:2) ~= size (B)(1:2))) if (~any (1 == [size(A) size(B)])) error ('bsxfun: both arguments must have the same dim, of one of them must have at least one singleton dim'); else Csize = max ([size(A)(1:2); size(B)(1:2)]); end else Csize = size (A)(1:2); end case 'mldivide' if (isscalar (A)) Csize = size (B)(1:2); else if (size (A, 1) ~= size (B, 1)) error ('Non compatible row sizes (op1 is %dx%d, op2 is %dx%d)',... size (A), size (B)(1:2)); end Csize = [size(A, 2) size(B, 2)]; end otherwise %# if strict is set, B may not be non-scalar vs scalar if (strict && isscalar (A)) if (itercol) %# requires full compatibility Csize = size (A)(1:2); if (any (Csize - size (B)(1:2))) %# disp([size(A) size(B)]) error ('Non compatible row and columns sizes (op1 is %dx%d, op2 is %dx%d)',... Csize, size (B)); end else %# compatibility with matrix product if (size (A, 2) - size (B, 1)) error ('Non compatible columns vs. rows size (op1 is %dx%d, op2 is %dx%d)',... size (A)(1:2), size (B)(1:2)); end Csize = [size(A, 1) size(B, 2)]; end end if (~(isscalar (A) || isscalar (B))) %# can it be broadcasted ? if (any (size (A)(1:2) ~= size (B)(1:2))) if (~any (1 == [size(A) size(B)])) error ('bsxfun: both arguments must have the same dim, of one of them must have at least one singleton dim'); else Csize = max ([size(A)(1:2); size(B)(1:2)]); end else Csize = size (A)(1:2); end end end if (~(isscalar (A) || isscalar (B))) C = []; if (isa (A, 'dataframe')) if (nargout > 2 && all (Csize == size (A)(1:2))) C = df_allmeta (A, Csize); end if (isa (B, 'dataframe')) if (nargout > 2 && isempty (C) && all (Csize == size (B)(1:2))) C = df_allmeta (B, Csize); end if (strict) %# compare indexes if both exist if (~isempty (A.x_ridx)) if (~isempty(B.x_ridx) && itercol) if (any (A.x_ridx-B.x_ridx)) error ('Non compatible indexes'); end end else if (nargout > 2 && itercol) C.x_ridx = B.x_ridx; end end if (itercol) idxB = 1; %# row-row comparison else idxB = 2; %# row-col comparsion end if (~isempty (A.x_name{1})) if (~isempty (B.x_name{idxB})) dummy = ~(strcmp (cellstr (A.x_name{1}), cellstr (B.x_name{idxB}))... | (A.x_over{1}(:)) | (B.x_over{idxB}(:))); if (any (dummy)) if (itercol) error ('Incompatible row names'); else error ('Incompatible row vs. column names'); end end dummy = A.x_over{1} > B.x_over{idxB}; if (any (dummy)) C.x_name{1}(dummy) = B.x_name{idxB}(dummy); C.x_over{1}(dummy) = B.x_over{idxB}(dummy); end end else if (nargout > 2) C.x_name{1} = B.x_name{idxB}; C.x_over{1} = B.x_over{idxB}; end end idxB = 3-idxB; if (~isempty(A.x_name{2})) if (~isempty(B.x_name{idxB})) dummy = ~(strcmp (cellstr (A.x_name{2}), cellstr (B.x_name{2}))... | (A.x_over{2}(:)) | (B.x_over{2}(:))); if (any (dummy)) if (itercol) error ('Incompatible column vs row names'); else error ('Incompatible column names'); end end dummy = A.x_over{2} > B.x_over{idxB}; if (any (dummy)) C.x_name{2}(dummy) = B.x_name{idxB}(dummy); C.x_over{2}(dummy) = B.x_over{idxB}(dummy); end end else if (nargout > 2 && ~isempty (B.x_name{idxB})) C.x_name{2} = B.x_name{idxB}; C.x_over{2} = B.x_over{idxB}; end end end if (isempty (A.x_src) && nargout > 2 && ~isempty (B.x_src)) C.x_src = B.x_src; end if (isempty (A.x_cmt) && nargout > 2 && ~isempty (B.x_cmt)) C.x_cmt = B.x_cmt; end else %# B is not a df B = dataframe (B, 'colnames', ''); if (nargout > 2 && isempty (C)) C = df_allmeta (A, Csize); end end else %# A is not a df A = dataframe (A, 'colnames', ''); if (nargout > 2) if (all (Csize == size (B)(1:2))) C = df_allmeta (B, Csize); else C = df_allmeta (B, Csize); end end end else %# both arg are scalar if (nargout > 2) if (isa (A, 'dataframe')) C = df_allmeta (A); else C = df_allmeta (B); end end end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/nth_element.m0000644000000000000000000000013213147547161020701 xustar0030 mtime=1503579761.905618754 30 atime=1503579761.905618754 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/nth_element.m0000644000175000017500000000404313147547161021055 0ustar00olafolaf00000000000000function resu = nth_element(df, n, dim) %# function resu = nth_element(x, n, dim) %# This is a wrapper for the real nth_element %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (~isa (df, 'dataframe')) resu = []; return; end if (nargin < 3) %# default: operates on the first non-singleton dimensio resu = df.x_cnt; dim = find (resu > 1); dim = dim(1); end switch dim case {1} resu = df_colmeta (df); for indi = (1:df.x_cnt(2)) resu.x_data{indi} = feval (@nth_element, df.x_data{indi}(:, df.x_rep{indi}), n, dim); resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); end resu.x_cnt(1) = max (cellfun ('size', resu.x_data, 1)); if (resu.x_cnt(1) == df.x_cnt(1)) %# the func was not contracting resu.x_ridx = df.x_ridx; resu.x_name{1} = resu.x_name{1}; resu.x_over{1} = resu.x_over{1}; end case {2} error ('Operation not implemented'); case {3} resu = df_allmeta(df); for indi = (1:df.x_cnt(2)) resu.x_data{indi} = feval (@nth_element, df.x_data{indi}(:, df.x_rep{indi}), n, dim-1); resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); end otherwise error ('Invalid dimension %d', dim); end resu = df_thirddim (resu); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/cumsum.m0000644000000000000000000000013213147547161017710 xustar0030 mtime=1503579761.885618474 30 atime=1503579761.885618474 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/cumsum.m0000644000175000017500000000162113147547161020063 0ustar00olafolaf00000000000000function resu = cumsum(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper2(@cumsum, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/iscell.m0000644000000000000000000000013213147547161017652 xustar0030 mtime=1503579761.893618586 30 atime=1503579761.893618586 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/iscell.m0000644000175000017500000000171313147547161020027 0ustar00olafolaf00000000000000function resu = iscell(df) %# function resu = iscell(df) %# This is iscell() operator for a dataframe object. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = true; end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/erfc.m0000644000000000000000000000013013147547161017314 xustar0029 mtime=1503579761.88961853 29 atime=1503579761.88961853 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/erfc.m0000644000175000017500000000161413147547161017473 0ustar00olafolaf00000000000000function resu = erfc(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@erfc, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/mldivide.m0000644000000000000000000000013213147547161020174 xustar0030 mtime=1503579761.901618698 30 atime=1503579761.901618698 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/mldivide.m0000644000175000017500000000217413147547161020353 0ustar00olafolaf00000000000000function resu = mldivide(A, B); %# function resu = mldivide(A, B) %# Implements the '\' operator when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . try resu = df_func (@mldivide, A, B, false, [true false]); catch disp (lasterr ()); error ('Operator \\ problem for %s vs. %s', class (A), class (B)); end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/erfcx.m0000644000000000000000000000013013147547161017504 xustar0029 mtime=1503579761.88961853 29 atime=1503579761.88961853 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/erfcx.m0000644000175000017500000000161613147547161017665 0ustar00olafolaf00000000000000function resu = erfcx(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@erfcx, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/expm1.m0000644000000000000000000000013013147547161017427 xustar0029 mtime=1503579761.88961853 29 atime=1503579761.88961853 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/expm1.m0000644000175000017500000000161613147547161017610 0ustar00olafolaf00000000000000function resu = expm1(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@expm1, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/isempty.m0000644000000000000000000000013213147547161020071 xustar0030 mtime=1503579761.893618586 30 atime=1503579761.893618586 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/isempty.m0000644000175000017500000000045413147547161020247 0ustar00olafolaf00000000000000function resu = isempty(df) %# -*- texinfo -*- %# @deftypefn {Function File} isempty(@var{df}) %# Return 1 if df is an empty dataframe (either the number of rows, or %# the number of columns, or both are zero). Otherwise, return 0. %# @end deftypefn resu = any (0 == size (df)); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/mrdivide.m0000644000000000000000000000013213147547161020202 xustar0030 mtime=1503579761.901618698 30 atime=1503579761.901618698 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/mrdivide.m0000644000175000017500000000220413147547161020353 0ustar00olafolaf00000000000000function resu = mrdivide(A, B); %# function resu = mrdivide(A, B) %# Implements the '/' operator when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . try resu = df_func (@mrdivide, A, B, [false true], [false true]); catch disp (lasterr ()); error ('Operator / problem for %s vs. %s', class(A), class(B)); end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/asin.m0000644000000000000000000000013213147547161017331 xustar0030 mtime=1503579761.881618418 30 atime=1503579761.881618418 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/asin.m0000644000175000017500000000161413147547161017506 0ustar00olafolaf00000000000000function resu = asin(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@asin, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/max.m0000644000000000000000000000013213147547161017164 xustar0030 mtime=1503579761.901618698 30 atime=1503579761.901618698 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/max.m0000644000175000017500000000161513147547161017342 0ustar00olafolaf00000000000000function resu = max(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper2(@max, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/size.m0000644000000000000000000000013213147547161017351 xustar0030 mtime=1503579761.917618922 30 atime=1503579761.917618922 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/size.m0000644000175000017500000000457713147547161017541 0ustar00olafolaf00000000000000function varargout = size(df, varargin) %# function resu = size(df, varargin) %# This is size operator for a dataframe object. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . switch nargin case 1 switch nargout case {0, 1} varargout{1} = df.x_cnt; case {2} varargout{1} = df.x_cnt(1); if (1 == df.x_cnt(2) && length (df.x_cnt) > 2) varargout{2} = df.x_cnt(3); else varargout{2} = df.x_cnt(2); end case {3} varargout = {df.x_cnt(1) df.x_cnt(2)}; if (2 == length (df.x_cnt)) varargout{3} = 1; else varargout{3} = df.x_cnt(3); end otherwise error (print_usage ()); end case 2 switch nargout case {0 1} varargout{1} = df.x_cnt; try varargout{1} = varargout{1}(varargin{1}); catch error (print_usage ()); end otherwise error (print_usage ()); end case 3 switch nargout case {0 1} if (length (df.x_cnt) < 3), varargout{1} = 1; else varargout{1} = df.x_cnt; end try varargout{1} = varargout{1}(varargin{1}); catch error (print_usage ()); end otherwise error (print_usage ()); end otherwise error (print_usage ()); end end function usage = print_usage() usage = strcat ('Invalid call to size. Correct usage is: ', ' ', ... '-- Overloaded Function: size (A, N)'); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/uminus.m0000644000000000000000000000013213147547161017717 xustar0030 mtime=1503579761.925619034 30 atime=1503579761.925619034 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/uminus.m0000644000175000017500000000173613147547161020101 0ustar00olafolaf00000000000000function resu = uminus(df); %# function resu = uminus(df) %# Implements the unitary '-' operator for a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@uminus, df); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/display.m0000644000000000000000000000013213147547161020044 xustar0030 mtime=1503579761.885618474 30 atime=1503579761.885618474 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/display.m0000644000175000017500000002063113147547161020221 0ustar00olafolaf00000000000000function resu = display(df) %# function resu = display(df) %# Tries to produce a nicely formatted output of a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (exist ('OCTAVE_VERSION', 'builtin')) mydisp = @(x) disp(x); else format short eng; mydisp = @(x) evalc ('disp (x)'); isna = @(x) isnan (x); end %# generate header name dummy = inputname (1); if (isempty (dummy)) dummy = 'ans'; end if (2 == length (df.x_cnt)) head = sprintf ('%s = dataframe with %d rows and %d columns', ... dummy, df.x_cnt); else head = sprintf ('%s = dataframe with %d rows and %d columns on %d pages', ... dummy, df.x_cnt); end if (~isempty (df.x_src)) for indi = (1:size (df.x_src, 1)) head = strvcat... (head, [repmat('Src: ', size (df.x_src{indi, 1}, 1), 1)... df.x_src{indi, 1}]); end end if (~isempty (df.x_cmt)) for indi = (1:size(df.x_cmt, 1)) head = strvcat... (head, [repmat('Comment: ', size (df.x_cmt{indi, 1}, 1), 1)... df.x_cmt{indi, 1}]); end end if (any (df.x_cnt > 0)) %# stop for empty df dummy = []; vspace = repmat (' ', max (1, df.x_cnt(1)), 1); indi = 1; %# the real, unfolded index %# loop over columns where the corresponding _data really exists for indc = (1:min (df.x_cnt(2), size (df.x_data, 2))) %# emit column names and type if (1 == length (df.x_rep{indc})) dummy{1, 2+indi} = deblank (df.x_name{2}{indc}); dummy{2, 2+indi} = deblank (df.x_type{indc}); else %# append a dot and the third-dimension index to column name tmp_str = [deblank(mydisp (df.x_name{2}{indc})) '.']; tmp_str = arrayfun (@(x) horzcat (tmp_str, num2str(x)), ... (1:length (df.x_rep{indc})), 'UniformOutput', false); dummy{1, 2+indi} = tmp_str{1}; dummy{2, 2+indi} = deblank (df.x_type{indc}); for indk = (2:length (tmp_str)) dummy{1, 1+indi+indk} = tmp_str{indk}; dummy{2, 1+indi+indk} = dummy{2, 2+indi}; end end %# 'print' each column switch df.x_type{indc} case {'char'} indk = 1; while (indk <= size (df.x_data{indc}, 2)) tmp_str = df.x_data{indc}(:, indk); %#get the whole column indj = cellfun ('isprint', tmp_str, 'UniformOutput', false); indj = ~cellfun ('all', indj); for indr = (1:length (indj)) if (indj(indr)), if (isna (tmp_str{indr})), tmp_str{indr} = 'NA'; else if (~ischar (tmp_str{indr})) tmp_str{indr} = char (tmp_str{indr}); end tmp_str{indr} = undo_string_escapes (tmp_str{indr}); end end end %# keep the whole thing, and add a vertical space dummy{3, 2+indi} = mydisp (char (tmp_str)); dummy{3, 2+indi} = horzcat... (vspace, char (regexp (dummy{3, 2+indi}, '.*', ... 'match', 'dotexceptnewline'))); indi = indi + 1; indk = indk + 1; end otherwise %# keep only one horizontal space per line unfolded = df.x_data{indc}(:, df.x_rep{indc}); indk = 1; while (indk <= size (unfolded, 2)) dummy{3, 2+indi} = mydisp (unfolded(:, indk)); tmp_str = char (regexp (dummy{3, 2+indi}, ... '[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?(\s??[-+]\s??[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?i)?', ... 'match', 'dotexceptnewline')); tmp_str = horzcat... (vspace, char (regexp (dummy{3, 2+indi}, '\S.*', ... 'match', 'dotexceptnewline'))); dummy{3, 2+indi} = tmp_str; indi = indi + 1; indk = indk + 1; end end end %# put everything together vspace = [' '; ' '; vspace]; %# second line content resu = []; for (ind1 = 1:size (df.x_ridx, 2)) %# simple case: no column-compressed data if ((1 == size(df.x_ridx, 3)) && ... (any (~isna (df.x_ridx(1:df.x_cnt(1), ind1)))) || ... (any (isempty (df.x_ridx(1:df.x_cnt(1), ind1))))) dummy{2, 1} = [sprintf('_%d', ind1) ; 'Nr']; %# save the actual format; display in short form, and restore. try %# Octave 3.8 (CentOS 7). MatLab still uses this in R2017 myform = get(0, 'format'); myformfunc = @(x) format(x); catch %# Octave 4.0 and 4.2 specific try myform = __formatstring__(); myformfunc = @(x) __formatstring__(x); catch %# Octave 4.4 ? try myform = format(); myformfunc = @(x) format(x); catch myform = "short"; myformfunc = []; end end end format short; dummy{3, 1} = mydisp (df.x_ridx(1:df.x_cnt(1), ind1)); if (~isempty (myformfunc)) myformfunc (myform); end %# re-format disp output over many lines, trimming extra spaces indi = regexp (dummy{3, 1}, '\S.*', 'match', 'dotexceptnewline'); %# was %# indi = regexp (dummy{3, 1}, '\b.*\b', 'match', 'dotexceptnewline'); if (isempty (resu)) resu = strjust (char (dummy{2, 1}, indi), 'right'); else resu = horzcat(resu, vspace, strjust (char (dummy{2, 1}, indi), ... 'right'), vspace); end else %# column-compressed data for ind2 = (1:size (df.x_ridx, 3)) if ((any (~isna (df.x_ridx(1:df.x_cnt(1), ind1, ind2)))) || ... (any (isempty (df.x_ridx(1:df.x_cnt(1), ind1, ind2))))) dummy{2, 1} = [sprintf('_%d.%d', ind1, ind2) ; 'Nr']; dummy{3, 1} = mydisp (df.x_ridx(1:df.x_cnt(1), ind1, ind2)); indi = regexp (dummy{3, 1}, '\S.*', 'match', ... 'dotexceptnewline'); if (isempty (resu)) resu = strjust (char (dummy{2, 1}, indi), 'right'); else resu = horzcat (resu, vspace, strjust (char(dummy{2, 1}, indi), ... 'right'), vspace); end end end end end %# emit row names if (isempty (df.x_name{1})), dummy{2, 2} = []; dummy{3, 2} = []; else dummy{2, 2} = [' ';' ']; dummy{3, 2} = df.x_name{1}; end %# insert a vertical space if (~isempty (dummy{3, 2})) indi = ~cellfun ('isempty', dummy{3, 2}); if (any (indi)) try resu = horzcat (resu, vspace, strjust (char(dummy{2, 2}, dummy{3, 2}),... 'right')); catch disp ('line 172 '); keyboard end end end %# emit each colum for indi = (1:size (dummy, 2) - 2) %# was max(df.x_cnt(2:end)), try %# avoid this column touching the previous one if (any (cellfun ('size', dummy(1:2, 2+indi), 2) >= ... size (dummy{3, 2+indi}, 2))) resu = horzcat (resu, vspace); end resu = horzcat (resu, strjust (char (dummy{:, 2+indi}), 'right')); catch tmp_str = sprintf ('Emitting %d lines, expecting %d', ... size (dummy{3, 2+indi}, 1), df.x_cnt(1)); keyboard error (tmp_str); end end else resu = ''; end resu = char (head, resu); mydisp (resu) end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/arg.m0000644000000000000000000000013213147547161017150 xustar0030 mtime=1503579761.881618418 30 atime=1503579761.881618418 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/arg.m0000644000175000017500000000161213147547161017323 0ustar00olafolaf00000000000000function resu = arg(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@arg, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/ndims.m0000644000000000000000000000013213147547161017511 xustar0030 mtime=1503579761.905618754 30 atime=1503579761.905618754 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/ndims.m0000644000175000017500000000041113147547161017660 0ustar00olafolaf00000000000000function resu = ndims(df) %# -*- texinfo -*- %# @deftypefn {Function File} ndims(@var{df}) %# overloaded function implementing ndims for a dataframe %# @end deftypefn resu = 2; nseq = max(cellfun(@length, df.x_rep)); if nseq > 1, resu = 3; end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/ipermute.m0000644000000000000000000000013213147547161020231 xustar0030 mtime=1503579761.893618586 30 atime=1503579761.893618586 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/ipermute.m0000644000175000017500000000162713147547161020412 0ustar00olafolaf00000000000000function resu = ipermute(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper2(@ipermute, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/ceil.m0000644000000000000000000000013213147547161017313 xustar0030 mtime=1503579761.881618418 30 atime=1503579761.881618418 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/ceil.m0000644000175000017500000000161413147547161017470 0ustar00olafolaf00000000000000function resu = ceil(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@ceil, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/dataframe.m0000644000000000000000000000013213147547161020323 xustar0030 mtime=1503579761.885618474 30 atime=1503579761.885618474 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/dataframe.m0000644000175000017500000005740713147547161020513 0ustar00olafolaf00000000000000function df = dataframe(x, varargin) %# -*- texinfo -*- %# @deftypefn {Function File} @var{df} = dataframe(@var{x = []}, ...) %# This is the default constructor for a dataframe object, which is %# similar to R 'data.frame'. It's a way to group tabular data, then %# accessing them either as matrix or by column name. %# Input argument x may be: @itemize %# @item a dataframe => use @var{varargin} to pad it with suplemental %# columns %# @item a matrix => create column names from input name; each column %# is used as an entry %# @item a cell matrix => try to infer column names from the first row, %# and row indexes and names from the two first columns; %# @item a file name => import data into a dataframe; %# @item a matrix of char => initialise colnames from them. %# @item a two-element cell: use the first as column as column to %# append to, and the second as initialiser for the column(s) %# @end itemize %# If called with an empty value, or with the default argument, it %# returns an empty dataframe which can be further populated by %# assignement, cat, ... If called without any argument, it should %# return a dataframe from the whole workspace. %# @*Variable input arguments are first parsed as pairs (options, values). %# Recognised options are: @itemize %# @item rownames : take the values as initialiser for row names %# @item colnames : take the values as initialiser for column names %# @item seeked : a (kept) field value which triggers start of processing. %# @item trigger : a (unkept) field value which triggers start of processing. %# @item datefmt: date format, see datestr help %# Each preceeding line is silently skipped. Default: none %# @item unquot: a logical switch telling wheter or not strings should %# be unquoted before storage, default = true; %# @item sep: the elements separator, default {'\t', ','} %# @item conv: some regexp to convert each field. This must be a %# two-elements cell array containing regexprep() second (@var{PAT}) %# and third (@var{REPSTR}) arguments. In order to replace ',' by '.', %# use '@{',', '.'@}'. In this case, the default separator is adjusted to '\t;' %# @end itemize %# The remaining data are concatenated (right-appended) to the existing ones. %# @end deftypefn %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . if (0 == nargin) %# default constructor: create a scalar struct and initialise the %# fields in the right order df = struct ('x_cnt', [0 0]); %# do not call 'struct' with the two next args: it would create an array df.x_name = {cell(0, 1), cell(1, 0)}; %# rows - cols df.x_over = cell (1, 2); df.x_ridx = []; df.x_data = cell (0, 0); df.x_rep = cell (0, 0); %# a repetition index df.x_type = cell (0, 0); %# the type of each column df.x_src = cell (0, 0); df.x_header = cell (0, 0); df.x_cmt = cell (0, 0); %# to put comments df = class (df, 'dataframe'); return end if (isempty (x) && 1 == nargin) disp ('FIXME -- should create a dataframe from the whole workspace') df = dataframe (); %# just call the default constructor return end if (isa (x, 'dataframe')) %# Try to append whatever data or metadata given through varargin %# into this dataframe df = x; else df = dataframe (); %# get the right fields if (isa (x, 'struct')) %# only accept a struct if it has the same fieldnames as a dataframe %# convert a struct to a dataframe using fieldnames as column names dummy = fieldnames (x); indi = fieldnames (df); if (size (dummy, 1) ~= size (indi, 1)) df = struct2df (x); %# error ('First argument of dataframe is a struct with the wrong number of fields'); else if (~all (cellfun (@strcmp, dummy, indi))) df = struct2df (x); %# error ('First argument of dataframe is a struct with wrong field names'); else %# looks like a real dataframe %# easy way to transform a struct into a dataframe object df = class (x, 'dataframe'); end end if (1 == nargin) return; end end end %# default values seeked = ''; trigger = ''; unquot = true; sep = ''; default_sep = {char(9), ','}; %# ascii tab and comma cmt_lines = []; conv_regexp = {}; datefmt = ''; verbose = false; if (length (varargin) > 0) %# extract known arguments indi = 1; %# loop over possible arguments while (indi <= size (varargin, 2)) if (isa (varargin{indi}, 'char')) switch(varargin{indi}) case 'rownames' switch class (varargin{indi+1}) case {'cell'} df.x_name{1} = varargin{indi+1}; case {'char'} df.x_name{1} = cellstr (varargin{indi+1}); otherwise df.x_name{1} = cellstr (num2str (varargin{indi+1})); end df.x_name{1} = genvarname (df.x_name{1}); df.x_over{1}(1, 1:length (df.x_name{1})) = false; df.x_cnt(1) = size (df.x_name{1}, 1); df.x_ridx = (1:df.x_cnt(1))'; varargin(indi:indi+1) = []; case 'colnames' switch class(varargin{indi+1}) case {'cell'} df.x_name{2} = varargin{indi+1}; case {'char'} df.x_name{2} = cellstr (varargin{indi+1}); otherwise df.x_name{2} = cellstr (num2str (varargin{indi+1})); end %# detect assignment - functions calls - ranges dummy = cellfun ('size', cellfun (@(x) strsplit (x, ':=('), df.x_name{2}, ... 'UniformOutput', false), 2); if (any (dummy > 1)) warning ('dataframe colnames taken literally and not interpreted'); end df.x_name{2} = genvarname (df.x_name{2}); df.x_over{2}(1, 1:length (df.x_name{2})) = false; varargin(indi:indi+1) = []; case 'seeked' seeked = varargin{indi + 1}; varargin(indi:indi+1) = []; case 'trigger' trigger = varargin{indi + 1}; varargin(indi:indi+1) = []; case 'unquot' unquot = varargin{indi + 1}; varargin(indi:indi+1) = []; case 'sep' sep = varargin{indi + 1}; varargin(indi:indi+1) = []; case 'conv' conv_regexp = varargin{indi + 1}; varargin(indi:indi+1) = []; case 'datefmt' datefmt = varargin{indi + 1}; varargin(indi:indi+1) = []; case 'verbose' verbose = varargin{indi + 1}; varargin(indi:indi+1) = []; case '--' %# stop processing args -- take the rest as filenames varargin(indi) = []; break; otherwise %# FIXME: just skip it for now disp (sprintf ('Ignoring unkown argument %s', varargin{indi})); indi = indi + 1; end else indi = indi + 1; %# skip it end end end if (isempty (sep)) sep = default_sep; if (~isempty (conv_regexp)) if (any (~cellfun (@isempty, (strfind (conv_regexp, ','))))) sep = [char(9) ';' ]; %# locales where ',' is used as decimal separator end end end if (~isempty (datefmt)) %# replace consecutive spaces by one datefmt = regexprep (datefmt, '[ ]+', ' '); %# is 'space' used as separator ? Then we may take more than one field. if (~isempty (regexp (sep, ' '))) datefields = 1 + length (regexp (datefmt, ' ')); else datefields = 1; end else datefields = 1; end if (~isempty (seeked) && ~isempty (trigger)) error ('seeked and trigger are mutuallly incompatible arguments'); end indi = 0; while (indi <= size (varargin, 2)) indi = indi + 1; if (~isa (x, 'dataframe')) if (isa (x, 'char') && size (x, 1) < 2) %# dummy = tilde_expand (x); dummy = x; try %# read the data frame from a file df.x_src{end+1, 1} = dummy; x = load (dummy); catch %# try our own method if (~exist('OCTAVE_VERSION', 'builtin')) UTF8_BOM = unicode2native (char ([hex2dec('EF') hex2dec('BB') hex2dec('BF')])); else UTF8_BOM = char ([hex2dec('EF') hex2dec('BB') hex2dec('BF')]); end %# Is it compressed ? cmd = []; count = regexpi (dummy, '\.gz'); if (length (dummy) - count == 2) cmd = ['gzip -dc ']; else count = regexpi (dummy, '\.bz2'); if (length (dummy) - count == 3) cmd = ['bzip2 -dc ']; else count = regexpi (dummy, '\.xz'); if (length (dummy) - count == 2) cmd = ['xz -dc ']; else count = regexpi (dummy, '\.zip'); if (length (dummy) - count == 3) cmd = ['unzip -p ']; else count = regexpi (dummy, '\.lzo'); if (length (dummy) - count == 3) cmd = ['lzop -dc ']; end end end end end if (isempty (cmd)) %# direct read [fid, msg] = fopen (dummy, 'rt'); else %# The file we read from external process must be seekable !!! tmpfile = tmpnam (); %# quote to protect from spaces in the name dummy = strcat ('''', dummy, ''''); cmd = [cmd, dummy, ' > ', tmpfile]; if (exist ('OCTAVE_VERSION', 'builtin')) [output, status] = system (cmd); else [status, output] = system (cmd); end if (not (0 == status)) disp (sprintf ('%s exited with status %d', cmd, status)); end fid = fopen (tmpfile, 'rt'); if (exist ('OCTAVE_VERSION', 'builtin')) [cmd, status] = unlink (tmpfile); else delete (tmpfile) end end unwind_protect in = []; if (fid ~= -1) dummy = fgetl (fid); if (-1 == dummy) x = []; %# file is valid but empty else if (~strcmp (dummy, UTF8_BOM)) frewind (fid); end %# slurp everything and convert doubles to char, avoiding %# problems with char > 127 in = char (fread (fid).'); end end unwind_protect_cleanup if (fid ~= -1) fclose (fid); end end_unwind_protect if (~isempty (in)) %# explicit list taken from 'man pcrepattern' -- we enclose all %# vertical separators in case the underlying regexp engine %# doesn't have them all. eol = '(\r\n|\n|\v|\f|\r|\x85)'; eol = strcat('(', char (13), char (10), '|', char (10), '|', char(11) , '|' ,char(12) ,'|', char(13), ')'); %# "\x85" is unicode continuation dot %# cut into lines -- include the EOL to have a one-to-one %# matching between line numbers. Use a non-greedy match. lines = regexp (in, ['.*?' eol], 'match'); %# spare memory clear in; try dummy = cellfun (@(x) regexp (x, eol), lines); catch disp ('line 245 -- binary garbage in the input file ? '); keyboard end %# remove the EOL character(s) lines(1 == dummy) = {''}; %# use a positive lookahead -- eol is not part of the match lines(dummy > 1) = cellfun (@(x) regexp (x, ['.*?(?=' eol ')'], ... 'match'), lines(dummy > 1)); %# a field either starts at a word boundary, either by + - . for %# a numeric data, either by ' for a string. %# content = cellfun(@(x) regexp(x, '(\b|[-+\.''])[^,]*(''|\b)', 'match'),\ %# lines, 'UniformOutput', false); %# extract fields if (all (cellfun (@isspace, sep))) content = cellfun (@(x) strsplit (x), lines, ... 'UniformOutput', false); %# extract fields else content = cellfun (@(x) strsplit (x, sep), lines, ... 'UniformOutput', false); %# extract fields end %# spare memory clear lines; indl = 1; indj = 1; dummy = []; if (~isempty (seeked)) while (indl <= length (content)) dummy = content{indl}; if (all (cellfun ('size', dummy, 2) == 0)) indl = indl + 1; continue; end if (all (cellfun (@isempty, regexp (dummy, seeked, 'match')))) if (isempty (df.x_header)) df.x_header = dummy; else df.x_header(end+1, 1:length (dummy)) = dummy; end indl = indl + 1; continue; end break; end elseif (~isempty (trigger)) while (indl <= length (content)) dummy = content{indl}; indl = indl + 1; if (all (cellfun ('size', dummy, 2) == 0)) continue; end if (isempty (df.x_header)) df.x_header = dummy; else df.x_header(end+1, 1:length (dummy)) = dummy; end if (all (cellfun (@isempty, regexp (dummy, trigger, 'match')))) continue; end break; end else dummy = content{1}; %# rough guess end if (indl > length (content)) x = []; else x = cell (1+length (content)-indl, size (dummy, 2)); empty_lines = []; cmt_lines = []; while (indl <= length (content)) dummy = content{indl}; if (all (cellfun ('size', dummy, 2) == 0)) empty_lines = [empty_lines indj]; indl = indl + 1; indj = indj + 1; continue; end %# does it looks like a comment line ? if (regexp (dummy{1}, ['^\s*' char(35)])) empty_lines = [empty_lines indj]; cmt_lines = strvcat (cmt_lines, horzcat (dummy{:})); indl = indl + 1; indj = indj + 1; continue; end if (all (cellfun (@isempty, regexp (dummy, trigger, 'match')))) %# it does not look like the trigger. Good. %# try to convert to float if (~ isempty(conv_regexp)) dummy = regexprep (dummy, conv_regexp{:}); end [the_line, counts] = cellfun (@(x) sscanf (x, '%f'), dummy, ... 'UniformOutput', false); indk = 1; indm = 1; while (indk <= size (the_line, 2)) if (isempty (the_line{indk}) || any (size (the_line{indk}) > 1)) %#if indi > 1 && indk > 1, disp ('line 117 '); keyboard; %#end if (isempty (dummy {indk})) %# empty field, just don't care indk = indk + 1; indm = indm + 1; continue; end if (2 == counts{indk}) %# the number was complex x(indj, indm) = ... complex(the_line{indk}(1), the_line{indk}(2)); elseif (unquot) try %# remove quotes and leading space(s) regexp (dummy{indk}, '[^''" ].*[^''"]', 'match'); x(indj, indm) = ans{1}; catch %# if the previous test fails, try a simpler one in = regexp (dummy{indk}, '[^'' ]+', 'match'); if (~isempty (in)) x(indj, indm) = in{1}; %# else %# x(indj, indk) = []; end end else %# no conversion possible, store and remove leading space(s) x(indj, indm) = regexp (dummy{indk}, '[^ ].*', 'match'); end elseif (~isempty (regexp (dummy{indk}, '[/:-]')) && ... ~isempty (datefmt)) %# does it look like a date ? datetime = dummy{indk}; if (datefields > 1) %# concatenate the required number of fields indc = 1; for indc = (2:datefields) datetime = horzcat (datetime, ' ', dummy{indk+indc-1}); end else %# ensure spaces are unique datetime = regexprep (datetime, '[ ]+', ' '); end try datetime = datevec (datetime, datefmt); timeval = struct ('usec', 0, 'sec', floor (datetime (6)), ... 'min', datetime(5), 'hour', datetime(4), ... 'mday', datetime(3), 'mon', datetime(2)-1, ... 'year', datetime(1)-1900); timeval.usec = 1e6*(datetime(6) - timeval.sec); x(indj, indm) = str2num (strftime ([char(37) 's'], timeval)) + ... timeval.usec * 1e-6; if (datefields > 1) %# skip fields successfully converted indk = indk + (datefields - 1); end catch %# store it as is x(indj, indm) = the_line{indk}; end else x(indj, indm) = the_line{indk}; end indk = indk + 1; indm = indm + 1; end if (verbose) if (0 == mod (indl, 256)) disp (sprintf ('Processed line %d', indl)); fflush (1); if (verbose > 1) keyboard end end end indl = indl + 1; indj = indj + 1; else %# trigger seen again. Throw last value and abort processing. x(end, :) = []; fprintf (2, 'Trigger seen a second time, stopping processing\n'); break end end if (~isempty (empty_lines)) x(empty_lines, :) = []; end %# detect empty columns empty_lines = find (0 == sum (cellfun ('size', x, 2))); if (~isempty (empty_lines)) x(:, empty_lines) = []; end end clear UTF8_BOM fid indl the_line content empty_lines clear datetime timeval idx count tmpfile cmd output status end end end %# fallback, avoiding a recursive call idx.type = '()'; indj = []; if (~isa (x, 'char')) %# x may be a cell array, a simple matrix, ... indj = df.x_cnt(2)+(1:size (x, 2)); else %# at this point, reading some filename failed error ('dataframe: can''t open "%s" for reading data', x); end; if (iscell (x) && ~isa (x, 'dataframe')) %# x was filled with fields read from the CSV if (and (isvector (x), 2 == length (x))) %# use the intermediate value as destination column [indc, ncol] = df_name2idx (df.x_name{2}, x{1}, df.x_cnt(2), 'column'); if (ncol ~= 1) error (['With two-elements cell, the first should resolve ' ... 'to a single column']); end try dummy = cellfun (@class, x{2}(2, :), 'UniformOutput', false); catch dummy = cellfun (@class, x{2}(1, :), 'UniformOutput', false); end df = df_pad (df, 2, [length(dummy) indc], dummy); x = x{2}; indj = indc + (1:size (x, 2)); %# redefine target range elseif (isa (x{1}, 'cell')) x = x{1}; %# remove one cell level end if (length (df.x_name{2}) < indj(1) || isempty (df.x_name{2}(indj))) [df.x_name{2}(indj, 1), df.x_over{2}(1, indj)] ... = df_colnames (inputname(indi), indj); df.x_name{2} = genvarname (df.x_name{2}); end %# allow overwriting of column names df.x_over{2}(1, indj) = true; elseif (~isempty (indj)) %# x is an array, generates fieldnames from names given as args if (1 == length (df.x_name{2}) && length (df.x_name{2}) < ... length (indj)) [df.x_name{2}(indj, 1), df.x_over{2}(1, indj)] ... = df_colnames (char (df.x_name{2}), indj); elseif (length (df.x_name{2}) < indj(1) || isempty (df.x_name{2}(indj))) [df.x_name{2}(indj, 1), df.x_over{2}(1, indj)] ... = df_colnames (inputname(indi), indj); end df.x_name{2} = genvarname (df.x_name{2}); end if (~isempty (indj)) %# the exact row size will be determined latter idx.subs = {'', indj}; %# use direct assignement if (ndims (x) > 2), idx.subs{3} = 1:size (x, 3); end %# df = subsasgn(df, idx, x); <= call directly lower level try if (verbose) printf ('Calling df_matassign, orig size: %s\n', disp (size (df))); printf ('size(x): %s\n', disp (size (x))); end dtemp = struct (df); df = df_matassign (dtemp, idx, indj, length (indj), x, trigger); df = class (df, 'dataframe'); catch disp ('line 443: df_matassign failure ??? '); keyboard end if (~isempty (cmt_lines)) df.x_cmt = vertcat (df.x_cmt, cellstr (cmt_lines)); cmt_lines = []; end else df.x_cnt(2) = length (df.x_name{2}); end elseif (indi > 1) error ('Concatenating dataframes: use cat instead'); end try %# loop over next variable argument x = varargin{1, indi}; catch %# disp ('line 197 ???'); end end end function [x, y] = df_colnames(base, num) %# small auxiliary function to generate column names. This is required %# here, as only the constructor can use inputname() if (~isempty( find (base == '='))) %# takes the left part as base x = strsplit (base, '='); x = deblank (x{1}); if (isvarname (x)) y = false; else x = 'X'; y = true; end else %# is base most probably a filename ? x = regexp (base, '''[^''].*[^'']''', 'match'); if (isempty (x)) if (isvarname (base)) x = base; y = false; else x = 'X'; y = true; %# this is a default value, may be changed end else x = x{1}; y = true; end end if (numel (num) > 1) x = repmat (x, numel (num), 1); x = horzcat (x, strjust (num2str (num(:)), 'left')); y = repmat (y, 1, numel (num)); end x = cellstr (x); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/minus.m0000644000000000000000000000013213147547161017532 xustar0030 mtime=1503579761.901618698 30 atime=1503579761.901618698 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/minus.m0000644000175000017500000000213313147547161017704 0ustar00olafolaf00000000000000function resu = minus(A, B); %# function resu = minus(A, B) %# Implements the '-' operator when at least one argument is a dataframe. %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . try resu = df_func (@minus, A, B); catch disp (lasterr ()); error ('Operator - problem for %s vs. %s', class(A), class(B)); end end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/abs.m0000644000000000000000000000013213147547161017144 xustar0030 mtime=1503579761.877618362 30 atime=1503579761.877618362 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/abs.m0000644000175000017500000000161213147547161017317 0ustar00olafolaf00000000000000function resu = abs(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@abs, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/atan.m0000644000000000000000000000013213147547161017322 xustar0030 mtime=1503579761.881618418 30 atime=1503579761.881618418 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/atan.m0000644000175000017500000000161413147547161017477 0ustar00olafolaf00000000000000function resu = atan(df, varargin) %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with this package; see the file COPYING. If not, %% see . resu = df_mapper(@atan, df, varargin{:}); end dataframe-1.2.0/inst/@dataframe/PaxHeaders.29945/subsref.m0000644000000000000000000000013213147547161020050 xustar0030 mtime=1503579761.921618978 30 atime=1503579761.921618978 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/@dataframe/subsref.m0000644000175000017500000006751613147547161020242 0ustar00olafolaf00000000000000function resu = subsref(df, S) %# function resu = subsref(df, S) %# This function returns a subpart of a dataframe. It is invoked when %# calling df.field, df(value), or df{value}. In case of fields, %# returns either the content of the container with the same name, %# either the column with the same name, priority being given to the %# container. In case of range, selection may occur on name or order %# (not rowidx for rows). If the result is homogenous, it is %# downclassed. In case an extra field is given, is it used to %# determine the class of the return value. F.i., %# df(1, 2, 'dataframe') %# does not return a scalar but a dataframe, keeping all the meta-information %% Copyright (C) 2009-2017 Pascal Dupuis %% %% This file is part of the dataframe package for Octave. %% %% This package is free software; you can redistribute it and/or %% modify it under the terms of the GNU General Public %% License as published by the Free Software Foundation; %% either version 3, or (at your option) any later version. %% %% This package is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %% PURPOSE. See the GNU General Public License for more %% details. %% %% You should have received a copy of the GNU General Public %% License along with Octave; see the file COPYING. If not, %% see . %# what kind of object should we return ? asked_output_type = ''; asked_output_format = []; if (strcmp (S(1).type, '.')) %# struct access indi = regexp (S(1).subs, 'as'); if (~isempty (indi)) if (length (S) < 2 || ~strcmp (S(2).type, '.')) error ('The output format qualifier "as" must be followed by a type'); end asked_output_type = 'array'; asked_output_format = S(2).subs; S = S(3:end); else indi = regexp (S(1).subs, 'array'); if (~isempty (indi)) asked_output_type = 'array'; S = S(2:end); else indi = find (~cellfun (@isempty, regexp (cellstr (char ('df', class (df))), S(1).subs))); if (~isempty (indi)) %# requiring a dataframe if (1 == indi) %# 'df' = short for 'dataframe' asked_output_type = 'dataframe'; else asked_output_type = S(1).subs; end S = S(2:end); if (isempty (S) && strcmp (asked_output_type, class (df))) resu = df; return; end else indi = regexp (S(1).subs, 'cell'); if (~isempty (indi)) asked_output_type = S(1).subs; S = S(2:end); else %# access as a pseudo-struct resu = struct (df); %# avoid recursive calls if (1 == strfind (S(1).subs, '_')) %# its an internal field name %# FIXME: this should only be called from class members and friends %# FIXME -- in case many columns are asked, horzcat them resu = horzcat (feval (@subsref, resu, S)); else %# direct access through the exact column name %# indi = strmatch (S(1).subs, resu.x_name{2}, 'exact'); indi = find (~cellfun (@isempty, regexp (resu.x_name{2}, S(1).subs))); if (~isempty (indi)) resu = df.x_data{indi}; %# extract colum; try if (strcmp (df.x_type{indi}, 'char') ... && 1 == size (df.x_data{indi}, 2)) resu = char (resu); end catch err if (length (indi) > 1) error (sprintf ('subsref.m querying name %s returned positions %d\n', S(1).subs, indi)); else rethrow (err); end end if (length (S) > 1) dummy = S(2:end); S = S(1); switch dummy(1).type case '()' if (isa (dummy(1).subs{1}, 'char')) [indr, nrow, dummy(1).subs{1}] = ... df_name2idx(df.x_name{1}, dummy(1).subs{1}, df.x_cnt(1), 'row'); end resu = feval (@subsref, resu, dummy); otherwise error ('Invalid column access'); end end else %# access of an attribute dummy = S(2:end); S = S(1); postop = ''; further_deref = false; %# translate the external to internal name switch S(1).subs case 'rownames' S(1).subs = 'x_name'; S(2).type = '{}'; S(2).subs{1}= 1; postop = @(x) char (x); case 'colnames' S(1).subs = 'x_name'; S(2).type = '{}'; S(2).subs{1}= 2; postop = @(x) char (x); further_deref = true; case 'rowcnt' S(1).subs = 'x_cnt'; S(2).type = '()'; S(2).subs{1}= 1; case 'colcnt' S(1).subs = 'x_cnt'; S(2).type = '()'; S(2).subs{1}= 2; case 'rowidx' S(1).subs = 'x_ridx'; further_deref = true; case 'types' %# this one should be accessed as a matrix S(1).subs = 'x_type'; further_deref = true; case 'source' S(1).subs = 'x_src'; further_deref = true; case 'header' S(1).subs = 'x_header'; further_deref = true; case 'comment' S(1).subs = 'x_cmt'; further_deref = true; case 'new' if (isempty (dummy)) resu = dataframe(); else if (~strcmp (dummy(1).type, '()')) error ('Bogus constructor call'); end resu = dataframe (dummy(1).subs{:}); end if (length (dummy) > 1) resu = subsref (resu, dummy(2:end)); end return; otherwise error ('Unknown column name: %s', S(1).subs); end if (~isempty (dummy)) if (~further_deref) error ('Invalid sub-dereferencing'); end if (isa (dummy(1).subs{1}, 'char')) [indc, ncol, dummy(1).subs{1}] = ... df_name2idx (df.x_name{2}, dummy(1).subs{1}, ... df.x_cnt(2), 'column'); if (isempty (indc)) %# should be already catched inside df_name2idx error ('Unknown column name: %s', dummy(1).subs{1}); end end if (~strcmp (dummy(1).type, '()')) error ('Invalid internal field name sub-access, use () instead'); end end %# workaround around bug 30921, fixed in hg changeset 10937 %# if !isempty (dummy) S = [S dummy]; %# end resu = feval(@subsref, resu, S); if (~isempty (postop)) resu = postop(resu); end end end return end end end end end %# disp ('line 103 '); keyboard IsFirst = true; while (1) %# avoid recursive calls on dataframe sub-accesses %# a priori, performs whole accesses nrow = df.x_cnt(1); indr = 1:nrow; ncol = df.x_cnt(2); indc = 1:ncol; %# linear indexes [fullindr, fullindc, fullinds, onedimidx] = deal ([]); %# iterate over S, sort out strange constructs as x()()(1:10, 1:4) while (length (S) > 0) if (strcmp (S(1).type, '{}')) if (~IsFirst || ~isempty (asked_output_format)) error ('Illegal dataframe dereferencing'); end [asked_output_type, asked_output_format] = deal ('cell'); elseif (~strcmp (S(1).type, '()')) %# disp (S); keyboard error ('Illegal dataframe dereferencing'); end if (isempty (S(1).subs)) %# process calls like x() if (isempty (asked_output_type)) asked_output_type = class (df); end if (length (S) <= 1) if (strcmp (asked_output_type, class (df))) %# whole access without conversion resu = df; return; end break; %# no dimension specified -- select all, the %# asked_output_type was set in a previous iteration else %# avoid recursive calls S = S(2:end); IsFirst = false; continue; end end %# generic access if (length (S(1).subs) > 1) if (isempty (S(1).subs{2})) error ('subsref: second dimension empty ???'); end if (strcmp (S(1).subs{1}, ':')) %# make dataframe compatible with plot: access to a whole row %# and a single colum are returned as array %if ((isnumeric(S(1).subs{2}) && (1 == length (S(1).subs{2})) && % df.x_cnt(2) > 1) && isempty (asked_output_type)) if (strcmp (S(1).subs{2}, ':') && 1 == df.x_cnt(2) ... && isempty (asked_output_type)) asked_output_type = 'array'; end end [indr, nrow, S(1).subs{1}] = ... df_name2idx (df.x_name{1}, S(1).subs{1}, df.x_cnt(1), 'row'); if (~isa(indr, 'char') && max (indr) > df.x_cnt(1)) error ('Accessing dataframe past end of lines'); end [indc, ncol, S(1).subs{2}] = ... df_name2idx (df.x_name{2}, S(1).subs{2}, df.x_cnt(2), 'column'); if (max (indc) > df.x_cnt(2)) %# is it a two index access of a 3D structure ? if (length (df.x_cnt) > 2) [fullindc, fullinds] = ind2sub (df.x_cnt(2:3), indc); if (fullindc <= df.x_cnt(2)) indc = fullindc; inds = fullinds; end end %# retest if (max (indc) > df.x_cnt(2)) error ('Accessing dataframe past end of columns'); end end else %# one single dim -- probably something like df(:), df(A), ... fullindr = 1; onedimidx = S(1).subs{1}; switch class (S(1).subs{1}) case {'char'} %# one dimensional access, disallow it if not ':' if (strcmp (S(1).subs{1}, ':')) fullindr = []; fullindc = []; asked_output_type = 'array'; else error (['Accessing through single dimension and name "' ... S(1).subs{1} '" not allowed\n-- use variable(:, "' S(1).subs{1}, '") instead']); end case {'logical'} S(1).subs{1} = find(S(1).subs{1}); case {'dataframe'} S(1).subs{1} = subsindex(S(1).subs{1}, 1); end if (isempty (S(1).subs{1})) resu = df_colmeta(df); return; end if (~isempty (fullindr)) %# convert linear index to subscripts if (length (df.x_cnt) <= 2) [fullindr, fullindc] = ind2sub (df.x_cnt, S(1).subs{1}); fullinds = ones (size (fullindr)); else dummy = max (cellfun(@length, df.x_rep)); [fullindr, fullindc, fullinds] = ... ind2sub ([df.x_cnt dummy], S(1).subs{1}); end indr = unique (fullindr); nrow = length (indr); %# determine on which columns we'll iterate unique (fullindc); indc = ans(:).'; ncol = length (indc); if (~isempty (asked_output_type) && ncol > 1) %# verify that the extracted values form a square matrix dummy = zeros (indr(end), indc(end)); for indi = (1:ncol) indj = find (fullindc == indc(indi)); dummy(fullindr(indj), indc(indi)) = 1; end dummy = dummy(indr(1):indr(end), indc(1):indc(end)); if (any (any (dummy~= 1))) error ('Vector-like selection is not rectangular for the asked output type'); else fullindr = []; fullindc = []; end end end end %# at this point, S is either empty, either contains further dereferencing break; end %# we're ready to extract data %# disp ('line 211 '); keyboard if (isempty (asked_output_type)) output_type = class (df); %# force df output else if (~strcmp (asked_output_type, 'array') ... || ~isempty (asked_output_format)) %# override the class of the return value output_type = asked_output_type; else %# can the data be merged ? if (isempty (df)) output_type = 0.0; else output_type = df.x_data{indc(1)}(1); dummy = isnumeric (df.x_data{indc(1)}); for indi = (2:ncol) dummy = dummy & isnumeric (df.x_data{indc(indi)}); if (~strcmp (class (output_type), df.x_type{indc(indi)})) if (dummy) %# let downclassing occur output_type = horzcat (output_type, df.x_data{indc(indi)}(1)); continue; end %# unmixable args -- falls back to type of parent container error ('Selected columns %s not compatible with cat() -- use ''cell'' as output format', mat2str (indc)); %# dead code -- suppress previous line for switching automagically the output format to df output_type = class (df); break; end end end asked_output_format = class (output_type); output_type = 'array'; end end if (any (strcmp ({output_type, asked_output_type}, class (df)))) if (~isempty (S) && (1 == length (S(1).subs))) %# is the selection index vector-like ? if ((isnumeric(S(1).subs{1}) && isvector (S(1).subs{1}) ... && df.x_cnt(1) > 1) && isempty (asked_output_type)) %# in the case of vector input, favor array output [asked_output_type, output_type] = deal ('array'); end end end indt = {}; %# in case we have to mix matrix of different width if (~isempty (fullinds)) inds = unique (fullinds); nseq = length (inds); %# indt(1, 1:df.x_cnt(2)) = inds; indt = num2cell(repmat(inds, 1, df.x_cnt(2))); else inds = 1; nseq = 1; %# indt(1, 1:df.x_cnt(2)) = inds; indt = num2cell(repmat(inds, 1, df.x_cnt(2))); nseq = 1; if (isempty (S) || all (cellfun ('isclass', S(1).subs, 'char'))) inds = ':'; indt(1, 1:df.x_cnt(2)) = inds; nseq = max (cellfun (@length, df.x_rep(indc))); else if (length (S(1).subs) > 1) %# access-as-matrix if (length (S(1).subs) > 2) inds = S(1).subs{3}; if (isa(inds, 'char')) nseq = max (cellfun (@length, df.x_rep(indc))); indt(1, 1:df.x_cnt(2)) = inds; else %# generate a specific index for each column nseq = length (inds); dummy = cellfun (@length, df.x_rep(indc)); indt(1, 1:df.x_cnt(2)) = inds; indt(1==dummy) = 1; end end end end end if (strcmp (output_type, class (df))) %# disp ('line 295 '); keyboard %# export the result as a dataframe resu = dataframe (); resu.x_cnt(1) = nrow; resu.x_cnt(2) = ncol; if (isempty (fullindr)) for indi = (1:ncol) resu.x_data{indi} = df.x_data{indc(indi)}... (indr, df.x_rep{indc(indi)}(indt{indc(indi)})); resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); resu.x_name{2}(indi, 1) = df.x_name{2}(indc(indi)); resu.x_over{2}(1, indi) = df.x_over{2}(indc(indi)); resu.x_type{indi} = df.x_type{indc(indi)}; end if (~isempty (df.x_ridx) && size (df.x_ridx, 2) >= inds) resu.x_ridx = df.x_ridx(indr, inds); end if (length (df.x_name{1}) >= max (indr)) resu.x_name{1}(1:nrow, 1) = df.x_name{1}(indr); resu.x_over{1}(1, 1:nrow) = df.x_over{1}(indr); end else dummy = df_whole(df); dummy = dummy(onedimidx); for indi = (1:resu.x_cnt(2)) indc = unique (fullindc(:, indi)); if (1 == length (indc)) resu.x_name{2}(indi)= df.x_name{2}(indc); resu.x_over{2}(indi)= df.x_over{2}(indc); unfolded = df.x_data{indc}(:, df.x_rep{indc}); indj = sub2ind (size (unfolded), fullindr(:, indi), ... fullinds(:, indi)); resu.x_data{indi} = unfolded(indj); resu.x_type{indi} = df.x_type{indc}; resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); else resu.x_name{2}(indi)= ['X' num2str(indi)]; resu.x_over{2}(indi)= true; resu.x_data{indi} = squeeze (dummy(:, indi, :)); resu.x_type{indi} = class (dummy(1, indi, 1)); resu.x_rep{indi} = 1:size (resu.x_data{indi}, 2); end end if (1 == size (df.x_ridx, 2)) resu.x_ridx = repmat (df.x_ridx, [1 ncol 1]); else resu.x_ridx = df.x_ridx; end if (~isempty (resu.x_ridx)) if (size (resu.x_ridx, 2) > 1) resu.x_ridx = resu.x_ridx(indr, indc); else resu.x_ridx = resu.x_ridx(indr); end end end %# to be verified : keyboard resu.x_src = df.x_src; resu.x_header = df.x_header; resu.x_cmt = df.x_cmt; resu = df_thirddim (resu); if (length (S) > 1) %# perform further access, if required df = resu; S = S(2:end); %# avoid recursive calls continue; %# restart the loop around line 150 end return; elseif (strcmp (output_type, 'cell')) %# export the result as a cell array if (isempty (asked_output_format)) resu = cell (2+nrow, 2+ncol); resu(1:end, 1:2) = {''}; resu(2, 3:end) = df.x_type(indc); %column type row_offs = 2; col_offs = 2; for indi = (1:ncol) resu{1, 2+indi} = df.x_name{2}{indc(indi)}; % column name end resu(3:end, 1) = mat2cell (df.x_ridx(indr), ones (nrow, 1), 1); if (length (df.x_name{1}) >= max (indr)) resu(3:end, 2) = df.x_name{1}{indr}; end else resu = cell (nrow, ncol); row_offs = 0; col_offs = 0; end for indi = (1:ncol) switch df.x_type{indc(indi)} % cell content case {'char' } %# dummy = cellstr(df.x_data{indc(indi)}(indr, :)); dummy = df.x_data{indc(indi)}(indr, :); resu(1+row_offs:end, indi+col_offs) = dummy; otherwise dummy = df.x_data{indc(indi)}(indr, :); resu(1+row_offs:end, indi+col_offs) = ... mat2cell (dummy, ones (nrow, 1), size (dummy, 2)); end end %# did we arrive here by x.cell ? if (0 == length (S)) return; end %# perform the selection on the content, keeping the header if (length (S) > 1) %# perform further access, if required if (~strcmp (S(2).type, '()')) error ('Illegal dataframe-as-cell sub-dereferencing'); end if (~isempty (asked_output_format)) resu = feval (@subsref, resu, S(2:end)); else if (length (S(2).subs) ~= 1) %# normal, two-dimensionnal access apply the selection on the %# zone containing the data dummy = S; if (~isempty (dummy(2).subs)) dummy(2).subs{2} = ':'; end %# reselect indexes; %# reselect rownames; %# extract - reorder - whatever resuf = cat (2, ... feval (@subsref, resu(3:end, 1), ... dummy(2:end)), ... feval (@subsref, resu(3:end, 2), ... dummy(2:end)), ... feval (@subsref, resu(3:end, 3:end), S(2:end))... ); dummy = S; if (~isempty (dummy(2).subs)) dummy(2).subs{1} = [1 2]; end %# reselect column names and types resuf = cat(1, ... [cell(2, 2) feval(@subsref, resu(1:2, 3:end), ... dummy(2:end))], ... resuf ... ); resuf(1:2, 1:2) = {''}; resu = resuf; else %# one dimensionnal access of the whole 2D cell array -- you %# asked it, you got it resu = feval (@subsref, resu(:), S(2:end)); if (~isa (S(2).subs{1}, 'char') ... && size (S(2).subs{1}, 2) > 1) resu = resu.'; end end end elseif (1 == length (S(1).subs)) resu = resu(:); if (~isa(S(1).subs{1}, 'char') ... && size (S(1).subs{1}, 2) > 1) resu = resu.'; end end return; %# no more iteration required else %# export the result as a vector/matrix. Rules: %# * x(:, :, :) returns a 3D matrix %# * x(:, n:m, :) returns a 3D matrix %# * x(:, :) returns a horzcat of the third dimension %# * x(:, n:m) select only the first sequence %# * x(:) returns a vertcat of the columns of x(:, :) %# disp ('line 403 '); keyboard if (isempty (S) || isempty (S(1).subs) || ... length (S(1).subs) > 1 || ... (isnumeric (S(1).subs{1}) && ~isvector(S(1).subs{1}))) %# access-as-matrix if (isempty (df)) resu = []; else df = struct (df); %# remove the magic, avoid recursive calls if (isempty (fullindr)) %# two index access if (~isempty (asked_output_format)) %# force a conversion if (regexp (asked_output_format, 'cell')) extractfunc = @(x) mat2cell... (df.x_data{indc(x)}(indr, df.x_rep{indc(x)}(inds)), ... ones (nrow, 1)); else extractfunc = @(x) cast ( df.x_data{indc(x)}... (indr, df.x_rep{indc(x)}(inds)),... asked_output_format); end else %# let the usual downclassing occur extractfunc = @(x) df.x_data{indc(x)}(indr, df.x_rep{indc(x)}(inds)); end try if (nseq > 1) dummy = reshape (extractfunc (1), nrow, 1, []); if (size (dummy, 3) < nseq) dummy = repmat (dummy, [1 1 nseq]); end else dummy = extractfunc (1); end catch keyboard error ('Column %d format (%s) can''t be converted to %s', ... indc(1), df.x_type{indc(1)}, asked_output_format); end if (ncol > 1) %# dynamic allocation with the final type resu = repmat (dummy, [1 ncol]); for indi = (2:ncol) try if (nseq > 1) dummy = reshape (extractfunc (indi), nrow, 1, []); if (size (dummy, 3) < nseq) dummy = repmat (dummy, [1 1 nseq]); end else dummy = extractfunc (indi); end catch error ('Column %d format (%s) can''t be converted to %s', ... indc(indi), df.x_type{indc(indi)}, asked_output_format); end resu(:, indi, :) = dummy; end else if (strcmp (df.x_type{indc(1)}, 'char')) resu = char (dummy); else resu = dummy; end end if (~isempty (S) && 2 == length (S(1).subs) ... && all (cellfun ('isclass', S(1).subs, 'char'))) resu = reshape (resu, nrow, ncol*nseq); end else %# one index access %# disp ('line 557'); keyboard if (~isempty (asked_output_format)) %# force a conversion if (regexp (asked_output_format, 'cell')) %% extractfunc = @(x, y) mat2cell (df.x_data{x}(:, df.x_rep{x}(y)), ... %% ones (length (y), 1)); else %% extractfunc = @(x, y) cast (df.x_data{x}(:, df.x_rep{x})(y), ... %% asked_output_format); end else %# let the usual downclassing occur %% extractfunc = @(x, y) df.x_data{x}(:, df.x_rep{x})(y); end try resu = zeros(0, class (sum (cellfun (@(x) zeros (1, class (x(1))),... df.x_data(indc))))); for indi = (indc) dummy = find (indi == fullindc); %# linear global index %# linear index for this matrix idx = sub2ind (size (df.x_data{indi}), fullindr(dummy), ... fullinds(dummy)); keyboard resu(dummy) = extractfunc (indi, idx); end catch disp (lasterr ()); error ('Column %d format (%s) can''t be converted to %s', ... indi, df.x_type{indi}, asked_output_format); end resu = reshape (resu, size (onedimidx)); end end else %# access-as-vector %# disp ('line 548 '); keyboard if (~isempty (fullindr)) switch df.x_type{indc(1)} case {'char'} resu = df.x_data{indc(1)}(fullindr(1), ... df.x_rep{indc(1)}(fullinds(1))); for indi = (2:length (fullindr)) resu = char (resu, df.x_data{indc(indi)}... (fullindr(indi), df.x_rep{indc(indi)}(fullinds(indi)))); end otherwise if (isempty (asked_output_format)) resu = df.x_data{fullindc(1)}... (fullindr(1), df.x_rep{fullindc(1)}(fullinds(1))); else %# this type will propagate with subsequent cat resu = cast (df.x_data{fullindc(1)}... (fullindr(1), df.x_rep{fullindc(1)}(fullinds(1))),... asked_output_format); end for indi = (2:length (fullindr)) resu = cat(1, resu, df.x_data{fullindc(indi)}... (fullindr(indi), ... df.x_rep{fullindc(indi)}(fullinds(indi)))); end end else %# using the (:) operator df_whole(df); resu = ans(:); end if (~isa (S(1).subs{1}, 'char') ... && size (S(1).subs{1}, 2) > 1) resu = resu.'; end end if (length (S) > 1) %# perform further access, if required %# disp ('line 442 '); keyboard resu = feval (@subsref, resu, S(2:end)); end end return; %# no more iteration required end %# disp ('line 343 !?!'); %# keyboard return end dataframe-1.2.0/inst/PaxHeaders.29945/data_test.csv0000644000000000000000000000013213147547161016662 xustar0030 mtime=1503579761.925619034 30 atime=1503579761.925619034 30 ctime=1503579761.961619538 dataframe-1.2.0/inst/data_test.csv0000644000175000017500000000151513147547161017037 0ustar00olafolaf00000000000000#notice there is a extra separator DataName, VBIAS, Freq, |IBIAS|, C, GOUT, OK?, DataValue, -6, 300000, 1.6272E-11, 7.02154E-13, 1.60436E-07, 'A', DataValue, -5.8, 300000, 1.599E-11, 6.96065E-13, 1.5728E-07, 'E', # a comment line, and an empty one DataValue, -5.6, 300000, 1.379E-11, 6.90475E-13, 1.54887E-07, '!', DataValue, -5.4, 300000, 1.442E-11, 6.85165E-13, 1.54777E-07, '?', # the next lines use \r\n, \r and \f as linefeed DataValue, -5.2, 300000, 1.293E-11, 6.79655E-13, 1.51887E-07, 'C', DataValue, -5, 300000, 1.261E-11, 6.74438E-13, 1.49309E-07, 'B', DataValue, -4.8, 300000, 1.439E-11, 6.70105E-13, 1.48758E-07, 'A', DataValue, -4.6, 300000, 1.089E-11, 6.64158E-13, 1.489E-07, '3', # one empty input field DataValue, -4.4, 300000, , 6.5859E-13, 1.45578E-07, 'C', DataValue, -4.2, 300000, 1.061E-11, 6.53547E-13, 1.44306E-07, 'B', dataframe-1.2.0/PaxHeaders.29945/DESCRIPTION0000644000000000000000000000013213147547161014726 xustar0030 mtime=1503579761.877618362 30 atime=1503579761.877618362 30 ctime=1503579761.961619538 dataframe-1.2.0/DESCRIPTION0000644000175000017500000000044713147547161015106 0ustar00olafolaf00000000000000Name: dataframe Version: 1.2.0 Date: 2017-08-14 Author: Pascal Dupuis Maintainer: The Octave Community Title: Data Frame Description: Data manipulation toolbox similar to R data.frame Categories: data manipulation, statistics Depends: octave (>= 3.4.0) License: GPLv3+ Url: http://octave.sf.net dataframe-1.2.0/PaxHeaders.29945/COPYING0000644000000000000000000000013213147547161014253 xustar0030 mtime=1503579761.873618306 30 atime=1503579761.873618306 30 ctime=1503579761.961619538 dataframe-1.2.0/COPYING0000644000175000017500000010451313147547161014432 0ustar00olafolaf00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . dataframe-1.2.0/PaxHeaders.29945/NEWS0000644000000000000000000000013213147547161013717 xustar0030 mtime=1503579761.877618362 30 atime=1503579761.877618362 30 ctime=1503579761.961619538 dataframe-1.2.0/NEWS0000644000175000017500000000337213147547161014077 0ustar00olafolaf00000000000000Summary of important user-visible changes for dataframe 1.2.0: ------------------------------------------------------------------- ** dataframe 1.2.0 is a major update. Most of the mapping functions are now supported: abs, acosh, acos, all, and, angle, any, arg, ... They are simple proxies to the corresponding Octave functions. -- The display function now supports 3.8, 4.0, 4.2, and upcoming 4.4 Octave major release. -- if some specific output format is requested, it must come first, e.g. x.dataframe([1:10]) instead of x([1:10].dataframe -- a longstanding bug on default separator was corrected. If more than one are used, they must be grouped into a cellstr instead of a str -- a dataframe may now contain 'pages' corresponding to a third dimension. The inner mechanism uses a "copy-on-write" scheme and avoid duplicating content repeated over many pages. Summary of important user-visible changes for dataframe 1.1: ------------------------------------------------------------------- ** dataframe 1.1.0 is a major update. As it introduces new functions, if dataframe-1.0.1 was previously loaded, Octave has to be restarted. Significants changes: - the structure of "row empty", i.e. dataframes with [0, n] size, is fully displayed - the "_src" metadata is now correctly set - new function: nth_element, make it compatible with median. Note that only row-median and page median are implemented, using directly the underlying data structures - new function; numel. Only the one argument form is supported. - bsxfun now better handles array as first arguement - vector vs matrix plot are now supported, provided both data set possess the same colum length.