r – Arrange kable interactive table by clicking on the column names

I’d like to be able to arrange a table by clicking the column name, like I can with View(.) in R

This is my code

library(kable)
library(kableExtra)

titanic %>% 
  kbl() %>%
  kable_styling(bootstrap_options = c("striped", "hover"),
                fixed_thead = T) %>% 
  scroll_box(width = "1000px", height = "1000px")

I click the column names now and it doesn’t re order the columns and that’s what I’d like to change

mysql – Why does USING give me 2 columns of the joining column?

I have a number of columns in HallOfFamers and one of them is playerID. I was joining it with People table using playerID with the keyword USING. However, I get 2 columns of playerID and I was under the impression that USING would give only 1 of the two columns meaning only 1 playerID.

SELECT 
    People.playerID,
    People.nameLast, 
    People.nameFirst,
    HallOfFamers.*,
    FROM People 
    INNER JOIN HallOfFamers USING(playerID)
    ORDER BY People.playerID;

result is:

| playerID | nameLast | nameFirst | playerID | statA | statB ....

Is there a way of getting rid of the 4 column without having to type out all the columns in HallOfFamers table and exclude just playerID?

r – How to add column that is a number that corresponds to the date

I am trying to add a column and I have a data frame that looks like this

     Date New.Recap Site
1    3/21/2020         N  Jag
2    3/21/2020         N  Jag
3    3/22/2020         N  Jag
4    3/23/2020         N  Jag
5    3/23/2020         N  Jag
6    3/23/2020         R  Jag
7    3/23/2020         N  Jag
8    3/23/2020         N  Jag
9    3/23/2020         R  Jag
10   3/23/2020         N  Jag
11   3/23/2020         N  Jag
12   3/24/2020         N  Bla
13   3/24/2020         N  Bla
14   3/25/2020         N  Bla
15   3/25/2020         N  Bla

Depending on the date I would like to add another column on the end that is the number 1-6 depending on the date that will be called the primary. For example, the dates 3/21/2020-3/23/2020 would be a 1 and hopefully look like this

          Date  Primary New.Recap Site
    1    3/21/2020   1      N  Jag
    2    3/21/2020   1      N  Jag
    3    3/22/2020   1      N  Jag
    4    3/23/2020   1      N  Jag
    5    3/23/2020   1      N  Jag
    6    3/23/2020   1      R  Jag
    7    3/23/2020   1      N  Jag
    8    3/23/2020   1      N  Jag
    9    3/23/2020   1      R  Jag
    10   3/23/2020   1      N  Jag
    11   3/23/2020   1      N  Jag
    12   3/24/2020   2      N  Bla
    13   3/24/2020   2      N  Bla
    14   3/25/2020   2      N  Bla
    15   3/25/2020   2      N  Bla

Basically, I have a bunch of dates that fall into the category of being 1-6 depending on the date. The dates are always in groups of three consecutive days in a row. For the graphing, I need to use the Primary 1-6 numbers and not the dates. I have been trying to do this with the mutate function but I am not sure how to use it with dates.

Import and extract certain column and row

I have a problem with importing and extracting 2nd column in my CSV file. I need to have 3 list, the first one first column except for first row, the second will be second column except for 1st row and the last one will be 3rd column without first row.
I have succesfully imported and extracted the first column using:

Centre = Import["C:\Users\vocko01\Desktop\TS.csv", "Table", 
   "FieldSeparators" -> ";"][[2 ;;, 1]]

The third one works too:

Suburb = Import["C:\Users\vocko01\Desktop\TS.csv", "Table", 
   "FieldSeparators" -> ";"][[2 ;;, -1]]

But when I want to import and extract 2nd column, it doesn´t work the same way:

City = Import["C:\Users\vocko01\Desktop\TS.csv", "Table", 
   "FieldSeparators" -> ";"][[2 ;;, 2]]

Can you please help me with this issue or is it a better way to write it?

Thank you

Here is the link for CSV file: https://gofile.io/d/ELwAhG

matrices – Linear Algebra: Rank of the product of a column vector and its transpose

I came across a Linear Algebra problem and I’m having some trouble understanding it. The problem is 2b from the Stanford CS229 Machine Learning Course’s first worksheet. I am not attending the class, I’m just taking it by myself on my own time since the course materials and lecture videos are online.

http://cs229.stanford.edu/materials/ps0.pdf

Problem

Let z ∈ R^n be a non-zero n-vector. Let A = zz^T. What is the null-space of A? What is the rank of A?

I figured out that the null space of A is the set of vectors orthogonal to z^T

What I can’t figure out is the rank of A. I saw that zz^T would be symmetric and since the the resulting matrix is the product of a column vector and its transpose, I figured all the columns would be linearly dependent of one another and thus rank(A) = 1. I wasn’t 100% sure of my reasoning since I had no way to really prove my hypothesis, so I checked the solution.

It turns out I was right on both accounts, but the reasoning used for the rank was different from mine and didn’t make sense? The answer said that because null space of A is the set of vectors orthogonal to z^T, then rank(A) is one. I don’t understand why this is true. Can someone explain?

Also, it mentioned that the null space of A would have n-1 dimensions which I also didn’t understand. A bit of clarification on that would also be helpful

google sheets timestamp – Removing Last Updated value when No data was selected from the column to check

I need help on my Google Sheet script. It is working fine on showing the timestamp of Last Updated at colB every time a new Call Status was set at ColA ; but when I deleted the status at colA, the timestamp remains at colB. It should also be clear once no data was selected at colA.

