Skip to content

Commit

Permalink
Documentation improvements (#455)
Browse files Browse the repository at this point in the history
* Documentation improvements

* Standardize printing output in docs

* Remove outdated reference to XChart
  • Loading branch information
benmccann authored and lwhite1 committed Feb 1, 2019
1 parent 8e30ea5 commit 70ac1f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
17 changes: 6 additions & 11 deletions docs/gettingstarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ To create a column you can use one of its static *create()* methods:
```java
double[] numbers = {1, 2, 3, 4};
DoubleColumn nc = DoubleColumn.create("Test", numbers);
out(nc.print());
System.out.println(nc.print());
```
which produces: [^1]
which produces:
```java
Column: Test
1.0
Expand All @@ -57,8 +57,9 @@ Tablesaw makes columns easy to work with. Operations that work on numbers in sta

```java
DoubleColumn nc2 = nc.multiply(4);
System.out.println(nc2.print());
```
producing: [^1]
producing:

```java
Column: Test * 4.0
Expand Down Expand Up @@ -123,7 +124,7 @@ If you have several columns of the same length as you would in a table of data,
DoubleColumn result = firstColumn.where(someOtherColumn.startsWith("foo"));
```

> **Key point:** Note the methods *startsWith(aString)*, *isLessThan(aNumber)*, and *isOdd()*. These were predefined for your use. There are many such methods that can be used in building queries. For StringColumn, they're defined in the [tech.tablesaw.columns.strings.StringFilters interface](http://www.javadoc.io/page/tech.tablesaw/tablesaw-core/latest/tech/tablesaw/columns/strings/StringFilters.html). It also includes *endsWith()*, *isEmpty()*, *isAlpha()*, *containsString()*[^2], etc. Each column has a similar set of filter operations. They can all be found in the filter interfaces located in sub-folders of tech.tablesaw.columns (e.g. tech.tablesaw.columns.dates.DateFilters).
> **Key point:** Note the methods *startsWith(aString)*, *isLessThan(aNumber)*, and *isOdd()*. These were predefined for your use. There are many such methods that can be used in building queries. For StringColumn, they're defined in the [tech.tablesaw.columns.strings.StringFilters interface](http://www.javadoc.io/page/tech.tablesaw/tablesaw-core/latest/tech/tablesaw/columns/strings/StringFilters.html). It also includes *endsWith()*, *isEmpty()*, *isAlpha()*, *containsString()*[^1], etc. Each column has a similar set of filter operations. They can all be found in the filter interfaces located in sub-folders of tech.tablesaw.columns (e.g. tech.tablesaw.columns.dates.DateFilters).
#### Map functions
Expand Down Expand Up @@ -463,10 +464,4 @@ See the section on [Cross Tabs](https://jtablesaw.github.io/tablesaw/userguide/c
We've covered a lot of ground. To learn more, please take a look at the [User Guide](https://jtablesaw.github.io/tablesaw/userguide/toc) or API documentation ([Java Docs](http://www.javadoc.io/page/tech.tablesaw/tablesaw-core/latest/index)).

[^1]: The method shown does not actually "produce" any output For that you would call *System.out.println()*. For brevity, this "faux" output will be shown indented by one tab beneath the code that produced it.
[^2]: Note that containsString(String subString) is different from contains(). The first method looks at each string in the column to see if it conains the substring. The second method looks at every row in the column and returns true if any matches the entire string. In other words, contains is like contains as defined on List<String>. , etc.





[^1]: Note that containsString(String subString) is different from contains(). The first method looks at each string in the column to see if it conains the substring. The second method looks at every row in the column and returns true if any matches the entire string. In other words, contains is like contains as defined on List<String>. , etc.
4 changes: 2 additions & 2 deletions docs/userguide/BarsAndPies.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Here we focus on some common plot types for working with univariate data:

When you're exploring data, you need plot creation to be as easy as possible. With Tablesaw's simple plot API you can usually create and display new charts in a line or two of code.

First we load the Tornado dataset:
First we load the Tornado dataset:

```java
Table tornadoes = Table.read().csv("Tornadoes.csv");
Table tornadoes = Table.read().csv("data/tornadoes_1950-2014.csv");
```

### Univariate data: counts and distributions
Expand Down
6 changes: 3 additions & 3 deletions docs/userguide/plotting.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ for every US tornado between 1950 and 2014. The code below loads the data, filte
and renders the plot:

```java
Table tornado = Table.createFromCsv("data/tornadoes_1950-2014.csv");
Table tornado = Table.read().csv("data/tornadoes_1950-2014.csv");
tornado = tornado.selectWhere(
both(column("Start Lat").isGreaterThan(0),
column("Scale").isGreaterThanOrEqualTo(0)));
Expand All @@ -20,7 +20,7 @@ Scatter.show("US Tornados 1950-2014",
tornado.numberColumn("Start Lon"),
tornado.numberColumn("Start Lat"));
```
These plots provide instant visual feedback to the analyst while she’s working. They’re for discovery, rather than for presentation, and so ease of use is stressed over beauty. Behind the scenes, the scatter plots are created with Tim Molter’s awesome XChart library: https://github.com/timmolter/XChart.
These plots provide instant visual feedback to the analyst while she’s working. They’re for discovery, rather than for presentation, and so ease of use is stressed over beauty.

The following chart is taken from a baseball data set. It shows how to split a table on the values of one or more columns,
producing a series for each group. In this case, we color the mark differently if the team made the playoffs.
Expand All @@ -30,7 +30,7 @@ winsByYear
Here’s the code:

```java
Table baseball = Table.createFromCsv("data/baseball.csv");
Table baseball = Table.read().csv("data/baseball.csv");
Scatter.show("Regular season wins by year",
baseball.numericColumn("W"),
baseball.numericColumn("Year"),
Expand Down

0 comments on commit 70ac1f8

Please sign in to comment.