Report not found

There was a problem finding this report.
COGS 127 - Example Replacement of Strings with Numbers
December 17, 2015 · Refreshed over 3 years ago

Collaborators

Run History
/* This looks trickier than it is... we are going to replace partcular string patterns (e.g., "more") with a number (e.g., 3) and then another string pattern (e.g., "less") with a lower number (e.g., 1). What this does is replaces strings for numbers in a cascaded way; if you choose to do this, try using a tabbed format like this so you don't forget to include a comma or parenthesis. */ select why, cast(replace( replace( replace( replace( replace( replace(why,'Did not skip','0') ,'Forgot','1') ,'To exhausted','2') ,'Was not hungry','3') ,'Worried about weight','4') ,'Not enough time','5') as int) as whyAsNumber from orionwill.fakedata LIMIT 100
/* This looks trickier than it is... we are going to replace partcular string patterns (e.g., "more") with a number (e.g., 3) and then another string pattern (e.g., "less") with a lower number (e.g., 1). What this does is replaces strings for numbers in a cascaded way; if you choose to do this, try using a tabbed format like this so you don't forget to include a comma or parenthesis. */ select why, cast(replace( replace( replace( replace( replace( replace(why,'Did not skip','0') ,'Forgot','1') ,'To exhausted','2') ,'Was not hungry','3') ,'Worried about weight','4') ,'Not enough time','5') as int) as whyAsNumber from orionwill.fakedata
<div class="mode-header embed-hidden"> <h1>{{ title }}</h1> <p>{{ description }}</p> </div> <div class="container mode-grid"> <div class="row"> <div class="col-md-12"> <mode-chart id="chart_46b679c2b73c" dataset="dataset" options="chart_options"></mode-chart> </div> </div> <div class="row"> <div class="col-md-12"> <mode-table id="table_6106282de558" dataset="dataset" options="table_options"></mode-table> </div> </div> </div>
{{ dataSourceName(params.queryId) }}

The dataset is too large to view in browser

Export

Looks like something went wrong with your query.

{{ DS.queryRuns[params.queryId].errorMessage }}
This query was cancelled