hello,
I have some data that looks similar to this (only not as nice as this):
Y <- c(abs(rnorm(100, 0.10, .1)), seq(.10, 1.0, .3)+rnorm(1, 0, .5) ,
seq(0.8, 4.0, .31)+rnorm(1, 0, .5)
, seq(3.9, .20, -.2)+rnorm(1, 0, .5) , abs(rnorm(100, 0.13, .1)) , seq(.10,
1.2, .35)+rnorm(1, 0, .5)
, seq(0.7,
X, Y, col=section)
>
>
> Or you could base the slope on the a smooth fit of the data rather than Y
> itself:
>
> P <- loess(Y ~ X, degree=2, span=1/10)$fitted
>
> upslope <- c(FALSE, diff(P) > 0)
> section <- rep(1, length(Y))
> section[upslope==TRUE &
1) get differences
2) run t-test on #1
* Be warned: I am not a statistician.
Tammy Ma wrote
> Dear All,
>
> I have two samples as the following:
> conjps<-c(9.41,10.45,10.78,10.73,11.11,11.12,11.59,11.04,11.63)
>
> ms<-c(4.11,5.10,5.70,6.46,6.04,6.16, 6.24,6.32,7.33)
>
> I want to test
got it, sorry!
structure(1243792800, class = c("POSIXct", "POSIXt"), tzone =
"GMT")-(60*60*24*10)
chuck.01 wrote
> Hi,
> Let say I have a date variable like this:
>
> structure(1243792800, class = c("POSIXct", "POSIXt"), tzone =
Hi,
Let say I have a date variable like this:
structure(1243792800, class = c("POSIXct", "POSIXt"), tzone = "GMT")
[1] "2009-05-31 18:00:00 GMT"
How can I make it 10 days prior, so:
[1] "2009-05-21 18:00:00 GMT"
I'm randomly selecting dates from a list and want a second value a set #
of days
Um, OK.
My dates have times, they are 00:00:00 (i.e. midnight)
I'll just add a fraction of a second my dates and go with it.
Thanks for the reply.
arun kirshna wrote
> HI,
> Please check this link
> (http://rss.acs.unt.edu/Rdoc/library/base/html/as.POSIXlt.html).
> "Dates without times are
Hi,
I have some dates that are giving me a problem, in general the dates look
like this:
free.dates[60:61]
[1] "2009-05-21 23:45:00 GMT" "2009-05-22 00:00:00 GMT"
but for some reason, when taken "alone", they look like this:
free.dates[60]
[1] "2009-05-21 23:45:00 GMT"
free.dates[61]
[1] "2009
0:00 GMT" "2009-05-21 23:45:00 GMT"
[3] "2009-05-22 00:00:00 GMT" "2009-05-22 00:15:00 GMT"
dates.mine[3]
[1] "2009-05-22 GMT"
chuck.01 wrote
> Hi,
>
> I have some dates that are giving me a problem, in general the dates look
> like this
onds.
>
> So, may be it is better to add a sec and later subtract it.
>
> dates.mine2<-dates.mine+1
> dates.mine2[3]
> #[1] "2009-05-22 00:00:01 GMT"
> dates.mine3<-dates.mine2-1
> dates.mine3[3]
> #[1] "2009-05-22 GMT"
> A.K.
>
>
&g
Sorry, I know I should read a little 1st about this, but I am actually just
helping somebody really quick and need help too.
I want to grep all of the names of the .txt files mentioned on this html web
page:
http://www.epa.gov/emap/remap/html/three/data/index.html
Thanks ahead of time.
--
Vi
Hello,
Here is a link to some data:
http://www.epa.gov/emap/html/data/surfwatr/data/mastreams/9396/wchem/chmval.txt
I am trying to read this in, and want to use:
chmval <-
read.table("http://www.epa.gov/emap/html/data/surfwatr/data/mastreams/9396/wchem/chmval.txt";,
sep=",", skip= 84, header=T)
epends on what you plan to do with them,
> and what sort of output you expect.
>
> It isn't even clear whether you plan to do this in R.
>
> Sarah
>
>
> On Wed, Oct 31, 2012 at 12:56 PM, chuck.01 <
> CharlieTheBrown77@
> >wrote:
>
>> Sorry, I
Yes.
see:
?lm
?coef
?write.csv
also, if
fit <- lm(Y~X)
then:
slope_p-value <- summary(fit)[[4]][2,4]
Double check that last one for yourself.
Good luck.
hoguejm wrote
> I want to export the coefficient values and p-values from my regression
> output into a spreadsheet. Is there a way to
see:
?boot
SASandRlearn wrote
> I have a large dataset from which i need to take a random sample many
> times ( say N=50) and run it through the same glm() - logistic regression
> model everytime ( 50 times ) and capture the chi-square p-values ( Pr >
> ChiSq ) of the variables for each run an
untested, but something like this should get you what you want:
no.it <- 5
out <- vector("list", length=no.it)
for(i in 1:no.it){
mydata2 <- mydata[ sample(1:nrow(mydata), 76000/no.it) ,]
out[[i]] <- coef(
glm(f_ocur~altitud+UTM_X+UTM_Y+j_sin+j_cos+temp_res+pp+offset(log(1/off)),
data
Please take the advice of Berend if you ever want to get help here. Also,
you will need to do some basic and initial work yourself; read what he
suggested, use Google to search keywords, and see great help like this:
http://cran.r-project.org/doc/contrib/Short-refcard.pdf
also, use the built in
1st. Calm down, this doesn't seem that important.
Then you will need to know some base functions.
see
?rnorm
Doing this 10,000 times and making them of size 50 is no problem.
FYI: I don't understand what "with replacement case" means; could you
clarify?
Jasmin wrote
> Hi,
> I want to gener
length(unique(a))
Hard Core wrote
> Hello,
> Suppose that i have a dataframe
> a <- read.dta("banca_impresa.dta")
>
> i have a column with 17900 obs like
>
> 1
> 2
> 3
> 1
> 6
> 7
> 8
> 3
> 4
> 4
>
> and i want to know the number of the different values so in this case it
> would be 7
> Ho
My apologies.
I still do not understand the difference; good luck.
Hard Core wrote
> this is wrong because with the command "unique" it counts the only values
> that are unique ..
>
> in my column, for instance, 1 and 4 are not unique so the formula doesn't
> work in my case
--
View this m
FYI:
As you are likely thinking: this doesn't belong here (It just occurred to
me), I am questioning what I did, not the output of lm()
But if someone knows why I am wrong please let me know.
chuck.01 wrote
>
> Hi,
> I was playing around with something else and I noticed th
Hi,
I was playing around with something else and I noticed this matrix code for
residuals in a linear model doesn't say what lm() says. Please tell me if I
am completely misguided here.
data(mtcars)
Y <- as.matrix(mtcars[,1])
X <- as.matrix(mtcars[,c(2:11)])
# shouldnt this:
H <- X %*% solve(
nevermind...
I forgot the column of 1's for the intercept term
chuck.01 wrote
>
> Hi,
> I was playing around with something else and I noticed this matrix code
> for residuals in a linear model doesn't say what lm() says. Please tell
> me if I am completely misguide
Try this as a starting point; dat is your whole data set, and r = correlation
coefficient threshold:
spec.cor <- function (dat, r, ...)
{
x <- cor(dat, ...)
x[upper.tri(x, TRUE)] <- NA
i <- which(abs(x) >= r, arr.ind = TRUE)
data.frame(matrix(colnames(x)[as.vector(i)], ncol = 2)
Hello,
I have data like the following:
datum <- structure(list(Y = c(415.5, 3847.8325, 1942.83325,
1215.223,
950.142857325, 2399.585, 804.75, 579.5, 841.70825, 494.053571425
), X = c(1.081818182, 0.492727273, 0.756363636, 0.896363636,
1.518181818, 0.49917, 1.35454545
initial guess is just so far gone that the nls()
> optimizer can't handle it.
>
> If you try a more reasonable initial guess it works fine:
>
> fit <- nls(Y ~ a*exp(-k * X), datum, start=c(a=3400, k=1.867))
>
> Michael
>
> On Wed, Nov 30, 2011 at 12:14 PM, chuck.01 <C
I have this type of format:
structure(list(day = 19, C1 = structure(1L, .Label = c("", "C1"
), class = "factor"), C2 = structure(2L, .Label = c("", "C2"), class =
"factor"),
C3 = structure(1L, .Label = c("", "C3"), class = "factor"),
Q1 = structure(2L, .Label = c("", "Q1"), class = "fact
ot;)
>
> paste(x[1, 1], do.call(paste, c(x[1, x != ""][, -1], list(sep="_"))),
> sep=" -")
>
> # Output looks like this
>> paste(x[1, 1], do.call(paste, c(x[1, x != ""][, -1], list(sep="_"))),
>> sep=" -")
Example data would be helpful
A Ezhil wrote
>
> Dear All,
> I have two matrices A (40 x 732) and B (40 x 1230) and would like to
> calculate correlation between them. I can use: cor(A,B, method="pearson")
> to calculate correlation between all possible pairs. But the issue is that
> there is
Hassan,
Others have provided you with better solutions, but I hope this allows you
to see why yours didn't work.
# first (going with your code) you needed a data.frame called "x"
# here is an example:
x <- structure(list(x1 = c(0.0986048226696643, -0.445652024980979,
0.0893989676314604, -3.02
Without taking away all the fun of trial and error, and exploration in R... I
will direct you to this website which I found invaluable when I first began
to use R.
one way would be to use:
plot(Yourdata, type="n")
and then 3 text() or points() statements to plot the groups represented by
differen
Using your posed data, the variable price was numeric:
data.precios <-
read.table("http://r.789695.n4.nabble.com/file/n4498828/p_diarios.txt";,
header=T)
str(data.precios)
'data.frame': 1996 obs. of 2 variables:
$ time : int 37988 37991 37993 37994 37995 37998 37999 38000 38001 38002
...
$
1) thats not a function (i'm sure just a mistake)
2) Just add another plot line
myplot <- function(x){
plot(x)
pdf("xplot.pdf")
plot(x)
dev.off()
}
myplot(1:20)
casperyc wrote
>
> Hi all,
>
> I know how to use pdf() and dev.off() to produce and save a graph.
>
> However, wh
dbh is the column name. What is the name of your data?
Lets assume your data is called "YOUR_DATA"
then try:
with(YOUR_DATA, hist(dbh))
OR
hist(YOUR_DATA$dbh)
OR
hist(YOUR_DATA[, "dbh"])
etc...
bamboohydraulics wrote
>
> Dear all
>
> I am a BEGINNER and have R on my Mac. I saved my
You really need to read one of many beginners guides to R; but I will say
this much:
YOUR_DATA <- read.table("nigeria slr misc/Nigeria India /DBHHISTOGRAM.txt",
header=TRUE)
then you should be able to plot it like I said previously.
If that still doesn't work, you need to read the posting guide
Could you please post a small example of your data and code which gives you
this error. Your assumed error distribution sounds reasonable. I am
interested as to why you have zeros... you have sites with species richness
==0 ??
Lívia Dorneles Audino wrote
>
> I'm trying to make a glmm to i
Hi,
I want to use map("state") and have the ecoregion shape (please see link)
file projected onto this.
ftp://ftp.epa.gov/wed/ecoregions/cec_na/NA_CEC_Eco_Level3.zip
ftp://ftp.epa.gov/wed/ecoregions/cec_na/NA_CEC_Eco_Level3.zip
Could someone please show me how; I have never messed with this so
Sun, Apr 1, 2012 at 4:55 PM, Michael Sumner <mdsumner@> wrote:
>>> Try the R-Sig-Geo mailing list for a better target community, but if
>>> these
>>> are shapefiles there is read support in rgdal (or maptools for a simpler
>>> alternative) and if these a
This is one way:
f <- function(x, y){
Z <- ifelse(x==y, 3, 4)
return(Z)
}
DS[3] <- with(DS, f(X,Y))
colnames(DS)[3] <- "Z"
But you don't really need a function to do that.
DS[3] <- with(DS, ifelse(X==Y, 3, 4)) # this works just fine
I'm glad you've decided to use R; eventually you will ne
Please use dput() to post your example matrix.
Rambler1 wrote
>
> I have run into a problem in my code. What I want to accomplish is this:
> I have a user input stock symbols into a list and from there I run the
> quantmod package to get historical data. I compute the correlation matrix
> and
This is true with regard to all things you don't understand in R... use
question mark (?) # this will show you the manual, or help page
?dput
also, make sure you hit the "quote" button when you reply on this forum so
that people know what you are replying to.
I used dput() to create the follo
the code without the "function(dat,...){}" and have it run in a
> larger function?
> Also what is the context of the command "dat" R is very new and confusing
> to me and sometimes ?# doesn't fully explain it for me. Thank you!
>
>
>
> chuck.01 wr
Hard to help without a short example dataset (please read posting guide!)
posted with dput().
You likely want to "paste" together a title for your graph.
see
?paste
Rambler1 wrote
>
> Another simple question that is driving me crazy:
> I have a for loop that loops through a matrix and pulls d
Hello,
I have some data that will be in the form:
structure(list(station = structure(c(20L, 2L, 4L, 19L, 3L, 11L,
1L, 5L, 10L, 12L, 17L, 18L, 6L, 9L, 13L, 16L, 7L, 8L, 15L, 14L
), .Label = c("1", "10", "11", "12", "13", "14", "15", "16",
"17", "18", "19", "2", "3", "4", "5", "6", "7", "8", "9",
Ok,
I've since found this:
# called previously posted dataset "dat"
attach(dat)
library(akima)
data.interp <- interp(x,y,z)
contour(data.interp)
any idea how to calculate area within specified contour lines?
Thanks
chuck.01 wrote
>
> Hello,
> I have some da
I wanted)
Per_neg_0.5 <- (length(which(z.2<=-.5))*diff_y*diff_x)/total_area
If you see a problem, please let me know.
chuck.01 wrote
>
> Ok,
> I've since found this:
>
> # called previously posted dataset "dat"
>
> attach(dat)
> library(akima)
http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=search_page&node=789695&query=cbind+with+different+rows
Rambler1 wrote
>
> I am trying to bind two matrices of different length. They both are one
> column and many rows but the rows differ by a few. How am I able to cbind
> them toge
I found something a little different:
> median(nb10[,1])
[1] 404
> mean(nb10[,1])
[1] 404.59
compare them
They are different. Your sample is not perfectly symmetrical (50% above,
50% below) about the mean (ie. the third standardized moment (skewness) is
not zero). This is really not a ques
Hello,
given the set of grey points (corners of squares, see visual)... something
like this:
http://r.789695.n4.nabble.com/file/n4363505/Slide2.png
how do I calculate the average value of the variable z, that was measured at
the corners of the rectangles (represented by the black points in th
I believe this should work
d <- read.table("foo.csv", header=T, sep=",", comment="T")
although its spitting back a warning... this used to work for me.
Noah Silverman wrote
>
> Hi,
>
> I have a CSV file that is formatted well, except that the last line is a
> "summary" not is CSV format.
sum(ifelse(x*total!=0, as.numeric(x> total), 0))
arunkumar wrote
>
> Hi
>
> I have two vector
>
> x=c(10,30,40,50)
> total=c(20,20,0,10)
>
> Var_exceeding_total=sum(as.numeric(x> total))
>
> This will compare the vectors x and total a gives the result.
>
> if i want to compare only if t
this is ugly, but...
l <-length(patrn)
l2 <-length(exmpl)
out <- vector("list")
for(i in 1:(l2-l+1))
{
exmpl[i:(i+l-1)]
patrn==exmpl[i:(i+l-1)]
if(all(patrn==exmpl[i:(i+l-1)]))
{ out[[i]] <- i } else { out[[i]] <- "NA"}
}
out <- do.call(c, out)
as.numeric(out[which(out!="NA")])
##
Hello,
I have recently had issues with read.csv where i get the following warning,
and this happens on both my OSX and Linux machines. Here is the warning
and an example CSV file is attached:
Warning message:
In read.table(file = file, header = header, sep = sep, quote = quote, :
incomplete
see:
?sample
library(vegan)
?rrarefy
not knowing your data structure, its hard to say.
camilleislande wrote
>
> Hello
> I have several populations where I have morphology and diet for each
> individual. I am interested in the correlation between diet and
> morphological distances. However the
Untested die to no data, but this should work with a loop
out=vector("list", length= length(MyVector))
for(i in 1 : length (MyVector))
{
x <- data.frame (sum (MyTable ==MyVector[i]))
out[[i]] <- x
}
sum(do.call(rbind, out))
--
View this message in context:
http://r.789
Let say I have an object (I hope my terminology is correct) a
a <- 12
> a
[1] 12
And "a" has been assigned the number 12, or whatever
And lets say I have a character "call_A"
call_A <- "a"
>call_A
[1] "a"
What is the function "F" that allows this to happen:
> F( call_A )
[1] 12
--
View this mes
I figured as much.
Thank you greatly.
plangfelder wrote
>
> On Wed, Apr 18, 2012 at 7:25 PM, chuck.01 <CharlieTheBrown77@>
> wrote:
>> Let say I have an object (I hope my terminology is correct) a
>> a <- 12
>>> a
>> [1] 12
>>
>> An
--
View this message in context:
http://r.789695.n4.nabble.com/fill-a-dataframe-with-zeros-where-the-rows-are-a-smaller-subset-of-a-larger-dataframe-species-by-sit-tp4586534p4586711.html
Sent from the R help mailing list archive at Nabble.com.
__
R-he
# dput() example
# lets say you have data called y, like this:
> y
sp1 sp2 sp3 sp4
d 0 0 0 0
e 0 0 0 0
f 0 0 0 0
# ok, so do this:
> dput(y)
structure(list(sp1 = c(0, 0, 0), sp2 = c(0, 0, 0), sp3 = c(0,
0, 0), sp4 = c(0, 0, 0)), .Names = c("sp1", "sp2", "sp3", "sp4"
)
Hi,
In the following lines of code are inside of a function, where "TRAIT1" is
a function variable calling a column-name inside of the data.frame "new3".
This works just fine:
m2 <- lmer(get(TRAIT1) ~ perm.score + (1|site), data=new3)
but this will not work,
m3 <- lme(get(TRAIT1) ~ perm.sc
please note that I edited the original message to say:
> length(with(new3, perm.score))==length(with(new3, get(TRAIT1)))
[1] TRUE
chuck.01 wrote
>
> Hi,
> The following lines of code are inside of a function, where "TRAIT1" is
> a function variable calling a
Hi,
How can I round up and down to the nearest hundredth
example:
x <- 0.18
how do I round down to 0.15?
how do I round down to 0.20?
--
View this message in context:
http://r.789695.n4.nabble.com/round-up-down-to-nearest-hundredth-tp4629451.html
Sent from the R help mailing list archive at
~EP, random= ~1|No, data=petrol)
I'd really like to use the variable... again, this is inside a function.
Any idea how to solve this.
Thanks for your time and expertise,
Chuck
chuck.01 wrote
>
> please note that I edited the original message to say:
>
>> length(with(new
62 matches
Mail list logo