New answers tagged

1 vote

How to check if the given row matches one of the rows of a table?

KeyExistsQ[Counts[tabb],rowThere] KeyExistsQ[Counts[tabb],roww] (* True False *) Data/Lists ...
user1066's user avatar
  • 14.4k
3 votes

How to check if the given row matches one of the rows of a table?

Another alternative is to use Union: ...
E. Chan-López's user avatar
1 vote

How to check if at least one ordering of the given row matches one of the rows of a table?

My attempt is as follows: MatchesRowQ[table_, row_] := MemberQ[table, #] & /@ Permutations[row, Length[row]] // Or @@ # & ...
E. Chan-López's user avatar
1 vote

How to check if at least one ordering of the given row matches one of the rows of a table?

Or @@ Map[ContainsAll[roww], tabb] Some examples ...
eldo's user avatar
  • 40.4k
2 votes

How to check if at least one ordering of the given row matches one of the rows of a table?

containsInAnyOrder = Not @ FreeQ[{OrderlessPatternSequence @@ #2}] @ # &;
kglr's user avatar
  • 377k
3 votes
Accepted

How to check if at least one ordering of the given row matches one of the rows of a table?

MemberQ[Sort /@ tabb, Sort[roww]]
Domen's user avatar
  • 18.3k
3 votes

How to check if the given row matches one of the rows of a table?

SeedRandom[1]; tabb = RandomInteger[{0, 4}, {5, 4}] row = {0, 3, 4, 4} ContainsAny[tabb, {row}] True
Syed's user avatar
  • 37.8k
5 votes
Accepted

How to check if the given row matches one of the rows of a table?

tabb = RandomInteger[{0, 4}, {5, 4}]; row = RandomInteger[{0, 4}, 4]; Well, it's simply MemberQ[tabb, row] returning ...
eldo's user avatar
  • 40.4k
2 votes

Replacing elements of one table with the elements of another table for common grid

Values @ AssociationThread[Most /@ #, #] & @ Join[tab1, tab2] ...
kglr's user avatar
  • 377k
2 votes

Replacing elements of one table with the elements of another table for common grid

...
user1066's user avatar
  • 14.4k
1 vote

Replacing elements of one table with the elements of another table for common grid

My attempt to do this, defining ReplaceByCoords: ...
E. Chan-López's user avatar
3 votes

Replacing elements of one table with the elements of another table for common grid

Using Association - overwriting Join @@ Values @ Association[GroupBy[Most] @ tab1, GroupBy[Most] @ tab2] {{0.5, 0.1, 0.05}, {0....
eldo's user avatar
  • 40.4k
8 votes
Accepted

Reverse the rotation of an animated gif and create a mirror image of it

To keep same speed for GIF import its "DisplayDurations": dur = Import["/Users/Vitaliy/Desktop/wheel.gif", "DisplayDurations"] And ...
Vitaliy Kaurov's user avatar
5 votes

Reverse the rotation of an animated gif and create a mirror image of it

The idea is rotate the matrix(rotate 90 Degree), that is ...
cvgmt's user avatar
  • 61.3k
2 votes
Accepted

How to automatically convert sub- super-indices to strings?

How did you get something like expr in the first place? It's probably much easier to produce "m_t" from a step earlier in the process. Anyway, from @...
Michael E2's user avatar
  • 233k
1 vote

How to automatically convert sub- super-indices to strings?

For your specific example, expr = Subscript[m, t]; ToString[expr[[1]]] ~~ "_" ~~ ToString[expr[[2]]] does the trick. For a more complicated example, ...
AccidentalFourierTransform's user avatar
1 vote

Clip, Select, FirstPosition not working for extracting values from an association based on a range from another list

This is pretty jenky, but I think it gives you what you're asking for. ...
lericr's user avatar
  • 22.3k
2 votes

Splicing a list of arguments into a function with Sequence

Another way is to delete the Head with Delete ...
user1066's user avatar
  • 14.4k
1 vote
Accepted

Clip, Select, FirstPosition not working for extracting values from an association based on a range from another list

You should eliminate the curly brackets: dt = <|data|> <|"A" -> "2017011_230833", "X" -> {7.96439, 7.85037, 18.128, 6....
eldo's user avatar
  • 40.4k
1 vote

Splicing a list of arguments into a function with Sequence

Another way to do this is to use Replace for the particular position the array has in your example: ...
E. Chan-López's user avatar
3 votes
Accepted

Splicing a list of arguments into a function with Sequence

Splice came with V 12.1: array = {e, f}; foo[a, b, c, d, Splice[array, foo]] foo[a, b, c, d, e, f] If we ...
eldo's user avatar
  • 40.4k
2 votes

How to leave only specific columns?

Another method using Tally: ...
E. Chan-López's user avatar
3 votes

How to leave only specific columns?

dt = MapApply[#1 -> {##2} &] @ Transpose[tabtest]; Lookup[#, "a", Nothing] & /@ dt // Transpose // MatrixForm
eldo's user avatar
  • 40.4k
5 votes

How to leave only specific columns?

Extract[Position[tabtest[[1]], "a"]] /@ tabtest or ...
lericr's user avatar
  • 22.3k
5 votes

How to leave only specific columns?

...
user1066's user avatar
  • 14.4k
6 votes
Accepted

How to leave only specific columns?

If you transpose your data you can use "Cases" like: Cases[Transpose[tabtest], {"a", __}] // Transpose // MatrixForm
Daniel Huber's user avatar
  • 45.4k
11 votes

How to leave only specific columns?

Perhaps this: ...
Michael E2's user avatar
  • 233k
1 vote

How to take the beginning and end parts of a list with simpler syntax?

Another way using Cases: ...
E. Chan-López's user avatar
3 votes

How to take the beginning and end parts of a list with simpler syntax?

With ReplaceAt (since 13.1): ReplaceAt[Range[10], _ -> b, {{;; 3}, {7 ;;}}] {b, b, b, 4, 5, 6, b, b, b, b}
eldo's user avatar
  • 40.4k
4 votes

How to take the beginning and end parts of a list with simpler syntax?

Using TakeList: (introduced 14 Sep 2017) alist = Range[10]; Examples ...
Syed's user avatar
  • 37.8k

Top 50 recent answers are included