Re: [R] reshape a data frame

2015-06-03 Thread javascriptart25
You can change ex <- data.frame("gIN" = gIN, "bc1" = bc1, "bc2"=bc2, "group" = group) to ex <- data.frame("gIN" = c(gIN,gIN), "bcX" = c(bc1,bc2), "group" = c(group,group)) On Wed, Jun 3, 2015 at 2:27 PM, hedelhusk [via R] < ml-node+s789695n4708145...@n4.nabble.com> wrote: > Hello, > > I would

[R] SVM error

2015-06-03 Thread Pijush Das
Dear Sir, I have converted the data into numeric as the function read.excel read the data file as a character (as it was said by David Meyer, maintainer of the package e1071) and after that run the function svm. Then another error is found there. The detail description of the code and error is giv

Re: [R] Save the result of map.market function to HTML file?

2015-06-03 Thread Jim Lemon
Hi valerio, Any chance of letting me know how "it didn't work out"? For example your code and the resulting error message. Jim On Wed, Jun 3, 2015 at 10:32 PM, valerio orfano wrote: > Hi Jim and thanx. Unfortunately it didn’t work out!! > > any other help? > > rgds valerio > On 03 Jun 2015, at

Re: [R] SVM error.

2015-06-03 Thread Jim Lemon
Hi Pijush, As before, please keep the messages on the mailing list. In your example above you have not defined "y", so the function is probably complaining about being passed a NULL for the dependent variable. I forgot to add in my previous message that I imported your data by exporting it from XLS

Re: [R] pairwise.t.test non numeric factors error

2015-06-03 Thread peter dalgaard
> On 03 Jun 2015, at 22:05 , Erica Cseko Nolasco wrote: > > I tried using TRUE instead T, but it gave me the same error. (Script on the > bottom) > I really want a paired test and it seems to give me as we can see on the > following matrix. > No idea what is happening > I get the impression

Re: [R] reshape a data frame

2015-06-03 Thread Jon BR
I found the gather function from the tidyr package, which worked nicely: gather(ex,bcX,value, bc1:bc2) gIN group bcX value 1 A_1 A bc1 1219.79 2 A_2 A bc1 1486.84 3 A_3 A bc1 1255.80 4 A_4 A bc1 941.87 5 B_1 B bc1 588.19 6 B_2 B bc1

Re: [R] reshape a data frame

2015-06-03 Thread John Kane
And I think this will do it too. library(reshape2) melt(ex, id.vars= c("gIN", "group"), variable.name = "bc", value.name = "value", na.rm = FALSE) John Kane Kingston ON Canada > -Original Message- > From: jonsle...@gmail.com > Sent: Wed, 3 Jun 2015 18:25:02 -0

[R] reshape a data frame

