Categories
Mastering Development

R efficient way to convert named/nested list to data frame

I’m trying to convert a named and nested list into a data frame (FYI, the list is a product of st_nn function, where nn stands for nearest neighbor and d stands for distance). Below is a reproducible example. nn <- list(c(1,2), c(2,3)) d <- list(c(0, 100), c(11,43)) l <- list(nn, d) df is what I […]

Categories
Mastering Development

R Convert List Into Data.Frame or Table

list1 = list( c(4,5,6,7,1,1,1,1,3,1,3,3), c(3,4,5,6,2,2,2,2,1,4,2,1), c(1,2,3,4,1,1,1,1,3,2,1,1), c(5,6,7,8,1,1,1,1,4,4,4,3), c(2,3,4,5,2,2,2,2,2,1,2,1) ) data1=data.frame(“ID”=c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5), “Time”=c(1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4), “Grade”=c(4,5,6,7,3,4,5,6,1,2,3,4,5,6,7,8,2,3,4,5), “Class”=c(1,1,1,1,2,2,2,2,1,1,1,1,1,1,1,1,2,2,2,2), “Score”=c(3,1,3,3,1,4,2,1,3,2,1,1,4,4,4,3,2,1,2,1)) I have ‘list1’ Each item in ‘list1’ equals to a single individual’s Grade, Class, Score for 4 years. So ‘list1’ has 5 students and 12 records for each student (4 records for every of three variables, Grade and Class and Score). […]

Categories
Mastering Development

how to remove last column of an array in python

my Array size is unknow and I would like to remove the very last column a = np.array([[“A1″,”A2″,”A3”],[“B1″,”B2″,”B3”],[“C1″,”C2″,”C3”]]) I tried a[-1:] it deleted all rows except the last row and i tried a[:-1] it deleted the last row. how can I delete the last column?

Categories
Mastering Development

Ignore row if all 4 cells are 0; get name if any of the 4 cells is greater than 0

i have a list of names(Column A), the numbers in columns B to F are result of a formula. I’m trying to create a FOR LOOP code that will check columns B to F, if all cells in B to F are zero then the code should ignore the current row and skip to the […]

Categories
Mastering Development

How to interlace two array lists?

I am trying to develop a program that shuffles a deck by dividing the deck into two and then interlacing them. Class Deck represents a deck of 52 cards. There are two methods: Deck(int n) and Card drawCard(). Deck(int n) is the constructor. The parameter tells how many rounds the deck should be shuffled. In […]

Categories
Mastering Development

Bit operator quiz, change int to bit

HI I am very begginner of JAVA And i want to solve this quiz Quiz Create a function that takes two ints, divides them into four bytes, adds each digit, and then sums them example 120 | 50 | 100 | 1 | ⇐ 2016568321 -120 | -50| -100| -1| ⇐ -1999725313 ⇓ ⇓ ⇓ […]

Categories
Mastering Development

Separate string column in data.table in multiple columns in R

Imagine I have a R data.table with following string column: string a1; b: b1, b2, b3; c: c1, c2, c3 a1; b: b2, b3, b4; c: c1, c2, c3; d: d1, d2, d3 a2; b: b1, b2, b3; c: c2, c5, c6; d: d1, d2, d3; e: e2, e3, e4 a5; b: b5, b6, b7; […]

Categories
Ask Mathematics

series problem with Battlestar Galactica/Star Trek can someone check my answers

this question is heavily weighted so I am wonder if my answers are correct or if there is a better way to do them. Captain Picard and the rest of the crew of the Enterprise are defending their position on the moon Yavin IV against the evil robotic Cylon invaders. Each day of the battle, […]

Categories
Mastering Development User Help

Formula to copy a cell from another worksheet where the name of worksheet to be copied from varies

I have a workbook with a worksheet containing the following: Destination Worksheet The data in cells B1, C1, D1 need to be equal to the value of cells A1, A2, A3 in a worksheet in same workbook named DOD11.2 (i.e. the name of the worksheet is the same as the letters up to the character […]

Categories
Ask Mathematics

Counting polysticks on the $n$-cube.

Over at Code Golf Stack Exchange, I put up a challenge asking people to count, among other things, the number of ways to take an $n$-cube and color $k$ (connected) edges up to isometries of the $n$-cube. Let’s call this number $C(n,k)$. For example, when $n=3$ (the ordinary cube) and $k=4$, $C(3,4) = 4$ as […]