Displaying 20 results from an estimated 20000 matches similar to: "Removing rows in dataframe w'o duplicated values"
2011 Sep 25
4
selecting first row of a variable with long-format data
Hi,
I am trying to select the first row of a variable with data in long-format,
e.g.,
# sample data
id <- c(1,1,1,2,2)
value <- c(5,6,7,4,5)
dat <- data.frame(id, value)
dat
How can I select/subset the first 'value' for each unique 'id'?
Thanks,
AC
[[alternative HTML version deleted]]
2012 Nov 28
4
remove NA or 0 values
Dear R users,
I want to remove zero's or NA values after this model.
year value1 value2
1854 0 12
1855 0 13
1866 12 16
1877 11 24
year value1 value2
1 12 12
2 11 13
3 16
4 24
Thank you!
--
---
Catalin-Constantin ROIBU
Forestry engineer, PhD
Forestry Faculty of Suceava
Str. Universitatii no. 13, Suceava, 720229, Romania
office phone +4 0230 52 29 78, ext. 531
mobile phone +4 0745 53
2012 Oct 15
1
How to read XML in UTF-8 format?
How to read xml in UTF-8 format. I have one XML file but i want to read it
in UTF-8 format. How this is possible?
<barplot>
<cd>
<name>?</name>
<value1>3</value1>
<value2>2.9</value2>
</cd>
<cd>
<name>?</name>
2010 Sep 07
3
Help with decimal points
Hi
I have found a little problem with an R script. I am trying to merge some data
and am finding something unusual going on. As shown below I am trying to
assign (MatchedValues[Value2,Value]) to (ClusteredData[k,Value]) which are two
separate dataframes.
1) By the following command you can see that the value im transferring
is 481844.03
> MatchedValues[Value2,Value]
[1] 481844.03
6618
2023 Mar 02
1
transform.data.frame() ignores unnamed arguments when no named argument is provided
Thanks and good point about unspecified behavior. The way it behaves now
(when it doesn't ignore) is more consistent with data.frame() though so I
prefer that to a "warn and ignore" behaviour:
data.frame(a = 1, b = 2, 3)
#> a b X3
#> 1 1 2 3
data.frame(a = 1, 2, 3)
#> a X2 X3
#> 1 1 2 3
(and in general warnings make for unpleasant debugging so I prefer
2008 May 02
2
Accesing data frame members from within functions
I am writing a simple R program to execute a t-test repeatedly on data
contained in a data frame. My data looks like this:
Category Value1 Value2
1 .5 .8
1 .3 .9
. . . . . . . . .
2
2010 Dec 17
4
How to arrange the data
Dear R helpers
I have one data as given below.
date value1 value2 value3
30-Nov-2010 100 40 61
25-Nov-2010 108 31 88
14-Sep-2010 11 180 56
I want the following output
date name amount
30-Nov-2010 value1
2007 Dec 03
3
Request param type of array
Hello.
I have tested such form:
<form method=''POST''>
<input type=''hidden'' name=''myfield'' value=''value1''>
<input type=''hidden'' name=''myfield'' value=''value2''>
<input type=''submit'' name=''_submit''
2011 Jul 14
2
cbind in aggregate formula - based on an existing object (vector)
Hello!
I am aggregating using a formula in aggregate - of the type:
aggregate(cbind(var1,var2,var3)~factor1+factor2,sum,data=mydata)
However, I actually have an object (vector of my variables to be aggregated):
myvars<-c("var1","var2","var3")
I'd like my aggregate formula (its "cbind" part) to be able to use my
"myvars" object. Is it
2005 Mar 18
3
extract rows in dataframe with duplicated column values
Hi
I want to extract all the rows in a data frame that have duplicates
for a given column.
I would expect this question to come up pretty often but I have
researched the archives and surprisingly couldn't find anything.
The best I can come up with is:
x <- data.frame(a=c(1,2,2,3,3,3), b=10)
xdup1 <- duplicated(x[,1])
xdup2 <- duplicated(x[,1][nrow(x):1])[nrow(x):1]
xAllDups <-
2011 Oct 24
1
Creating data frame with residuals of a data frame
Dear experts,
I am trying to create a data frame from the residuals I get after
having applied a linear regression to each column of a data frame, but
I don't know how to create this data frame from the resulting list
since the list has differing numbers of rows.
So for example:
age<- c(5,6,10,14,16,NA,18)
value1<- c(30,70,40,50,NA,NA,NA)
value2<- c(2,4,1,4,4,4,4)
df<-
2010 Jun 17
1
big big problem
Dear list,
I'll try to be more clear in explaining my problem. I have a data frame like this called X:
CLUSTER YEAR variable value1 value2
M1 2005 EC01 NA NA
M1 2006 EC01 2 5
M1 2007
2013 Feb 11
2
How to plot doubles series with different location using plotCI
Dear list
members,
I would
like to create two series of plotted mean values and error bars, yet with
different locations along the x-axis.
Plotting of
first series using plotCI with the standard arguments goes without any problem.
However I do not succeed to add the second series in the same plot, which
should be horizontally shifted from the first series along the x-axis. The “add=TRUE”
2006 Apr 06
1
reshape question
Hi,
I have a data fram like this:
date column1 column2 column3 value1 value2 value3
1-1 A B C 10 5 2
2-1 A B D 5 2 0
3-1 A B E 17 10 7
How can I reshape it to:
date column1 column2 column3 v x
1-1 A B C value1 10
1-1 A B C value2 5
1-1 A B C value3 2
2-1 A B D value1 5
2-1 A B D value2 2
2-1 A B D value3 0
3-1 A B E value1 17
3-1 A B E value2 10
3-1 A B E value3 7
Thx!
Regards,
Richard
2007 Mar 23
4
Conversion from string to date type
Hi,
I'm on my very first steps to R and so I hope that I do
not ask a really stupid questions but I did not found it
via R-Search, in the FAQ or Google (BTW, the name "R" is
not a really good seekiong criterion ;-) ).
I have a data file containing a table that containes
dates and values like
date\t value1\t value2, ...
01.03.2007\t 17\t 42\t ...
02.03.2007\t 2\t 3\t ...
2006 May 20
1
merge problem... extra lines appear in the presence of NAs
Good morning!
I've searched the docs etc... Am I doing something wrong or is this a bug?
I'm doing a merge of two dataframes and getting extra rows in the
resulting dataframe - the dataframes being merged might have NAs...
count <- 10
nacount <- 3
a1 <- as.data.frame(as.Date("2005-06-01")+0:(count-1))
names(a1) <- "mdate"
a1$value <- runif(count)
2007 Feb 23
2
bug with boolean query evaluation containing parenthesis and NOT ?
Hi,
The following [simplified] query works well, however a variation which
includes parenthesis seems to fail, in that it returns hits which should
be excluded by the NOT term.
This is surprising because in this simple case, the parenthesis
shouldn''t change the Boolean evaluation ... any pointers?
Working Query: field1:value1 AND NOT field2:value2
Failing Query: field1:value1 AND
2007 Nov 19
3
link_to and GET parameters
Hi,
I am trying to generate a link to external site with GET parameters
( in new window).
I tried following code, but it does not produce any parameters.
<%=link_to "Open New Page", "https://www.foo.com/page/", {:popup =>
true}, {:param1 => "value1", :param2 => "value2"}%>
and
<%=link_to "Open New Page",
2012 Nov 08
3
Beginner help about output in R
Dear R experts,
I am a beginner with R and I have a question regarding the output of a
function.
Basically, I created 2 functions, value1 and value2, that calculate two
values, and I would like to print those two values to an output datafile. I
tryed the following function:
function (x) {write.table(data.frame(value1(x),value2(x)),file=output.txt)}
My problem is that I would like to calculate
2011 Apr 18
1
using "aggregate" when variable names contain spaces
Hello!
my data set has many variables. Unfortuantely, many of those variables
contain spaces in their names.
I need advice on: how to refer to variable names in the formula for
"aggregate". See example below:
### Generating example data set:
mydate = rep(seq(as.Date("2008-12-01"), length = 3, by = "month"),4)
value1=c(1,10,100,2,20,200,3,30,300,4,40,400)