similar to: Proper use of grep

Displaying 20 results from an estimated 800 matches similar to: "Proper use of grep"

2023 Aug 13
4
Noisy objective functions
While working on 'random walk' applications, I got interested in optimizing noisy objective functions. As an (artificial) example, the following is the Rosenbrock function, where Gaussian noise of standard deviation `sd = 0.01` is added to the function value. fn <- function(x) (1+rnorm(1, sd=0.01)) * adagio::fnRosenbrock(x) To smooth out the noise, define another
2006 May 09
3
remove Punctuation characters
Hi, I want to remove all punctuation characters in a string. I was trying it use a regular expressions but it doesn't work. Here is a sample os what i want: str <- 'ABD - remove de punct, and dot characters.' str <- gsub('[:punct:]','',str) str "'ABD remove de punct and dot characters" is there any function that do this kind of thing? Thanks to
2005 Nov 09
2
Sort a dataframe
Dear All, How can I sort a data frame (using one of the column)? Thanks for your support. Regards. Abd. Rahman Kassim (PhD) Head Forest Ecology Branch Forest Management & Ecology Program Forestry and Conservation Division Forest Research Institute Malaysia Kepong 52109 Selangor, Malaysia ***************************************** Checked by TrendMicro Interscan Messaging Security. For any
2005 Nov 10
2
polynomials transformation
Dear All, Need some help in polynomials transformation to get the coefficients. I have tried "poly.transform" as applied in S-plus but it does not work. Thanks in advanced for any helps. Regards. Abd. Rahman Kassim (PhD) Head Forest Ecology Branch Forest Management & Ecology Program Forestry and Conservation Division Forest Research Institute Malaysia Kepong 52109 Selangor,
2006 Jan 19
2
Legend Outside Plot Dimension
Dear All, I'm trying to attach a legend outside the plot (Inside plot OK), but failed. Any help is very much appreciated. Thanks. Abd. Rahman Kassim, PhD Forest Management & Ecology Program Forestry & Conservation Division Forest Research Institute Malaysia Kepong 52109 Selangor MALAYSIA ***************************************** Checked by TrendMicro Interscan Messaging Security.
2015 Jun 16
4
Ayuda boxplot ggplot2
Hola a todos Me gustaría saber si me pueden ayudar con lo siguiente. Realicé un Boxplot usando ggplot2 para visualizar el comportamiento de dos variables. Visualmente no se notan las diferencias porque la gráfica de la derecha (parásitos en el abdomen) llega hasta 20 en el eje y. ¿Cómo puedo hacer para que las dos gráficas muestren la misma escala en el eje Y, es decir, que las dos lleguen a 60?
2010 Aug 04
6
applying strsplit to a whole column
I am sorry, I'd like to split my column ("names") such that all the beginning of a string ("X..") is gone and only the rest of the text is left. x<-data.frame(names=c("X..aba","X..abb","X..abc","X..abd")) x$names<-as.character(x$names) (x) str(x) Can't figure out how to apply strsplit in this situation - without using a
2003 Jul 17
3
how to divide a string into characters? - for comparing strings that is
Hi I am searching for a way to do something like "ABC" -> c("A","B","C"). How can this be accomplished? I tried cut() and split(), but they do something else, it seems. The purpose for doing this is to find the number of common (and uncommon) characters, i.e. ultimately I want something like this: > foo("ABD","ADE") c(2,1) # 2
2006 Feb 13
2
Plotting contour & filled.contour in one graph
Dear All, I have a question on overlaying a filled.contour (e.g. on soil properties data) and contour (by elevation) in one graph. Both have the same z matrix dimension. I'm able to overlay both graph, but the plots dimension did not overlap well on the same plots. How can I have both filled.contour and contour on the same graph? The commands that I have written are as follows:
2006 Mar 29
2
write.table command
Dear All, I'm trying to save a dataframe using write.table command. It works, but when I retrieved, there's an error message as shown below: > write.table(soil.dat,file="C:/soil.rdata") > load("C:/soil.rdata") Error: bad restore file magic number (file may be corrupted)-- no data loaded I can figure out the error message. Any assistance to solve the
2007 Sep 06
3
WINE
I have downloaded Ububtu abd used Add/Remove to install Wine. I can not get it to work. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.winehq.org/pipermail/wine-users/attachments/20070906/86803328/attachment.htm
2011 Apr 02
3
Plotting MDS (multidimensional scaling)
Hi, I just encountered what I thought was strange behavior in MDS. However, it turned out that the mistake was mine. The lesson learned from my mistake is that one should plot on a square pane when plotting results of an MDS. Not doing so can be very misleading. Follow the example of an equilateral triangle below to see what I mean. I hope this helps others to avoid this kind of headache.
2016 Apr 26
0
Antwort: Fw: Re: Creating variables on the fly (SOLVED)
Hi Don, Hi to all readers, many thanks for all your answers and all your help. I adapted Don's code to my data and Don's code does the trick: str(Kunden01) for (year in 2011:2015) { Reeller_Kunde <- paste0("Reeller_Kunde_", year) Umsatz <- paste0("Umsatz_", year) cat('Creating', Reeller_Kunde,'from', Umsatz,'\n') Kunden01[[
2009 Mar 11
1
matrix multiplication, tensor product, block-diagonal and fast computation
Dear R-users, I am searching to the "best" way to compute a series of n matrix multiplications between each matrix (mXm) in an array (mXmXn), and each column of a matrix (mXn). Please find below an example with four possible solutions. The first is a simple for-loop which one might avoid; the second solution employs the tensor product but then manually selects the right outcomes. The
2010 Aug 05
2
try-error within for loop
Dear all, I run a loop wrapped in try(), and for each of the rows where "try-error" is true I want to fill that row with NA (at the moment it is omitted). So I would expect to get a dataframe with 1000 rows some of which would be empty, but instead I get a dataframe with 995 rows. In this case missing 5 rows were omitted. Any suggestions? Thanks, Olga ----------------
2006 Mar 17
1
Adding axis limit to log-log plot
Dear All, I've tried to add axis limit ( e.g. ylim=c(0,50)) to the log-log plot, but it turn out to be error (see below). Any solution is much appreciated. > plot(maxsd$tph,maxsd$qdbh,log="xy",xlab="Stand density(trees per ha)",ylab="Quadratic mean dbh (cm)",ylim=c(0,50)) Error in plot.window(xlim, ylim, log, asp, ...) : Infinite axis extents
2013 Nov 18
3
Sending a matrix in an email
I have a matrix which has colnames and I would like to send this matrix using sendmailR. How can I convert this simple matrix to a format which can be used as the body variable in sendmailR? I see how I can create a file attachment using mime_part but I would like to send the matrix in the body of the email. The matrix looks like: ABD DEF GHI JKL MNO TOT [1,] 0.44 0.81 1.67 0.37
2016 Apr 22
4
Creating variables on the fly
Hi all, I would like to use a loop for tasks that occurs repeatedly: # Groups # Umsatz <= 0: 1 (NICHT kaufend) # Umsatz > 0: 2 (kaufend) for (year in c("2011", "2012", "2013", "2014", "2015")) { paste0("Kunden$Kunde_real_", year) <- (paste0("Kunden$Umsatz_", year) <= 0) * 1 +
2007 Jul 27
4
Looping through all possible combinations of cases
Hello! I have a regular data frame (DATA) with 10 people and 1 column ('variable'). Its cases are people with names ('a', 'b', 'c', 'd', 'e', 'f', etc.). I would like to write a function that would sum up the values on 'variable' of all possible combinations of people, i.e. 1. I would like to write a loop - in such a way that it
2012 Apr 07
4
Display instruction text on package load
I'm currently working on a new package for R that interfaces with an API. Most of the package's functionality requires users to supply an access key that allows the package to work with the API. I want to display text immediately upon loading the package that instructs/reminds users to enter their access key before attempting to do anything (as the package won't really work without