Questions tagged as 'array'

1
answer

How to use contents of a vector to assemble the name of a file to be saved?

I have tried to use colnames() , names() and nothing works. My data is something like (however, I have 38,000 names and 38,000 columns): nomes <- c("nome105", "outro.nome_26", "qualquerCoisa") dados <- as.data.frame(matri...
asked by 10.05.2016 / 21:19
1
answer

Fill char array with random words [closed]

I'm trying to develop an algorithm able to get a vector of strings, sort by word size in descending order and place them inside an array of char embedding if possible all words. The idea of everything would be how to create a grid and make the w...
asked by 20.09.2016 / 12:52
4
answers

How to know the highest value of an Array?

I'm doing 1 calculator that adds values entered by the user and when the values of the sums reach 1000 or exceed, the loop ends. So far so good, the problem is to be able to identify the highest value entered by the user Each time the loop...
asked by 08.10.2014 / 04:54
4
answers

How to format this array?

I have the following array: $dados = array( '0' => array( 'id_assinante' => $id, 'nome' => 'Aluguel' ), '1' => array( 'id_assinante' => $id, 'nome' => 'Água' ), '2'...
asked by 21.12.2016 / 12:14
3
answers

Foreach Array by incrementing another array

With a question about foreach and incrementing another helper to perform an insert in the database, see: When I send a form via post I get the following array as a result: array (size=2) 'quantidade' => array (size=8) 0 =>...
asked by 14.11.2016 / 12:43
4
answers

How to search within this object vector?

How would I search for a record within my object? The program is a contact book, and I wanted it to do the search by the name that I type in a JPane and return the contact's contact information. Here is the commented code. package ExemploDe...
asked by 09.03.2016 / 08:25
3
answers

How to shuffle characters from a String in Java at random?

I am developing a password generator program. Here you can set the percentage of numbers, letters and special characters you want to have in your password, as well as the size of your password. Later I concatenate the numbers, letters and symbol...
asked by 12.11.2015 / 20:43
3
answers

Last position of an Array

In PHP, what's the fastest and easiest way to get the last position of an Array? I got this doing $array[ count($array) - 1 ] , and it works, but is there any simpler and less ugly way?     
asked by 23.04.2014 / 21:53
2
answers

How to make mobile sum in R?

I have a 1:50 vector and I need to make a moving sum (equal to the moving average), ie in the case of the last 5 observations, the new vector would be c(sum(1:5), sum(2:6), sum(3:7), ..., sum(45:49), sum(46:50)) . The aggregate func...
asked by 17.12.2018 / 15:51
3
answers

Is there comparator operator "in" in JavaScript?

In JavaScript is there a way to use in to check if the value of a variable is contained in a list of values? A visual example: if (tipoDemissao in (1,2,5)){ valorDemissao = 525.20; }     
asked by 12.04.2016 / 14:25