Displaying 20 results from an estimated 10000 matches similar to: "How do I Convert "<1" to the number 1?"
2009 May 21
4
Re placing a "+" in a string
I know this is easy, but I am stumped:
> gsub("0","K","8.00+00")
[1] "8.KK+KK"
> gsub("+","K","8.00+00")
Error in gsub("+", "K", "8.00+00") : invalid regular expression '+'
In addition: Warning message:
In gsub("+", "K", "8.00+00") :
regcomp error:
2017 Oct 24
5
Problem Subsetting Rows that Have NA's
This has every appearance of being a bug. If it is not a bug, can
someone tell me what I am asking for when I ask for "x[x[,2]==0,]". Thanks.
> #here is the toy dataset
> x <- rbind(c(1,1),c(2,2),c(3,3),c(4,0),c(5,0),c(6,NA),
+ c(7,NA),c(8,NA),c(9,NA),c(10,NA)
+ )
> x
[,1] [,2]
[1,] 1 1
[2,] 2 2
[3,] 3 3
[4,] 4 0
[5,] 5 0
2017 Oct 25
4
Problem Subsetting Rows that Have NA's
On 10/25/2017 4:38 AM, Ista Zahn wrote:
> On Tue, Oct 24, 2017 at 3:05 PM, BooBoo <booboo at gforcecable.com> wrote:
>> This has every appearance of being a bug. If it is not a bug, can someone
>> tell me what I am asking for when I ask for "x[x[,2]==0,]". Thanks.
> You are asking for elements of x where the second column is equal to zero.
>
>
2008 Oct 14
6
Doing a Task Without Using a For Loop
Assume that I have the dataframe "data1", which is listed at the end of this
message. I want count the number of lines that each person has for each
year. For example, the person with ID=213 has 15 entries (NinYear) for 1953.
The following bit of code calculates NinYear:
for (i in 1:length(data1$ID)) {
data1$NinYear[i] <- length(data1[data1$Year==data1$Year[i] &
2017 Oct 25
0
Problem Subsetting Rows that Have NA's
> On Oct 25, 2017, at 6:57 AM, BooBoo <booboo at gforcecable.com> wrote:
>
> On 10/25/2017 4:38 AM, Ista Zahn wrote:
>> On Tue, Oct 24, 2017 at 3:05 PM, BooBoo <booboo at gforcecable.com> wrote:
>>> This has every appearance of being a bug. If it is not a bug, can someone
>>> tell me what I am asking for when I ask for "x[x[,2]==0,]". Thanks.
2009 Feb 01
2
Extracting Coefficients and Such from mle2 Output
The mle2 function (bbmle library) gives an example something like the
following in its help page. How do I access the coefficients, standard
errors, etc in the summary of "a"?
> x <- 0:10
> y <- c(26, 17, 13, 12, 20, 5, 9, 8, 5, 4, 8)
> LL <- function(ymax=15, xhalf=6)
+ -sum(stats::dpois(y, lambda=ymax/(1+x/xhalf), log=TRUE))
> a <- mle2(LL,
2009 Jan 23
2
Dates in Common
I have two collections of dates and I want to figure out what dates they have
in common. This is not giving me what I want (I don't know what it is giving
me). What is the best way to do this?
Tom
> data1
[1] "1948-02-24 EST" "1949-04-12 EST" "1950-05-29 EDT" "1951-05-21 EDT"
[5] "1951-12-20 EST" "1953-01-22 EST"
2008 Jun 17
1
Simultaneous Confidence/Prediction Bands
Is there a built-in function in R that will generate simultaneous confidence
and prediction bands for linear regression?
Tom
--
View this message in context: http://www.nabble.com/Simultaneous-Confidence-Prediction-Bands-tp17941537p17941537.html
Sent from the R help mailing list archive at Nabble.com.
2010 Mar 28
3
Ellipse that Contains 95% of the Observed Data
I can take the results of a simulation with one random variable and generate
an empirical interval that contains 95% of the observations, e.g.,
x <- rnorm(10000)
quantile(x,probs=c(0.025,0.975))
Is there an R function that can take the results from two random variables
and generate an empirical ellipse that contains 95% of the observations,
e.g.,
x <- rnorm(10000)
y <- rnorm(10000)
?
2017 Oct 25
0
Problem Subsetting Rows that Have NA's
On Tue, Oct 24, 2017 at 3:05 PM, BooBoo <booboo at gforcecable.com> wrote:
> This has every appearance of being a bug. If it is not a bug, can someone
> tell me what I am asking for when I ask for "x[x[,2]==0,]". Thanks.
You are asking for elements of x where the second column is equal to zero.
help("==")
and
help("[")
explain what happens when
2008 Mar 12
7
Specifying relative position of text in a plot
What is the simplest way to specify the location of text in a scatter plot
(created using the plot function) in relative terms rather than specific x-y
coordinates? For example, rather than putting text at (300,49) on a plot,
how do I put it 1/10 of the way over from the y axis and 1/2 of the way up
from the x axis? Thanks.
Tom
--
View this message in context:
2007 May 31
3
Problem with Weighted Variance in Hmisc
The function wtd.var(x,w) in Hmisc calculates the weighted variance of x
where w are the weights. It appears to me that wtd.var(x,w) = var(x) if all
of the weights are equal, but this does not appear to be the case. Can
someone point out to me where I am going wrong here? Thanks.
Tom La Bone
[[alternative HTML version deleted]]
2007 Mar 18
2
Problem Loading rggobi package
After installing rggobi, I get the following error when I try to load it:
> local({pkg <- select.list(sort(.packages(all.available = TRUE)))
+ if(nchar(pkg)) library(pkg, character.only=TRUE)})
Loading required package: RGtk2
Error in dyn.load(x, as.logical(local), as.logical(now)) :
unable to load shared library
2001 Oct 16
4
two way ANOVA with unequal sample sizes
Hi,
I am trying a two way anova with unequal sample sizes but results are not
as expected:
I take the example from Applied Linear Statistical Models (Neter et al.
pp889-897, 1996)
growth rate gender bone development
1.4 1 1
2.4 1 1
2.2 1 1
2.4 1 2
2.1 2 1
1.7 2 1
2.5 2 2
1.8 2 2
2 2 2
0.7 3 1
1.1 3 1
0.5 3 2
0.9 3 2
1.3 3 2
expected results are
2007 Oct 17
1
Documentation for Pearson Residuals
Greetings,
I have been using lm to perform weighted linear regressions and resid to
extract the residuals. I happened upon some class notes on the internet that
described how one can specify type="pearson" in resid to extract the
weighted residuals. Where is this option documented? And if you know that,
what is the best way to find such documentation if you don't know that the
2012 Nov 08
1
validates_uniqueness_of(*attr_names) w scope not working in unit test
Rails 3.2.8
Very strange , it works in dv mode console , but not in a unit test
class User < ActiveRecord::Base
belongs_to :subdomain
validates_uniqueness_of :email, :scope => :subdomain_id
class UserTest < ActiveSupport::TestCase
def initialize_user
@booboo = FactoryGirl.create(:subdomain, name: "booboo")
@coocoo = FactoryGirl.create(:subdomain, name:
2008 Sep 25
1
ggplot: adding layer using different data, groups and also controlling appearance
I have a more complicated function I am trying to write, but I run in to a problem when I want to
add something to the plot from more than one data set while simultaneously controlling the
appearance of the additional layer.
# Toy data:
foo <- data.frame ( x = 1:4, y = 4:1 , membership = c( "A", "A", "B", "B" ) )
bar <- data.frame ( x = 1:4 + 1 , y
2009 Feb 06
3
How to convert Charagter variables into numeric
I am importing a dataset in R where some of the variable are numerical and
some of them are character...but the problem is that R is treating
numerical variables as character (I am using "is.character" to judge the
type). Now the question is how can I convert these character variables into
numeric and also let me know about the other conversion like "numeric to
2008 Nov 10
3
how to stop without error message?
Dear list
Can anyone suggest a simple way to abort execution like stop(...) does, but without issuing an "Error: ..." message?
I don't want to set 'options( show.error.messages=TRUE)' because I want normal behaviour to resume after this particular stop.
(Please reply personally as well as to the list, as I'm not subscribed to R-help)
Thanks
Mark
--
Mark Bravington
2003 Sep 23
3
number of distinct values in a dataframe
Hi R-users,
How can I found the number of a distinct values in a data frame
(occurrence of distinct values)? The dataframe consists of several
thousands integer numbers.
Thanks,
Rado
--
Radoslav Bonk M.S.
Dept. of Physical Geography and Geoecology
Faculty of Sciences, Comenius University
Mlynska Dolina 842 15, Bratislava, SLOVAKIA
tel: +421 905 968 127 e-mail: rbonk at host.sk