[R] POSIX turns into factor

2010-10-16 Thread Toby Gass
Dear helpeRs,

I am working with a dataframe that includes a column, "calendar", 
used for plotting time series.

> class(dat$calendar)
[1] "POSIXt"  "POSIXlt"

When I finish working, I save my data as a .csv file.  When I read 
the file in again, "calendar" is always a factor

> class(dat$calendar)
[1] "factor"

and I have to turn it back into a date-time object.

Is this unavoidable when going back and forth from a .csv, or can I 
do something differently to retain the class?

R 2.11.1 on Windows OS.

Thank you.

Toby

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Reshape

2010-09-27 Thread Toby Gass
That does work, thank you.  I didn't understand that the "fame" 
column would be the time varying column.

Toby

On 28 Sep 2010 at 12:47, Michael Bedward wrote:

> Hi Toby,
> 
> I think this should work...
> 
> reshape(dat, v.names=c("weight"), idvar=c("valley", "plot", "trt"),
> timevar="fame", direction="wide")
> 
> Michael
> 
> 
> On 28 September 2010 12:17, Toby Gass  
> wrote:
> > Hello, helpeRs,
> >
> > I've been trying, unsuccessfully, to change a dataframe from long to
> > wide format using reshape (the original).  I would appreciate it if
> > someone could demonstrate the correct syntax.  The script below will
> > create a toy example.  The new wide data should have a column name
> > for each unique entry in the "fame" column.   Under each column
> > should be either the appropriate weight or na, if there is no match.
> > Thus, the end product should have column names:
> >
> > valley  plot   trt   18w   16iso  12:0, etc.
> >
> > Here is the toy script for the starting data in long form:
> >
> > dat <- data.frame(fame =  gl(4,1,10, labels = c( "18w", "16iso",
> > "12:0", "16w")), valley = gl(2,6,10, labels = c("H", "M")), plot =
> > gl(5, 2, 10), trt = gl(2,1,10, labels = c("e", "g")), weight =
> > 1000*runif(10, 0, 1))
> >
> > Thank you for your assistance.
> >
> > Toby
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Reshape

2010-09-27 Thread Toby Gass

Hello, helpeRs, 

I've been trying, unsuccessfully, to change a dataframe from long to 
wide format using reshape (the original).  I would appreciate it if 
someone could demonstrate the correct syntax.  The script below will 
create a toy example.  The new wide data should have a column name 
for each unique entry in the "fame" column.   Under each column 
should be either the appropriate weight or na, if there is no match.  

Thus, the end product should have column names:

valley  plot   trt   18w   16iso  12:0, etc.

Here is the toy script for the starting data in long form:

dat <- data.frame(fame =  gl(4,1,10, labels = c( "18w", "16iso", 
"12:0", "16w")), valley = gl(2,6,10, labels = c("H", "M")), plot = 
gl(5, 2, 10), trt = gl(2,1,10, labels = c("e", "g")), weight = 
1000*runif(10, 0, 1))

Thank you for your assistance.

Toby

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Reshape

2010-09-27 Thread Toby Gass
Hello, helpeRs, 

I've been trying, unsuccessfully, to change a dataframe from long to 
wide format using reshape (the original).  I would appreciate it if 
someone could demonstrate the correct syntax.  The script below will 
create a toy example.  The new wide data should have a column name 
for each unique entry in the "fame" column.   Under each column 
should be either the appropriate weight or na, if there is no match.  
Thus, the end product should have column names:

valley  plot   trt   18w   16iso  12:0, etc.

Here is the toy script for the starting data in long form:

dat <- data.frame(fame =  gl(4,1,10, labels = c( "18w", "16iso", 
"12:0", "16w")), valley = gl(2,6,10, labels = c("H", "M")), plot = 
gl(5, 2, 10), trt = gl(2,1,10, labels = c("e", "g")), weight = 
1000*runif(10, 0, 1))

Thank you for your assistance.

Toby

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] interpreting date-related error message

2010-08-27 Thread Toby Gass
Thanks to everyone for the explanations.

Toby

On 27 Aug 2010 at 12:46, Phil Spector wrote:

