names

Shiny R using input-variables for dynamic dplyr creation of dataTables

谁都会走 提交于 2021-02-08 09:55:53
问题 Target: Building a shiny-app which enables the user to make 3 inputs via Groupcheckboxfields: Groupingvariables Metricvariables Statistics which are used in dplyr look at this code first - it is executed without shiny and displays the to be achived results: library("plyr") library("dplyr") ## Without shiny - it works! groupss <- c("gear", "carb") statistics <- c("min", "max", "mean") metrics <- c("drat", "hp") grp_cols <- names(mtcars[colnames(mtcars) %in% groupss]) dots <- lapply(grp_cols,

Shiny R using input-variables for dynamic dplyr creation of dataTables

不打扰是莪最后的温柔 提交于 2021-02-08 09:55:52
问题 Target: Building a shiny-app which enables the user to make 3 inputs via Groupcheckboxfields: Groupingvariables Metricvariables Statistics which are used in dplyr look at this code first - it is executed without shiny and displays the to be achived results: library("plyr") library("dplyr") ## Without shiny - it works! groupss <- c("gear", "carb") statistics <- c("min", "max", "mean") metrics <- c("drat", "hp") grp_cols <- names(mtcars[colnames(mtcars) %in% groupss]) dots <- lapply(grp_cols,

How to store a set of functions into a Fortran array

↘锁芯ラ 提交于 2021-02-04 21:44:34
问题 As we know that function name can be treated as parameters to pass in/out by other subroutines. I wonder if we have any tricks to save a list of functions into an array, which would be passed in and out for process. !-------for example. At somewhere we set any array type(Idonotknow)::Farray(N) Then set the value: Farray(1)%any=>fun1 Farray(2)%any=>fun2 ... Farray(N)%any=>funN where fun1,fun2...funN are something like Function fun1(input) implicit none statements End Function Finally we can

How to names lists under list when using lapply?

故事扮演 提交于 2021-01-27 21:57:42
问题 I have a two nested loop which I want to do it with lapply instead of for loops. I have made up the following simple example: a<-as.list(c(1,2)) b<-as.list(c(6,7)) results<-lapply(a, function(x) lapply(b, function(y) x+y)) > results [[1]] [[1]][[1]] [1] 7 [[1]][[2]] [1] 8 [[2]] [[2]][[1]] [1] 8 [[2]][[2]] [1] 9 how can I assign names to this list, I can assign names to the first level using names(result)<-a, but I do not know how to do it for the second level. And naming should be done in

Why are names(x)<-y and “names<-”(x,y) not equivalent?

有些话、适合烂在心里 提交于 2021-01-27 21:30:00
问题 Consider the following: y<-c("A","B","C") x<-z<-c(1,2,3) names(x)<-y "names<-"(z,y) If you run this code, you will discover that names(x)<-y is not identical to "names<-"(z,y) . In particular, one sees that names(x)<-y actually changes the names of x whereas "names<-"(z,y) returns z with its names changed. Why is this? I was under the impression that the difference between writing a function normally and writing it as an infix operator was only one of syntax, rather than something that

Why is the code “foo::foo::foo::foob” compiling? [duplicate]

谁都会走 提交于 2020-02-01 00:42:16
问题 This question already has an answer here : Why is there an injected class name? (1 answer) Closed 2 years ago . A co-worker accidentally wrote code like this: struct foo { foo() : baz(foobar) {} enum bar {foobar, fbar, foob}; bar baz; }; void f() { for( auto x : { foo::foobar, foo::fbar, foo:: foo:: foo::foob } ); // ... } GCC 5.1.0 compiles this. What's the rule that makes this compile? 回答1: The injected-class-name is used here, the name of the class within its own definition acts as a

Different parameter name in function prototype

为君一笑 提交于 2020-01-30 04:58:15
问题 I found a program which uses different parameters in function prototyping and declaring, so I made a basic program. #include <iostream> using namespace std; void add(int a, int b); int main() { add(3,4); } void add(int c, int d){ int e = c + d; cout << e << endl; } I run this program and it works. Does that mean it isn't necessary to same parameter name in both "function prototyping" and in "function declaring"? 回答1: Yes, the name of parameters used in declaration and definition doesn't have

Does .NET web service client support SSL cert with IP in Alternate Subject Name

≯℡__Kan透↙ 提交于 2020-01-25 19:14:05
问题 I have an application where many of our endpoints do not support DNS lookups so for those endpoints they cannot use a URL to hit our servers. Our application gives out a list of IPs of our servers they need to hit and this works fine for http. I am trying to enable use of https to hit our servers and I have created a SAN cert with some urls as Subject Alternative Names plus the IPs of our servers as Subject Alternative names. For example in the openssl.cnf I used to create the CSR I have: DNS

R: How to get a dataset with blanks in its name

跟風遠走 提交于 2020-01-25 11:52:07
问题 How can one get an R dataset with blanks in its name, such as 'BJsales.lead (BJsales)' in package "datasets" ? pkg = "datasets" cat( "Summary of all the datasets in package", pkg, "--\n" ) d = data( package=pkg ) $results # "Package" "LibPath" "Item" "Title" names = d[ , "Item" ] titles = d[ , "Title" ] # sum( duplicated( names )) ?? for( j in 1:len(names) ){ name = names[[j]] cat( name, ":\n" ) data( list=name ) x = get( name ) # <-- Error if blank in name m = paste( dim( as.matrix( x )),

refer to range of columns by name in R

前提是你 提交于 2020-01-21 03:35:26
问题 I need help with something that might be fairly simple in R. I want to refer to a range of columns in a data frame (e.g., extracting a few select variables). However, I don't know their column numbers. Normally, if I wanted to extract columns 4-10 i would say mydata[,4:10]. However, given that I don't know the column numbers, I would want to refer to them by name. Is there an easy way to do this? in sas or spss it is fairly easy to refer to a range of variables by name. Alternatively, is