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
9
votes
2 answers

Assign op in TensorFlow: what is the return value?

I was trying to build an autoincrementing graph in TensorFlow. I thought that the assign op might be suitable for that, but found no documentation for it. I assumed that this op returns its value—like in C-like languages—and wrote the following…
Dims
  • 47,675
  • 117
  • 331
  • 600
9
votes
3 answers

Assign 0 to certain words when the words are not present

This is my first ever post on stackoverflow and am I am total fresher to coding. So, please bear with me. I am working on an experiment which has two sets of data documents. Doc1 is as follows: TOPIC:topic_0 5892.0 site 0.0371690427699 Internet…
Ana_Sam
  • 469
  • 2
  • 4
  • 12
9
votes
4 answers

Excel VBA set multiple cells to the same value

I want to set every eighth cell on one worksheet to the value of a cell in another worksheet. I wrote this here: Sub xx() For i = 5 To 45 Step 8 Set ThisWorkbook.Sheets("Sheet5").Cells(i, 3).Value =…
Prot
  • 99
  • 1
  • 1
  • 6
8
votes
4 answers

Assigning Values to JSON Objects in Javascript

This is what I'm trying to build via JavaScript in dot or [ ] notation: var shoppingCart = { 'item1' : { 'description' : 'This is item #1', 'price' : 10, 'quantity' : 1, 'shipping' : 0, …
phpKid
  • 333
  • 1
  • 4
  • 14
8
votes
2 answers

Use function argument as name for new data frame in R

this is very simple, but I have searched and failed to find a solution for this small problem. I want to use the argument of a function as the name for a new data frame, for example: assign.dataset<-function(dataname){ x<-c(1,2,3) …
AP30
  • 505
  • 7
  • 18
8
votes
1 answer

C++ How to assign ifstream content (from file) to string with offset (istreambuf_iterator)

i try to read parts of a binary file content into a string. Why a string? I need this for my message protocol (with protobuf). The following works very well: std::string* data = new std::string(); std::ifstream ifs("C:\\data.bin",…
8
votes
1 answer

R- assign inside a function

I need to create a data frame from a function entering another data frame name and reshaping the data. The issue comes when I need to named the output after a transformation of the input table name. My code so far…
GabyLP
  • 3,649
  • 7
  • 45
  • 66
7
votes
2 answers

Difference between assign( ... , envir = ... ) and environment( ... ) =

What is the difference between assigning a value to a name in an environment and setting the environment of a variable? I couldn't figure it out from the documentation. for example: MyTestFunc = function(x) { myVal = "abcde" # what is this…
Suraj
  • 35,905
  • 47
  • 139
  • 250
7
votes
4 answers

Object.assign() creates wierd properties when assigns mongoose doc

MessageThread.findById(req.body._id) .populate({ path: "messages" }) .exec((err, foundMessageThread) => { var filtered = foundMessageThread.messages.map(message=>{ return Object.assign({}, message, {isRead: true}); …
m_rd_n
  • 175
  • 2
  • 11
7
votes
1 answer

How to get the result if forgot to name a function or object

I have a very big function which takes hours to give me the result. I forgot to name it. Is there any way that I can show the result of my function? Thanks in advance.
user8389133
7
votes
5 answers

"Protect" text box value from input (HTML form)

I was wondering whether it is possible to assign a value to an HTML text box and protect it. What I mean is make it´s content unmodifiable, so that when the form gets submitted im "sure" it was this value which was submitted. BTW I realize the…
Trufa
  • 39,971
  • 43
  • 126
  • 190
7
votes
1 answer

Is it possible to use the data.table index-join-assignment idiom to do a left join and assign NAs in the non-matching rows of i to x?

Yesterday I gave this answer: Matching Data Tables by five columns to change a value in another column. In the comments, the OP asked if we could effectively achieve a left join of the two tables and thereby get the NAs that would result in the…
bgoldst
  • 34,190
  • 6
  • 38
  • 64
7
votes
2 answers

Copying properties from one object to another with a condition

Lazy-me is wondering if there a better way to copy the properties in one object (source) over to another object (destination) only if the properties exist in the latter? It does not necessarily have to be using Underscore. For example, _.mixin({ …
Mikey
  • 6,728
  • 4
  • 22
  • 45
7
votes
3 answers

Does "<-" mean assigning a variable in Haskell?

Just started Haskell, it's said that everything in Haskell is "immutable" except IO package. So when I bind a name to something, it's always something immutable? Question, like below: Prelude> let removeLower x=[c|c<-x, c `elem` ['A'..'Z']] Prelude>…
vik santata
  • 2,989
  • 8
  • 30
  • 52
7
votes
1 answer

Assign value to the same field of every element of non-scalar struct

In Matlab, assigning cell arrays to a struct arrays field foo is possible with my_array(1000).foo = []; [my_array.foo] = some_cell{:}; Now what I would like to do is assign a single value to all fields in the array. But whatever I tried, Matlab…
quazgar
  • 4,304
  • 2
  • 29
  • 41