Displaying 12 results from an estimated 12 matches similar to: "How to extract from a column in a table?"
2012 Aug 31
7
splits with 0s in middle columns
Hi,
A column of my df looks like
A
10/20/30
40/20
60/10/10/5
80/10
I want to split it such that the last column has the last composition and if there are not enough the middle columns get the 0s. That way my df would look like
A1 A2 A3 A4
10 20 0 30
40 0 0 20
60 10 10 5
80 0 0 10
How can I do that ??
[[alternative HTML version deleted]]
2012 Aug 28
7
check and verify
Hi,
I have 6 columns in my dataframe (test)
A B C D E F
a b c d 40 30
a f a b 20 10
x m y m 50 30
If character value in column A matches with that in column C, it gets the percentage in column E, similarly if value in column B matches the value in D, it gets the percentage in F column. If it doesn't match, it gets 0 percentage.
How can I do that ?
thanks
[[alternative HTML version
2012 Aug 27
6
find and replace
I have 5 (A,B,C,D,E) columns in my dataframe. I want to replace all "x" with "y" and all "a" with "b" within these 5 columns. Can I do it in one step?
Thanks
[[alternative HTML version deleted]]
2012 Aug 29
4
Use or ??
Hi, My data frame looks like
A B C
a b a
x y z
I want to add a new column which says "y" if either A or B matches with C and "n" if there is no match. How can I do that?
Thanks
[[alternative HTML version deleted]]
2012 Aug 20
7
relating data in two data frames
Hi,
My data.frame "A" has FID like this
FID
a
a
b
b
b
c
c
d
d
d
d
Now my second data.frame "B" has age value for a, b, c, d like
FID Age
a 5
b 7
c 9
d 3
How can search for the Age column in "B" and replace the values in "A" so that my new "A" looks like this
FID Age
a 5
a 5
b 7
b 7
b 7
2012 Aug 27
4
?nchar ?strsplit
Hi, my data frame is
x<-data.frame(ID=c("abc/def","abc/def/ghi","abc","mno/pqr/st/ab"))
I want to split my column ID using "/" as the place to split. How can I do that without telling the code how many sub-columns. I could use nchar(gsub("[^/]","",x$ID)) to get how many "/" are in each row of the column, but could
2012 Oct 02
2
add values in one column getting range from other column
Hi,
My dataframe has two columns one with area and other with percent. How can i add the areas that are within a range of percentage??
My dataframe looks like
Area Percent
456 0
3400 10
79 25
56 18
467 0
67 67
839 85
1120 0
3482 85
I want to add the area for values whose percent is <0, 0-25, 25-50, 50-75, >75. How
2013 Dec 06
13
Can't seem to get modulepath attribute recognized by puppetmasterd
Warning - Puppet newby here.
I am trying to set up a puppetmaster 3.3.2 and have run into a snag right
out of the box.
I want to add a new directory to modulepath= in /etc/puppet/puppet.conf
So I added the following line in the [main] header
modulepath = /etc/puppet/modules:/opt/our-repo/puppetmaster/modules
And populated new new directory with modules I have written.
I then run
puppet
2011 Oct 25
4
comparing two tables
Hi everybody,
I would like to know whether it is possible to compare to tables for certain
parameters.
I have these two tables:
gene table
name chr start end str accession Length
gen1 4 646752 646838 + MI0005806 86
gen12 2L 243035 243141 - MI0005821 106
gen3 2L 159838 159928 + MI0005813 90
gen7 2L
2013 Apr 12
1
Removing rows that are duplicates but column values are in reversed order
Hi,
From your example data,
dat1<- read.table(text="
id1?? id2?? value
a????? b?????? 10
c????? d??????? 11
b???? a???????? 10
c????? e???????? 12
",sep="",header=TRUE,stringsAsFactors=FALSE)
#it is easier to get the output you wanted
dat1[!duplicated(dat1$value),]
#? id1 id2 value
#1?? a?? b??? 10
#2?? c?? d??? 11
#4?? c?? e??? 12
But, if you have cases like the one
2013 Feb 17
6
histogram
HI Elisa,
You could use ?cut()
vec1<-c(33,18,13,47,30,10,6,21,39,25,40,29,14,16,44,1,41,4,15,20,46,32,38,5,31,12,48,27,36,24,34,2,35,11,42,9,8,7,26,22,43,17,19,28,23,3,49,37,50,45)
label1<-unlist(lapply(mapply(c,lapply(seq(0,45,5),function(x) x),lapply(seq(5,50,5),function(x) x),SIMPLIFY=FALSE),function(i) paste(i[1],"<x<=",i[2],sep="")))
2013 Nov 12
1
static link libsmbclient.a got a lot of error, and how to include "smbtree" feature in program
Hi All:
I have some questions when writing a lib with libsmbclient-dev ,my target environment is on any linux system.
1 I want to static link libsmbclient.a instead of using libsmbclient.so, but I got a lot of error , am I able to use libsmbclient-dev using static link?
2 I found that ?smbtree? command is more stable in finding all those domains and servers than