similar to: grep

Displaying 20 results from an estimated 500 matches similar to: "grep"

2024 Jul 14
0
grep
Yes. Any of the following worked. The pipe greater than (|>) is neat! Thanks. > v<-goprobit.p$est > names(v) |> grep("somewhat|very", x = _) ?[1]? 6? 7? 8? 9 10 11 12 13 28 29 30 31 32 33 34 35 50 51 52 53 54 55 56 57 > v |> names() |> grep("somewhat|very", x = _) ?[1]? 6? 7? 8? 9 10 11 12 13 28 29 30 31 32 33 34 35 50 51 52 53 54 55 56 57 >
2024 Jul 12
0
grep
Now I've found another way to make it work. All I need is to pick up the names in the column (x.1.age...). > v<-pr(goprobit.p); v Maximum-Likelihood Estimates weighted = FALSE iterations = 5 logLik = -14160.75 finalHessian = TRUE Covariance matrix is Robust Number of parameters = 66 Sample size = 17922 est se t p g sig x.1.age 0.0341 0.0138 2.4766 0.0133 -3.8835e-04 ** x.1.sleep
2024 Jul 12
1
grep
Could not get "which" to work, but my grep worked. Thanks. > which(grep("very|somewhat",names(goprobit.p$est))) Error in which(grep("very|somewhat", names(goprobit.p$est))) : argument to 'which' is not logical > grep("very|somewhat",names(goprobit.p$est)) [1] 6 7 8 9 10 11 12 13 28 29 30 31 32 33 34 35 50 51 52 53 54 55 56 57 On 7/12/2024
2023 Feb 12
2
Removing variables from data frame with a wile card
x["V2"] is more efficient than using drop=FALSE, and perfectly normal syntax (data frames are lists of columns). I would ignore the naysayers, or put a comment in if you want to accelerate their uptake. As I understand it, one of the main reasons tibbles exist is because of drop=TRUE. List-slice (single-dimension) indexing works equally well with both standard and tibble types of data
2023 Nov 03
1
[EXTERNAL] RE: I need to create new variables based on two numeric variables and one dichotomize conditional category variables.
Yes, that will halve the number of multiplications. If you?re looking for such optimisations then you can also consider ifelse(G=='male', 65L, 58L). That will definitely use less time & memory if WC is integer, but the trade-offs are more complicated if WC is floating point. Regards, Jorgen Harmse. From: avi.e.gross at gmail.com <avi.e.gross at gmail.com> Date: Friday,
2020 Oct 08
2
[External] Re: unable to access index for repository...
Hi Steven Which optimisation algorithms in maxLik work better under R-3.0.3 than under the current version of R? /Arne On Thu, 8 Oct 2020 at 21:05, Steven Yen <styen at ntu.edu.tw> wrote: > > Hmm. You raised an interesting point. Actually I am not having problems with aod per se?-it is just a supporting package I need while using old R. The essential package I need, maxLik, simply
2006 Nov 16
1
[3.0.23d] winbind: ads_connect for domain X failed: Operations error
SAMBA 3.0.23d (netbios name is PDC01, domain is LINBOXTEST) Windows 2000 server SP4 in mixed mode (netbios name is MAFIA-L6FFST3UP, domain is ADTEST / adtest.linbox.com) Hello, So I've successfully established a two ways interdomain trust relationship between a SAMBA PDC and a Windows domain. It was working fine: for example a windows user was able to connect on a share on the SAMBA server.
2023 Aug 06
1
Stacking matrix columns
Eric, I am not sure your solution is particularly economical albeit it works for arbitrary arrays of any dimension, presumably. But it seems to involve converting a matrix to a tensor just to undo it back to a vector. Other solutions offered here, simply manipulate the dim attribute of the data structure. Of course, the OP may have uses in mind which the package might make easier. We often get
2024 Aug 09
2
If loop
OK. The fact it's in a function is making things clearer. Are you trying to update the values of an object from within the function, and have them available outside the function. I don't speak functional programming articulately enough but basically v <- 1 funA <- function() { v <- v+1 } funA() cat (v) # 1 You either return the v from the function so funB <- function() {
2017 Jun 08
1
Matrix multiplication
OK Thanks. Your response made me think. Here (the last line) is what I need: set.seed(76543211) w<-1:10; w a<-matrix(rpois(20,2),nrow=10); a t(w*a)%*%a On 6/8/2017 12:09 PM, Jeff Newmiller wrote: > Is this a question? You seem to have three possible calculations, have already implemented two of them (?) and it is unclear (to me) what you think the right answer for any of them is
2024 Apr 08
1
duplicated() on zero-column data frames returns empty
I appreciate the compliment from Ivan and still share the puzzlement at the empty return. What is the policy for changing something that is wrong? There is a trade-off between breaking old code that worked around a problem and breaking new code written by people who make reasonable assumptions. Mathematically, it seems obvious to me that duplicated.matrix(A) should do something like this: v
2024 Mar 02
1
Initializing vector and matrices
The matrix equivalent of x <- ... v <- ... x[length(x)+1] <- v is m <- ... r <- ... m <- rbind(m, r) or m <- ... k <- ... m <- cbind(m, c) A vector or matrix so constructed never has "holes" in it. It's better to think of CONSTRUCTING vectors and matrices rather than INITIALISING them, because always being fully defined is important. It
2024 Feb 29
2
Initializing vector and matrices
You could declare a matrix much larger than you intend to use. This works with a few megabytes of data. It is not very efficient, so scaling up may become a problem. m22 <- matrix(NA, 1:600000, ncol=6) It does not work to add a new column to the matrix, as in you get an error if you try m22[ , 7] but convert to data frame and add a column m23 <- data.frame(m22) m23$x7 <- 12 The only
2023 Nov 03
2
I need to create new variables based on two numeric variables and one dichotomize conditional category variables.
Just a minor point in the suggested solution: df$LAP <- with(df, ifelse(G=='male', (WC-65)*TG, (WC-58)*TG)) since WC and TG are not conditional, would this be a slight improvement? df$LAP <- with(df, TG*(WC - ifelse(G=='male', 65, 58))) -----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of Jorgen Harmse via R-help Sent: Friday,
2017 Jun 08
0
Matrix multiplication
Is this a question? You seem to have three possible calculations, have already implemented two of them (?) and it is unclear (to me) what you think the right answer for any of them is supposed to be. -- Sent from my phone. Please excuse my brevity. On June 7, 2017 8:50:55 PM PDT, Steven Yen <syen04 at gmail.com> wrote: >I need to have all elements of a matrix multiplied by a weight
2018 Mar 14
1
Documenting R package with Rd file
I have trouble documenting an R package. In my .Rd file (sixth line below), I have uhat<-m%*%y but when the package is built (successfully), the matrix multiplication part does not show up in the documentation. The line become (missing %*% y) uhat<-m === \examples{ x<-c(1,2,3,4,5) y<-c(1,1,2,2,4) x<-cbind(1,x) m<-mmat(x) uhat<-m%*%y dstat(uhat) } ?-- styen at ntu.edu.tw
2023 Aug 06
1
Stacking matrix columns
Avi, I was not trying to provide the most economical solution. I was trying to anticipate that people (either the OP or others searching for how to stack columns of a matrix) might be motivated by calculations in multilinear algebra, in which case they might be interested in the rTensor package. On Sun, Aug 6, 2023 at 6:16?PM <avi.e.gross at gmail.com> wrote: > > Eric, > > I
2024 Mar 26
1
Printout and saved results
Your desire is not unusual among novices... but it is really not a good idea for your function to be making those decisions. Look at how R does things: The lm function prints nothing... it returns an object containing the result of a linear regression. If you happen to call it directly from the R command prompt and don't assign it to a variable, then the command interpreter notices that
2023 Aug 06
2
Stacking matrix columns
You could also do dim(x) <- c(length(x), 1) On Sat, Aug 5, 2023, 20:12 Steven Yen <styen at ntu.edu.tw> wrote: > I wish to stack columns of a matrix into one column. The following > matrix command does it. Any other ways? Thanks. > > > x<-matrix(1:20,5,4) > > x > [,1] [,2] [,3] [,4] > [1,] 1 6 11 16 > [2,] 2 7 12 17 > [3,]
2023 Jan 14
1
Removing variables from data frame with a wile card
mydata[, -grep("^yr",colnames(mydata))] On Sat, Jan 14, 2023 at 8:57 AM Steven T. Yen <styen at ntu.edu.tw> wrote: > I have a data frame containing variables "yr3",...,"yr28". > > How do I remove them with a wild card----something similar to "del yr*" > in Windows/doc? Thank you. > > > colnames(mydata) > [1]