Column mean function with many columns - multiple-columns

This seems so simple...but I am lost.
I have a data frame set up so that I can make new columns that are means of certain columns (over 2500 columns). The column names are numeric, so I added an X to column header. I would like to get the mean of 500 columns with names and looking to write code calculating the means of columns with character headings.
enter image description here
Each row is a sample, and for each sample, I would like to get the mean of columns X350: to X420.
DF$blue <- mean(DF$X350: DF$X355), ie, the mean of columns X350 to 355 in a new column labeled blue.
Advice greatly appreciated, Thanks!
I think I have to first make the data numeric, I have tried to unlist, but lost as to what to do with the list.
x <- list(DF,4:2504)
x_num <- as.numeric(unlist(x))

Related

Double Column lookup for Outline Format Data

So I am wondering how to find a specific cell in a given Column (in this case column F), when I want the search area for the lookup to be within a certain range, and these ranges will be separated when a new value shows up in column A (because the format for this data is in outline format). I know the description sounds confusing, the picture provide a better explanation than I can. The file format is excel, but I can convert to sheets if necessary.
So ideally what I want is either a query for some other lookup function that will search the sheet for column A first, so in this case I would search for title contains "ADC-BOH" and then do a sub-search within the area between the two rows with the long column A values (Totals for Dept...) for the Reg Hours. Then repeating that for OT, ESICK, etc.
I don't know how to concatenate a column A value (ADC-BOH) to the Column C value (Reg) to then get the value at column E, and make this dynamic for all of the respective restaurants (Column A) I have to do that are all on this sheet.

How to get total from another tablix column? (SSRS)

Hello awesome people of stackoverflow!
I need help with a simple problem with my SSRS expression.
How could I do this in SSRS?
As you can on the 2nd table below in my excel screenshot.
for each row we divide -BC5...-BC10 to column/row BC4. To get the desired results for table 2 in excel column total 2018 into column/rows BC17 upto BC22.
I've tried referencing my textbox like this
ReportItems!TextBox1.Value / ReportItems!TextBox2.Value.
But got me the wrong values.
Can someone please help.
Thank you!
If those two tables are in the same table/tablix then it should work with the expression that you wrote (try to type it instead of copy paste sometimes that may work).
=(ReportItems!Textbox7.Value /ReportItems!Textbox1.Value) * 100
If they are not in the same Table/Tablix then you should write like the following:
=(Fields!ColumnName1.Value / Fields!ColumnName2.Value) * 100
Format your cells.
There is not enough info to give you an exact answer but you should be able to work it out.
The first thing you need to do is get the context of the aggregations you want to work with. So click on the cell containing the number you want to divide ([Sum(DiscountOERestated)] ). In the row and column groups panel near the bottom on the screen, look at the row group that is highlighted. For this example I'll assume the row group is called grpCategory.
Now we need to do the same for GrossCatalogRestated. However, GrossCatalogRestated in the top tablix does not appear to be an aggregate. I'll assume it should be the total GrossCatalogRestated for the dataset. For this exmaple, we'll say the dataset name is dsMyDataSet. If it's within a row group, just swap the dataset name out with the row group name that it sits in, just like we did for DiscountOERestated .
So you expression would look something like
=SUM(Fields!DiscountOERestated.Value, "grpCategory") / SUM(Fields!GrossCatalogRestated .Value, "myDataSetName")
This will give you a deicmal result, somehting like 0.025 . You then just need to set the format property to say, "p1", so it shows as 2.5%
If this does not work, edit your question to show the expressions in the cells you are working with along with the rowgroup and dataset names.

How do I replace values in a column in KNIME?

I have a column of countries with 50 different values that I want to reduce to United States and Other.
Can someone help me with that?
Another example is Age which has 48 values that I'd like to reduce to only 4 like 1 to 18 = youth, 18-27 = starting, etc.
I've actually got about 5 columns that I want to reduce the values of. So would I need to repeat the process multiple times in KNIME or can I accomplish multiple column value replacements at once?
The latter on can easily be achieved with the Rule Engine
$Col0$ > 1 AND $Col0$ <18 => "youth"
For the First problem I'd use a String Replace (Dictionary).
I don't think you replace all at once but you can loop over columns.
For the second case I would use Numeric Binner:
For each column a number of intervals - known as bins - can be
defined. Each of these bins is given a unique name (for this column),
a defined range, and open or closed interval borders. They
automatically ensure that the ranges are defined in descending order
and that interval borders are consistent. In addition, each column is
either replaced with the binned, string-type column, or a new binned,
string-type column is appended.

Counting same values between rows in Open Office Calc

(Open Office Calc) I have two rows of the same length, containing letters.
Suppose the two rows are A1:Z1 and A2:Z2.
I want to check if A1=A2, B1=B2, ... Z1=Z2 and output in one cell how many of these conditions are true.
I tried using COUNTIF but the condition can only refer to a fixed cell, not to a "moving" cell. In this case I would like to be able to write something like "COUNTIF(?1= ?2)" where "?" is the column index.
Any ideas?
Please try:
=SUMPRODUCT(A1:Z1=A2:Z2)

SSRS - Get the ReportItem!____.Name of the current item (textbox or column)

I have a big report with 100+ columns named 'Column001', 'Column002' etc etc.
These columns hide depending on whether there is any data or not, and I'd like to have the last column have a right side border.
So I could do something like (in pseudocode)
= IIF(COUNT(ReportFields!Columns.Values) = CINT(RIGHT([CurrentReportItem].Name,3)), RIGHT_BORDER, NO_BORDER)
Is there any way to get the current item (ReportItem!) so that I can get it's name?
If you have control over the query then you can modify it to return the number of visible rows as a non-displayed new field in the result set and then compare that value at each column to decide if the border should be displayed.
If you do not have control over the query then I think you are limited to a painful series of nested IIf() statements.