Displaying 20 results from an estimated 30000 matches similar to: "Extract Row on Criteria"
2009 May 10
1
Select the rows in a dataframe that matches a criteria in another dataframe
Hi everyone! Thank you for the help you have been given to
me, and here I'm with another problem with my dataframes:
I have two dataframes (with much more observations), like
these:
Dataframe1
Firm Year cash
500400200 2007 100
500400200 2006 200
500400200 2005 400
500400300 2007 300
500400300 2006 240
500400300 2005 120
500400400
2005 Jul 01
5
Generating correlated data from uniform distribution
Dear R users,
I want to generate two random variables (X1, X2) from uniform
distribution (-0.5, 0.5) with a specified correlation coefficient r.
Does anyone know how to do it in R?
Many thanks!
Menghui
2008 Sep 25
1
Splitting row names up and then adding up the columns associated with criteria from the parts of the site coding (help)
d <- c("upwd1201", "upwd0502", "upwd0702", "upwd1002", "upwd1102",
"upwd0203", "upwd0503", "upwd0803", "upwd0104", "upwd0704", "upwd0804",
"upwd1204", "upwd0805", "upwd1005", "upwd0106", "dnwd1201", "dnwd0502",
2009 Jul 31
1
Fill dataframe from a table according to a criteria
Deare R users
I am new to R.
What I want to do is explained below;-
I have table called States.Prob which is given below
Prob of States
Changes State1 State2 State3 State4
A Pa1 Pa2 Pa3 Pa4
B Pb1 Pb2 Pb3 Pb4
C Pc1 Pc2 Pc3 Pc4
D Pd1 Pd2 Pd3 Pd4
and I have a dataframe called
2011 Apr 04
1
Ordering every row of a matrix while ignoring off diagonal elements
Sorry if this is a stupid question but I've been stuck on how to code
so that I can order rows of a matrix without paying attention to the
diagonal elements.
Say, for example, I have a matrix d:
> d
[,1] [,2] [,3] [,4]
[1,] 0.000000 2.384158 2.0065682 2.2998856
[2,] 2.384158 0.000000 1.4599928 2.4333213
[3,] 2.006568 1.459993 0.0000000 0.9733285
[4,] 2.299886
2004 Jun 14
2
ordering points as vertex of a polygon
Dear R-users,
Suppose I have the following x-y coordinates which give the boundaries of
a polygon:
> x <- c(5,4,5,9,6,6,4,7,10,7,10,4,10)
> y <- c(6,3,2,6,3,7,5,4,4,7, 5,4, 6)
I would like to plot the following graph:
> plot(x,y)
> ord <- c(7,12,2,3,5,8,9,11,13,4,10,6,1)
> polygon(x[ord],y[ord])
How I can obtain the above ordering (in the example an anti-clockwise
2009 May 29
3
IP-Address
Hi,
Is there any way to sort a tabel with a colum with IP-address?
table:
id rank color status ip
138 29746 yellow no 162.131.58.26
138 29746 red yes 162.131.58.16
138 29746 blue yes 162.131.58.10
138 29746 red no 162.131.58.17
138 29746 yellow no 162.131.58.14
138 29746 red no 162.131.58.13
138 29746 yellow no 162.132.58.15
139 29746 green no 162.252.20.69
140 29746 red yes
2008 Aug 13
3
Comination of two barcharts and one xyplot
Hi Rhelpers,
I would like to have some help with a plot which is beyond my capabilities. This plot that I am seeking involves an overlay of two different barcharts and one xyplot.
The code that I have used is the following :
#save(df1,file="M:\\KBR\\df1.RData")
load(file="M:\\KBR\\df1.RData")
# df1$Year.ord created to obtain the right order i.e. 2015M < 2015K
2012 Apr 11
1
row.names in dunes and dunes.env?
Hello,
I've got a small dataset on box turtle shell measurements that I would like to perform a detrended correspondence analysis on. I thought that it would be interesting to examine the morphometrics for each species in the area of overlap and in areas where neither species occurs.
I've taken a look at the dune and dune.env datasets in vegan. Using the str() command gives me
>
2010 Dec 21
1
Coding a new variable based on criteria in a dataset
Hi,
I'm a bit stuck and need some help with R code to code a variable F_R based
on a combination of conditions.
The first condition would code F_R as "F" and would be based on the
min(Date) and Min(Time) for each combination of UniqueID & Reason. The
second condition would code the variable as "R" as it would be the rest of
the data that dont meet the first
2006 May 23
2
transpose dataset to PC-ORD?
Hello:
I need to take a species-sample matrix and transpose it to the format
used by PC-ORD for analysis. Unfortunately, the number of species is
very large (>5000), and so this operation cannot be performed simply
in an application like Excel, which has a 255 column limit. So, I
wrote relatively simple code in R that I hoped would do this
(appended below). But there are glitches.
The
2013 May 01
1
selecting rows based on multiple criteria
Dear List,
I am struggling with the following problem.
Suppose I have the following data.frame:
coord<-expand.grid(x=1:10,y=1:10)
and I want to extract the row numbers of those matching the criteria defined by the following data.frame:
choice<-data.frame(x=c(2,1,2),y=c(1,2,2))
the result should return in this case:
2,11,12
All I managed to do is the following:
which(data
2008 Mar 07
4
locate the rows in a dataframe with some criteria
Hi, netters,
This is probably a rookie question but I couldn't find the answer after hours of searching and trying.
Suppose there'a a dataframe M:
x y
10 A
13 B
8 A
11 A
I want to locate the rows where x >=10 and y="A". I know how to do it to vectors by using
which, but how to do it with the dataframe?
Thank you very much!
Zhihua Li
2007 Jan 28
1
plot.lm (PR#9474)
Full_Name: Robert Kushler
Version: 2.4.1
OS: Windows XP
Submission from: (NULL) (69.245.71.40)
In the constant leverage case, plot #5 is not correctly produced.
The labels on the x-axis are sorted correctly by magnitude of the
fitted value, but the data are plotted in the original factor order.
I changed
facval[ord] <- facval
xx <- facval
2008 Aug 02
3
Bubble plots
Is there a way to create a 'bubble plot' in R?
For example, if we define the following data frame containing the level of y observed for 5 patients at three time points:
time<-c(rep('time 1',5),rep('time 2',5),rep('time 3',5))
2010 Feb 08
2
Counting by rows based on multiple criteria
Dear all,
I have a data frame of 6 columns and ~60000 rows which I hope to perform the following calculation on.
For each row, I wish to determine whether there are a greater number of positive or negative numbers. Then, if there are more positive numbers in the row, count how many occur - but if there are more negative numbers in the row, count them instead and insert a minus symbol before
2008 Dec 28
1
Using a constant scale across X-Y plots
I am working off an example from Deepayan Sarkar's
Lattice:Multivariate Data Visualiization with R. I am trying to create
Figure 5.6, essentially, but I would like to be able depict different
metro areas. These of course have different lat/longs, so I need to
make different graphs. BUT (and this has been the tricky part), I
would like to produce graphics for each metropolitan
2007 Mar 19
2
sorting with criteria that are "out of order"
I try to sort this dataframe:
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] "CM" "BARBY" "INCREASED" " 0" " 2" " 0" " 1" " 1"
[2,] "CM" "BARBY" "REDUCED" " 0" " 1" " 2" " 2" " 5"
[3,] "CM"
2010 Feb 05
2
ifelse on a series of rows for multiple criteria
Dear all,
I am attempting to perform a calculation which counts the number of positive (or negative) values based on the sample mean (on a per-row basis). If the mean is>0 then only positive values should be counted, and if the mean is <0 then only negative values should be counted. In cases where the mean is equal to zero, the value -99999 should be returned.
The following is an example
2017 Jun 21
0
Counting with multiple criteria using data table
Have you gone through any R tutorials? If not, why not? If so, maybe
you need to spend some more time with them.
It looks like you want us to do your work for you. We don't do this.
See (and follow) the posting guide below for what we might do (we're
volunteers, so no guarantees).
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and