Re: [R] how to read a database in R?

2020-01-31 Thread Hasan Diwan
Ms Marija, Would you happen to know which program created it? If not, you can try the Unix file command, if you have access to that. -- H [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] how to read a database in R?

2020-01-31 Thread Jeff Newmiller
Too little information to tell. I googled the file name though and pages about genetics came up... perhaps you should ask in the Bioconductor support area. On January 31, 2020 3:02:16 PM PST, Ana Marija wrote: >Hello, > >I have a database DGN-WB_0.5.db is there is a way to explore its >content

Re: [R] How to read a file containing two types of rows - (for the Netflix challenge data format)

2020-01-31 Thread Berry, Charles
> On Jan 31, 2020, at 1:04 AM, Emmanuel Levy wrote: > > Hi, > > I'd like to use the Netflix challenge data and just can't figure out how to > efficiently "scan" the files. > https://www.kaggle.com/netflix-inc/netflix-prize-data > > The files have two types of row, either an *ID* e.g., "1:"

[R] how to read a database in R?

2020-01-31 Thread Ana Marija
Hello, I have a database DGN-WB_0.5.db is there is a way to explore its content in R? I don't know anything about this data base. Thanks Ana __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] How to read a file containing two types of rows - (for the Netflix challenge data format)

2020-01-31 Thread Emmanuel Levy
Hi All, Thanks so much for your inputs, it's so nice to have such a helpful community -- I wrote some kind of mix between the different replies, I copy my final code below. All the best, Emmanuel mat = read.csv("~/format_test.csv", fill=TRUE, header=FALSE, as.is=TRUE) first.col.idx =

Re: [R] How to create a vector by searching information in multiple data.tables in r?

2020-01-31 Thread Ivan Krylov
On Fri, 31 Jan 2020 18:06:00 + Ioanna Ioannou wrote: > I want to extract e.g., the country from all these files. How can i > add NA for the files for which the country is not mentioned? I am starting from the beginning, since I don't know what you have tried and where exactly you are stuck.

Re: [R] How to extract or sort values from one column

2020-01-31 Thread pooja sinha
It worked, initially I made some mistake. Thanks a lot. Trying to read basics of R. Puja On Fri, Jan 31, 2020 at 1:06 PM pooja sinha wrote: > Thanks but it gives error "incorrect number of dimensions". > > > Best, > Puja > > On Fri, Jan 31, 2020 at 11:37 AM K. Elo wrote: > >> Hi! >> >> To

Re: [R] How to extract or sort values from one column

2020-01-31 Thread pooja sinha
Thanks but it gives error "incorrect number of dimensions". Best, Puja On Fri, Jan 31, 2020 at 11:37 AM K. Elo wrote: > Hi! > > To extract full rows, use: > > df[ ( (df$Value>=0.2 & df$Value<=0.4) | df$Value>=0.7 ), ] > > > But it is also a good idea to start reading some introductory >

[R] How to create a vector by searching information in multiple data.tables in r?

2020-01-31 Thread Ioanna Ioannou
Hello everyone, Once again i am a bit stack. I have over 200 json files with information. I managed to manipulate them and their format is rather difficult as shown below. Unfortunately, not all these files contain the same fields. I want to extract e.g., the country from all these files. How

Re: [R] How to extract or sort values from one column

2020-01-31 Thread K. Elo
Hi! To extract full rows, use: df[ ( (df$Value>=0.2 & df$Value<=0.4) | df$Value>=0.7 ), ] But it is also a good idea to start reading some introductory tutorials. These are basic things you can find in all tutorials :-) Best, Kimmo pe, 2020-01-31 kello 10:50 -0500, pooja sinha kirjoitti: >

Re: [R] How to extract or sort values from one column

2020-01-31 Thread Bert Gunter
Time to study some tutorials and do your own work, don't you think? There are many good tutorials on the web. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On

Re: [R] How to read a file containing two types of rows - (for the Netflix challenge data format)

2020-01-31 Thread Jan Galkowski
With the *data.table* package, *R* can use *fread* as follows: > grab<- function(file) > { > fin<- fread(file=file, > sep=NULL, > dec=".", > quote="", nrows=Inf, header=FALSE, > stringsAsFactors=FALSE, verbose=FALSE, > col.names=c("record"), > check.names=FALSE, fill=FALSE,

Re: [R] How to extract or sort values from one column

2020-01-31 Thread pooja sinha
Thanks for providing the code but I also needed the output sheet in .csv format with all the four columns corresponding to the value (Chrom, Start_pos, End_pos & Value ranging from what I specified earlier). Puja On Fri, Jan 31, 2020 at 10:23 AM K. Elo wrote: > Hi! > > Oh, sorry, one "s" too

Re: [R] How to extract or sort values from one column

2020-01-31 Thread K. Elo
Hi! Oh, sorry, one "s" too much in my code. Here the correct one: df$Value[ (df$Value>=0.2 & df$Value<=0.4) | df$Value>=0.7 ] Best, Kimmo pe, 2020-01-31 kello 17:12 +0200, K. Elo kirjoitti: > Hi! > > Let's assume your data is stored in a data frame called 'df'. So this > code should do the

Re: [R] How to extract or sort values from one column

2020-01-31 Thread K. Elo
Hi! Let's assume your data is stored in a data frame called 'df'. So this code should do the job: df$Value[ (df$Value>=0.2 & df$Values<=0.4) | df$Value>=0.7 ] Best, Kimmo pe, 2020-01-31 kello 09:21 -0500, pooja sinha kirjoitti: > Hi All, > > I have a .csv file with four columns (Chrom,

Re: [R] How to extract or sort values from one column

2020-01-31 Thread Ben Tupper
Welcome to R! You could try using findInterval() which will quickly determine into which interval your values belong. # your break points define the intervals brks <- c( 0.2, 0.4, 0.7) # make an example data frame n <- 100 x <- data.frame( x = seq_len(n), y = runif(n, min = 0, max = 1)) #

[R] How to extract or sort values from one column

2020-01-31 Thread pooja sinha
Hi All, I have a .csv file with four columns (Chrom, Start_pos, End_pos & Value). The value column range from 0 to 1.0 having more than 2.8 million rows. I need to write a code from which I can extract the values from 0.2-0.4 & 0.7-1.0. Could anyone help me in writing the code because I am new to

Re: [R] How to read a file containing two types of rows - (for the Netflix challenge data format)

2020-01-31 Thread Chris Evans
I am sure Rainer's approach is good and I know my R programming is truly terrible but here's a crude script in base R that does what you want # rawDat <- readLines(con = "netflix.dat") fil <- tempfile(fileext = ".dat") cat("*1:* value1,value2, value3 value1,value2, value3 value1,value2, value3

Re: [R] How to read a file containing two types of rows - (for the Netflix challenge data format)

2020-01-31 Thread Rainer M Krug
I did something similar yesterday… Use readLine() to read at in and identify the “*1:*, … with a regex. Than you have your dividers. In a second step, use read.csv(skip = …, Ncollumns = …) to read the enclosed blocks, and last, combine them accordingly. This is written without an R

[R] How to read a file containing two types of rows - (for the Netflix challenge data format)

2020-01-31 Thread Emmanuel Levy
Hi, I'd like to use the Netflix challenge data and just can't figure out how to efficiently "scan" the files. https://www.kaggle.com/netflix-inc/netflix-prize-data The files have two types of row, either an *ID* e.g., "1:" , "2:", etc. or 3 values associated to each ID: The format is as