Displaying 20 results from an estimated 200 matches similar to: "nls question"
2012 Dec 17
5
save to file
Hi,
What's the equivalent of "Save to File" from the R console File menu on an R routine? Just trying
to capture the whole R console into a text file when my code fails.
Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish & Wildlife Service
California, USA
http://www.fws.gov/redbluff/rbdd_jsmp.aspx
[[alternative HTML version deleted]]
2011 Apr 03
1
another question on shapefiles and geom_point in ggplot2
Manuel:
I changed your variable names from x to 'long' and y to 'lat' on the
riqueza_out.csv file.
The code below should do what you want. Also, since the legend title is kind of
long, I broke it
down into three lines so you can see more plot area. I am cc'ing the other
groups so more people
use it if needed.
library(rgdal)
library(ggplot2)
library(sp)
library(maptools)
2012 Nov 12
3
arrange data
Dear r-users,
I have daily rainfall data from 1971 to 2000. I would like to extract november and december data only. I would also like to do column bind for november and december, therefore I would like to delete 31 December from december data so that the length of november and december are the same. Hope somebody can help me. I tried this below:
> kuantan.dt.1 <-
2009 Jul 09
2
r bug (?) display of data
Hi R Fans,
I stumbled across a strange (I think) bug in R 2.9.1. I have read in a
data file with 5934 rows and 9 columns with the commands:
daten = data.frame(read.table("C:/fussball.dat",header=TRUE))
Then I needed a subset of the data file:
newd = daten[daten[,1]!=daten[,2],]
--> two values do not meet the logical specification and are dropped.
The strange thing about it:
2012 Aug 29
1
Help on not matching object lengths
Dear All
I have the following code set up:
Code #1
a <-matrix(seq(0,8, by = sign(8-0)*0.25))
b <-matrix(seq(8,16, by = sign(16-8)*0.25))
c <-runif(1000,50,60)
d <-exp(-c*a)+exp(-c*b)
This will give me the obvious error message of lengths not matching. What I am trying to do here is to have 33 rows x 1000 columns d values calculated in total. As an eaxmple for visual, this is what
2023 Nov 30
1
back tick names with predict function
?s 17:38 de 30/11/2023, Robert Baer escreveu:
> I am having trouble using back ticks with the R extractor function
> 'predict' and an lm() model.? I'm trying too construct some nice vectors
> that can be used for plotting the two types of regression intervals.? I
> think it works with normal column heading names but it fails when I have
> "special"
2012 Dec 02
4
simple subset question
Hi,
Consider the small dataset below, I want to subset by two variables in
one line but it wont work...it works though if I subset separately. I have
to be missing something obvious that I did not realize before while using subset..
fish <- structure(list(IDWeek = c(27L, 28L, 29L, 30L, 31L, 32L, 33L,
34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L,
47L, 48L, 49L, 50L, 51L,
2007 Feb 13
1
Missing variable in new dataframe for prediction
Hi,
I'm using a loop to evaluate several models by taking adjacent variables from my dataframe.
When i try to get predictions for new values, i get an error message about a missing variable in my new dataframe.
Below is an example adapted from ?gam in mgcv package
library(mgcv)
set.seed(0)
n<-400
sig<-2
x0 <- runif(n, 0, 1)
x1 <- runif(n, 0, 1)
x2 <- runif(n, 0, 1)
x3 <-
2011 Apr 09
1
loop and sapply problem, help need
Dear R experts
Sorry for this question
M1 <- 1:10
lcd1 <- c(11, 22, 33, 44, 11, 22, 33, 33, 22, 11)
lcd2 <- c(22, 11, 44, 11, 33, 11, 22, 22, 11, 22)
lcd3 <- c(12, 12, 34, 14, 13, 12, 23, 23, 12, 12)
#generating variables through sampling
pvec <- c("PR1", "PR2", "PR3", "PR4", "PR5", "PR6", "PR7",
2011 Jan 25
1
ggplot - controlling point size
Can anyone illuminate the following for me?
How can I get rid of the blue line in the key in the second plot?
## Create a simple data frame
df=data.frame(x=1:1000, y=2*1:1000+rnorm(1000,sd=1000),
type=sample(letters[1:2],1000, replace=TRUE))
## Very nice! Almost what I want
qplot(x, y, data=df, colour=factor(type)) + geom_smooth()
## Make a nicer plot, with smaller points
## but why
2011 Feb 13
1
Changes titles in ggplot2 plot
Dear Colleagues,
In the following simple ggplot2 code:
--------------------------------
m <- ggplot(d.fig, aes(time, prob))
m + stat_summary(fun.data = "median_hilow", conf.int = .95, geom =
"smooth") + facet_wrap(~ Cohort, nrow=1) + coord_cartesian(ylim = c(0,
.03))
--------------------------------
Is there a way to replace the y-axis label from "prob" to
2007 Feb 23
2
Extracting a subset from a dataframe
Good day everyone,
Can anyone suggest an effective method to solve
the following problem:
I have 2 dataframes D1 and D2 as follows:
D1:
dates ws wc pwc
2005-10-19:12:00 10.8 80 81
2005-10-20:12:00 12.3 5 15
2005-10-21:15:00 12.3 3 15
2005-10-22:15:00 11.3 13 95
2005-10-23:12:00 12.3 13 2
2005-10-24:15:00 10.3 2 95
2005-10-25:15:00 10.3 2 2
D2:
2017 Jun 12
0
plotting gamm results in lattice
Hi Maria
If you have problems just start with a small model with predictions and then plot with xyplot
the same applies to xyplot
Try
library(gamm4)
spring <- dget(file = "G:/1/example.txt")
str(spring)
'data.frame': 11744 obs. of 11 variables:
$ WATERBODY_ID : Factor w/ 1994 levels "GB102021072830",..: 1 1 2 2 2 3 3 3 4 4 ...
$ SITE_ID
2012 Oct 25
2
mean of a value of the last 2 hours
Hello,
I have a data frame somewhat like that:
myframe <- data.frame (ID=c("Ernie", "Ernie", "Ernie", "Bert", "Bert",
"Bert"), Timestamp=c("24.09.2012 09:00", "24.09.2012 10:00", "24.09.2012
11:00"), Hunger=c(1,1,1,2,2,1) )
myframestime <- as.POSIXct (strptime(as.character(myframe$Timestamp),
2013 May 03
1
print multiple plots to jpeg, one lattice and one ggplot2
hello everybody,
I want to print two plots in one png file, I tried several options but i
didn't succeed
the first plot (bwplot) print to the defined position, but the second
(ggplot) doesn't
Any idea?
Thanks a lot
Christophe
# Example:
#-------------------------------------
library(ggplot2)
library(lattice)
library(grid)
one <- bwplot(decrease ~ treatment, OrchardSprays, groups
2009 Apr 05
4
predicting values into the future
Hi:
I have usually used the GROWTH() excel function to do this but now want to see if I can do this with R.
I want to predict values into the future, possibly with the predict.arima Function.
I have the following weekly fish weight averages:
weight <- c("2.1","2.4","2.8","3.6","4.1","5.2","6.3")
week <-
2003 Jun 03
3
gam questions
Dear all,
I'm a fairly new R user having two questions regarding gam:
1. The prediction example on p. 38 in the mgcv manual. In order to get
predictions based on the original data set, by leaving out the 'newdata'
argument ("newd" in the example), I get an error message
"Warning message: the condition has length > 1 and only the first element
will be used in: if
2011 May 17
4
Summarize by two or more attributes
Okay everyone heres a likely softball for someone.
Consider the following data frame:
#Create data
x<-rep(c(1,15),10)
y<-rnorm(20)
z<-c(rep("auto",10),rep("bus",10))
a<-rep(c(1,1,2,2,3,3,4,4,5,5),2)
#Create Data frame
Df<-data.frame(Source=x,Rate=y,Bin=a,Type=z)
I want to create a new column the equals the sum of the Rates for each type
(1,15) by Bin.
A
2017 Nov 21
2
help
I am working on Johansen cointegration test, using urca and var package.
in the selection of var, I have got following results.
>VARselect(newd, lag.max = 10,type = "none")
$selection
AIC(n) HQ(n) SC(n) FPE(n)
6 6 6 5
$criteria
1 2 3 4
5 6 7 8 9
AIC(n) -3.818646e+01 -3.864064e+01
2011 Nov 01
3
factor level issue after subsetting
Dear list,
I cannot figure out why, after sub-setting my data, that particular item
which I don't want to plot is still in the newly created subset (please
see example below). R somehow remembers what was in the original data
set. A work around is exporting and importing the new subset. Then it's
all fine; but I don't like this idea and was wondering what am I missing
here?
Thanks!