EzDevInfo.com

dataset

JavaScript library that makes managing the data behind client-side visualisations easy The Miso Project

How to delete a row in R?

I have a dataset with 11 columns with over a 1000 rows each. The columns were labeled V1, V2, V11, etc.. I replaced the names with something more useful to me using the "c" command. I didn't realize that row 1 also contained labels for each column and my actual data starts on row 2.

Is there a way to delete row 1 and decrement?


Source: (StackOverflow)

Why is a SQL float different from a C# float

Howdy, I have a DataRow pulled out of a DataTable from a DataSet. I am accessing a column that is defined in SQL as a float datatype. I am trying to assign that value to a local variable (c# float datatype) but am getting an InvalidCastExecption

DataRow exercise = _exerciseDataSet.Exercise.FindByExerciseID(65);
_AccelLimit = (float)exercise["DefaultAccelLimit"];

Now, playing around with this I did make it work but it did not make any sense and it didn't feel right.

_AccelLimit = (float)(double)exercise["DefaultAccelLimit"];

Can anyone explain what I am missing here?


Source: (StackOverflow)

Advertisements

R mtcars dataset, meaning of "vs" variable?

What does the "vs" variable mean in the "mtcars" dataset in R? The helpfile says it means "V/S" but that is not enlightening.

Commands:

data(mtcars)
head(mtcars)
?mtcars

Source: (StackOverflow)

Datatable vs Dataset

I currently use a DataTable to get results from a database which I can use in my code.

However, many example on the web show using a DataSet instead and accessing the table(s) through the collections method.

Is there any advantage, performance wise or otherwise, of using DataSets or DataTables as a storage method for SQL results?


Source: (StackOverflow)

What is the difference between "LINQ to Entities", "LINQ to SQL" and "LINQ to Dataset"

I've been working for quite a while now with LINQ. However, it remains a bit of a mystery what the real differences are between the mentioned flavours of LINQ.

The successful answer will contain a short differentiation between them. What is the main goal of each flavor, what is the benefit, and is there a performance impact...

P.S. I know that there are a lot of information sources out there, but I'm looking for a kind of a "cheat sheet" which instructs a newbie where to head for a specific goal.


Source: (StackOverflow)

How do I find out if a column exists in a VB.Net DataRow

I am reading an XML file into a DataSet and need to get the data out of the DataSet. Since it is a user-editable config file the fields may or may not be there. To handle missing fields well I'd like to make sure each column in the DataRow exists and is not DBNull.

I already check for DBNull but I don't know how to make sure the column exists without having it throw an exception or using a function that loops over all the column names. What is the best method to do this?


Source: (StackOverflow)

DataSet.WriteXml to string

I'm tring to get a string from a DataSet without using GetXml. I'm using WriteXml, instead. How to use it to get a string? Thanks


Source: (StackOverflow)

What triggers ConstraintException when loading DataSet?

How can I find out which column and value is violating the constraint? The exception message isn't helpful at all:

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.


Source: (StackOverflow)

ClassCastException with ListView when executing notifyDataSetChanged

I have added a view to the header of listVivew,

    View TopSearch =  (View) View.inflate(this, R.layout.search, null);
    lv.addHeaderView(TopSearch, null, false);

And everything is fine until I try to execute (when data changes)

adapter.notifyDataSetChanged();

That always crash my application giving me following error:

> java.lang.ClassCastException: android.widget.HeaderViewListAdapter

If I remove header view then there is no error. Any suggestions? Thanks.


Source: (StackOverflow)

A simple explanation of Naive Bayes Classification

I am finding it hard to understand the process of Naive Bayes, and I was wondering if someone could explained it with a simple step by step process in English. I understand it takes comparisons by times occurred as a probability, but I have no idea how the training data is related to the actual dataset.

Please give me an explanation of what role the training set plays. I am giving a very simple example for fruits here, like banana for example

training set---
round-red
round-orange
oblong-yellow
round-red

dataset----
round-red
round-orange
round-red
round-orange
oblong-yellow
round-red
round-orange
oblong-yellow
oblong-yellow
round-red

Source: (StackOverflow)

Should I Dispose() DataSet and DataTable?

DataSet and DataTable both implement IDisposable, so, by conventional best practices, I should call their Dispose() methods.

However, from what I've read so far, DataSet and DataTable don't actually have any unmanaged resources, so Dispose() doesn't actually do much.

Plus, I can't just use using(DataSet myDataSet...) because DataSet has a collection of DataTables.

So, to be safe, I'd need to iterate through myDataSet.Tables, dispose of each of the DataTables, then dispose of the DataSet.

So, is it worth the hassle to call Dispose() on all of my DataSets and DataTables?

Addendum:

For those of you who think that DataSet should be disposed: In general, the pattern for disposing is to use using or try..finally, because you want to guarantee that Dispose() will be called.

However, this gets ugly real fast for a collection. For example, what do you do if one of the calls to Dispose() thrown an exception? Do you swallow it (which is "bad") so that you can continue on to dispose the next element?

Or, do you suggest that I just call myDataSet.Dispose(), and forget about disposing the DataTables in myDataSet.Tables?


Source: (StackOverflow)

How I can filter a Datatable?

I use a DataTable with Information about Users and I want search a user or a list of users in this DataTable. I try it butit don't work :(

Here is my c# code:

 public DataTable GetEntriesBySearch(string username,string location,DataTable table)
        {
            list = null;
            list = table;

            string expression;
            string sortOrder;

            expression = "Nachname = 'test'";
            sortOrder = "nachname DESC";

            DataRow[] rows =  list.Select(expression, sortOrder);

            list = null; // for testing
            list = new DataTable(); // for testing

            foreach (DataRow row in rows)
            {
                list.ImportRow(row);
            }

            return list; 
        }

Source: (StackOverflow)

Git + a large data set?

We're often working on a project where we've been handed a large data set (say, a handful of files that are 1GB each), and are writing code to analyze it.

All of the analysis code is in Git, so everybody can check changes in and out of our central repository. But what to do with the data sets that the code is working with?

I want the data in the repository:

  • When users first clone the repository, the data should come with.
  • The data isn't 100% read-only; now and then a data point is corrected, or a minor formatting change happens. If minor changes happen to the data, users should be notified at the next checkout.

However, I don't want the data in the git repository:

  • git cloning a spare copy (so I have two versions in my home directory) will pull a few GB of data I already have. I'd rather either have it in a fixed location [set a rule that data must be in ~/data] or add links as needed.
  • With data in the repository, copying to a thumb drive may be impossible, which is annoying when I'm just working on a hundred lines of code.
  • If an erroneous data point is fixed, I'm never going to look at the erroneous version again. Changes to the data set can be tracked in a plain text file or by the person who provided the data (or just not at all).

It seems that I need a setup with a main repository for code and an auxiliary repository for data. Any suggestions or tricks for gracefully implementing this, either within git or in POSIX at large? Everything I've thought of is in one way or another a kludge.


Source: (StackOverflow)

How to loop through a dataset in powershell?

I am trying a "very" simple task to output values of each rows from a DataSet :

for ($i=0;$i -le $ds.Tables[1].Rows.Count;$i++)
{
  Write-Host 'value is : ' + $i + ' ' + $ds.Tables[1].Rows[$i][0]
}

gives output ...

value is :  +0+ +System.Data.DataSet.Tables[1].Rows[0][0] 
value is :  +1+ +System.Data.DataSet.Tables[1].Rows[1][0] 
value is :  +2+ +System.Data.DataSet.Tables[1].Rows[2][0] 
value is :  +3+ +System.Data.DataSet.Tables[1].Rows[3][0] 
value is :  +4+ +System.Data.DataSet.Tables[1].Rows[4][0] 
value is :  +5+ +System.Data.DataSet.Tables[1].Rows[5][0] 
value is :  +6+ +System.Data.DataSet.Tables[1].Rows[6][0] 

How do i get the actual value from the column?


Source: (StackOverflow)

What are the disadvantages of Typed DataSets

I come from a world that favors building your own rather than rely on libraries and frameworks built by others. After escaping this world I have found the joy, and ease, of using such tools as Typed DataSets within Visual Studio. So besides the loss of flexibility what else do you lose? Are there performance factors (disregarding the procs vs dynamic sql debate)? Limitations?


Source: (StackOverflow)