Re: [R] title of r plots

2015-02-27 Thread William Dunlap
plot(1,1,main=expression(-70*degree*C%+-%10*degree*C/Ambient)) Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Feb 27, 2015 at 7:27 PM, li li hannah@gmail.com wrote: Hi all, I would like to add -70°C ± 10°C/Ambient as the title of my plot. Could anyone give some help on this?

Re: [R] Substring replacement in string

2015-02-27 Thread Alrik Thiem
Many thanks. Unfortunately, I cannot work directly on these expressions since they’re only created from other strings. Would I first have to transform these strings to unevaluated expressions? Von: William Dunlap [mailto:wdun...@tibco.com] Gesendet: Freitag, 27. Februar 2015 23:39 An: Alrik

[R] title of r plots

2015-02-27 Thread li li
Hi all, I would like to add -70°C ± 10°C/Ambient as the title of my plot. Could anyone give some help on this? Thanks. Hanna [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] title of r plots

2015-02-27 Thread li li
Thanks very much. Also How do add an empty space when using expression()? When I do the following, it returns an error message. plot(1,1,main=expression(-70*degree*C%+-%10*degree*C/Ambient Condition)) Hanna 2015-02-27 23:03 GMT-05:00 William Dunlap wdun...@tibco.com:

Re: [R] Why does R replace all row values with NAs

2015-02-27 Thread Dimitri Liakhovitski
So, Duncan, do I understand you correctly: When I use x$x6, R doesn't know if it's TRUE or FALSE, so it returns a logical value of NA. When this logical value is applied to a row, the R says: hell, I don't know if I should keep it or not, so, just in case, I am going to keep it, but I'll replace

Re: [R] Save a list of list and search for values

2015-02-27 Thread Alaios via R-help
Hi,thanks all for the answer.I am using mclapply to call the lapply many times as needed. My function returns only a value if the fit is succesful.For testing if the fit is sucessfuly my code works like that

Re: [R] integrate with vector arguments

2015-02-27 Thread David Winsemius
On Feb 27, 2015, at 4:49 AM, marKo mton...@ffri.hr wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gee. That simple. I knew that! Thanks a lot. Essentially, I needed only the diagonal elements. Easily solved by: diag(outer( X=v1,Y=v2, FUN= fV) I am sure that there are

[R] Call R from Matlab

2015-02-27 Thread Julian Keil
Dear all, I have a Mac, OSX 10.7.5, run R 3.1.2 (2014-10-31) and Matlab R2013a (8.1.0.604). I try to call R from within Matlab to run a function in Batch mode. To do this, I followed this example: From: www.mathworks.com/matlabcentral/newsreader/view_thread/163726 In an m-file you would have:

[R] retrieving protein for swissport‏

2015-02-27 Thread Ron Flatau
I Try to run this script on order to get all the protein named Delta 9 acyl CoA desaturase. library(seqinr) choosebank(swissprot) D9aCd - query(Delta 9 acyl-CoA desaturase,KD=Delta 9 acyl-CoA desaturase) Nothing happen i be glad to know what i do wrong... Thnks [[alternative HTML

Re: [R] Save a list of list and search for values

2015-02-27 Thread Alaios via R-help
Sorry Jim I forgot to reply on what I am trying to do.I  have many data sets that contain some numbers: I am trying to fit those with a mixture distribution. For that I am using the mix function that returns me back the fitted parameters and the chi square (which is a first performance

Re: [R] integrate with vector arguments

2015-02-27 Thread marKo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yes. That's it. Thanks, a lot, really. Marko On 02/27/2015 02:46 PM, David Winsemius wrote: On Feb 27, 2015, at 4:49 AM, marKo mton...@ffri.hr wrote: Gee. That simple. I knew that! Thanks a lot. Essentially, I needed only the diagonal

Re: [R] Summing certain values within columns that satisfy a certain condition

2015-02-27 Thread Don McKenzie
Use Jeff’s solution. This doesn’t account for ties. On Feb 26, 2015, at 1:11 PM, Don McKenzie d...@u.washington.edu wrote: Kate — here is a transparent solution (tested but without NA treatment). Doubtless there are cleverer faster ones, which later posters will present. HTH #

[R] Why does R replace all row values with NAs

2015-02-27 Thread Dimitri Liakhovitski
I know how to get the output I need, but I would benefit from an explanation why R behaves the way it does. # I have a data frame x: x = data.frame(a=1:10,b=2:11,c=c(1,NA,3,NA,5,NA,7,NA,NA,10)) x # I want to toss rows in x that contain values =6. But I don't want to toss my NAs there.

Re: [R] Why does R replace all row values with NAs

2015-02-27 Thread Duncan Murdoch
On 27/02/2015 9:04 AM, Dimitri Liakhovitski wrote: I know how to get the output I need, but I would benefit from an explanation why R behaves the way it does. # I have a data frame x: x = data.frame(a=1:10,b=2:11,c=c(1,NA,3,NA,5,NA,7,NA,NA,10)) x # I want to toss rows in x that contain

[R] Variable Column Names and Lists

2015-02-27 Thread Brian Trautman
This should be a simple question, but I am at my wits end. dt-data.table(a=rep(1:10, 26), b=1:260, c=rep(1:2, 130)) sumvar - 'mysum' bvar - 'b' dt_min - dt[, list(sumvar = sum(get(bvar))), by=list(a)] print(dt_min) I want the function to return two variables, a and mysum. However, it instead

Re: [R] Call R from Matlab

2015-02-27 Thread William Dunlap
This usually has to do with the caller (Matlab) and the callee (R) being dynamically lined with different versions of dynamic libraries. On Linux I work around this sort of thing by setting LD_LIBRARY_PATH to exactly what I want when invoking R. E.g., instead of making the sh command

Re: [R] Why does R replace all row values with NAs

2015-02-27 Thread Dimitri Liakhovitski
Thank you very much, Duncan. All this being said: What would you say is the most elegant and most safe way to solve such a seemingly simple task? Thank you! On Fri, Feb 27, 2015 at 10:02 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 27/02/2015 9:49 AM, Dimitri Liakhovitski wrote: So,

Re: [R] Why does R replace all row values with NAs

2015-02-27 Thread William Dunlap
You could define functions like is.true - function(x) !is.na(x) x is.false - function(x) !is.na(x) !x and use them in your selections. E.g., x - data.frame(a=1:10,b=2:11,c=c(1,NA,3,NA,5,NA,7,NA,NA,10)) x[is.true(x$c = 6), ] a b c 7 7 8 7 10 10 11 10 Bill Dunlap

Re: [R] Summing certain values within columns that satisfy a certain condition

2015-02-27 Thread David L Carlson
Here is another approach maxv - apply(df, 2, max) # Get the column maximums maxv0 - ifelse(maxv == 0, -1, maxv) # Replace 0 maximums with -1 Sum - rowSums(sweep(df, 2, maxv0, ==)) data.frame(df, Sum) A B C D Sum 1 0 1 0 7 1 2 0 2 0 7 1 3 0 3 0 7 1 4 0 4 0 7 1 5 0 1 0 0 0 6

Re: [R] Why does R replace all row values with NAs

2015-02-27 Thread Duncan Murdoch
On 27/02/2015 10:27 AM, Dimitri Liakhovitski wrote: Thank you very much, Duncan. All this being said: What would you say is the most elegant and most safe way to solve such a seemingly simple task? If you have NA values, test for them explicitly, e.g. your original x[(x$c6) | is.na(x$c),]

[R] Reading in an XLS (really XML) file from website

2015-02-27 Thread Bos, Roger
All, I am trying to read the SP 500 constituents from the iShares website using the following code: URL - http://www.ishares.com/us/239726/fund-download.dl; setInternet2(TRUE) download.file(url=URL, destfile=temp.xls) out - readWorksheetFromFile(file=temp.xls, sheet=Holdings,

Re: [R] Why does R replace all row values with NAs

2015-02-27 Thread Duncan Murdoch
On 27/02/2015 9:49 AM, Dimitri Liakhovitski wrote: So, Duncan, do I understand you correctly: When I use x$x6, R doesn't know if it's TRUE or FALSE, so it returns a logical value of NA. Yes, when x$x is NA. (Though I think you meant x$c.) When this logical value is applied to a row, the R

Re: [R] Why does R replace all row values with NAs

2015-02-27 Thread Dimitri Liakhovitski
Thank you very much guys! On Fri, Feb 27, 2015 at 11:04 AM, William Dunlap wdun...@tibco.com wrote: You could define functions like is.true - function(x) !is.na(x) x is.false - function(x) !is.na(x) !x and use them in your selections. E.g., x -

Re: [R] Variable Column Names and Lists

2015-02-27 Thread Duncan Murdoch
On 27/02/2015 1:18 PM, Brian Trautman wrote: This should be a simple question, but I am at my wits end. dt-data.table(a=rep(1:10, 26), b=1:260, c=rep(1:2, 130)) sumvar - 'mysum' bvar - 'b' dt_min - dt[, list(sumvar = sum(get(bvar))), by=list(a)] print(dt_min) I want the function to

Re: [R] Reading in an XLS (really XML) file from website

2015-02-27 Thread Raghuraman Ramachandran
This works: Change the destination directory to suit you. MyURL1 = http://www.ishares.com/us/239726/fund-download.dl; download.file(MyURL1,paste(C:/Data/Rtest1,date1,r.xls,sep=),method=wget,quiet=TRUE,mode=wb, extra=--header=\User-Agent: Mozilla/5.0 (X11; Linux x86_64;

[R] Using R for agent based modeling

2015-02-27 Thread Wall, Wade A ERDC-RDE-CERL-IL
Hi all, I am wanting to model some patch dynamics using raster objects in R and am trying to figure out the best way to do it. I want to treat each patch (pixel, cell, grid) and assign multiple attributes (for example biomass, temperature, precipitation, etc). I know that I can do this using

Re: [R] Variable Column Names and Lists

2015-02-27 Thread Brian Trautman
This worked perfectly, thank you! On Fri, Feb 27, 2015 at 10:47 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 27/02/2015 1:18 PM, Brian Trautman wrote: This should be a simple question, but I am at my wits end. dt-data.table(a=rep(1:10, 26), b=1:260, c=rep(1:2, 130)) sumvar -

Re: [R] Reading in an XLS (really XML) file from website

2015-02-27 Thread John McKown
On Fri, Feb 27, 2015 at 10:01 AM, Bos, Roger roger@rothschild.com wrote: All, I am trying to read the SP 500 constituents from the iShares website using the following code: URL - http://www.ishares.com/us/239726/fund-download.dl; setInternet2(TRUE) download.file(url=URL,

Re: [R] Schedule R function/Code to run at specific time

2015-02-27 Thread Rolf Turner
What ***on earth does the content of your message have to do with the subject line? Get your expletive deleted act together if you want to ask a question of this list!!! cheers, Rolf Turner On 27/02/15 08:40, macfire wrote: I have a problem with statistics, I think this forum is not

Re: [R] Substring replacement in string

2015-02-27 Thread William Dunlap
If your string will always represent an R expression, you could work with the expression directly with functions like all.names() and substitute(). f - function (expr) { toReplace - setdiff(all.names(expr), c(pmin, pmax)) toReplace - grep(value = TRUE, [a-z], toReplace)

Re: [R] integrate with vector arguments

2015-02-27 Thread marKo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gee. That simple. I knew that! Thanks a lot. Essentially, I needed only the diagonal elements. Easily solved by: diag(outer( X=v1,Y=v2, FUN= fV) I am sure that there are simpler options, but that works like a charm. Thanks a lot. Cheers, Marko

[R] Substring replacement in string

2015-02-27 Thread Alrik Thiem
Dear R-help list, I would like to replace all lower-case letters in a string that are not part of certain fixed expressions. For example, I have the string: pmin(pmax(pmin(x1, X2), pmin(X3, X4)) == Y, pmax(Z1, z1)) Where I would like to replace all lower-case letters that do not belong to the

[R] Online courses in R from Statistics.com

2015-02-27 Thread Janet Dobbins
Perhaps you could circulate this? *Online courses in R from Statistics.com* *Basic​ programming​ courses: * - R Programming - Intro 1 http://www.statistics.com/R-Prog-Intro-1 (Dr. Paul Murrell, instructor - core development team for R and author of *R Graphics *and *Introduction to Data