> Toby -
>  Since dat$doy is just a number, the default S3 method
> for format is used, where the second argument is the trim
> parameter.  I suspect you are confusing format (which is for
> output) with strptime (which is for input).
>   For example,
> 
> strptime(dat$doy,'%j')
> 
> will assume that the dates are in the current year, and 
> return a POSIXlt object.  Alternatively, you could pass
> an origin to as.Date:
> 
> as.Date(dat$doy,origin='2009-12-31')
> 
> to get a similar Date object.
> 
>   - Phil
> 
> 
> On Fri, 27 Aug 2010, Toby Gass wrote:
> 
> > Hello, helpeRs,
> >
> > I have a vector of numbers from 1-365 (days of the year) that I would
> > like to convert to a date.  There are no NA's and no missing values.
> > I did not insert leading zero's for numbers less than 100.
> >
> > Using the syntax:
> >
> > dat$doy.1 <- as.numeric(format(dat$doy, "%j" ))
> >
> > I get the following error message:
> >
> > Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width,
> > 3L,  :
> >  invalid 'trim' argument
> >
> > .What is the error message telling me?
> > (Windows OS and R 2.11.1)
> >
> >
> > Thank you.
> >
> > Toby
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] interpreting date-related error message

2010-08-27 Thread Toby Gass
Hello, helpeRs,

I have a vector of numbers from 1-365 (days of the year) that I would 
like to convert to a date.  There are no NA's and no missing values. 
I did not insert leading zero's for numbers less than 100.

Using the syntax:

dat$doy.1 <- as.numeric(format(dat$doy, "%j" ))

I get the following error message:
  
Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 
3L,  : 
  invalid 'trim' argument

.What is the error message telling me?
(Windows OS and R 2.11.1)


Thank you.

Toby

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] syntax for batching rbind process

2010-08-18 Thread Toby Gass
It works perfectly now.  Thank you all.

Toby

On 18 Aug 2010 at 15:04, Erik Iverson wrote:

> 
> 
> Toby Gass wrote:
> > Thank you for the suggestions for the more efficient code.  The 
> > problem remains, however, that the final dataframe does not contain 
> > the correct values.  So, in the case of the code you suggested, 
> > 
> > imp <- lapply(test, read.csv)
> > do.call(rbind, imp)
> > 
> > imp does contain all the data from each dataframe, and the data from 
> > each csv can be accessed with a single bracket index, but the do.call 
> > does not work, possibly because rbind doesn't work on a list??  
> > 
> 
> I think that syntax looks OK. What error are you actually getting?
> 
> > Any additional suggestions will be happily tested.  I'm still 
> > figuring out how to create a functionally equivalent toy example.
> 
> Toy example that can replicate error would be perfect. You can always
> just ?dput a subset of imp, say the first few elements if there are
> many.
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] syntax for batching rbind process

2010-08-18 Thread Toby Gass
Thank you for the suggestions for the more efficient code.  The 
problem remains, however, that the final dataframe does not contain 
the correct values.  So, in the case of the code you suggested, 

imp <- lapply(test, read.csv)
do.call(rbind, imp)

imp does contain all the data from each dataframe, and the data from 
each csv can be accessed with a single bracket index, but the do.call 
does not work, possibly because rbind doesn't work on a list??  

Any additional suggestions will be happily tested.  I'm still 
figuring out how to create a functionally equivalent toy example.

Thank you.

Toby


On 18 Aug 2010 at 13:49, Erik Iverson wrote:

> 
> 
> Toby Gass wrote:
> > Dear helpeRs,
> > 
> > I am attempting to read in a series of csv files so I can bind them 
> > into one large dataframe.  I have written the following script:
> > 
> > test <- list.files(".", pattern = "csv")  #lline 1
> > imp <- list()#line 2
> > for (i in 1:length(test)) {#line 3
> > imp[i] <- read.csv(test[i])  #line 4
> > }#line 5
> > works <- do.call(rbind, imp)  #line 6
> > write.csv(works, "allmet.csv")   #line 7
> > 
> > This script has an error at line 4.  imp[i] contains only the value 
> > of the first element of test[i]; in other words, every element of 
> > imp[i] equals test[i] [1,1].  Otherwise, the script works.  Could 
> > someone please enlighten me as to the correct syntax for line 4?
> 
> Just use lapply instead of a loop, easier syntax.
> 
> imp <- lapply(test, read.csv)
> do.call(rbind, imp)
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] syntax for batching rbind process

