Displaying 20 results from an estimated 200 matches similar to: "Select rows with distinct values in a column and other conditions"
2011 Jan 20
4
How to reshape wide format data.frame to long format?
Dear list,
I need to convert this data.frame
> names(codesM)
[1] "key" "AMR.pa1.M" "AMR.pa2.M" "AMR.pa3.M" "AMR.pa4.M"
[6] "AMR.pa5.M" "AMR.pa6.M" "AMR.pa7.M" "AMR.pa8.M" "AMR.pa9.M"
[11] "AMR.pa10.M" "AMR.ta1.M" "AMR.ta2.M" "AMR.ta3.M"
2008 May 21
2
Search a string and modify it in a .txt file
Hi there,
I use R and I would like to be able to modify a file .txt "init_file" like this one :
# ---------------------------------------------------------------------------- #
# Parameters A
# ---------------------------------------------------------------------------- #
# Parameter 1
PA1 = 15
# Parameter 2
PA2 = 3
# Parameter 3
PA3 = 2
#
2009 Aug 01
2
Add columns in a dataframe and fill them from another 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:-
This table gives the probabilities of the changes in the swap curve
depending on the state of the swap curve. I want to put these probabilities
in my dataframe mydata(given after the prob table).
Prob of States
Changes State1 State2 State3 State4
a
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
2005 Nov 16
5
"Warning message: package '...' was built under R version 2.3.0"
Hi,
While installing precompiled packages I often get warnings like the one in
the subject. I usually ignore them, but I still do not understand why
windows packages are build with unreleased versions of R.
Is there some way to get packages build under R-2.2.0?
What are potential problems that can result from that version mismatch?
My system: winXP
R version: 2.2.0
Jarek Tuszynski
2009 Apr 14
2
subset dataframe by rows using character vector?
Dear List,
I'm stuck on what seems like a simple indexing problem, I'd be very grateful to anyone willing to help me out.
I queried a dataframe which returns a character vector called "plot". I have another dataframe from which I want to subset or select only those rows that match "plot". I've tried subset, and also the "which" command.
plot
2009 Jul 29
4
- counting factor occurrences within a group: tapply()
Dear List,
I'm an [R] novice starting analysis of an ecological dataset containing the
basal areas of different tree species in a number of research plots.
Example data follow:
> Trees<-data.frame(SppID=as.factor(c(rep('QUEELL',2), rep('QUEALB',3),
'CORAME', 'ACENEG', 'TILAME')), BA=c(907.9, 1104.4, 113.0, 143.1, 452.3,
638.7, 791.7, 804.3),
2003 Dec 26
2
OC curve in "Quality Control"
Dear all,
Can anyone please help me about any of the following questions:
--------------------------------------------
1. How can i find "factorial" of any number in R? I tried
> prod(170:1) # to find factorial of 170 or 170!
Is it the only procedure - or R has any better process / operational
character to calculate factorial? Also, is it possible to calculate
factorial of 500? Or
2010 Mar 19
1
Sweave and " object of type 'closure' is not subsettable" error
Hello folks:
I have a data frame which includes two numeric vectors: "Pa1" and "Ingr" (which represents income). I run the following code on the R console:
ingreso <- factor(ifelse(Ingr<=3000,"bajo","alto"))
tapply(Pa1,ingreso,summary)
boxplot(Pa1~ingreso)
and it works fine. However, when I "Sweave" through an rnw file containing that
2006 Aug 25
1
Plot y ~ x under condition of variable a and b [Broadcast ]
It's the "|source" in your formula that tells lattice to separate them.
If you drop that, you'll get all points without S and P distinguished at
all. If you add a groups argument, you should get them presented with
different colors/symbols/etc. depending on your trellis settings (warning:
untested code):
par.plot(lnvol~lnden, groups =
2008 Jul 19
1
wroung groupedData despite reading Bates and Pinheiro 3 times
Hi everyone. I am trying to add a formula to my data using the groupedData
function.
My experiment consists of randomized block design using fruits, vegetation
and time as factors. The idea is to see if fruits, vegetation and time
explain the abundance of mice. I am using tree density as a covariate.
So I tried to fit the following structure to my data.
>
2009 Apr 15
2
How to extract p-value into a table from a groups of t test
Hi,
I have run a groups of t test and obtained a list of the t-test results
(about 30). How do I extract p-values from the 30 t-test results and make a
table output? Thanks
Jun
Example t-test output:
============================
$Lambda_z
Welch Two Sample t-test
data: x[PA1.BS.DN$Onecode == 2] and x[PA1.BS.DN$Onecode == 3]
t = -0.1128, df = 33.635, p-value = 0.9109
alternative
2012 Dec 07
1
how to add a column from another dataset with "merge"
kiotoqq wrote
> I want to add a shorter column to my dataset with the function "merge",
> it
> should be filled with NAs wo be as long as the other colums, like this:
>
> id age
> 9 46
> 8 56
> 6 52
> 5 NA
> 4 NA
> 3 NA
> 1 NA
>
> i did this:
> pa1 <- merge(pa1, an1, by="mergeid")
>
> and it says
2009 Apr 22
1
Gee with nested desgin
Dear all,
Is it possible to incorporate a nested design in GEE? I have
measurements on trees that where measured in two years. The trees are
nested in plots. Each plot contains 24 trees. The number of plots is 72.
Hence we would expect 2 * 24 * 72 = 3456 data points. A few are missing,
so we end up wih 3431 data points.
This is what I have tried until now.
#assuming independence between trees
2009 Jul 15
0
Fwd: DLLs
Thanks for your help with this problem about dynamic linked libraries.
I thought I had it solved, but apparently not.
Below is a small piece of Pascal code that I compile into a library.
When I load the library using dyn.load R becomes very unstable.
The Mac GUI crashes in all kinds of situations --even moving a window
can sometimes crash it.
Running from the command line (I thought the
2012 Oct 05
2
Dúvida função Anova pacote car - Medidas repetidas
Olá pessoal, estou realizando uma ANOVA com medidas repetidas e estou
utilizando a função "Anova" do pacote "car".
Medi o biovolume de algas a cada dois dias durante 10 dias (no banco de
dados abaixo só coloquei até o 4° dia). Tenho 2 tratamentos ("c","t") e o
experimento foi realizado em tréplicas ("A","B","C").
> Pa2
2009 Apr 29
1
R Macro Question
Dear all,
I am a new R user, and I have a question about R macro.
Here is the situation, I want to do item option analysis (options include: A
, B, C, D), below is the codes for option A analyses.
#option A analyses
optiona<-mat.or.vec(nrow(responsedata2), ncol(responsedata2))
# create A matrix by recoding
for (i in 1:ncol(responsedata2)){
2009 Jul 10
1
Degree of freedom in the linear mixed effect model using lme function in R
Hello,
I would appreciate if somebody could help me clear my mind about the below issues.
I have a factorial experiment to study the effects of Grazing and Fire on Forest biomass production. The experimental unit (to which the treatment combinations are applied) are PLOTs. The measures were made repeatedly for 13 years.
I am planning to use the linear mixed effect model function lme in R for this.
2009 Jul 23
1
ggplot2 : commands on one line vs two lines.
I have just started using ggplot2 and I seem to be doing something stupid
in writing ggplot2 commands on more than one line.
In the example below the commands on one line are working fine, but as
soon as I put them on two lines I get an error. Can any one point out
what I am doing wrong? It must be something blindingly simple.
Thanks
Example
2005 May 11
1
Mixed Effect Model - Jackknife error estimate
Greetings,
I?ve fit the following mixed effects model using the NLME package:
hd.impute.lme <- lme(I(log(HEIGHT_M - 1.37)) ~ SPECIES + SPECIES:I(1/(DBH_CM + 2.54)),
random = ~ I(1/(DBH_CM + 2.54)) | PLOTID,
data = trees, na.action = na.exclude)
I would now like to extract a jackknife estimate of model error. I tried the following code, however, the estimate produced seems too