Displaying 17 results from an estimated 17 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?
Dear ?,
I'm sure that there are many ways to do what you want; here's one:
> cbind(concept_df, category=
+ ifelse(apply(
+ sapply(chemical_df$chemical,
+ function(x) grepl(x, concept_df$concept)),
+ 1, any),
+ "chemical", ""))
concept category
1 butan
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 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 Feb 21
0
Odd Error message with rare events logit
I'm running a rare events logit model in R using the Zelig package and am
getting some of the oddest error messages that I can't figure out.
y = rnorm(100)
x = c(rep("0",1), rep("1",99))
d = data.frame(won=x, bid=y)
d
mod1 <- zelig(y~x, model="relogit", data=d, tau=1/100,
case.correct="prior", bias.correct=TRUE, robust=TRUE)
> mod1 <-
2006 Jan 22
0
Get colum types in auto form
Hi all,
I''m trying to build a routine that generates table rows with the appropriate
field types (text_area and text_field for now), and filters out the
''created_at'' and ''deleted_at''.
<% for column in Project.content_columns %>
<tr class="ListLine<%= cycle("0","1") %>">
<td><%=
2011 Mar 30
1
CDR Mysql adaptive Colum
Hello folks, i installed asterisk 1.8 from repo:
https://wiki.asterisk.org/wiki/display/AST/Asterisk+Packages
And Looked at this article about CDR in mysl.
http://www.voip-info.org/wiki/view/Asterisk+cdr+mysql
I installed asterisk-mysql pacakge from debian repo.
The cdr in mysql is working, but i can not get cdr adaptive colums are not,
i use this in my extension.conf
exten =>
2009 Dec 04
1
Converting a Matrix in a colum vector
Hi all,
Imagine I have a matrix G
with N rows
and M columns
So L=NxM is the number of different cells in my matrix.
I want to create a column vector F whose size will be F(L,1)
So the fisrt row in F is G(1,1)
Second row in F is G(1,2)
When we arrive to a point M
the element M+1 will be G(2, 1)
Element M+2 will be G(2,2) and so on.
I´m trying but allways error....
Easy Example:
G=
2 3 4
2011 Apr 23
1
How to delete an entire row, if a specific colum has the value of "#VALUE!"
I am importing CSV data with thousands of rows, if any row contains an error
from excel, the whole program crashes, so i need to delete all rows with the
value of #VALUE!, all other values are non-numeric...
I've tried a bunch of strategies, but nothing seems to work.
Thanks ahead of time guys,
Best,
Cody
--
View this message in context:
2009 Feb 22
1
Filtering a data frame using a string for colum header
Hi all,
I was just radomly playing with R and got the following error when
trying to filter a data frame using a string:
> Angel <- c(7,8,6,9,10)
> Buffy <- c(8,9,4,9,10)
> Firefly <- c(9,9,10,10,10)
> DrHorrible <- c(10,9,9,10,10)
> my.df <- data.frame(Angel, Buffy, Firefly, DrHorrible)
> my.df["DrHorrible"]
DrHorrible
1 10
2 9
3
2008 Jul 18
1
only "T" becomes logical colum with read.table
Hello,
I am a biologist and I am dealing with files composed of columns with T or A
or C or G (example below)
Sometimes a column is composed of only "T"
and in that case, the columns becomes a logical column TRUE (example below)
I know that the argument "as.is" controls the turns off turning a column
into a factor, instead becoming a character
Is there something similar for
2010 Aug 01
3
finding max value in a row and reporting colum name
Hi,
Hopefully someone can point me in the right direction on how I would go
about solving the following.
I have some data and need to find the column name of the maximum value in
each row.
This could be the data...
> a <- data.frame(x = rnorm(4), y = rnorm(4), z = rnorm(4))
> a
x y z
1 1.6534561 0.11523404 0.2261730
2 -1.2274320 -0.24096054 1.5096028
2008 Mar 22
2
counting values on one colum only
Hi all:
Can someone help me count the
number of rows with values in
colum "a" only. assume the name
of my dataframe is "weekly"
I was trying
i<- nrows(weekly$a)
i
but returns 7 when it should
be 4. Thanks
a b c d
27.000
27.000
1.569 0.013 160.000 27.000
1.632 0.013 146.000 27.000
1.830 0.015 70.000 27.000
2.475 0.019
2006 Nov 29
2
db:migrate to add colum bombs...
Hi
I get the following when I try and run "rake db:migrate" (I"m running un
Ubuntu linux)
********** code **********
(in /<home hidden>)
== AddRpts: migrating
=========================================================
-- add_column("rpts", :integer, {:limit=>3})
rake aborted!
You have a nil object when you didn''t expect it!
You might have expected an
2007 May 29
2
summing up colum values for unique IDs when multiple ID's exist in data frame
I have data.frame's with IDs and multiple columns. B/c some of IDs showed up
more than once, I need sum up colum values to creat a new dataframe with
unique ids.
I hope there are some cheaper ways of doing it... Because the dataframe is
huge, it takes almost an hour to do the task. Thanks so much in advance!
Young
# ------------------------- examples are here and sum.dup.r is at the
2006 Apr 26
3
drop downs
I''m having trouble getting a second drop down populated based on the
value from the first drop down. I''ve tried following some of the
examples posted, but haven''t had any success. I''m new to RoR so any help
would be appreciated. When the first drop down''s value gets changed, it
calls the correct method in the controller and even finds the correct
2011 Feb 11
1
Time Series in R with ggplot2
Hi Folks,
First, the important information.
> sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: i386-pc-mingw32/i386 (32-bit)
Second, my problem.
I have a series of data sets comprised in the following format.
> totsoc
Location Year Value
1 SOUTH 1998 29
2 SOUTH 1999 20
3 SOUTH 2000 32
4 SOUTH 2001 29
5 SOUTH 2002 25
6 SOUTH 2003 28
7
2011 Mar 21
1
Help with POSIXct
I rarely work with dates in R, so I know very little about the
POSIXct and POSIXlt classes. I'm importing an excel file into R using
the RODBC package, and am having issues reformatting the dates.
1. The important info:
> sessionInfo()
R version 2.12.2 (2011-02-25)
Platform: i386-pc-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United