2010-08-18 Thread Toby Gass
Dear helpeRs,

I am attempting to read in a series of csv files so I can bind them 
into one large dataframe.  I have written the following script:

test <- list.files(".", pattern = "csv")  #lline 1
imp <- list()#line 2
for (i in 1:length(test)) {#line 3
imp[i] <- read.csv(test[i])  #line 4
}#line 5
works <- do.call(rbind, imp)  #line 6
write.csv(works, "allmet.csv")   #line 7

This script has an error at line 4.  imp[i] contains only the value 
of the first element of test[i]; in other words, every element of 
imp[i] equals test[i] [1,1].  Otherwise, the script works.  Could 
someone please enlighten me as to the correct syntax for line 4?

Thank you in advance.

Toby

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] conditional selection of dataframe rows

2010-08-12 Thread Toby Gass
Hi,

I do want to look only at slope.
If there is one negative slope measurement  for a given day and a 
given chamber, I would like to remove all other slope measurements 
for that day and that chamber, even if they are positive.  

On one day, I will have 20 slope measurements for each chamber.  If 
one is negative, I would like to delete the other 19 for that chamber 
on that day, even if they are positive.  I have measurements for 
every day of the year, for 4 years and multiple chambers.  

I know I could make some awful nested loop with a vector of day and 
chamber numbers for each occurrence of a negative slope and then run 
that against the whole data set but I hope not to have to do that.

Here is the rationale, if that helps.  These are unattended outdoor 
chambers that measure soil carbon efflux.  When the numbers go 
negative during part of the day but otherwise look normal, it usually 
means a plant has sprouted in the chamber and is using the carbon 
dioxide.  That means the measurements are all lower than they should 
be and I need to discard all measurements collected on that day, 
whether positive or negative.

It might have been a little clearer if I'd make the toy dataframe a 
bit larger.  

Thanks again for the assistance.

Toby



On 12 Aug 2010 at 16:39, David Winsemius wrote:

> 
> On Aug 12, 2010, at 4:06 PM, Toby Gass wrote:
> 
> > Thank you all for the quick responses.  So far as I've checked,
> > Marc's solution works perfectly and is quite speedy.  I'm still
> > trying to figure out what it is doing. :)
> >
> > Henrique's solution seems to need some columns somewhere.  David's
> > solution does not find all the other measurements, possibly with
> > positive values, taken on the same day.
> 
> I assumed you only wanted to look at what appeared to be a data  
> column, SLOPE. If you want to look at all columns for negatives then  
> try:
> 
> toy[ which( apply(toy, 1, function(x) all(x >= 0)) ), ]  # or
> toy[ apply(toy, 1, function(x) all(x >= 0)) , ]
> 
> This is how they differ w,r,t, their handling of NA's.
> 
>  > toy[3,2] <- NA
>  > toy[ apply(toy, 1, function(x) all(x >= 0)) , ]
> CH DAY SLOPE
> 1   3   4   0.2
> 2   4   4   0.3
> NA NA  NANA
> 4   3   4   0.5
> 5   4   4   0.6
> 6   5   5   0.2
> 7   3   5   0.1
> 8   4   5   0.0
>  > toy[ which(apply(toy, 1, function(x) all(x >= 0)) ), ]
>CH DAY SLOPE
> 1  3   4   0.2
> 2  4   4   0.3
> 4  3   4   0.5
> 5  4   4   0.6
> 6  5   5   0.2
> 7  3   5   0.1
> 8  4   5   0.0
> 
> 
> >
> > Thank you again for your efforts.
> >
> > Toby
> >
> > On 12 Aug 2010 at 14:32, Marc Schwartz wrote:
> >
> >> On Aug 12, 2010, at 2:24 PM, Marc Schwartz wrote:
> >>
> >>> On Aug 12, 2010, at 2:11 PM, Toby Gass wrote:
> >>>
> >>>> Dear helpeRs,
> >>>>
> >>>> I have a dataframe (14947 x 27) containing measurements collected
> >>>> every 5 seconds at several different sampling locations.  If one
> >>>> measurement at a given location is less than zero on a given day, I
> >>>> would like to delete all measurements from that location on that  
> >>>> day.
> >>>>
> >>>> Here is a toy example:
> >>>>
> >>>> toy <- data.frame(CH = rep(3:5,3), DAY = c(rep(4,5), rep(5,4)),
> >>>> SLOPE = c(seq(0.2,0.6, .1),seq(0.2, -0.1, -0.1)))
> >>>>
> >>>> In this example, row 9 has a negative measurement for Chamber 5,  
> >>>> so I
> >>>> would like to delete row 6, which is the same Chamber on the same
> >>>> day, but not row 3, which is the same chamber on a different  
> >>>> day.  In
> >>>> the full dataframe, there are, of course, many more days.
> >>>>
> >>>> Is there a handy R way to do this?
> >>>>
> >>>> Thank you for the assistance.
> >>>>
> >>>> Toby
> >>>
> >>>
> >>>
> >>> Not fully tested, but here is one possibility:
> >>>
> >>>> toy
> >>> CH DAY SLOPE
> >>> 1  3   4   0.2
> >>> 2  4   4   0.3
> >>> 3  5   4   0.4
> >>> 4  3   4   0.5
> >>> 5  4   4   0.6
> >>> 6  5   5   0.2
> >>> 7  3   5   0.1
> >>> 8  4   5   0.0
> >>> 9  5   5  -0.1
> >>>
> >>>
> >>>> subset(toy, ave(SLOPE, CH, DAY, FUN = function(x) any(x < 0)) == 0)
> >>> CH D

