Displaying 20 results from an estimated 300 matches similar to: "function similar to str_replace() in php."
2008 Jan 07
1
help.search and indexing
Dear expeRt,
I occasionally use help.search() function to find appropriate
functions in R.
Whenever committing help.search() after rerunning R, it takes so much
time to find help (around 2 minutes).
Is there any way to make it faster in help.search()?
I think indexing help database is one of the solution, but i don't
know how to do.
Best,
Dong-hyun Oh
2008 Jul 01
4
Find classes of each column of data.frame()
Dear UseRs,
I would like to know the way to find classes of each column of
data.frame().
Thank you in advance.
=========================================================
Dong-hyun Oh
Center of Excellence for Science and Innovation Studies
Royal Institute or Technology, Sweden
e-mail: oh.dongh at gmail.com
cel: +46 73 563 45 22
2008 Jun 26
2
create new column with colnames resulting from paste()
Dear UseRs,
I would like to know the way to create a new column by naming it
simultaneously.
For example, in for() loop I want to create columns named as
paste("test", i, sep = ""), as shown below.
----------------------------
dt <- data.frame(a = c(1, 2, 3), b = c(3, 2, 2), c = c(1, 3, 5))
for(i in 1:2){
dt$as.name(paste("test", i, sep = ""))
2008 Aug 22
2
Deleting NA in list()
Dear useRs,
I would like to know the way of deleting NA in list().
Following is a example.
lt <- list(a = 1:3, b = NA, c = letters[1:3], d = NA)
for(i in length(lt):1) {
if(is.na(lt[[i]])) lt[[i]] <- NULL
}
How to simplify for() loop by using (l)apply family?
Thank you in advance.
=========================================================
Dong-hyun Oh
Center of Excellence for
2003 Nov 27
1
cclust - cindex - binary data
Hi,
I'm trying to debug a function I wrote to calculate the cindex for a
hierarchical tree.
For this it is useful to compare my calculations with those in output from
the clustindex function, in the cclust library.
There's no way, however, to have the cindex value for a given output of the
cclust function, as a NA value is always returned.
This happens almost surely because the cindex in
2007 Apr 16
2
Simplify simple code
Dear expeRts,
I would simplify following code.
---------------------------------------------
youtput <- function(x1, x2){
n <- length(x1)
y <- vector(mode="numeric", length=n)
for(i in 1:n){
if(x1[i] >=5 & x1[i] <= 10 & x2[i] >=5 & x2[i] <=10)
y[i] <- 0.631 * x1[i]^0.55 * x2[i]^0.65
if(x1[i] >=10 & x1[i] <= 15 &
2006 Jun 22
2
str_replace PHP Function Equiv.
I''ve been searching for ages and not come up with anything on the
internet. I was wondering if there is a Rails equiv. for the PHP
function str_replace. For example;
variable_for_new_string("value_to_repace", "string_to_replace_with",
"string_to_perform_modification_to")
Thanks in advance for any help.
--
Posted via http://www.ruby-forum.com/.
2023 Mar 13
1
str_replace por orden de aparición en una cadena.
Hola,
Tengo una variable string que tiene muchos casos, pero necesito en cada uno
de ellos reemplazar el último "==" por "=".
asi está asi necesito
si p1 == 1 o 2 == 1,3 si p1 == 1 o 2 = 1,3
si p1 == 3 o 4 == 1 si p1 == 3 o 4 = 1
si p1 == 5 == 0,7 si p1 == 5 = 0,7
si p1 == 5 = 0,7 si p1 == 5 = 0,7
si p1 == 6 == 0 si p1 == 6 = 0
si p1 == 7 == no aplica si p1 == 7 = no aplica
2023 Mar 13
1
str_replace por orden de aparición en una cadena.
Mientras aparezca alguien que sepa guiarte bien, te muestro desde mi
autodidactez por dónde encararía. Y lo que para mí fue un gran
descubirmiento: El paquete RegExplain,
[image: irudia.png]
(==)([\d, \w]*=[\d, \w]*)$
Eso captura en dos grupos diferentes todo lo que está desde el final hasta
el primer igual, más todo lo que sigue hasta en igual doble, que lo excluye
y lo captura como otro grupo.
2023 Mar 20
0
str_replace por orden de aparición en una cadena.
muchas gracias!!
El mié, 15 mar 2023 a las 6:12, Carlos Ortega (<cof en qualityexcellence.es>)
escribió:
> Hola,
>
> Juntandolo todo se puede hacer así...
>
> #-----------------------------
> cadena <- c(
> 'si p1 == 1 o 2 == 1,3 si p1 == 1 o 2 = 1,3',
> 'si p1 == 3 o 4 == 1 si p1 == 3 o 4 = 1',
> 'si p1 == 5 == 0,7 si p1 == 5 =
2023 Mar 13
1
str_replace por orden de aparición en una cadena.
hola ,muchas gracias!
no conocía esa librería para los regex...respecto a la pregunta de Carlos,
puedo tener más de un == dentro de la cadena, por ejemplo así:
así está
si p1 == 1 o 2 o p2 == 1 == 1,3
así necesito
si p1 == 1 o 2 o p2 == 1 = 1,3
El lun, 13 mar 2023 a las 18:11, Juan Abasolo (<juan.abasolo en ehu.eus>)
escribió:
> Mientras aparezca alguien que sepa guiarte bien, te
2023 Mar 14
1
str_replace por orden de aparición en una cadena.
Buenas,
Una opción es partir la cadena usando el == como separador y luego recomponerla.
> a <- "p1 == 1 o 2 o p2 == 1 == 1,3"
> b <- strsplit(a, "==")
> b <- b[[1]]
> b
[1] "p1 " " 1 o 2 o p2 " " 1 " " 1,3"
> paste0(paste0(b[1:(length(b)-1)], collapse = '=='), '=', b[length(b)])
[1] "p1 ==
2023 Mar 14
1
str_replace por orden de aparición en una cadena.
Muchas gracias!! Lo pruebo!!!
El mar., 14 de marzo de 2023 04:55, Proyecto R-UCA <r-uca en uca.es> escribió:
> Buenas,
>
> Una opción es partir la cadena usando el == como separador y luego
> recomponerla.
>
> > a <- "p1 == 1 o 2 o p2 == 1 == 1,3"
> > b <- strsplit(a, "==")
> > b <- b[[1]]
> > b
> [1] "p1 "
2023 Mar 14
1
str_replace por orden de aparición en una cadena.
hola! ,me sirve, pero el tema es que necesito crear tres variables nuevas
con el resultado de strsplit....pero me genera una lista y no lo estoy
pudiendo combinar con mutate de dplyr....
El mar, 14 mar 2023 a las 7:46, juan manuel dias (<juamadias en gmail.com>)
escribió:
> Muchas gracias!! Lo pruebo!!!
>
> El mar., 14 de marzo de 2023 04:55, Proyecto R-UCA <r-uca en uca.es>
2004 Feb 02
2
ordering in dotplot
Dear R-friends,
the dataset I am using (data.it) is organized as follows
partner stp btp reg
hk 0.64 1 s
ger 0.27 1 d
tur 0.27 1 s
rom 0.24 1 s-f
por 0.24 1 s
spa 0.23 1 s
gre 0.22 1 d-f
aus 0.17 1 d
uk 0.16 1 s
be 0.16 1 d
arg 0.15 1 s
usa 0.13 1 d-f
fra 0.13 1 s
neth
2006 Nov 08
5
query in R
how to realize the following SQL command in R?
select distinct A, B, count(C)
from TABLE
group by A, B
;
quit;
Best Regards
---------------------------------
Sponsored Link
Get a free Motorola Razr! Today Only! Choose Cingular, Sprint, Verizon, Alltel, or T-Mobile.
[[alternative HTML version deleted]]
2008 Jun 13
0
restricted coefficient and factor for linear regression.
Hi,
my data set is data.frame(id, yr, y, l, e, k).
I would like to estimate Lee and Schmidts (1993, OUP) model in R.
My colleague wrote SAS code as follows:
** procedures for creating dummy variables are omitted **
** di# and dt# are dummy variables for industry and time **
data a2; merge a1 a2 a; by id yr;
proc sysnlin maxit=100 outest=beta2;
endogenous y;
exogenous l e k
2008 Jun 14
1
restricted coefficient and factor in linear regression.
Hi,
my data set is data.frame(id, yr, y, l, e, k).
I would like to estimate Lee and Schmidts (1993, OUP) model in R.
My colleague wrote SAS code as follows:
** procedures for creating dummy variables are omitted **
** di# and dt# are dummy variables for industry and time **
data a2; merge a1 a2 a; by id yr;
proc sysnlin maxit=100 outest=beta2;
endogenous y;
exogenous l e k
2010 Mar 30
1
R package checking error.
Dear useRs,
I am trying to build my package (nonpareff) which deals with some models of
data envelopment analysis.
The building worked well, but checking complains when it tests examples.
Zipped nonparaeff.Rcheck is attached.
Following is the log.
---------------------------------------------
arecibo:tmp arecibo$ R CMD build nonparaeff/
* checking for file 'nonparaeff/DESCRIPTION' ...
2010 Mar 30
1
Error when checking a package.
Dear useRs,
I am trying to build my package (nonpareff) which deals with some models of
data envelopment analysis.
The building worked well, but checking complains when it tests examples.
Zipped nonparaeff.Rcheck is attached.
Following is the log.
---------------------------------------------
arecibo:tmp arecibo$ R CMD build nonparaeff/
* checking for file 'nonparaeff/DESCRIPTION' ...