[R] Text Mining in R

2016-05-17 Thread Burhan ul haq
Hi, Wishing you all well. I am exploring text mining with R. Here is where I need help: 1. The starting point is a data frame worder1<- c("I am, taking 2","are these the three samples?", "He speaks differently to you, aint it !","This is distilled - my dear, now give me $3","I

Re: [R] Sum of Numeric Values in a DF Column

2016-04-18 Thread Burhan ul haq
le 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 Mon, Apr 18, 2016 at 10:07 AM, Richard M. Heiberger <r...@temple.edu>

[R] Sum of Numeric Values in a DF Column

2016-04-18 Thread Burhan ul haq
Hi, I request help with the following: INPUT: A data frame where column "Lower" is a character containing numeric values (different count or occurrences of numeric values in each row, mostly 2) > dput(dd) structure(list(State = c("Alabama", "Alaska", "Arizona", "Arkansas", "California"), Lower

Re: [R] R-help Digest, Vol 157, Issue 25

2016-03-24 Thread Burhan ul haq
Thanks to Boris Steipe, Jim Lemon and Ivan Calandra for replying. I messed up while copying, there are equal number of values for each country. @ Ivan, In case there were different number of values, and we wanted to fill in with 1) NA, or 2) "average of the rest of values" in the missing

[R] Splitting a vector into data frame

2016-03-24 Thread Burhan ul haq
Hi, 1. I have scraped some data from the web, subset shown below > dput(temp.data) c("Armenia", "Armenia", "43827", "39200", "35700", "36700", "39341", "30571", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", " 0", "0", "0", "0", "0", "Austria", "Austria", "135417", "166200", "144500",

Re: [R] Error in upgrading ggplot2

2016-03-03 Thread Burhan ul haq
ep is upgrading your R software to the latest... if > only to comply with the Posting Guide. > -- > Sent from my phone. Please excuse my brevity. > > On March 3, 2016 9:33:05 PM PST, Burhan ul haq <ulh...@gmail.com> wrote: >> >> Hi, >> >> I was

[R] Error in upgrading ggplot2

2016-03-03 Thread Burhan ul haq
Hi, I was planning to use GGally, which required me to upgrade ggplot2 but despite trying multiple times, I have been unable to do so: The ggplot2 downloads and installs, but when I load it, I get the following message: > library("ggplot2", lib.loc="/usr/local/lib/R/site-library") Error in

[R] Grep Help

2016-02-22 Thread Burhan ul haq
Hi, # 1) I have read in a CSV file df = read.csv(file="GiftCards - v1.csv",stringsAsFactors=FALSE) head(df) str(df) # 2) converted to a tbl_df df2 = tbl_df(df) # 3) fixed the names to remove leading "X" character n = names(df2) n2 = gsub(pattern="^\\w","\\1",n) names(df2) = n2 # 4) somehow

Re: [R] Text Input from a Non Delimited File

2014-02-09 Thread Burhan ul haq
, but please let me know, if I should be posting this to sublime forum. \\Cheers On Mon, Feb 10, 2014 at 3:48 AM, Burhan ul haq ulh...@gmail.com wrote: Hi, I am trying to read in a file, which is not delimited by any specific characters. Something as follows

Re: [R] Generate Variable Length Strings from Various Sources

2014-01-18 Thread Burhan ul haq
Hi Rainer, Thanks for the tip. Your suggestion works perfectly, however as per the R Mantra of avoiding for loops, I propose the following this alternate: # number of strings to be created n - 50 # random length of each string v.length = sample( c( 2:4), n, rep = TRUE ) # letter sources

[R] Generate Variable Length Strings from Various Sources

2014-01-15 Thread Burhan ul haq
Hi, I am trying to generate variable length strings from variable sources as follows: # 8 8- # Function to generate a string, given: # its length(passed as len) # and the source(passed as src) my.f =

Re: [R] Relative Cumulative Frequency of Event Occurence

2013-11-29 Thread Burhan ul haq
0.333 0.250 0.400 0.333 0.4285714 [8] 0.500 0.444 0.500 A.K. On Thursday, November 28, 2013 11:26 AM, Burhan ul haq ulh...@gmail.com wrote: Hi, My objective is to calculate Relative (Cumulative) Frequency of Event Occurrence - something as follows

[R] Help with Cast Function

2013-11-29 Thread Burhan ul haq
Hi, This is the input data frame: ### df.1 = read.table(header=T,text= id gender WMC_alcohol WMC_caffeine WMC_no.drug RT_alcohol RT_caffeine RT_no.drug 1 1 female 3.7 3.7 3.9 488 236 371 2 2 female 6.4 7.3 7.9 607 376 349 3 3 female 4.6 7.4 7.3 643 226

Re: [R] Help with Cast Function

2013-11-29 Thread Burhan ul haq
(df.1[,c(1:2,grep(x,names(df.1)))],id.vars=c(id,gender),var=drug),drug=gsub(.*\\_,,drug))),by=c (id,gender,drug)) # Cheers ! On Sat, Nov 30, 2013 at 1:20 AM, David Winsemius dwinsem...@comcast.netwrote: On Nov 29, 2013, at 9:42 AM, Burhan ul haq wrote: Hi, This is the input data

Re: [R] Relative Cumulative Frequency of Event Occurence

2013-11-29 Thread Burhan ul haq
, 2013 12:36 PM, Burhan ul haq ulh...@gmail.com wrote: Hi Arun, Thanks a lot. It works perfectly. Here is the complete code - for all those who are interested to see Rel Cum Freq oscillating to reach the Expected Value # Bernouilli Trial where: v.fly=c(G,B) # Outcome is Green or Blue fly n

[R] Relative Cumulative Frequency of Event Occurence

2013-11-28 Thread Burhan ul haq
Hi, My objective is to calculate Relative (Cumulative) Frequency of Event Occurrence - something as follows: Sample.Number 1st.Fly 2nd.Fly Did.E.occur? Relative.Cum.Frequency.of.E 1 G B No 0.000 2 B B Yes 0.500 3 B G No 0.333 4 G B No 0.250 5 G G Yes 0.400 6 G B No 0.333 7 B B Yes 0.429 8 G G

[R] Generating Frequency Values

2013-11-26 Thread Burhan ul haq
Hi, My problem is as follows: INPUT: Frequency from one column and value of Piglets from another one OUTPUT: Repeat this Piglet value as per the Frequency i.e. Piglet 1, Frequency 3, implies 1,1,1 Piglet 7, Frequency 2, implies 7,7 SOLUTION: This is what I have tried so far: 1. A helper

Re: [R] Generating Frequency Values

2013-11-26 Thread Burhan ul haq
Hi, A big thanks to everyone who replied. But special ones to Berend for pointing out my mistakes, that will really help me in future. Cheers ! On Tue, Nov 26, 2013 at 11:19 PM, Berend Hasselman b...@xs4all.nl wrote: On 26-11-2013, at 15:59, Burhan ul haq ulh...@gmail.com wrote: Hi