Re: [R] conditional selection of dataframe rows

2010-08-12 Thread Toby Gass
Thank you all for the quick responses.  So far as I've checked, 
Marc's solution works perfectly and is quite speedy.  I'm still 
trying to figure out what it is doing. :)

Henrique's solution seems to need some columns somewhere.  David's 
solution does not find all the other measurements, possibly with 
positive values, taken on the same day.

Thank you again for your efforts.

Toby

On 12 Aug 2010 at 14:32, Marc Schwartz wrote:

> On Aug 12, 2010, at 2:24 PM, Marc Schwartz wrote:
> 
> > On Aug 12, 2010, at 2:11 PM, Toby Gass wrote:
> > 
> >> Dear helpeRs,
> >> 
> >> I have a dataframe (14947 x 27) containing measurements collected 
> >> every 5 seconds at several different sampling locations.  If one 
> >> measurement at a given location is less than zero on a given day, I 
> >> would like to delete all measurements from that location on that day.
> >> 
> >> Here is a toy example:
> >> 
> >> toy <- data.frame(CH = rep(3:5,3), DAY = c(rep(4,5), rep(5,4)), 
> >> SLOPE = c(seq(0.2,0.6, .1),seq(0.2, -0.1, -0.1)))
> >> 
> >> In this example, row 9 has a negative measurement for Chamber 5, so I 
> >> would like to delete row 6, which is the same Chamber on the same 
> >> day, but not row 3, which is the same chamber on a different day.  In 
> >> the full dataframe, there are, of course, many more days.
> >> 
> >> Is there a handy R way to do this?
> >> 
> >> Thank you for the assistance.
> >> 
> >> Toby
> > 
> > 
> > 
> > Not fully tested, but here is one possibility:
> > 
> >> toy
> >  CH DAY SLOPE
> > 1  3   4   0.2
> > 2  4   4   0.3
> > 3  5   4   0.4
> > 4  3   4   0.5
> > 5  4   4   0.6
> > 6  5   5   0.2
> > 7  3   5   0.1
> > 8  4   5   0.0
> > 9  5   5  -0.1
> > 
> > 
> >> subset(toy, ave(SLOPE, CH, DAY, FUN = function(x) any(x < 0)) == 0)
> >  CH DAY SLOPE
> > 1  3   4   0.2
> > 2  4   4   0.3
> > 3  5   4   0.4
> > 4  3   4   0.5
> > 5  4   4   0.6
> > 7  3   5   0.1
> > 8  4   5   0.0
> 
> 
> This can actually be slightly shortened to:
> 
> > subset(toy, !ave(SLOPE, CH, DAY, FUN = function(x) any(x < 0)))
>   CH DAY SLOPE
> 1  3   4   0.2
> 2  4   4   0.3
> 3  5   4   0.4
> 4  3   4   0.5
> 5  4   4   0.6
> 7  3   5   0.1
> 8  4   5   0.0
> 
> 
> HTH,
> 
> Marc
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] conditional selection of dataframe rows