Here is my google sheet>> t.ly/z2P0

Here is my script>>

var timezone = "UTC+00:00";
var timestamp_format = "hh:mm:ss dd/MM/yyyy"; // Timestamp Format.
var updateColName = "Call Status";
var timeStampColName = "Last Updated";

var sheet = event.source.getSheetByName('StatusDate'); //Name of the sheet where you want to run this script.
var actRng = event.source.getActiveRange();
var editColumn = actRng.getColumn();
var index = actRng.getRowIndex();
var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues();
var dateCol = headers(0).indexOf(timeStampColName);
var updateCol = headers(0).indexOf(updateColName); updateCol = updateCol+1;
if (dateCol > -1 && index > 1 && editColumn == updateCol) { // only timestamp if 'Last Updated' header exists, but not in the header row itself!
var cell = sheet.getRange(index, dateCol + 1);
var date = Utilities.formatDate(new Date(), timezone, timestamp_format);
cell.setValue(date);

Thank you so much for the help.

sharepoint designer – Calculated Column Absolute Mess Please Help

I have been stumped on this particular task for weeks. Any help would be GREATLY appreciated. I’m desperate.

I have three columns I am working with: Date Admitted to Hospital (date column), Date Discharged (date column), and Hospital Duration (calculated column)

Hospital Duration currently looks like this:

=IF(ISBLANK((Date Discharged)),DATEDIF((Date Admitted to Hospital),TODAY(),"d"))

This is great because it accounts for a scenario where ‘Date Admitted to Hospital’ is filled in, but ‘Date Discharged’ is blank.
However, it does not account for when neither of the columns are filled out – and when BOTH of the columns are filled out, the result I get in ‘Hospital Duration’ is “no”??

mysql – Selecting a value from a row where another column is max

I have the following SQL query:

SELECT bug.`id`,
       Max(report.`date`),
       Count(report.`id`),
       Max(version.`code`),
       bug.`id`
FROM   `bug`
       LEFT OUTER JOIN `stacktrace`
                    ON ( stacktrace.`bug_id` = bug.`id` )
       CROSS JOIN `version`
                  LEFT OUTER JOIN `report`
                               ON ( report.`stacktrace_id` = stacktrace.`id` )
WHERE  stacktrace.`version_id` = version.`id`
GROUP  BY bug.`id`
ORDER  BY Max(report.`date`) DESC; 

I now want to select version.name instead of version.code from the row where version.code is maximal. Is this possible? If so, how do I do this with minimal amount of queries/overhead?


Relevant Tables (stripped):

CREATE TABLE `bug` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
);

INSERT INTO `bug` VALUES();
INSERT INTO `bug` VALUES();

CREATE TABLE `version` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` int(11) NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
);

CREATE TABLE `stacktrace` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `bug_id` int(11) NOT NULL,
  `version_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_s_v` (`version_id`),
  KEY `FK_s_b` (`bug_id`),
  CONSTRAINT `FK_s_b` FOREIGN KEY (`bug_id`) REFERENCES `bug` (`id`) ON DELETE CASCADE,
  CONSTRAINT `FK_s_v` FOREIGN KEY (`version_id`) REFERENCES `version` (`id`) ON DELETE CASCADE
);

CREATE TABLE `report` (
  `id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `date` datetime NOT NULL,
  `stacktrace_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_r_s` (`stacktrace_id`),
  CONSTRAINT `FK_r_s` FOREIGN KEY (`stacktrace_id`) REFERENCES `stacktrace` (`id`) ON DELETE CASCADE
);

As SQLFiddle

Woocommerce error on admin ajax search product: Unknown column ” in ‘where clause’

When I want to add products to a manual order in Woocommerce, the product search returns “no matches found”. I looked at the logs and I found this error seems to be culprit. I searched the error but every case I found, the unknown column name is defined in the log. Here it’s blank: Unknown column '' How can I investigate what’s causing it? I’m trying with TwentyTwenty and only WC activated…

Full error:
(proxy_fcgi:error) (pid 3178592) (client *:60140) AH01071: Got error 'PHP message: WordPress database error Unknown column '' in 'where clause' for query SELECT DISTINCT posts.ID as product_id, posts.post_parent as parent_id FROM wp_posts postsnttt LEFT JOIN wp_wc_product_meta_lookup wc_product_meta_lookup ON posts.ID = wc_product_meta_lookup.product_idnttt LEFT JOIN wp_wc_product_meta_lookup parent_wc_product_meta_lookupnttt ON posts.post_type = 'product_variation' AND parent_wc_product_meta_lookup.product_id = posts.post_parent ntttWHERE posts.post_type IN ('product','product_variation')nttt AND ( ( ( posts.post_title LIKE '%chorizo%') OR ( posts.post_excerpt LIKE '%chorizo%') OR ( posts.post_content LIKE '%chorizo%' ) OR ( wc_product_meta_lookup.sku LIKE '%chorizo%' ) OR ( wc_product_meta_lookup.sku = "" AND parent_wc_product_meta_lookup.sku LIKE '%chorizo%' ) )) nttt AND posts.post_status IN ('private','publish') ntttntttORDER BY posts.post_parent ASC, posts.post_title ASCnttt LIMIT 30 nttt made by do_action('wp_ajax_woocommerce_json_search_products_and_varia...',