2015-06-03 Thread Jon BR
Hello, I would like to ask for some advice in reformatting a data frame such as the following one: gIN <- c("A_1","A_2","A_3","A_4","B_1","B_2") bc1 <- c(1219.79, 1486.84, 1255.80, 941.87, 588.19, 304.02) bc2 <- c(319.79, 186.84, 125.80, 94.87, 1008.19, 314.02) group <- c("A","A","A","A","B","B"

Re: [R] pairwise.t.test non numeric factors error

2015-06-03 Thread Erica Cseko Nolasco
I tried using TRUE instead T, but it gave me the same error. (Script on the bottom) I really want a paired test and it seems to give me as we can see on the following matrix. No idea what is happening > pairwise.t.test(x = data$tss,data$pa,p.adjust.method = 'bonferroni',paired=TRUE) Error in compl

Re: [R] pairwise.t.test non numeric factors error

2015-06-03 Thread peter dalgaard
> On 03 Jun 2015, at 19:14 , Erica Cseko Nolasco wrote: > > Thanks Jim, > > I removed the corresponding cases and tried again. What I discovery now is > if I run the function without paired = T (pairwise.t.test(x = > data$tss,data$pa) is works. However, if I add the paired = T > (pairwise.t.tes

Re: [R] Greek letters with subscript numbers on x-axis

2015-06-03 Thread William Dunlap
You can use labels=as.expression(lapply(1:9, function(i)bquote(hat(lambda)[.(i)]))) Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, Jun 3, 2015 at 12:39 PM, Frank S. wrote: > Hi everyone, I have allocated greek letters with subscript numbers on > x-axis of my R plot this way: > plot(10

Re: [R] pairwise.t.test non numeric factors error

2015-06-03 Thread Michael Dewey
Just to be on the safe side, what is T? It is recommended to use TRUE in case you set T to something else. I think this is very unlikely to solve the problem but it is worth trying. On 03/06/2015 18:14, Erica Cseko Nolasco wrote: Thanks Jim, I removed the corresponding cases and tried again.

[R] Greek letters with subscript numbers on x-axis

2015-06-03 Thread Frank S.
Hi everyone, I have allocated greek letters with subscript numbers on x-axis of my R plot this way: plot(10:18, 30:38, lwd=2, xlim=c(10,18), ylim=c(30,38), xaxt="n", xlab="weights", ylab="value") points(10:18, 30:38, pch=19) axis(1, at=10:18, labels=c(expression(hat(lambda)[1]), expression(ha

Re: [R] Adding legend

2015-06-03 Thread David Winsemius
On Jun 3, 2015, at 9:39 AM, John Wasige wrote: > ​Hello community, > > Could somebody help on how I can > ​add ​ > a legend to my heatmap plot. I need to know what values from the data do > colours ( "red","yellow", "yellowgreen","lightblue4") represent from the > data. The script is here below

Re: [R] Combining multiple probability weights for the sample() function.

2015-06-03 Thread Daniel Nordlund
On 6/3/2015 11:26 AM, Boris Steipe wrote: If letters 1 and 2 must be equal with p=0.5, and 1 and 3 must be equal with p=0.5, then letter 1 must be the same as either 2 or 3. Therefore: Choose a letter. Make a pair of (letter, (not letter)). Reverse the pair with p = 0.5 Concatenate your letter

Re: [R] R convert pdf/png to html

2015-06-03 Thread Bos, Roger
Valerio, Actually htmlize works pretty well. I used it for a long time. If you want to get the most help from this forum you need to provide a reproducible example showing htmlize not working for you. Nevertheless, today I would recommend going with RMarkdown. It may be overkill for your ex

Re: [R] Combining multiple probability weights for the sample() function.

2015-06-03 Thread Boris Steipe
If letters 1 and 2 must be equal with p=0.5, and 1 and 3 must be equal with p=0.5, then letter 1 must be the same as either 2 or 3. Therefore: Choose a letter. Make a pair of (letter, (not letter)). Reverse the pair with p = 0.5 Concatenate your letter and the pair. Is that what you need? B.

Re: [R] R convert pdf/png to html

2015-06-03 Thread Ista Zahn
Or try the brand-new way: http://www.r-pkg.org/search.html?q=html --Ista On Wed, Jun 3, 2015 at 1:06 PM, MacQueen, Don wrote: > When it's as simple as in Boris's example, just use cat() statements. > > Otherwise, go to CRAN, find the packages page ("Table of available > packages, sorted by name

Re: [R] pairwise.t.test non numeric factors error

2015-06-03 Thread Erica Cseko Nolasco
Thanks Jim, I removed the corresponding cases and tried again. What I discovery now is if I run the function without paired = T (pairwise.t.test(x = data$tss,data$pa) is works. However, if I add the paired = T (pairwise.t.test(x = data$tss,data$pa,paired = T) is gives me the error ' Error in compl

Re: [R] R convert pdf/png to html

2015-06-03 Thread MacQueen, Don
When it's as simple as in Boris's example, just use cat() statements. Otherwise, go to CRAN, find the packages page ("Table of available packages, sorted by name"), and search for "html" -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-4

Re: [R] Graphs for scientific publication ?

2015-06-03 Thread David Winsemius
On Jun 3, 2015, at 3:30 AM, Jeremy Clark wrote: > The coding I've settled on to save file without clipping is: What exactly was "clipping". You earlier complained about "jaggies". There was no restriction of the plotted lines to the plot area in the example you earlier presented. That's what I

[R] Adding legend

2015-06-03 Thread John Wasige
​Hello community, Could somebody help on how I can ​add ​ a legend to my heatmap plot. I need to know what values from the data do colours ( "red","yellow", "yellowgreen","lightblue4") represent from the data. The script is here below and attached is the test dataset. Thanks for your help. Hohn

Re: [R] R convert pdf/png to html

2015-06-03 Thread valerio orfano
Hi Boris and thanx a lot Which library should i be using to create html in R? rgds valerio On 03 Jun 2015, at 18:08, Boris Steipe wrote: > ... as in: the png exists in a directory that is accessible to the server? > > That would be as simple as creating a HTML document with the following > co

[R] Adding legend

2015-06-03 Thread John Wasige
​Hello community, Could somebody help on how I can a legend to my heatmap plot. I need to know what values from the data do colours ( "red","yellow", "yellowgreen","lightblue4") represent from the data. The script is here below and attached is the test dataset. Thanks for your help. Hohn ###

Re: [R] Difference between 32-bit and 64-bit version

2015-06-03 Thread Duncan Murdoch
On 03/06/2015 11:56 AM, Thierry Onkelinx wrote: > Dear all, > > I'm a bit puzzled by the difference in an object when created in R 32-bit > and R 64-bit. > > Consider the code below. test.rda is available at > https://drive.google.com/file/d/0BzBrlGSuB9n-NFBWeC1TR093Sms/view?usp=sharing > > # Ru

Re: [R] R convert pdf/png to html

2015-06-03 Thread Boris Steipe
... as in: the png exists in a directory that is accessible to the server? That would be as simple as creating a HTML document with the following contents: http://www.w3.org/TR/html4/strict.dtd";> B. On Jun 3, 2015, at 11:32 AM, valerio orfano wrote: > Hi All > > Is there any chanc

[R] Difference between 32-bit and 64-bit version

2015-06-03 Thread Thierry Onkelinx
Dear all, I'm a bit puzzled by the difference in an object when created in R 32-bit and R 64-bit. Consider the code below. test.rda is available at https://drive.google.com/file/d/0BzBrlGSuB9n-NFBWeC1TR093Sms/view?usp=sharing # Run in R 3.2.0 Windows 32-bit, lme4 1.1-8 library(lme4) load("test.r

Re: [R] How to add legend to a dotplot

2015-06-03 Thread li li
Thank you! It worked. Hanna 2015-06-03 3:49 GMT-04:00, Duncan Mackay : > Hi > If you use the lattice package and not resort to other packages read the ? > xyplot carefully > There are several ways to put a key in the graph including auto.key if you > want something simple ie default > The examp

Re: [R] SVM error

2015-06-03 Thread Boris Steipe
svm() needs a matrix as input but read.xlsx() produces a data frame. B. On Jun 3, 2015, at 5:01 AM, Pijush Das wrote: > Dear Sir, > > > I am working with SVM recently, facing a problem which is given below. > If you able to solve the problem, please send me the code. > > > Thank you very

[R] R convert pdf/png to html

2015-06-03 Thread valerio orfano
Hi All Is there any chance in R to convert a png and/or pdf file into an html? Any example? I’ve tried htmlize but doesn’t work out! Rgds valerio __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo

Re: [R] Splitting and arranging in ascending order

2015-06-03 Thread PIKAL Petr
Hi there is probably easy solution by gsub but it is not my cup of tea so I used strsplit spl<-data.frame(t(matrix(unlist(strsplit(as.character(my_dat$instrument), "_")),2))) res<-data.frame(spl, my_dat$mtm_value) > res X1 X2 my_dat.mtm_value 1 EQ 0 23 2 EQ 1

Re: [R] Splitting and arranging in ascending order

2015-06-03 Thread Rui Barradas
Hello, Try the following. tmp <- strsplit(as.character(my_dat$instrument), "_") tmp <- t(as.data.frame(tmp)) tmp <- data.frame(instrument = tmp[,1], sr_no = as.integer(tmp[, 2]), my_dat$mtm_value) result <- tmp[order(tmp[, 1], tmp[, 2]), ] rm(tmp) rownames(result) <- NULL result Hope this

Re: [R] Clarification about data/weekday conversion

2015-06-03 Thread MacQueen, Don
First of all, the as.Date() function converted it to the Date class (not "Date,format..", and I'd suggest the terminology is important here). > class('2015-4-1') [1] "character" > class( as.Date('2015-4-1') ) [1] "Date" Second, the format() function always converts to character class. > n <- 3

[R] Splitting and arranging in ascending order

2015-06-03 Thread Amelia Marsh
Dear R forum I have a data (actually its a big data and I am only giving part of my interest) as my_dat = data.frame(instrument = c("EQ_0", "EQ_1", "EQ_10", "EQ_100", "EQ_2", "EQ_20", "IRS_0", "IRS_1", "IRS_10", "IRS_100", "IRS_2", "IRS_20"), mtm_value = c(23, 63, 8, 44, 68, 11, 83, 56, 73, 92

[R] xpathSApply skip if text equals postseason

2015-06-03 Thread Don Hessey
I'm running into a road block here and I can't figure out what I'm doing wrong. I need to skip over the link if the text equals postseason. The text is in the second li in the xpaths below in my code. I tried li[not(.,"postseason")] as I thought that is what I needed to exclude the postseason

[R] SVM error

2015-06-03 Thread Pijush Das
Dear Sir, I am working with SVM recently, facing a problem which is given below. If you able to solve the problem, please send me the code. Thank you very much. >library(e1071) >library(openxlsx) > List<- read.xlsx(file.choose(), sheet = 1, colNames=TRUE,rowNames = TRUE) > Data<- read.xlsx(fi

Re: [R] Colour gradient is not working.

2015-06-03 Thread MacQueen, Don
Another trick if Bill is correct is to sort the data first, by whatever variable the color is intended to represent. -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 6/2/15, 9:06 AM, "William Dunlap" wrote: >Points later in

Re: [R] Adding columns to a 2D vector

2015-06-03 Thread Sarah Goslee
Hi, On Wed, Jun 3, 2015 at 8:26 AM, Thomas Chesney wrote: > I'd like to add some columns into the middle of this: > > vec <- c(1, -1) > lst <- lapply(numeric(n-1), function(x) vec) > combos <- as.matrix(expand.grid(lst)) > colnames(combos) <- NULL This isn't quite reproducible, since n is undefi

Re: [R] Upload Error Occurred in uploading markdown file to RPubs

2015-06-03 Thread John Kane
Hi Antonello, I had never heard of Rpubs until now so I went and had a look. It seems to have allowed me to register but I don't seem to be able to do anything. I tried goign to the support page (bottom of intro page) and go a message "This site is closed" so it may be they are down or having a

Re: [R] Save the result of map.market function to HTML file?

2015-06-03 Thread valerio orfano
Hi Jim and thanx. Unfortunately it didn’t work out!! any other help? rgds valerio On 03 Jun 2015, at 02:29, Jim Lemon wrote: > Hi valerio, > This is a guess, but try running your code with "htmlize" (prettyR). > Change the "pdf" call to: > > png("C:/Users/Administrator/Desktop/treemap1.png") >

[R] Adding columns to a 2D vector

2015-06-03 Thread Thomas Chesney
I'd like to add some columns into the middle of this: vec <- c(1, -1) lst <- lapply(numeric(n-1), function(x) vec) combos <- as.matrix(expand.grid(lst)) colnames(combos) <- NULL The way I have used is: combos2 <- matrix(NA, nrow=64, ncol=9) combos2[,1] <- 0 combos2[,2] <- combos[,1] combos2[,3]

Re: [R] ggplot stat_bin question

2015-06-03 Thread John Kane
I don't think there is any reason to get rid of that message unless you have a presentation problem, that is, you are including that output in a paper. All that is, AFAIK, is a notice that ggplot() is using the default binning rule. You can change the number of the bins if you need more gran

[R] subset svydesign problem

2015-06-03 Thread Daniela Droguett
Hi, it seems not possible to susbset a svydesign object (DBI svydesign) and use variables to make the subset expression uff<-c("14","15") for (i in 1:length(uff)) { subpnad<-subset(pnad, uf==uff[i] & v0302=='4') } the error is the following Error in sqliteSendQuery(con, statement, bind.data)

Re: [R] Graphs for scientific publication ?

2015-06-03 Thread Jeremy Clark
The coding I've settled on to save file without clipping is: library(gridExtra) gt <- ggplot_gtable(ggplot_build(q3)) gt$layout$clip[gt$layout$name=="panel"] <- "off" gt4 <- arrangeGrob(gt) ggsave <- ggplot2::ggsave; body(ggsave) <- body(ggplot2::ggsave)[-2] ## from Baptiste ggsave("gt.pdf", plot

[R] Integration using nlsLM ?

2015-06-03 Thread Jeremy Clark
Dear All - I'm trying to integrate the following function via nlsLM - and I think the problem is something to do with passing the correct arguments (error is given below) - any help gratefully appreciated - many thanks. library(minpack.lm) dOM <- function(x, mu = 0, sigma = 1, log = FALSE) {

[R] Upload Error Occurred in uploading markdown file to RPubs

2015-06-03 Thread Antonello Preti
Hi, I do not know whether someone had the same problem and if s/he can help me with some advice. I'm using RPubs from RStudio to publish tutorials and exercises. On June 2, I've published a Markdown post in RPubs with RStudio. So, I'm sure the system can connect to Rpubs without any issues. Some

Re: [R] SVM error.

2015-06-03 Thread Jim Lemon
Hi Pijush, First, please keep the messages on the help list. As far as I can determine, the "x" in your code above is a matrix of character strings. When you transpose (t) the initial data frame, all of the numbers are coerced to character mode as the columns must all be of the same mode. The firs

Re: [R] How to add legend to a dotplot

2015-06-03 Thread Duncan Mackay
Hi If you use the lattice package and not resort to other packages read the ? xyplot carefully There are several ways to put a key in the graph including auto.key if you want something simple ie default The examples at the bottom give some ideas If you want something special you can use key = lis

Re: [R] ggplot stat_bin question

2015-06-03 Thread Thierry Onkelinx
Dear Glenn, Your code contains a typo: it has bindwidth instead of binwidth. Fixing that will no longer show the message. AFAIK, the message is always displayed when binwidth is not set. You can use suppressMessages() to hide them. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bos