2010-08-12 Thread Toby Gass
Dear helpeRs,

I have a dataframe (14947 x 27) containing measurements collected 
every 5 seconds at several different sampling locations.  If one 
measurement at a given location is less than zero on a given day, I 
would like to delete all measurements from that location on that day.

Here is a toy example:

toy <- data.frame(CH = rep(3:5,3), DAY = c(rep(4,5), rep(5,4)), 
SLOPE = c(seq(0.2,0.6, .1),seq(0.2, -0.1, -0.1)))

In this example, row 9 has a negative measurement for Chamber 5, so I 
would like to delete row 6, which is the same Chamber on the same 
day, but not row 3, which is the same chamber on a different day.  In 
the full dataframe, there are, of course, many more days.

Is there a handy R way to do this?

Thank you for the assistance.

Toby

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] extracting values conditonal on other values

2010-03-03 Thread Toby Gass
Dear R helpers,

I have a dataframe (test1) containing the time of sunrise and sunset for each 
day of the year 
for 3 years.  I have another dataframe (test2) containing measurements that are 
taken every 
15 minutes, 24/7. I would like to extract all rows from test2 that occur 
between sunrise and 
sunset for the appropriate date.  Can you suggest a good vectorized way to do 
this?  Keep in 
mind that the sunrise/sunset dataframe has 1 row for each day, and the 
measurement 
dataset has 96 rows for each day.  I'm hoping not to have to match strings...

The times (test1$rise, test1$set, and test2$time) in the example are rather 
ugly since I wasn't 
sure how to generate a random hourly time series.  I would also use a standard 
date format 
for the real thing but, again, wasn't sure how to generate dates for this 
example.

Example data:

test1 <- data.frame(year = gl(3, 30, 90, labels = c("2006", "2007", "2008")),
month =  gl(3, 10, 30, labels = c("1", "2", "3")),
day = rep(c(21:30, 19:28, 22:31),3),
rise = as.integer(runif(90, 700, 750)),
set = as.integer(runif(90, 1630,1745)))


test2 <- data.frame(year = gl(3, 2880, 8640, labels = c("2006", "2007", 
"2008")),
month = gl(3, 96, 288, labels = c("1", "2", "3")),
day = rep(c(21:30, 19:28, 22:31),3, each = 96),
time = 100*rep(seq(, 23.75,by= .25),90),
temp = runif(8640, -5, 15))

Thank you in advance,

Toby

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Error message: Bad value

2008-06-24 Thread Toby Gass
Thank you for the response.  I was doing a basic operation 
with a small dataset and am (fortunately for me) unable to 
reproduce the error.  After restarting R, without shutting 
down anything else, there was no error.  I thought I would 
post, however, since 2 others had reported the same problem 
in the past year.

Toby

- Original Message - 
From: "Duncan Murdoch" <[EMAIL PROTECTED]>
To: "Toby Gass" <[EMAIL PROTECTED]>
Cc: 
Sent: Tuesday, June 24, 2008 6:27 PM
Subject: Re: [R] Error message: Bad value


