Questions tagged [assign]

Something related to an assignment operation, i.e. the process of changing the content of a variable to reflect some given value.

1695 questions
6
votes
2 answers

Fortran: initializing of and assigning value to arrays

To initialize and assign value to arrays in Fortran we do as the following: Initializing: real(kind=8):: r(3,4) ... r(:,:) = 0.0_8 what if we use only real(kind=8):: r(3,4) ... r = 0.0_8 and what if we do as: real(kind=8):: r(3,4) ... r =…
Developer
  • 8,258
  • 8
  • 49
  • 58
6
votes
5 answers

Joomla component not appearing in the menu item types

I just followed the joomla tutorials on how to create the "perfect" MVC joomla component. However, my problem is that I don't know yet how to assign it to a menu. I thought that my component would then just show up when I select a "menu item type",…
ubi
  • 103
  • 1
  • 1
  • 4
6
votes
2 answers

Liquid: How to assign the output of an operator to a variable?

I'm working with Liquid templates for Shopify. I want some elements to show up only if the month happens to be December. Since there are multiple elements that need this, I want to set a variable at the top of the document and refer to it later.…
Robert
  • 6,660
  • 5
  • 39
  • 62
6
votes
1 answer

perl6 grammar actions: unable to make anything if not using $/

I wrote a test program, and now it seems that if I don't use $/ in a method signature because I have to use .match inside the method, I can no long make anything. What did I do wrong? A further question is that if .match sets $/, and $/ is…
lisprogtor
  • 5,677
  • 11
  • 17
6
votes
4 answers

perl6 rakudo 2016.11 match tries to assign to read-only variable, why not in 2016.07?

I have the following method in an action class that worked well in Rakudo 2016.07, but I just installed 2016.11 and now the new Rakudo says my method tries to assign to read-only varible, and I just don't see the problem: method ptName ($/) { …
lisprogtor
  • 5,677
  • 11
  • 17
6
votes
2 answers

How is allocator-aware container assignment implemented?

For example, from std::deque::operator = in C++ Reference: (1) Copy Assignment (const std::deque &other) Replaces the contents with a copy of the contents of other. If std::allocator_traits::propagate_on_container_copy_assignment() is true,…
Dannyu NDos
  • 2,458
  • 13
  • 32
6
votes
3 answers

Object assign with dynamic variable

I have this initialState in my Redux store: const initialState = { isFetching : false, active : {} } Where active is an object. Now I have an action that should append or add a property to active’s data property, like…
Joey Hipolito
  • 3,108
  • 11
  • 44
  • 83
6
votes
4 answers

Replace negative values by NA values

I have positive, negative and NA values in a Table, I need to replace negative values by NA values. Positive and NA values should remain as they are in Table. My Data set is similar to the one below: NO. q 1 NA 2 NA 3 -133.6105198 4 …
Tika Ram Gurung
  • 179
  • 3
  • 3
  • 9
6
votes
4 answers

Multiple assignment at once in java

In python you can do this: def f(): return 1, 2, 3 (foo, bar, baz) = f() Is there an equivalent in java?
qed
  • 22,298
  • 21
  • 125
  • 196
6
votes
3 answers

Return a dataframe from a function and store it in the workspace

This is my first week working with R and there is one thing about function I cannot seems to manage. df <- data.frame(a = c(1:10), b = c("a", "a", "b", "c", "c", "b", "a", "c", "c", "b")) testF = function(select) { dum = subset(df, b…
user3122822
  • 127
  • 1
  • 2
  • 8
6
votes
2 answers

Two-dimensional list wrongly assigning values in python

class Board: def __init__(self): self.board = self.createBoard() def createBoard(self): line = [] for i in range(7): line.append(' ') board = [] for i in range(7): …
Azeirah
  • 6,176
  • 6
  • 25
  • 44
6
votes
1 answer

C++ streamsize prec = cout.precision(3) - How does it work?

I am kind of newbie in using c++. I have a quick question, probably a dumb question. streamsize prec = cout.precision(3); As I understand correctly this declaration works like that: set the cout precision to 3, but assign the previous precision…
user2371160
  • 107
  • 1
  • 6
6
votes
2 answers

How to use `assign()` or `get()` on specific named column of a dataframe?

Is there a way to assign a value to a specific column within a data frame? e.g., dat2 = data.frame(c1 = 101:149, VAR1 = 151:200) j = "dat2[,"VAR1"]" ## or, j = "dat2[,2]" assign(j,1:50) The approach above doesn't work. Neither does this: j =…
baha-kev
  • 3,029
  • 9
  • 33
  • 31
6
votes
2 answers

Succinctly assign names and values simultaneously

I find myself often writing the following two lines. Is there a succinct alternative? newObj <- vals names(newObj) <- nams # This works, but is ugly and not necessarily preferred 'names<-'(newObj <- vals, nams) I'm looking for something…
Ricardo Saporta
  • 54,400
  • 17
  • 144
  • 178
5
votes
1 answer

Assigning to map in golang

In the following go snippet, what am I doing wrong? type Element interface{} func buncode(in *os.File) (e Element) { e = make(map[string]interface{}) for { var k string = buncode(in).(string) v := buncode(in) …
Matt Joiner
  • 112,946
  • 110
  • 377
  • 526