search for: mi2kelgrum

Displaying 20 results from an estimated 31 matches for "mi2kelgrum".

2007 Dec 30
3
Date formats
Is the following expected behaviour for a date used in an ifelse function? > date <- Sys.Date() > date [1] "2007-12-30" > ifelse(TRUE, date-1, date) [1] 13876 > ifelse(FALSE, date-1, date) [1] 13877 > ifelse(TRUE, as.character(date-1), date) [1] "2007-12-29" > if (TRUE) {date} [1] "2007-12-30" It would seem more natural to me if a date produced
2006 Jan 27
3
substituting an object not found
Is there any function in R like is.not.found(x, y) meaning if you can't find object x, then use object y?? Mikkel Grum
2010 Dec 28
4
batch file output
I run a batch file with the following command in Windows XP: C:\R\R-2.12.1\bin\Rterm.exe --no-save --no-restore <C:\users\me\file.R> C:\users\me\file.out 2>&1 Is there any way to get only the output of R in file.out, without getting all the code from file.R too? Any help greatly appreciated, Mikkel
2005 Jun 01
3
x[x$a=="q",,drop=TRUE]
I'm trying to select a subset of a dataframe while dropping some factors. While the dataset gets smaller all Factor levels remain and I need to get rid of them. Strangely enough, I am almost certain that the same code on the same data worked OK earlier today - and it is not the first time that I'm not able to replicate earlier results with this command (I know, I might just be going
2004 Aug 22
1
latitude longitude data
Dear R-helpers, I get GPS readings with bug counts (bugs meaning insects in this case) made along rows in crop fields and use these to make maps of bug distribution. The GPS readings are not quite accurate enough for my purpose, so since I know what row each reading is made in, I adjust the latitudinal coordinate using: grd<-lm(lat~lon+Row,data)
2004 Dec 21
1
scheduling R tasks under windows
I'm trying to schedule R tasks in Windows Server 2003. I can run the following from the DOS prompt without any difficulty: c:\Reports>c:\r\rw2001\bin\rterm.exe --no-restore --no-save <test.R> test.out where test.r has two lines: library(tools); Sweave("rlr.Rnw"). When I try to run the same from the task scheduler, I fill in the dialogue box as follows: Run:
2006 Jan 02
1
"7:9, 12:14" in dataframe to c(7:9, 12:14)
I want to do something like df[df$b %in% df2[i, 2], ] where df$b is a numeric vector and df2[i, 2] is a factor with levels like "7:9, 12:14". For example: a <- c(paste("A", 1:10, sep = ""), paste("B", 1:10, sep = "")) b <- 1:20 df <- as.data.frame(cbind(a, b)) df$b <- as.numeric(levels(df$b))[as.integer(df$b)] f <-
2004 Dec 31
2
Supressing empty sections with Sweave
Dear useRs, I'm writing regular survey reports using Sweave. Each report has several sections along the lines of: \section*{Disease X} <<MapX,fig=TRUE,echo=FALSE>>= image(vectorx,vectory,matrixz) @ Notes with or without Sexpr{a}. \vfill \pagebreak \section*{Disease Y} <<MapY,fig=TRUE,echo=FALSE>>= ...etc. Often one or more of the diseases is not observed (all
2007 Aug 07
2
backslash c
How do I get output with "\color{blue}", i.e. with only one backslash??? > "\color{blue}" [1] "color{blue}" Warning messages: 1: '\c' is an unrecognized escape in a character string 2: unrecognized escape removed from "\color{blue}" > "\\color{blue}" [1] "\\color{blue}" > Any help greatly appreciated. Best regards,
2011 Sep 12
1
Superimposing titles on dotcharts
I've created a chart with times that employees have entered data on named tasks as in the following example: Employee <- c(rep("Tom", 127),? rep("Dick", 121),? rep("Sally", 130) ) Time <- c(seq(as.POSIXct("2011-09-12 07:00:00"), as.POSIXct("2011-09-12 14:00:00"), 200), seq(as.POSIXct("2011-09-12 07:00:00"),
2011 Sep 07
1
process id of an R script
I have a script that runs as a cron job every minute (on Ubuntu 10.10 and R 2.11.1), querying a database for new data. Most of the time it takes a few seconds to run, but once in while it takes more than a minute and the next run starts (on the same data) before the previous one has finished. In extreme cases this will fill up memory with a large number of runs of the same script on the same data.
2011 May 02
2
INSERT OR UPDATE
I'm trying to insert rows of a data.frame into a database table, or update where the key fields of a record already exist in the table. I've come up with a possible solution below, but would like to hear if anyone has a better solution. # The problem demonstrated: # Create a data.frame with test values library(RODBC) tbl <- data.frame( key1 = rep(1:3, each = 2), key2 =
2007 Nov 24
2
truncated fields with RODBC
I'm changing some functions from storing data in SQLite (using RSQLite) to storing it in PostgreSQL (using RODBC). When trying to store very long character fields I get the following message: > sqlSave(pg, Grids, rownames = FALSE, append = TRUE) Warning messages: 1: In odbcUpdate(channel, query, mydata, paramdata, test = test, verbose = verbose, : character data truncated in column
2004 Jun 01
1
converting text coordinates to decimal degrees
I receive GPS readings in a text string such as "0121.6723S 03643.6893E" and need the coordinates as decimal degrees in two separate variables: "-1.361205" and "36.728155". How do I do this in R? mikkel
2004 Aug 22
1
data files for packages
Dear R-helpers, This must be really simple and clearly expained somewhere, but I can't find it. I'm writing an R-package and want to create data sets for the examples. How do I save them in the format needed for a package? cheers, Mikkel
2004 Sep 01
2
RODBC query on one line
Dear R-helpers, When I use sqlQuery in the package RODBC, I cannot break the line, but have to write the entire SQL Query on the same line. Is this expected behaviour? It is definitely workable, but makes the queries a slightly difficult to read and edit. I'm using R 1.9.1 and RODBC 1.0-4 on Windows Server 2003 and querying a Sybase database. Best wishes, Mikkel
2005 Mar 03
1
image() z-values beyond zlim
Dear useRs, When plotting with image(), I would like the z-values that extend beyond the upper zlim to be indicated with one colour, or preferably with som sort of hatching, as I'm printing in black and white. By default these values just show up as blank areas in the image. I've tried all sorts of things, but nothing seems to work for me. Any solutions would be greatly appreciated.
2005 Mar 04
1
image size
Dear useRs, I'm working in R 2.0.1 for Windows and producing PDF files with Sweave. I seem to be hitting an image size ceiling of around 6.8 x 6.8 inches. I would like to produce taller images to make better use of my A4 page and have tried: <<TestMap, fig = TRUE, width = 6.5, height = 8 >>= par.old(fin = c(6.5, 8)) image(x, etc.) I get the message: Error in plot.new(): Figure
2005 Nov 02
2
readline() and Rterm in Windows
I'm running an R script in Rterm and would like the user to be prompted for input as in: id <- readline("Please enter ID: ") myfunction(id) . . . etc. This works when I run one line at a time in RGui, but not when I try to run the script in Rterm (I'm working with R 2.2.0 in Windows Server 2003). Is there any way to do this? Mikkel
2010 Feb 22
1
tickmarks with time in dotplots
Hi, I'm drawing lattice dotplots with time along the x-axis as in: C <-data.frame(c("A", "B"),Sys.time()+ rnorm(50)*3600) names(C) <- c("Name", "Time") dotplot(Name ~ Time, data = C, horizontal = TRUE) On my display, the x-axis shows tick marks every two hours. I would like to show something more frequent; at least every hour, possibly more