| On 24/06/2008 3:12 PM, Toby Gass wrote:
| > Dear R help,
| >
| > In the middle of my session, I started receiving the 
error
| > message "bad value"
| > regardless of what I entered.  I had to close R and 
restart
| > it.  When the error
| > occurred, I was creating basic lattice plots, with no 
other
| > add-on packages running.
| > I am running R through John Fox's XEmacs interface, 
XEmacs
| > version
| > 21.4.20 on a Windows XP Pro machine with 2 GB of RAM.  I
| > have had
| > no other problems.  I've found 2 similar reports in the
| > R-help
| > archive,
| > neither of which was resolved; one of the earlier 
posters
| > was running Linux.
|
| That message is probably being printed in response to 
memory corruption.
|
| > platform i386-pc-mingw32
| > arch i386
| > os mingw32
| > system i386, mingw32
| > status
| > major 2
| > minor 6.2
|
| That version is a little old; 2.7.1 was just released.  If 
you can make
| the error reproducible in a current version (or even in 
2.6.2), it would
| be very helpful to post the recipe, and it will probably 
get fixed.
|
| Duncan Murdoch
|
|
| > year 2008
| > month 02
| > day 08
| > svn rev 44383
| > language R
| > version.string R version 2.6.2 (2008-02-08)
| >
| > Previous reports are found here:
| > 
http://tolstoy.newcastle.edu.au/R/e4/help/08/01/0686.html
| > 
http://tolstoy.newcastle.edu.au/R/e2/help/07/06/19095.html
| >
| > I do not need a response, unless there is a preventative
| > measure,
| > but thought I would bring this to your attention.
| >
| > Thank you,
| >
| > Toby
| >
| > Toby Gass
| > Graduate Degree Program in Ecology
| > Department of Forest, Rangeland, and Watershed 
Stewardship
| > Warner College of Natural Resources
| > Colorado State University
| > Fort Collins, CO  80523
| >
| > __
| > R-help@r-project.org mailing list
| > https://stat.ethz.ch/mailman/listinfo/r-help
| > PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
| > and provide commented, minimal, self-contained, 
reproducible code.
|

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Error message: Bad value

2008-06-24 Thread Toby Gass
Dear R help,

In the middle of my session, I started receiving the error
message "bad value"
regardless of what I entered.  I had to close R and restart
it.  When the error
occurred, I was creating basic lattice plots, with no other
add-on packages running.
I am running R through John Fox's XEmacs interface, XEmacs
version
21.4.20 on a Windows XP Pro machine with 2 GB of RAM.  I
have had
no other problems.  I've found 2 similar reports in the 
R-help
archive,
neither of which was resolved; one of the earlier posters
was running Linux.

platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 6.2
year 2008
month 02
day 08
svn rev 44383
language R
version.string R version 2.6.2 (2008-02-08)

Previous reports are found here:
http://tolstoy.newcastle.edu.au/R/e4/help/08/01/0686.html
http://tolstoy.newcastle.edu.au/R/e2/help/07/06/19095.html

I do not need a response, unless there is a preventative
measure,
but thought I would bring this to your attention.

Thank you,

Toby

Toby Gass
Graduate Degree Program in Ecology
Department of Forest, Rangeland, and Watershed Stewardship
Warner College of Natural Resources
Colorado State University
Fort Collins, CO  80523

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] nested time series data with measurement error

2008-04-23 Thread Toby Gass
Dear R helpers,

I am trying to fit a model with the main objective of
assessing differences, rather than predicting.
The treatment was applied to half of the subjects after 9
months of measurement.
Then 9 more months of data were collected. The variable
"month" has measurement error
due to the complexities of data collection.
The dependent variable is numeric and continuous.
This would be a simple difference between means were it not
for the repeated
measurements and measurement error.

I am wondering what the R gurus suggest as to which R
function might best model
these data.  I have been looking at tsls (two-stage least
squares) in the sem package
and pls (partial least squares).  I am not sure about their
compatibility with repeated
measurements and time series.  The response curve is also
likely to be non-linear.

The following script approximates the data, including sample
size.  In the real data, there are 18 months spread out over 
a
36 month period.

#generate data

tree<- gl(6,18,label = paste("tree",1:6))
month <- gl(18,1,length = 108,label = paste("month",1:18),
ordered = TRUE)
trtmt <- gl(2, 54, length = 108, label = paste("trt",1:2))
pre.post <- gl(2,9,length = 108,  label = c("pre","post"))
response <- runif(108, min = -28, max = -25)
help <- data.frame(tree,month,trtmt,pre.post, response)


Thank you in advance for your assistance.

Toby Gass

Graduate Degree Program in Ecology
Department of Forest, Rangeland, and Watershed Stewardship
Warner College of Natural Resources
Colorado State University
Fort Collins, CO  80523
email: [EMAIL PROTECTED]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.