Dataset Tables Merging in single dataset with result set - asp.net

I have three result sets and that will be in the Dataset. So each result set has only one Row. No I want to make it into one Table with three rows.
Example ::
Result Set ::
ds.Tables[0].Rows[0]["A"],
ds.Tables[1].Rows[0]["B"],
ds.Tables[2].Rows[0]["C"]
My desired Output ::
ds.Tables[0].Rows[0]["A"],
ds.Tables[0].Rows[0]["B"],
ds.Tables[0].Rows[0]["C"]
How can I achieve this?

Could you not use the DataTable.Merge method? Start with a clone of the first table and then merge in the data from the other tables?
The Merge method has an option, MissingSchemaAction, that lets you specify that new columns should be added to the resulting table so it should do what you are after.

Related

Select one row in R, result is a new table

I try to select just one row in my data but the result come out in new data and I can't compute the mean of this, because the header is showing. But when I select the column, there is no problem and I can see the result as a value. You can see the result of the code in the photo that y is in data and X is in the value.
y=mydata[1,]
X=mydata[,4]
enter image description here
you should use rowMeans.
When you select a row you are selecting multiple variables and that results in giving you a dataframe.

Inserting and combining data between 2 table

We have a table students with ID,NAME,SURNAME. We want have another table (created) students_2 with ID1,NAME1,SURNAME1.
Starting from table students, i want to fill data in the second table in the following way : I want to have in the second table combinations of names ( example : NAME,SURNAME1; NAME1,SURNAME1). Moreover, i want to generate combination of names.
How can I do that ? I tried something like :
INSERT INTO students_2 (ID1,NAME1,SURNAME1) SELECT ID,NAME,NAME from students;
But it's not correct cause I don't generate combinations, just inserting . A solution is appreciated, but mainly i need ideas.
You could write something like
INSERT INTO students2(NAME, VALUE) FROM
SELECT s1.name, s2.value from students1 s1 cross join students1 s2
This will do Cartesian product , and will get a NxN rows with combinations

R naming convention/tricks for many columns in data.table / data.frame

I have a list of, say, n=10 data.tables (or data.frames).
Performing names(myList) returns the unique table names.
Performing names(myList[[i]]) (for i in 1:n) returns identical output for each value of i - i.e. each data.table has identical column names.
I need to merge all the data tables into one large data table, but would like to preserve the name of the list data.table for each column somehow, in order to keep an overview of where each column originated from.
Is there a trick to doing this, such as giving the columns keys? Or must one just prepend the table name to each of the columns in the final result? This would make the names pretty long in my case.
I want to avoid having to remember (or think about) which columns belongs to which table. Just for comparisons sake, I'd like to run str(myBigTable) or summary(myBigTable) and see something like Excel shows here [but vertically displayed in R]:

How to save the first N rows of a table in R into a file?

I have a table data structure that contains 10000 rows (using R package). I know how to save the whole object using the function write.table(...); however, I am wondering if there is an easy way to save just the first N rows ( in the same order ) of that table, where N<10000. I am sure I can use a loop to iterate over the first N rows of the table, but an easier predefined function or parameter would always be helpful. Any ideas?
Use object[1:N,] with write.table ();

Referencing offset cells with INDIRECT() function

Suppose that I have a cell, lets say Sheet2.A1, with the value: Sheet1.A10.
It contains the information from where to fetch the data.
Now I would like to fetch this data, which I do with INDIRECT(Sheet2.A1). However, I would further like to extract the data from some cells below in the same column. So suppose I would like to extract data from Sheet1.A11 and Sheet1.A12.
How can I calculate this offset to extract the data?
Is there any extension to the INDIRECT function where I can add this offset of one or two columns below?
I resolved it using =OFFSET(INDIRECT(Sheet2.A1),1,0) and =OFFSET(INDIRECT(Sheet2.A1),2,0)

Resources