Displaying 20 results from an estimated 8000 matches similar to: "numbering observations: help please!"
2012 Oct 30
1
peer-reviewed (or not) publications on R
Dear Friends,
I'm contributing to a paper on a new R package for a clinical (medicine,
ophthalmology) audience, and part of the mission is to encourage people who
might be occasional users of Excel or SPSS, to become more familiar with R.
I'd really appreciate any pointers to more recent papers that describe R,
it's growth (statistics on user base, number of packages, volume of help
2012 Apr 27
2
Deleting observations from baseline that don't appear in follow up
Hello all,
I'm almost embarrassed to post this , it seems so easy. Suppose I have a
baseline and follow up survey but some people are missing in the follow up:
> baseline<-data.frame(id=c(3,5,7,9,12), data= runif(5))
> follow.up<-data.frame(id=c(3,7,9,12), data= runif(4))
> baseline
id data
1 3 0.66771988
2 5 0.28794744
3 7 0.01892821
4 9 0.64863175
5 12 0.86485882
2011 Sep 22
2
Numbering entries for each subject
Hi R Users
I am hoping someone might be able to give some pointers on alternative code to the for loop described below.
I have a dataset which is ordered by subject ID and date, what I would like to do is create a new variable that numbers the entries for each person (e.g. 1,2,3,....)
As an example if we have subjects A, B and C all with multiple entries (have excluded date variable for
2011 Feb 24
4
Running code sequentially from separate scripts (but not functions)
Hello!
I am wondering if it's possible to run - in sequence - code that is
stored in several R scripts.
For example:
Script in the file "code1.r" contains the code:
a = 3; b = 5; c = a + b
Script in the file "code2.r" contains the code:
d = 10; e = d - c
Script in the file "code3.r" contains the code:
result=e/a
I understand that I could write those 3 scripts
2011 Nov 29
2
how to transform a data file
Hello R people,
I have a data file with 101 numeric variables: one variable called IDN (the
individual's unique id number, which I need to retain, and which ranges
from 1000 to 1320; some numbers are obviously skipped), and V1 to V100
(each has a value of 0 or 1; these 100 variables represent sequentially
ordered days and whether a characteristic was present or absent--e.g., v1
is day 1 and a
2013 Nov 22
1
multiple pages with ggplot2 possible?
Dear all,
This question was asked a few years ago. Back then, the answer was NO. Just
wonder if the package has been updated to make it possible.
An example (Theoph is a dataset coming with R)
ggplot(data=Theoph, aes(x=Time, y=conc)) + geom_point() +
facet_wrap(~Subject)
gives me all 12 subjects on one page. Can I break it down to several pages?
say 2x2 on each page?
Thanks.
Jun
2012 Jul 06
1
Problem using Lag on time series
I'm trying to duplicate something in Excel, where it is easy to reference the previous row in formula. Have been stuck on this for ages trying to achieve the same result in R. I've managed to do it with a loop but it takes ages on a large data set.
What I want to do is create a new variable in a matrix that will refer to it's previous value if the ifelse statements aren't met.
2018 Jan 08
2
Replace NAs in split lists
Hi
With the example, na.locf seems to be the easiest way.
> library(zoo)
> na.locf(df1)
ID ID_2 Firist Value
1 a aa TRUE 2
2 a ab FALSE 2
3 a ac FALSE 2
4 b aa TRUE 5
5 b ab FALSE 5
Cheers
Petr
> -----Original Message-----
> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Jeff
> Newmiller
> Sent: Monday, January
2012 Apr 23
2
.rda vs. .RData
Are they the same with .RData being the newer format?? Thanks,
...Tao
2013 Oct 10
1
Rcpp and mclapply
Dear all,
I have an R script that uses Rcpp, and I have been trying to parallelize
it using mclapply (I tried with the multicore and the parallel library)
Sometimes (not always, interestingly), the CPU use for each core drops,
usually so that the total over all cores reaches 100%, i.e., as fast as if
using just one single core fully. I tried my code directly from within
emacs, and also using a
2013 Oct 12
1
lmerTest
Hi,
I'm trying to user lmer function from lmerTest package because, if I
understood correectly, it allows to make better inference than lmer method
from lme4 package. However, whatever I do I keep getting this error:
Error in lme4::lFormula(formula = mark ~ ssCount + sTime+ : rank of X =
1660 < ncol(X) = 1895
any ideas what could be a problem?
thanks,
Srecko
[[alternative HTML
2012 Nov 11
2
Cropping a matrix by rows
Hello r-help,
I've been banging my head against the computer in an attempt to learn how
to divide my matrix into segments by rows. I want to be able to return each
segment as a newly named object. I've tried looking at the apply functions
and creating a for loop but brain no work. Here's the basic starting
objects that I believe would be needed to separate the matrix.
mat <-
2018 Jan 08
2
Replace NAs in split lists
You can enforce these assumptions by sorting on multiple columns, which
leads to
na.locf(df1[ order(df1$ID,df1$Value), ])
On Mon, Jan 8, 2018 at 4:19 PM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us>
wrote:
> Yes, you are right if the IDs are always sequentially-adjacent and the
> first non-NA value appears in the first record for each ID.
> --
> Sent from my phone. Please
2011 Nov 25
3
counting values with some conditions in a simulation
Dear R users,
I am running simulations (1000), and in my simulation I am looking at
specific sums. For example, if the sum is >=4 then count this, if say <3,
then don't count, if the sum=3, then generate a random number from uniform
distribution, if this number is say less than 0.5, then count this sum, if
greater than 0.5, then don't count. I am having trouble with introducing
this
2012 Jan 11
3
64bit R under 32bit winxp
Hi all:
My OS is 32bit winxp,but I wanna install 64bit R2.14.1.
>From the following website,it says "You can also go back and add 64-bit components to a 32-bit install, or vice versa"
http://cran.r-project.org/bin/windows/rw-FAQ.html#Can-both-32_002d-and-64_002dbit-R-be-installed-on-the-same-machine_003f
Does it mean that I can install and run 64bit R2.14.1 under 32bit
2011 Aug 15
3
write.table extra column
In the following data.frame there are 6 columns, but 7 are written to
the CSV file.
install.packages("pmlr")
library(pmlr)
data(enzymes)
write.table(enzymes, sep=",", eol="\n",file="albert.csv")
2012 Mar 12
3
Idea/package to "linearize a curve" along the diagonal?
Hi,
I am trying to normalize some data. First I fitted a principal curve
(using the LCPM package), but now I would like to apply a
transformation so that the curve becomes a "straight diagonal line" on
the plot. The data used to fit the curve would then be normalized by
applying the same transformation to it.
A simple solution could be to apply translations only (e.g., as done
after a
2013 Apr 04
2
question about message
Hello R, could you tell me please, how to fix this issue?
There is installed RStudio-2.15.2 and the next steps where follow but
the message appears:
http://cran.r-project.org/web/packages/RMySQL/INSTALL):
>
> 1. Download the RMySQL_0.9.tar.gz file to the folder C:\Program
> Files\R\R-2.15.1\bin\x64
> 2. Open a Windows command line, and change directory to that folder
> 3.
2012 Dec 12
3
Fw: regarding plot
Hello,
i am working in origin pro,
i want to plot a graph as like a pdf attached but with black and white lines.
here radial axis varies from 0 to 1. and angular axis from 0 degree to 60 degree.and third axis which is depend on both radial and axial gives non intersecting lines.
how can i read the data from plot for replot.
vikas
-------------- next part --------------
A non-text attachment was
2012 Mar 12
3
How to plot diagonal line at any coordinate range in R
Dear expert
How can we plot diagonal across (from bottom-left-hand corner to top
right-hand corner),
at any given coordinate range
For example
> plot(c(-2,3), c(-1,5), type = "n", xlab="x", ylab="y", asp = 1)
or
> plot(c(0,1000), c(0,334), type = "n", xlab="x", ylab="y", asp = 1)
I tried abline with the following but failed: