arguments

R- pass argument to ggplot in function

两盒软妹~` 提交于 2021-01-28 14:23:05
问题 I have a question about how to pass an argument to ggplot if I want to have a 1-x x-axis. The function is being used to specify column name in my data frame. Let's say my data frame looks like x1 x2 x3 x4 0.1 0.2 0.3 0.4 0.3 0.5 0.7 0.9 0.4 0.6 0.8 0.2 And I have a function myfunction<- function(x, y, convert = False){ if (flip) { ggplot(data = mydata, aes(x=1-get(x), y=get(y))) + geom_line() + xlab(x) + ylab(y) } else { ggplot(data = mydata, aes(x=get(x), y=get(y))) + geom_line() + xlab(x) +

xargs pass multiple arguments to perl subroutine?

醉酒当歌 提交于 2021-01-28 13:55:06
问题 I know how to pipe multiple arguments with xargs: echo a b | xargs -l bash -c '1:$0 2:$1' and I know how to pass the array of arguments to my perl module's subroutine from xargs: echo a b | xargs --replace={} perl -I/home/me/module.pm -Mme -e 'me::someSub("{}")' But I can't seem to get multiple individual arguments passed to perl using those dollar references (to satisfy the me::someSub signature): echo a b | xargs -l perl -e 'print("$0 $1")' Just prints: -e So how do I get the shell

Calling vba function(with parameters) from vbscript and show the result

巧了我就是萌 提交于 2021-01-28 13:00:32
问题 I have the following vba function ( in a module in Excel file) Public Function validate_fncname(strFncname As String) As Boolean . . . validate_fncname = True End Function and I wrote the following vbscript to call it : Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open("C:\Users\uidu8611\Desktop\CAM0500040F10_SW_Quality_Assurance_Report_Template(new_version).xlsm") objExcel.Application.Visible = True Dim str str ="hello" Dim validate_fncname validate

Passing a string as an argument to a python script

喜欢而已 提交于 2021-01-28 08:00:22
问题 I want to pass a string of ZPL codes from one python script to another python script. The string becomes malformed when used in the second script. How can I pass a string literal as an argument to another python script without it being malformed? Original String ^XA^FO20,20^BQ,2,3^FDQA,001D4B02107A;1001000;49681207^FS^FO50,50^ADN,36,20^FDMAC: 001D4B02107A^FS^FO50,150^ADN,36,20^FDSN: 1001000^FS^FO50,250^ADN,36,20^FDCode: 49681207^FS^XZ Malformed string XAFO20,20BQ,2,3FDQA,001D4B02107A;1001000

Python argparse requiring option, depending on the defined flags

…衆ロ難τιáo~ 提交于 2021-01-28 04:21:19
问题 I have a small python script, which uses argparse to let the user define options. It uses two flags for different modes and an argument to let the user define a file. See the simplified example below: #!/usr/bin/python3 import argparse from shutil import copyfile def check_file(f): # Mock function: checks if file exists, else "argparse.ArgumentTypeError("file not found")" return f def main(): aFile = "/tmp/afile.txt" parser = argparse.ArgumentParser(description="An example",formatter_class

Function Pointer Error in C++

∥☆過路亽.° 提交于 2021-01-28 04:17:45
问题 Here is the error I am getting: error: no matching function for call to ‘pcl::ConditionalEuclideanClustering <pcl::Normal>::setConditionFunction(bool (EuclideanPlaneSegmentation::*)(const pcl::Normal&, const pcl::Normal&, float))’ cec.setConditionFunction(&EuclideanPlaneSegmentation::customRegionGrowing; ^ note: candidate is:/segmentation/conditional_euclidean_clustering.h:125:7: note: void pcl::ConditionalEuclideanClustering <PointT>::setConditionFunction(bool (*)(const PointT&, const PointT

Julia scoping: why does this function modify a global variable?

独自空忆成欢 提交于 2021-01-28 02:32:20
问题 I'm a relative newcomer to Julia, and so far I am a fan of it. But coming from years of R programming, some scoping rules leave me perplexed. Let's take this function. This behaves exactly as I would expect. function foo1(x) y = x t = 1 while t < 1000 t += 1 y += 1 end return 42 end var = 0; foo1(var) # 42 var # 0 But when doing something similar on an array, it acts as a mutating function (modifies it argument in the global scope!) function foo2(x) y = x t = 1 while t < 1000 t += 1 y[1] += 1

In Swift, how do I explicitly specify a return value for map with anonymous closure arguments?

非 Y 不嫁゛ 提交于 2021-01-28 02:31:40
问题 Say I call map like this, using the anonymous closure argument $0 : array.map { return $0.description } How would I explicitly define that map returns a string ? This doesn’t work: array.map { -> String return $0.description } Contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored Does that mean if I want to specify a return value I have to name my arguments? [EDIT: I know I do not need an explicit return type here; still would like how to specify one

Julia scoping: why does this function modify a global variable?

随声附和 提交于 2021-01-27 22:51:45
问题 I'm a relative newcomer to Julia, and so far I am a fan of it. But coming from years of R programming, some scoping rules leave me perplexed. Let's take this function. This behaves exactly as I would expect. function foo1(x) y = x t = 1 while t < 1000 t += 1 y += 1 end return 42 end var = 0; foo1(var) # 42 var # 0 But when doing something similar on an array, it acts as a mutating function (modifies it argument in the global scope!) function foo2(x) y = x t = 1 while t < 1000 t += 1 y[1] += 1

Validate vbScript argument names

 ̄綄美尐妖づ 提交于 2021-01-27 18:43:49
问题 I am calling a vbScript from PowerShell, with arguments that are defined in a text string, and I want to validate that the arguments being used are correct. Say my valid arguments are ARG1 , ARG2 & ARG3 , and someone has a string of "/ARGG1:one /ARG2:two" , I want to validate the named arguments against an array of valid arguments and catch that ARGG1 . Where I am failing is in getting the names of the named arguments. I can reference a particular named argument with WScript.Arguments.Named(