combining octave sets with repeating - math

how can I combine two sets in octave with repeating? I mean that if there are value that exists two times or more it will be in the new set with the same amount?
I tried (union) function but it gave me the values with out repeating

Related

How to pull an entire row of data in R using only one column's value

I'm working with a big data set and want to create a value that is based on multiple variables (columns) from a single observation (row). The observation the value is based on needs to have the minimum value of the data set for one of the variables which is how I can identify the observation.
Is there a way I can create this value without looking manually by telling R to pull the variables I need from whatever row has the minimum value of a different variable?

How can I make two key columns from the different part of the column names in R?

I am going to do repeated measures ANOVA on my data, but to this point, my data is wide. Two independent (categorical) variables are spread across single responsive variable.
See the image: https://imgur.com/1eTWSIM
I want to create two categorical variables that take values from the different parts of the columns (circled on the screenshot). Subject numbers should be kept as a category. So after using gather() function, the data should look something like this:
https://imgur.com/SGM2N69
I've seen in a tutorial (that I can't find anymore) that you can create two columns from a single function, using different parts of the colnames (using "_" as a separator), but I can't exactly remember how it was done.
Any help would be appreciated and ask if anythings is not clear in my explanation.
I have solved the problem by using 'gather()' function first and then 'separate()' to separate it into two new columns. So I guess, if you want to make two key columns, first you have to make a single column containing both values and later separate it into two.
At least that is how I did it.

Dimensions of object in R

Whenever I need to find out number of rows in dataframe, I use nrow(df) or dim(df). I need to find out number of rows in series I use NROW(df$col_1). Is there one function, which works in both cases?

Set value for multiple variables at once?

While programming a sample program in my TI-84 calculator, I was wondering if there were a way to initialize multiple variables to a single value in one line?
I tried doing
0 -> A,B,C,D
However this did not work for the calculator. I know you can do each one on an individual line, but my question is, is it possible to initialize multiple variables to a single value at once in TI-BASIC?
No. You cannot initialize multiple variables to a single value at once in TI-Basic.
However, you can:
Set all values in an array or matrix to the same value at once.
Initialize variables to zero in three bytes instead of four using DelVar (variable) and then leaving off the following colon. For example, instead of doing :0->A:0->B:Disp A,B you can do :DelVar ADelVar BDisp A,B.
Remember that uninitialized variables are treated as zero when first used.
No, you can't set multiple variables at once with one value. But if you just want them on the same line, you can use a colon like this 0→A:0→B. If you really feel like it, you could make another program that zeroes out every variable and just call it from within your program like this.
PROGRAM:ZERO
:0→A
:0→B
:0→C
...
PROGRAM:OTHER
:prgmZERO
...

Concatenate excel cells with numbers without summing

I know you can use the concatenate function in excel to combine two strings in two different cells into one cell, but how do I do the same for cells with numbers in them? I have two columns as seen in the image below (I have started the process by hand to demonstrate what I want) and I want to concatenate the value to read into R to perform a choice experiment evaluation on the data but using concatenate sums the values.
You can also do the concatenation within R itself, by setting the column type to string, and then using the paste0(string1, string2) function.
You can use the & sign
=A1&C1
concatenate does also work in excel
=CONCATENATE(A1,C1)

Resources