Displaying 20 results from an estimated 100 matches similar to: "How to replace match words whith colum name of data frame?"
2017 Jul 01
0
How to replace match words whith colum name of data frame?
I have two data frame. I want to use "chemical_df" to match "concept_df "
concept_df <- data.frame(concept=c("butan acid ", "nano diamond particl", "slurri
composit", "composit ph polis", " inorgan particl ", "grind liquid", "liquid formul", "nanoparticl", "size abras particl",
2017 Jul 30
0
How to replace match words whith colum name of data frame?
Try the stringr package.
This should work
chemical=c("basic", "alkalin", "alkali", "acid", " ph ", "hss")
chemical_match <- str_c(chemical, collapse = "|")
chemical_match
concept_df$match[str_detect(concept_df$concept, chemical_match)] <-
"chemical"
concept_df
> concept_df
concept match
2017 Aug 01
0
How to replace match words whith colum name of data frame?Hi--
Hi--
concept_df$NewCol <- "";
kw <- "acid|ph";
bb <- grepl(kw,concept_df$concept)
concept_df[dd,2] <- "chemical"
The is a bit late but it accomplish the same with base R.
Good luck--EK
PS.. my email doesn't accept reply
[[alternative HTML version deleted]]
2013 Jan 24
2
Question on matrix calculation
Hello again,
Ley say I have 1 matrix and 1 data frame:
> mat <- matrix(1:15, 5)
> match_df <- data.frame(Seq = 1:5, criteria = sample(letters[1:5], 5, replace = T))
> mat
[,1] [,2] [,3]
[1,] 1 6 11
[2,] 2 7 12
[3,] 3 8 13
[4,] 4 9 14
[5,] 5 10 15
> match_df
Seq criteria
1 1 c
2 2 e
3 3 c
4 4 c
5
2011 Apr 11
0
plyr: version 1.5
# plyr
plyr is a set of tools for a common set of problems: you need to
__split__ up a big data structure into homogeneous pieces, __apply__ a
function to each piece and then __combine__ all the results back
together. For example, you might want to:
* fit the same model each patient subsets of a data frame
* quickly calculate summary statistics for each group
* perform group-wise
2011 Apr 11
0
plyr: version 1.5
# plyr
plyr is a set of tools for a common set of problems: you need to
__split__ up a big data structure into homogeneous pieces, __apply__ a
function to each piece and then __combine__ all the results back
together. For example, you might want to:
* fit the same model each patient subsets of a data frame
* quickly calculate summary statistics for each group
* perform group-wise
2004 Jul 13
2
help with as.function
HI, sorry but i don't understand how to make a function with as.function()
formula<-"2+3*x"
formu<-as.symbol(formula)
> formu
2+3*x
formul<-as.function(alist(x=,formu))
curve(formul,1,5,col="blue")
Error in xy.coords(x, y, xlabel, ylabel, log) :
x and y lengths differ
> typeof(formul)
[1] "closure"
and not plot the curve function, Why?
2008 Oct 18
3
Cucumber "standard base" setup?
I''m trying to set up cucumber so we can try it in some Ruby automation
scripts I''m working on. These will be straight Ruby, for use in BBEdit
and TextMate (on the Mac).
NOT Rails.
The big early-stage stumbling block I''m having is setting up the
initial Rakefile and directory structure. I think I''m rtfm''ing, but
clearly I''m missing
2005 Nov 29
1
help combining mtext and strwrap?
Hi all,
I've got some image plots on which I'd like to include some gene information
(in the margins using mtext). Unfortunately, the description is rather long
and will need to be wrapped to fit on several lines. From what I know about
mtext, it's really only meant for single-line labels, not paragraphs.
Here's some sample code of the idea I'm trying to accomplish:
2004 Mar 08
5
Getting ACLs to work with Samba 3.0.2a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello!
I'm currently trying to get ACLs to work with my Samba-PDC. I compiled Samba
with the "--with-acl-support"-option and the configure-script says:
checking sys/acl.h usability... yes
checking sys/acl.h presence... yes
checking for sys/acl.h... yes
After install, a "ldd smbd" gives
libacl.so.1 => /lib/libacl.so.1
2005 Mar 21
3
IPSec gateway configuration
Hi,
I''m trying to build an ipsec gateway and somewhere I''m doing something
wrong.
I have a couple of routers that have clients in their back. All the
routers are connected into a switch. In that switch I also have a
computer that provides internet access to the clients.
I would like to setup some sort of autentification (don''t need
encryption), to allow me
2009 May 13
2
Optimization algorithm to be applied to S4 classes - specifically sparse matrices
Hello.
I am trying to optimize a set of parameters using /optim/ in which the
actual function to be minimized contains matrix multiplication and is of
the form:
SUM ((A%*%X - B)^2)
where A is a matrix and X and B are vectors, with X as parameter vector.
This has worked well so far. Recently, I was given a data set A of size
360440 x 1173, which could not be handled as a normal matrix. I
2008 Oct 17
1
ggplot2 scale relation free
I don't know if there is a way to use the scale relation free argument
in ggplot2 like in lattice. I have a feeling that there is not, but I
would like to make a plea for this feature. It would be nice to be
able to plot Total Inorganic Nitrogen Total Phosphorus and the ratio
of the two- the numbers on the axis are not related, but the previous
two are surely related to the last (this ratio
2002 Sep 16
0
error in htb or I don''t understand something
Hi
I''m use htb and as I think if I don''t setup default class,
all other (not classified) traffic must going throw 0 class
without any shaping
But when I try to make such config all other traffic doesn''t
transmiting.
I have some clients on vlan connected with modem (routing,
not bridging)
So modem has own addresses
I try shape clients not modems
If no default - no ping
2005 Feb 07
1
Streaming MP3 issues with Windows Media Player
Hello all,
I've set up a live mp3 stream for our non-commercial radio station,
and just recently I've received a slurry of complaints from folks
using Windows Media Player.
Most of the complaints vary, but seem to be consistent regarding long
buffer time, odd drop outs, long reconnect times, etc.
Normally, I refer folks to one of the infinitely better players out
there, but now the
2004 Oct 20
1
Drawing multiple line plots
Hi All:
Greetings, and best wishes from the festive times here at Kolkata, India -- the time of Durga Puja celebrations.
I seek your advice as I try plotting lines for my data. The problem:
I have created a dataframe that looks like this (name: myFrame):
lowest second third fourth highest significance
INAS 0.107 0.115 0.123 0.115 0.166 0.000
MMA 0.091 0.107 0.115
2020 Aug 09
3
lm() takes weights from formula environment
I know this programmers can reason this out from R's late parameter evaluation rules PLUS the explicit match.call()/eval() lm() does to work with the passed in formula and data frame. But, from a statistical user point of view this seems to be counter-productive. At best it works as if the user is passing in the name of the weights variable instead of values (I know this is the obvious
2004 May 03
1
boxplot.formula with missing values (PR#6846)
If an array has missing values in different rows, plotting using the formul=
a=20
interface can produce errors. Example:
fake.data <- matrix(rep(-100:100, 4),
ncol =3D 4)
par(mfrow =3D c(1,2))
boxplot(fake.data ~ col(fake.data))
abline(h =3D 0, lty =3D 2)
boxplot(as.data.frame(fake.data))
abline(h =3D 0, lty =3D 2)
##### Add the missing data
fake.data[190:200, 1] <-
2009 Apr 24
0
New package: CHNOSZ
Dear R users,
A new package, CHNOSZ (version 0.8), is available on CRAN.
CHNOSZ is a package for thermodynamic calculations and analysis.
Functions are available for calculating the standard Gibbs energies and
other thermodynamic properties, and chemical affinities, of reactions
between species contained in the thermodynamic database. The database
includes standard thermodynamic properties
2009 Apr 24
0
New package: CHNOSZ
Dear R users,
A new package, CHNOSZ (version 0.8), is available on CRAN.
CHNOSZ is a package for thermodynamic calculations and analysis.
Functions are available for calculating the standard Gibbs energies and
other thermodynamic properties, and chemical affinities, of reactions
between species contained in the thermodynamic database. The database
includes standard thermodynamic properties