From vedahung1116 at gmail.com Mon Nov 2 14:21:40 2015 From: vedahung1116 at gmail.com (Veda) Date: Mon, 2 Nov 2015 05:21:40 -0800 (PST) Subject: [datatable-help] write strings with a specific font Message-ID: <1446470500146-4714249.post@n4.nabble.com> Dear R experts, I'd like to export a data frame with both numbers and strings in a text file. The problem is that I don't know how to write the strings in a specific font "Zapf Dingbats". Any suggestions are appreciated. Thanks! Sincerely, Veda -- View this message in context: http://r.789695.n4.nabble.com/write-strings-with-a-specific-font-tp4714249.html Sent from the datatable-help mailing list archive at Nabble.com. From niparisco at gmail.com Mon Nov 2 15:11:44 2015 From: niparisco at gmail.com (Nicolas Paris) Date: Mon, 2 Nov 2015 15:11:44 +0100 Subject: [datatable-help] write strings with a specific font In-Reply-To: <1446470500146-4714249.post@n4.nabble.com> References: <1446470500146-4714249.post@n4.nabble.com> Message-ID: Hello, Look at the openxlsx package : It allows to apply style. hs <- createStyle(textDecoration = "BOLD", fontColour = "#FFFFFF", fontSize=12, fontName="Arial Narrow", fgFill = "#4F80BD") write.xlsx(iris, file = "writeXLSX3.xlsx", colNames = TRUE, borders = "rows", headerStyle = hs) On the other hand, the readxl packages is the best I know to read xlsx files. Note that the xlsx format has a row number limitation of 1,048,576 and a column limitation of 16,384 regards 2015-11-02 14:21 GMT+01:00 Veda : > Dear R experts, > > I'd like to export a data frame with both numbers and strings in a text > file. The problem is that I don't know how to write the strings in a > specific font "Zapf Dingbats". Any suggestions are appreciated. Thanks! > > Sincerely, > Veda > > > > -- > View this message in context: http://r.789695.n4.nabble.com/write-strings-with-a-specific-font-tp4714249.html > Sent from the datatable-help mailing list archive at Nabble.com. > _______________________________________________ > datatable-help mailing list > datatable-help at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help From vedahung1116 at gmail.com Mon Nov 2 17:14:58 2015 From: vedahung1116 at gmail.com (Veda) Date: Mon, 2 Nov 2015 08:14:58 -0800 (PST) Subject: [datatable-help] write strings with a specific font In-Reply-To: References: <1446470500146-4714249.post@n4.nabble.com> Message-ID: <1446480898647-4714254.post@n4.nabble.com> Hello Natus, Thanks for suggestions. I tried the function and some other similar functions (e.g., xlsx) but found that they do not work for text file. Any idea to get around this? thanks! Veda -- View this message in context: http://r.789695.n4.nabble.com/write-strings-with-a-specific-font-tp4714249p4714254.html Sent from the datatable-help mailing list archive at Nabble.com. From niparisco at gmail.com Mon Nov 2 17:31:25 2015 From: niparisco at gmail.com (Nicolas Paris) Date: Mon, 2 Nov 2015 17:31:25 +0100 Subject: [datatable-help] write strings with a specific font In-Reply-To: <1446480898647-4714254.post@n4.nabble.com> References: <1446470500146-4714249.post@n4.nabble.com> <1446480898647-4714254.post@n4.nabble.com> Message-ID: What do you exactly mean by text file ? 2015-11-02 17:14 GMT+01:00 Veda : > Hello Natus, > > Thanks for suggestions. > I tried the function and some other similar functions (e.g., xlsx) but found > that they do not work for text file. Any idea to get around this? thanks! > > Veda > > > > > > -- > View this message in context: http://r.789695.n4.nabble.com/write-strings-with-a-specific-font-tp4714249p4714254.html > Sent from the datatable-help mailing list archive at Nabble.com. > _______________________________________________ > datatable-help mailing list > datatable-help at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help From vedahung1116 at gmail.com Mon Nov 2 17:39:16 2015 From: vedahung1116 at gmail.com (Veda) Date: Mon, 2 Nov 2015 08:39:16 -0800 (PST) Subject: [datatable-help] write strings with a specific font In-Reply-To: References: <1446470500146-4714249.post@n4.nabble.com> <1446480898647-4714254.post@n4.nabble.com> Message-ID: <1446482356628-4714257.post@n4.nabble.com> file extension of .txt -- View this message in context: http://r.789695.n4.nabble.com/write-strings-with-a-specific-font-tp4714249p4714257.html Sent from the datatable-help mailing list archive at Nabble.com. From aragorn168b at gmail.com Mon Nov 2 17:54:16 2015 From: aragorn168b at gmail.com (Arunkumar Srinivasan) Date: Mon, 2 Nov 2015 17:54:16 +0100 Subject: [datatable-help] write strings with a specific font In-Reply-To: <1446482356628-4714257.post@n4.nabble.com> References: <1446470500146-4714249.post@n4.nabble.com> <1446480898647-4714254.post@n4.nabble.com> <1446482356628-4714257.post@n4.nabble.com> Message-ID: Veda, you?re spamming the forum for the data.table package. Could you please ask under r-help instead: https://stat.ethz.ch/mailman/listinfo/r-help? --? Arun On 2 November 2015 at 17:52:20, Veda (vedahung1116 at gmail.com) wrote: file extension of .txt -- View this message in context: http://r.789695.n4.nabble.com/write-strings-with-a-specific-font-tp4714249p4714257.html Sent from the datatable-help mailing list archive at Nabble.com. _______________________________________________ datatable-help mailing list datatable-help at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help -------------- next part -------------- An HTML attachment was scrubbed... URL: From aragorn168b at gmail.com Mon Nov 2 17:56:31 2015 From: aragorn168b at gmail.com (Arunkumar Srinivasan) Date: Mon, 2 Nov 2015 17:56:31 +0100 Subject: [datatable-help] fread with multi-line character vector input In-Reply-To: <1446073541400-4714096.post@n4.nabble.com> References: <1446073541400-4714096.post@n4.nabble.com> Message-ID: Can fread read from a multi-line character vector, similar to the read.table? text= argument?? No. Feature request?? Please do, but check the existing issues using ?label:fread? before filing please. Even if it couldn?t be done any efficiently, it might be convenient. --? Arun On 29 October 2015 at 00:18:13, Douglas Clark (clark9876 at airquality.dk) wrote: Can fread read from a multi-line character vector, similar to the read.table text= argument? Feature request? I am importing the output "print" file from a dispersion model (a fortran program). The output file consists of 4000+ lines of text, tables of model parameters, and tables of model results, all of varying lengths. I read the entire file into a character vector variable, such as mylines <- readLines(...), and then use regular expressions to "clean" the text and locate the starting and ending lines of the tables to be imported. I tried to use fread(mylines[start:stop]), but fread doesn't accept a vector of character strings as input -- only a length 1 character vector (ie all in one string). read.table does allow reading from a multi-line character vector variable, using the text= argument, ie read.table(text = mylines[start:stop],...). fread will also read it, if I collapse the multi-line character vector into a single string using paste0 or stri_flatten, as in fread(paste0(mylines[start:stop], collapse = "\n")) or fread(stri_flatten(mylines[start:stop], collapse = "\n")) But it would be nice if I could skip the collapse step. Does fread have a way to directly read from a multi-line character vector without flattening it -- like the text= argument in read.table ? Or is there an easier approach? If not, should this be a feature request? -- View this message in context: http://r.789695.n4.nabble.com/fread-with-multi-line-character-vector-input-tp4714096.html Sent from the datatable-help mailing list archive at Nabble.com. _______________________________________________ datatable-help mailing list datatable-help at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help -------------- next part -------------- An HTML attachment was scrubbed... URL: From niparisco at gmail.com Mon Nov 2 20:23:21 2015 From: niparisco at gmail.com (Nicolas Paris) Date: Mon, 2 Nov 2015 20:23:21 +0100 Subject: [datatable-help] write strings with a specific font In-Reply-To: References: <1446470500146-4714249.post@n4.nabble.com> <1446480898647-4714254.post@n4.nabble.com> <1446482356628-4714257.post@n4.nabble.com> Message-ID: .txt files does not deal with fonts as well csv 2015-11-02 17:54 GMT+01:00 Arunkumar Srinivasan : > Veda, you?re spamming the forum for the data.table package. Could you > please ask under r-help instead: > https://stat.ethz.ch/mailman/listinfo/r-help? > > -- > Arun > > On 2 November 2015 at 17:52:20, Veda (vedahung1116 at gmail.com) wrote: > > file extension of .txt > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/write-strings-with-a-specific-font-tp4714249p4714257.html > Sent from the datatable-help mailing list archive at Nabble.com. > _______________________________________________ > datatable-help mailing list > datatable-help at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help > > > _______________________________________________ > datatable-help mailing list > datatable-help at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hamza_essid at hotmail.fr Wed Nov 4 10:07:51 2015 From: hamza_essid at hotmail.fr (Ash111) Date: Wed, 4 Nov 2015 01:07:51 -0800 (PST) Subject: [datatable-help] R function In-Reply-To: <1446586415577-4714304.post@n4.nabble.com> References: <1446567806247-4714299.post@n4.nabble.com> <1446586415577-4714304.post@n4.nabble.com> Message-ID: <1446628071704-4714328.post@n4.nabble.com> Thank you Patrick -- View this message in context: http://r.789695.n4.nabble.com/R-function-tp4714299p4714328.html Sent from the datatable-help mailing list archive at Nabble.com. From hamza_essid at hotmail.fr Wed Nov 4 11:01:35 2015 From: hamza_essid at hotmail.fr (Ash111) Date: Wed, 4 Nov 2015 02:01:35 -0800 (PST) Subject: [datatable-help] R - Comparison Message-ID: <1446631295976-4714329.post@n4.nabble.com> Hello everyone, I have a vector X = [ 0 2 5 4 1 9 ] I want to build another vector Y wich will have the same length as X and which contains the comparison of the elements of x as follows : if x < = 3: returns F if 3 < x < = 6: returns M if 6 < x: returns E I expected the result: Y = [F F M M F E ] How to do that with R ?? Thank you :-) -- View this message in context: http://r.789695.n4.nabble.com/R-Comparison-tp4714329.html Sent from the datatable-help mailing list archive at Nabble.com. From niparisco at gmail.com Wed Nov 4 15:53:52 2015 From: niparisco at gmail.com (Nicolas Paris) Date: Wed, 4 Nov 2015 15:53:52 +0100 Subject: [datatable-help] R - Comparison In-Reply-To: <1446631295976-4714329.post@n4.nabble.com> References: <1446631295976-4714329.post@n4.nabble.com> Message-ID: hello, use ifelse that is vectorial function x <- c( 0, 2, 5, 4, 1, 9 ) y <- ifelse(x<=3,"F",ifelse( 3 < x && x <= 6,"M",ifelse(6: > Hello everyone, > > I have a vector X = [ 0 2 5 4 1 9 ] > I want to build another vector Y wich will have the same length as X and > which contains the comparison of the elements of x as follows : > if x < = 3: returns F > if 3 < x < = 6: returns M > if 6 < x: returns E > > I expected the result: > Y = [F F M M F E ] > > How to do that with R ?? > > Thank you :-) > > > > -- > View this message in context: http://r.789695.n4.nabble.com/R-Comparison-tp4714329.html > Sent from the datatable-help mailing list archive at Nabble.com. > _______________________________________________ > datatable-help mailing list > datatable-help at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help From hamza_essid at hotmail.fr Wed Nov 4 16:02:33 2015 From: hamza_essid at hotmail.fr (Ash111) Date: Wed, 4 Nov 2015 07:02:33 -0800 (PST) Subject: [datatable-help] R - Comparison In-Reply-To: <1446631295976-4714329.post@n4.nabble.com> References: <1446631295976-4714329.post@n4.nabble.com> Message-ID: <1446649353081-4714347.post@n4.nabble.com> Thank you natus :-) -- View this message in context: http://r.789695.n4.nabble.com/R-Comparison-tp4714329p4714347.html Sent from the datatable-help mailing list archive at Nabble.com. From niparisco at gmail.com Wed Nov 4 16:25:26 2015 From: niparisco at gmail.com (Nicolas Paris) Date: Wed, 4 Nov 2015 16:25:26 +0100 Subject: [datatable-help] R - Comparison In-Reply-To: <1446649353081-4714347.post@n4.nabble.com> References: <1446631295976-4714329.post@n4.nabble.com> <1446649353081-4714347.post@n4.nabble.com> Message-ID: sorry use 3 < x & x <= 6 instead of 3 < x && x <= 6 because & is vectorial && not something like that 2015-11-04 16:02 GMT+01:00 Ash111 : > Thank you natus :-) > > > > -- > View this message in context: http://r.789695.n4.nabble.com/R-Comparison-tp4714329p4714347.html > Sent from the datatable-help mailing list archive at Nabble.com. > _______________________________________________ > datatable-help mailing list > datatable-help at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help From aragorn168b at gmail.com Wed Nov 4 16:26:42 2015 From: aragorn168b at gmail.com (Arunkumar Srinivasan) Date: Wed, 4 Nov 2015 16:26:42 +0100 Subject: [datatable-help] R - Comparison In-Reply-To: References: <1446631295976-4714329.post@n4.nabble.com> <1446649353081-4714347.post@n4.nabble.com> Message-ID: Please do not spam the data.table mailing list. The question isn?t data.table related at all. Please post this on r-help. And please stop encouraging such questions. --? Arun On 4 November 2015 at 16:25:33, Nicolas Paris (niparisco at gmail.com) wrote: sorry use 3 < x & x <= 6 instead of 3 < x && x <= 6 because & is vectorial && not something like that 2015-11-04 16:02 GMT+01:00 Ash111 : > Thank you natus :-) > > > > -- > View this message in context: http://r.789695.n4.nabble.com/R-Comparison-tp4714329p4714347.html > Sent from the datatable-help mailing list archive at Nabble.com. > _______________________________________________ > datatable-help mailing list > datatable-help at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help _______________________________________________ datatable-help mailing list datatable-help at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help -------------- next part -------------- An HTML attachment was scrubbed... URL: From hamza_essid at hotmail.fr Wed Nov 4 16:15:17 2015 From: hamza_essid at hotmail.fr (Ash111) Date: Wed, 4 Nov 2015 07:15:17 -0800 (PST) Subject: [datatable-help] R - Comparison In-Reply-To: References: <1446631295976-4714329.post@n4.nabble.com> Message-ID: <1446650117227-4714351.post@n4.nabble.com> Hi, The result is : "F" "F" "ERROR" "ERROR" "F" "ERROR" but it should be : "F" "F" "M" "M" "F" "E" !! -- View this message in context: http://r.789695.n4.nabble.com/R-Comparison-tp4714329p4714351.html Sent from the datatable-help mailing list archive at Nabble.com. From hamza_essid at hotmail.fr Wed Nov 4 16:18:20 2015 From: hamza_essid at hotmail.fr (Ash111) Date: Wed, 4 Nov 2015 07:18:20 -0800 (PST) Subject: [datatable-help] R - Comparison In-Reply-To: <1446650117227-4714351.post@n4.nabble.com> References: <1446631295976-4714329.post@n4.nabble.com> <1446650117227-4714351.post@n4.nabble.com> Message-ID: <1446650300039-4714352.post@n4.nabble.com> Now it's working Thank you :-) -- View this message in context: http://r.789695.n4.nabble.com/R-Comparison-tp4714329p4714352.html Sent from the datatable-help mailing list archive at Nabble.com. From t.jonesd289 at gmail.com Thu Nov 5 04:05:07 2015 From: t.jonesd289 at gmail.com (tjonesd289) Date: Wed, 4 Nov 2015 19:05:07 -0800 (PST) Subject: [datatable-help] For each row, aggregate an external vector based on a column value Message-ID: <1446692707898-4714376.post@n4.nabble.com> Hello, Say I have data.table: >> dt <- data.table(a = c(as.Date('2014-01-01'), >> as.Date('2014-06-01'),as.Date('2014-12-31'))) and a vector of dates: >> my.dates <- >> sapply(c('2014-02-21','2014-04-03','2014-10-21','2015-01-20'), as.Date) In dt, I want to create a column (b) with the number of items in my.dates that are on or before the date given in dt$a. In the above example, the result would be: >> print(dt$b) 0 2 3 The following two methods work outside a data.table: >> d1 = as.Date('2014-06-01') >> length(which(my.dates <= d1)) 2 >> d2 = as.Date('2014-12-31') >> sum(my.dates <= d2) 3 However, I cannot get either of these to work inside of data.table. When I do: >> dt[, b:=sum((my.dates)<=a)] # or dt[, b:=length(which((my.dates)<=a))] Warning message: In `<.default`((my.dates), a) : longer object length is not a multiple of shorter object length >> print(dt$b) 2 2 2 Can anyone advise an easy way to do this? I was thinking I might first have to move the vector into it's own column in the data.table, but am not sure how I would even do that. Thanks! -TJ -- View this message in context: http://r.789695.n4.nabble.com/For-each-row-aggregate-an-external-vector-based-on-a-column-value-tp4714376.html Sent from the datatable-help mailing list archive at Nabble.com. From fperickson at wisc.edu Thu Nov 5 05:50:05 2015 From: fperickson at wisc.edu (Frank Erickson) Date: Wed, 4 Nov 2015 23:50:05 -0500 Subject: [datatable-help] For each row, aggregate an external vector based on a column value In-Reply-To: <1446692707898-4714376.post@n4.nabble.com> References: <1446692707898-4714376.post@n4.nabble.com> Message-ID: First, I guess you should not create my.dates that way, rather my.dates = as.Date(c('2014-02-21','2014-04-03','2014-10-21','2015-01-20')) If you compare str(my.dates) this way and your way, you'll see that sapply refuses to return a Date-class object (as documented in the "Value" section of ?sapply). For the column, I'd do: dt[, b := findInterval(a, sort(my.dates))] though this approach is not data.table-specific. By the way, the >> at the start of each line makes it annoying to copy-paste your code. On Wed, Nov 4, 2015 at 10:05 PM, tjonesd289 wrote: > Hello, > > Say I have data.table: > >> dt <- data.table(a = c(as.Date('2014-01-01'), > >> as.Date('2014-06-01'),as.Date('2014-12-31'))) > and a vector of dates: > >> my.dates <- > >> sapply(c('2014-02-21','2014-04-03','2014-10-21','2015-01-20'), as.Date) > > In dt, I want to create a column (b) with the number of items in my.dates > that are on or before the date given in dt$a. In the above example, the > result would be: > >> print(dt$b) > 0 2 3 > > The following two methods work outside a data.table: > >> d1 = as.Date('2014-06-01') > >> length(which(my.dates <= d1)) > 2 > > >> d2 = as.Date('2014-12-31') > >> sum(my.dates <= d2) > 3 > > However, I cannot get either of these to work inside of data.table. > When I do: > >> dt[, b:=sum((my.dates)<=a)] # or dt[, b:=length(which((my.dates)<=a))] > Warning message: > In `<.default`((my.dates), a) : > longer object length is not a multiple of shorter object length > >> print(dt$b) > 2 2 2 > > Can anyone advise an easy way to do this? > > I was thinking I might first have to move the vector into it's own column > in > the data.table, but am not sure how I would even do that. > > Thanks! > -TJ > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/For-each-row-aggregate-an-external-vector-based-on-a-column-value-tp4714376.html > Sent from the datatable-help mailing list archive at Nabble.com. > _______________________________________________ > datatable-help mailing list > datatable-help at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help > -------------- next part -------------- An HTML attachment was scrubbed... URL: From clark9876 at airquality.dk Thu Nov 5 10:45:02 2015 From: clark9876 at airquality.dk (Douglas Clark) Date: Thu, 5 Nov 2015 01:45:02 -0800 (PST) Subject: [datatable-help] R function In-Reply-To: <1446567806247-4714299.post@n4.nabble.com> References: <1446567806247-4714299.post@n4.nabble.com> Message-ID: <1446716702533-4714387.post@n4.nabble.com> A data.table way to do this could be: library(data.table) x = c(10, 25, 4, 10, 9, 4, 4) DT <- data.table(x) DT # x # 1: 10 # 2: 25 # 3: 4 # 4: 10 # 5: 9 # 6: 4 # 7: 4 # create a new column y as the count in each group defined by x DT[, y := .N, by = x] DT # x y # 1: 10 2 # 2: 25 1 # 3: 4 3 # 4: 10 2 # 5: 9 1 # 6: 4 3 # you can then either directly use DT$y DT$y # [1] 2 1 3 2 1 3 3 # or extract the y column to a separate vector y y <- DT[, y] y # [1] 2 1 3 2 1 3 3 # or all of the above in one line: y <- data.table(x = c(10, 25, 4, 10, 9, 4, 4) )[, y := .N, by = x][, y] y # [1] 2 1 3 2 1 3 3 -- View this message in context: http://r.789695.n4.nabble.com/R-function-tp4714299p4714387.html Sent from the datatable-help mailing list archive at Nabble.com. From hamza_essid at hotmail.fr Thu Nov 5 11:03:53 2015 From: hamza_essid at hotmail.fr (Xena222) Date: Thu, 5 Nov 2015 02:03:53 -0800 (PST) Subject: [datatable-help] KNN Message-ID: <1446717833006-4714388.post@n4.nabble.com> Hello everyone, I have a database that contains IP addresses, time of connection for every client and the number of connections for each one .. here is an example : I want to do a classification using KNN clustering and build a model that recognizes the attempts of attack ( attempt of attack = High number of connection ) I'm beginner with R language and I do not know how to do that !! someone can help me please !! -- View this message in context: http://r.789695.n4.nabble.com/KNN-tp4714388.html Sent from the datatable-help mailing list archive at Nabble.com. From hamza_essid at hotmail.fr Thu Nov 5 11:05:06 2015 From: hamza_essid at hotmail.fr (Xena222) Date: Thu, 5 Nov 2015 02:05:06 -0800 (PST) Subject: [datatable-help] KNN Message-ID: <1446717906590-4714390.post@n4.nabble.com> Hello everyone, I have a database that contains IP addresses, time of connection for every client and the number of connections for each one .. here is an example : I want to do a classification using KNN clustering and build a model that recognizes the attempts of attack ( attempt of attack = High number of connection ) I'm beginner with R language and I do not know how to do that !! someone can help me please !! -- View this message in context: http://r.789695.n4.nabble.com/KNN-tp4714390.html Sent from the datatable-help mailing list archive at Nabble.com. From hamza_essid at hotmail.fr Thu Nov 5 11:06:05 2015 From: hamza_essid at hotmail.fr (Xena222) Date: Thu, 5 Nov 2015 02:06:05 -0800 (PST) Subject: [datatable-help] R function In-Reply-To: <1446716702533-4714387.post@n4.nabble.com> References: <1446567806247-4714299.post@n4.nabble.com> <1446716702533-4714387.post@n4.nabble.com> Message-ID: <1446717965217-4714391.post@n4.nabble.com> Thank you Douglas :-) -- View this message in context: http://r.789695.n4.nabble.com/R-function-tp4714299p4714391.html Sent from the datatable-help mailing list archive at Nabble.com. From clark9876 at airquality.dk Thu Nov 5 16:32:51 2015 From: clark9876 at airquality.dk (Douglas Clark) Date: Thu, 5 Nov 2015 07:32:51 -0800 (PST) Subject: [datatable-help] fread with multi-line character vector input In-Reply-To: References: <1446073541400-4714096.post@n4.nabble.com> Message-ID: <1446737571162-4714398.post@n4.nabble.com> This is now added as a feature request on GitHub: Issue #1423: [Request] add text= argument to fread, to read from multi-line character vectors -- View this message in context: http://r.789695.n4.nabble.com/fread-with-multi-line-character-vector-input-tp4714096p4714398.html Sent from the datatable-help mailing list archive at Nabble.com. From aragorn168b at gmail.com Thu Nov 5 20:57:53 2015 From: aragorn168b at gmail.com (Arunkumar Srinivasan) Date: Thu, 5 Nov 2015 20:57:53 +0100 Subject: [datatable-help] fread with multi-line character vector input In-Reply-To: <1446737571162-4714398.post@n4.nabble.com> References: <1446073541400-4714096.post@n4.nabble.com> <1446737571162-4714398.post@n4.nabble.com> Message-ID: @Douglas, thank you! --? Arun On 5 November 2015 at 16:46:15, Douglas Clark (clark9876 at airquality.dk) wrote: This is now added as a feature request on GitHub: Issue #1423: [Request] add text= argument to fread, to read from multi-line character vectors -- View this message in context: http://r.789695.n4.nabble.com/fread-with-multi-line-character-vector-input-tp4714096p4714398.html Sent from the datatable-help mailing list archive at Nabble.com. _______________________________________________ datatable-help mailing list datatable-help at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help -------------- next part -------------- An HTML attachment was scrubbed... URL: From t.jonesd289 at gmail.com Thu Nov 5 20:58:10 2015 From: t.jonesd289 at gmail.com (tjonesd289) Date: Thu, 5 Nov 2015 11:58:10 -0800 (PST) Subject: [datatable-help] For each row, aggregate an external vector based on a column value In-Reply-To: References: <1446692707898-4714376.post@n4.nabble.com> Message-ID: <1446753490817-4714413.post@n4.nabble.com> Many thanks - worked like a charm! I use the >>'s to distinguish stdin from stdout in the shell -- sorry for the hassle! -- View this message in context: http://r.789695.n4.nabble.com/For-each-row-aggregate-an-external-vector-based-on-a-column-value-tp4714376p4714413.html Sent from the datatable-help mailing list archive at Nabble.com. From sgrioni at chicagobooth.edu Sun Nov 8 20:41:40 2015 From: sgrioni at chicagobooth.edu (Stefano Grioni) Date: Sun, 8 Nov 2015 19:41:40 +0000 Subject: [datatable-help] Pivot part of a data table Message-ID: Hello, I am new to R and trying to understand how data manipulation works. I have a CSV file which allows me to build a data table that looks like the following (simplified example): >db names ages grade_spring_quarter grade_summer_quarter 1: John 24 A A+ 2: Steve 16 B+ B 3: Peter 12 C B+ Now, my goal is to denormalize the data table in order to transform the last 2 columns in rows, therefore obtaining the following: > db2 names ages quarter grades 1: John 24 spring A 2: Steve 16 spring B+ 3: Peter 12 spring C 4: John 24 summer A+ 5: Steve 16 summer B 6: Peter 12 summer B+ I think that I would be able to do it using for loops, but I doubt that's the most efficient way. I have started looking into the Join functionality of data table but so far didn't manage to build db2 from db that way. Do you see how I could proceed? Many thanks Stefano -------------- next part -------------- An HTML attachment was scrubbed... URL: From aragorn168b at gmail.com Sun Nov 8 20:44:07 2015 From: aragorn168b at gmail.com (Arunkumar Srinivasan) Date: Sun, 8 Nov 2015 20:44:07 +0100 Subject: [datatable-help] Pivot part of a data table In-Reply-To: References: Message-ID: Hi, have a look at `?melt` and the reshaping vignette:?https://github.com/Rdatatable/data.table/wiki/Getting-started --? Arun On 8 November 2015 at 20:42:05, Stefano Grioni (sgrioni at chicagobooth.edu) wrote: Hello, I am new to R and trying to understand how data manipulation works. I have a CSV file which allows me to build a data table that looks like the following (simplified example): >db ? ?names ages grade_spring_quarter grade_summer_quarter 1: ?John ? 24 ? ? ? ? ? ? ? ? ? ?A ? ? ? ? ? ? ? ? ? A+ 2: Steve ? 16 ? ? ? ? ? ? ? ? ? B+ ? ? ? ? ? ? ? ? ? ?B 3: Peter ? 12 ? ? ? ? ? ? ? ? ? ?C ? ? ? ? ? ? ? ? ? B+ Now, my goal is to denormalize the data table in order to transform the last 2 columns in rows, therefore obtaining the following: > db2 ? ?names ages quarter grades 1: ?John ? 24 ?spring ? ? ?A 2: Steve ? 16 ?spring ? ? B+ 3: Peter ? 12 ?spring ? ? ?C 4: ?John ? 24 ?summer ? ? A+ 5: Steve ? 16 ?summer ? ? ?B 6: Peter ? 12 ?summer ? ? B+ I think that I would be able to do it using for loops, but I doubt that's the most efficient way. I have started looking into the Join functionality of data table but so far didn't manage to build db2 from db that way.? Do you see how I could proceed?? Many thanks Stefano _______________________________________________ datatable-help mailing list datatable-help at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgrioni at chicagobooth.edu Mon Nov 9 02:32:23 2015 From: sgrioni at chicagobooth.edu (Stefano Grioni) Date: Mon, 9 Nov 2015 01:32:23 +0000 Subject: [datatable-help] Pivot part of a data table In-Reply-To: References: Message-ID: Thanks Arun, it worked! Here is my code, in case someone has the same question: names = c("John", "Steve", "Peter") ages = c(24,16,12) grade_spring_quarter = c("A","B+", "C") grade_summer_quarter = c("A+","B", "B+") gift_spring_quarter = c("A gift","B+ gift", "C gift") gift_summer_quarter = c("A+ gift","B gift", "B+ gift") db <- data.table(names,ages,grade_spring_quarter,grade_summer_quarter,gift_spring_quarter,gift_summer_quarter) db.M <- melt(db, measure = patterns("^grade","^gift"), variable.name="quarter", value.name=c("grades","gifts")) Cheers, Stefano On Sun, Nov 8, 2015 at 1:44 PM Arunkumar Srinivasan wrote: > Hi, have a look at `?melt` and the reshaping vignette: > https://github.com/Rdatatable/data.table/wiki/Getting-started > > > -- > Arun > > On 8 November 2015 at 20:42:05, Stefano Grioni (sgrioni at chicagobooth.edu) > wrote: > > Hello, > > I am new to R and trying to understand how data manipulation works. I have > a CSV file which allows me to build a data table that looks like the > following (simplified example): > > >db > names ages grade_spring_quarter grade_summer_quarter > 1: John 24 A A+ > 2: Steve 16 B+ B > 3: Peter 12 C B+ > > Now, my goal is to denormalize the data table in order to transform the > last 2 columns in rows, therefore obtaining the following: > > > db2 > names ages quarter grades > 1: John 24 spring A > 2: Steve 16 spring B+ > 3: Peter 12 spring C > 4: John 24 summer A+ > 5: Steve 16 summer B > 6: Peter 12 summer B+ > > I think that I would be able to do it using for loops, but I doubt that's > the most efficient way. I have started looking into the Join functionality > of data table but so far didn't manage to build db2 from db that way. > > Do you see how I could proceed? > > Many thanks > > Stefano > > _______________________________________________ > datatable-help mailing list > datatable-help at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgrioni at chicagobooth.edu Mon Nov 9 02:43:36 2015 From: sgrioni at chicagobooth.edu (Stefano Grioni) Date: Mon, 9 Nov 2015 01:43:36 +0000 Subject: [datatable-help] Update on auto-join Message-ID: Hello, As I was reading through the vignette on data handling and joins, it was not immediately evident to me how to do an update on auto-join using only data table. I have managed to do what I need using by using SQL, but I don't find it particularly elegant and performance will probably be terrible on large datasets: tmp <- sqldf("select a.Field1, a.Field2, a.Field3, b.Output from MyDataset a INNER JOIN MyDataset b on a.Field1 =b.Field1 and *a.Field2 = b.Field2+1* and a.Field3=b.Field3") tmp <- as.data.table(tmp) setkey(MyDataset, Field1, Field2, Field3) setkey(tmp, Field1, Field2, Field3) MyDataset[tmp,Field4 := i.Output, nomatch=0] I tried to do the same using twice the same data frame but I can't see how to integrate the join condition on Field2 (see above). Is there an elegant way to address this? Many thanks Stefano -------------- next part -------------- An HTML attachment was scrubbed... URL: From aragorn168b at gmail.com Wed Nov 11 15:45:31 2015 From: aragorn168b at gmail.com (Arunkumar Srinivasan) Date: Wed, 11 Nov 2015 15:45:31 +0100 Subject: [datatable-help] Update on auto-join In-Reply-To: References: Message-ID: Joins vignettes aren't done yet ?. It is planned for v1.9.8. Will work on it after wrapping up things I am working on now. Arun -- Sent from my iPhone > On 09 Nov 2015, at 02:43, Stefano Grioni wrote: > > Hello, > > As I was reading through the vignette on data handling and joins, it was not immediately evident to me how to do an update on auto-join using only data table. > > I have managed to do what I need using by using SQL, but I don't find it particularly elegant and performance will probably be terrible on large datasets: > > tmp <- sqldf("select a.Field1, a.Field2, a.Field3, b.Output from MyDataset a INNER JOIN MyDataset b on a.Field1 =b.Field1 and a.Field2 = b.Field2+1and a.Field3=b.Field3") > tmp <- as.data.table(tmp) > setkey(MyDataset, Field1, Field2, Field3) > setkey(tmp, Field1, Field2, Field3) > MyDataset[tmp,Field4 := i.Output, nomatch=0] > > I tried to do the same using twice the same data frame but I can't see how to integrate the join condition on Field2 (see above). > > Is there an elegant way to address this? > > Many thanks > > Stefano > _______________________________________________ > datatable-help mailing list > datatable-help at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help -------------- next part -------------- An HTML attachment was scrubbed... URL: From Mat_eil04 at hotmail.com Wed Nov 11 15:48:24 2015 From: Mat_eil04 at hotmail.com (matts_91) Date: Wed, 11 Nov 2015 06:48:24 -0800 (PST) Subject: [datatable-help] Rplot for Correspondence Analisys Message-ID: <1447253304450-4714571.post@n4.nabble.com> Hi, I'm making some Rplots for correspondence analisys, and the problem I have is that the names of each point, are too far away from the point. So it's difficult to see what name correspond to each point. I leave a image for you to see what I trying to mean: The command I'm using is the following: plot(ca(Matriz), map="rowprincipal") So I have no way of modifying parameters. Is there a way of making the graph in a more properly way, in where the names are closer to the corresponding point? Thank you very much in advance. Regards, Matias -- View this message in context: http://r.789695.n4.nabble.com/Rplot-for-Correspondence-Analisys-tp4714571.html Sent from the datatable-help mailing list archive at Nabble.com. From caneff at gmail.com Wed Nov 11 16:04:25 2015 From: caneff at gmail.com (Chris Neff) Date: Wed, 11 Nov 2015 15:04:25 +0000 Subject: [datatable-help] Rplot for Correspondence Analisys In-Reply-To: <1447253304450-4714571.post@n4.nabble.com> References: <1447253304450-4714571.post@n4.nabble.com> Message-ID: This is not a general r help mailing list. This is for the data.table package only. On Wed, Nov 11, 2015 at 10:02 AM matts_91 wrote: > Hi, > > I'm making some Rplots for correspondence analisys, and the problem I have > is that the names of each point, are too far away from the point. So it's > difficult to see what name correspond to each point. > > I leave a image for you to see what I trying to mean: > > < > http://r.789695.n4.nabble.com/file/n4714571/Captura_de_pantalla_2015-11-11_11.png > > > > The command I'm using is the following: > plot(ca(Matriz), > map="rowprincipal") > > So I have no way of modifying parameters. > > Is there a way of making the graph in a more properly way, in where the > names are closer to the corresponding point? > > Thank you very much in advance. > Regards, > Matias > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Rplot-for-Correspondence-Analisys-tp4714571.html > Sent from the datatable-help mailing list archive at Nabble.com. > _______________________________________________ > datatable-help mailing list > datatable-help at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alboukadel.kassambara at gmail.com Sat Nov 14 20:06:36 2015 From: alboukadel.kassambara at gmail.com (pe@rson) Date: Sat, 14 Nov 2015 11:06:36 -0800 (PST) Subject: [datatable-help] Rplot for Correspondence Analisys In-Reply-To: <1447253304450-4714571.post@n4.nabble.com> References: <1447253304450-4714571.post@n4.nabble.com> Message-ID: <1447527996776-4714675.post@n4.nabble.com> The following tutorials might be helpful: 1. Correspondence Analysis in R: The Ultimate Guide for the Analysis, the Visualization and the Interpretation 2. ca package and factoextra : Correspondence Analysis 3. ade4 and factoextra : Correspondence Analysis Good Luck! PK -- View this message in context: http://r.789695.n4.nabble.com/Rplot-for-Correspondence-Analisys-tp4714571p4714675.html Sent from the datatable-help mailing list archive at Nabble.com. From Mat_eil04 at hotmail.com Sun Nov 15 23:52:58 2015 From: Mat_eil04 at hotmail.com (matts_91) Date: Sun, 15 Nov 2015 14:52:58 -0800 (PST) Subject: [datatable-help] Rplot for Correspondence Analisys In-Reply-To: <1447527996776-4714675.post@n4.nabble.com> References: <1447253304450-4714571.post@n4.nabble.com> <1447527996776-4714675.post@n4.nabble.com> Message-ID: Thank you ! Date: Sat, 14 Nov 2015 11:06:37 -0800 From: ml-node+s789695n4714675h87 at n4.nabble.com To: Mat_eil04 at hotmail.com Subject: Re: Rplot for Correspondence Analisys The following tutorials might be helpful: 1. Correspondence Analysis in R: The Ultimate Guide for the Analysis, the Visualization and the Interpretation 2. ca package and factoextra : Correspondence Analysis 3. ade4 and factoextra : Correspondence Analysis Good Luck! PK If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/Rplot-for-Correspondence-Analisys-tp4714571p4714675.html To unsubscribe from Rplot for Correspondence Analisys, click here. NAML -- View this message in context: http://r.789695.n4.nabble.com/Rplot-for-Correspondence-Analisys-tp4714571p4714699.html Sent from the datatable-help mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From orlovoleh at gmail.com Wed Nov 25 18:07:43 2015 From: orlovoleh at gmail.com (mahadev) Date: Wed, 25 Nov 2015 09:07:43 -0800 (PST) Subject: [datatable-help] hetcor error when variables are more than 30 Message-ID: <1448471263880-4715010.post@n4.nabble.com> Hello friends, I'm trying to do a factor analysis of a questionnaire of 243 items with YES/NO (1/0) type answers. That's why I need a polychoric correlation matrix. I'm trying to use hetcor() function from "polychor" package: e <- read.xlsx2(file="ukon_1.xlsx", sheetIndex = 1, as.data.frame="true") #this is to load my binary data e1 <- hetcor(e) #this is to generate correlation matrix And I get an error: Error in optim(0, f, control = control, hessian = TRUE, method = "BFGS") : non-finite finite-difference value [1] When I cut my data to up to 30 variables, everything is fine - I get a correlation matrix. Any ideas how to fix that? PS Sorry for my English - it's not my native language =( -- View this message in context: http://r.789695.n4.nabble.com/hetcor-error-when-variables-are-more-than-30-tp4715010.html Sent from the datatable-help mailing list archive at Nabble.com. From aragorn168b at gmail.com Wed Nov 25 19:00:56 2015 From: aragorn168b at gmail.com (Arunkumar Srinivasan) Date: Wed, 25 Nov 2015 19:00:56 +0100 Subject: [datatable-help] hetcor error when variables are more than 30 In-Reply-To: <1448471263880-4715010.post@n4.nabble.com> References: <1448471263880-4715010.post@n4.nabble.com> Message-ID: Hi, you?re on the wrong mailing list. This is the mailing list for R?s data.table package. --? Arun On 25 November 2015 at 18:23:32, mahadev (orlovoleh at gmail.com) wrote: Hello friends, I'm trying to do a factor analysis of a questionnaire of 243 items with YES/NO (1/0) type answers. That's why I need a polychoric correlation matrix. I'm trying to use hetcor() function from "polychor" package: e <- read.xlsx2(file="ukon_1.xlsx", sheetIndex = 1, as.data.frame="true") #this is to load my binary data e1 <- hetcor(e) #this is to generate correlation matrix And I get an error: Error in optim(0, f, control = control, hessian = TRUE, method = "BFGS") : non-finite finite-difference value [1] When I cut my data to up to 30 variables, everything is fine - I get a correlation matrix. Any ideas how to fix that? PS Sorry for my English - it's not my native language =( -- View this message in context: http://r.789695.n4.nabble.com/hetcor-error-when-variables-are-more-than-30-tp4715010.html Sent from the datatable-help mailing list archive at Nabble.com. _______________________________________________ datatable-help mailing list datatable-help at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help -------------- next part -------------- An HTML attachment was scrubbed... URL: