[R] Please help(urgent) - How to simulate transactional data for reliability/survival analysis

2017-06-27 Thread sandeep Rana
Hi friends, 
I haven't done such a simulation before and any help would be greatly 
appreciated. I need your guidance.

I need to simulate end to end data for Reliability/survival analysis of a Pump 
,with correlation in place, that is at 'Transactional level' or at the 
granularity of time-minutes, where each observation is a reading captured via 
Pump's sensors each minute.
Once transactional data is prepared I Then need to summarise above data for 
reliability/ survival analysis. 

To begin with below is the transactional data format that i want prepare: 
Pump-id| Timestamp | temp | vibration | suction pressure| discharge pressure | 
Flow 

Above transactional data has to be prepared with below failure modes
Defects :
(1)Cavitation – very high in frequency but low impact
(2)Bearing Damage – very low in frequency but high impact
(3)Worn Shaft – medium frequency but medium impact

I have used survsim package but that's not what I need here. 
Please help and guide. 

Regards,
Sandeep 

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] Rfacebook -- searchPages() -- help

2016-03-07 Thread Sandeep Rana
Hi,
I’m using searchPages() function in ‘Rfacebook' package. 

I want to know why I receive 400 pages when i command only 300 pages in the 
function.
sample code: 
searchPages(‘youtube’, n=300, token=fb_oauth)
output printed: 200 pages 400 

Also, the result differs whenever I specify n>200 in the function.

Regards,
Sunny Singha
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] issue -- Packages unavailable for R version 3.2.3

2016-02-23 Thread Sandeep Rana
Hi,

I have newly installed R version 3.2.3 and experiencing an issue where the
packages that I had been using in previous release aren't compatible in the
latest release.
I need you help to suggest how we could force the installation even if its
not supported or what is the workaround to move ahead with it.

Right now, I need to install the package 'sentiment'. Please help.

Regards,

Sandeep S. Rana

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R Memory Issue

2016-02-17 Thread Sandeep Rana
Hi,
May be its reading your file and taking time which depends on size of the file 
that you are reading.
Please explore ‘data.table’ library to read big files in few seconds.

If you attempt to close the application while execution had been in progress 
for sometime it would take time most of the times.
Instead, end the r_session process from task manager which is immediate. 

Regards,
Sandeep S. Rana


> On 17-Feb-2016, at 2:46 PM, SHIVI BHATIA  wrote:
> 
> Dear Team,
> 
> 
> 
> Every now and then I face some weird issues with R. For instance it would
> not read my csv file or any other read.table command and once I would close
> the session and reopen again it works fine. 
> 
> 
> 
> It have tried using rm(list=ls()) & gc() to free some memory and restart R
> 
> 
> 
> 
> Also today while closing the R session it took more than 10 minutes. I am
> not sure as to what is leading to this. Kindly throw some light on this. Not
> sure if I have provided enough information.  
> 
> 
> 
> Thanks, Shivi
> 
> Mb: 9891002021
> 
> 
> 
> This e-mail is confidential. It may also be legally privileged. If you are 
> not the addressee you may not copy, forward, disclose or use any part of it. 
> If you have received this message in error, please delete it and all copies 
> from your system and notify the sender immediately by return e-mail. Internet 
> communications cannot be guaranteed to be timely, secure, error or 
> virus-free. The sender does not accept liability for any errors or omissions.
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Need your favour : twitter sentiment issue while cleaning the corpus

2016-02-16 Thread Sandeep Rana
Hi,
In continuation to my initial mail I also observed that as I include more 
number of tweets, the likelihood of getting this error increases.

Platform I’m using:
- Mac Yosemite
- R version 3.2.2(RStudio) 

I have below questions:
- Does this error has to do anything with the default locale set in R session? 
I have had it set from Mac terminal “defaults write org.R-project.R force.LANG 
en_US.UTF-8” 
- Before creating the Corpus() I had the tweets converted to character by using 
this command tw_text <- sapply(tw, function(x) x$getText()). Is it the 
recommended approach ?

How should I go about getting this issue resolved ?

Regards,
Sunny Singha


> On 16-Feb-2016, at 5:22 PM, Sandeep Rana <sunnysingha.analyt...@gmail.com> 
> wrote:
> 
> Hi,
> I need your favour. I received below warning while cleaning the corpus of 
> tweets which is not allowing me to further the analysis:
> 
> Warning message:
> In mclapply(content(x), FUN, ...) :
>   scheduled core 1 encountered error in user code, all values of the job will 
> be affected
> 
> Code used: for cleaning. 
> tw_clean <- tm_map(tw_corpus, removePunctuation)
> tw_clean <- tm_map(tw_clean, content_transformer(tolower))
> tw_clean <- tm_map(tw_clean, removeWords, stopwords('english'))
> tw_clean <- tm_map(tw_clean, removeNumbers)
> tw_clean <- tm_map(tw_clean, stripWhitespace)
> 
> Code used to create the corpus:
> tw_corpus <- Corpus(VectorSource(tw_text))
> 
> The error is raised for each of the above line of code. 
> 
> I some how found a way to ignore the error/warning message by including 
> ‘lazy=TRUE’ argument in the tm_map() function
> but when attempted to view the wordcloud(tw_clean)  below error is raised 
> with the same warning.
> 
> Error in UseMethod("meta", x) : 
>   no applicable method for 'meta' applied to an object of class "try-error"
> 
> In addition: Warning message:
> In mclapply(unname(content(x)), termFreq, control) :
>   scheduled core 1 encountered error in user code, all values of the job will 
> be affected
> 
> Regards,
> Sunny Singha


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] Need your favour : twitter sentiment issue while cleaning the corpus

2016-02-16 Thread Sandeep Rana
Hi,
I need your favour. I received below warning while cleaning the corpus of 
tweets which is not allowing me to further the analysis:

Warning message:
In mclapply(content(x), FUN, ...) :
  scheduled core 1 encountered error in user code, all values of the job will 
be affected

Code used: for cleaning. 
tw_clean <- tm_map(tw_corpus, removePunctuation)
tw_clean <- tm_map(tw_clean, content_transformer(tolower))
tw_clean <- tm_map(tw_clean, removeWords, stopwords('english'))
tw_clean <- tm_map(tw_clean, removeNumbers)
tw_clean <- tm_map(tw_clean, stripWhitespace)

Code used to create the corpus:
tw_corpus <- Corpus(VectorSource(tw_text))

The error is raised for each of the above line of code. 

I some how found a way to ignore the error/warning message by including 
‘lazy=TRUE’ argument in the tm_map() function
but when attempted to view the wordcloud(tw_clean)  below error is raised with 
the same warning.

Error in UseMethod("meta", x) : 
  no applicable method for 'meta' applied to an object of class "try-error"

In addition: Warning message:
In mclapply(unname(content(x)), termFreq, control) :
  scheduled core 1 encountered error in user code, all values of the job will 
be affected

Regards,
Sunny Singha
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Error with Twitter Authorization for Sentiment Analysis

2016-02-15 Thread Sandeep Rana
Shivi,
I’m not sure how you have installed ‘twitterR’ package. But please follow below 
steps and your issue will be resolved: 
- Ensure there are no objects in memory. To be sure run these commands : 
- .r.restartR()
- rm(list=ls())  
- gc()

# Remove packages
remove.packages('twitteR')
remove.packages('ROAuth')
remove.packages('rjson')
remove.packages('bit64')
remove.packages('httr')
remove.packages('devtools')

- Execute below in sequence and later assign your keys to get going:
 #Twitter analytics with R
install.packages(c("devtools", "rjson", "bit64", "httr"))
install_github("twitteR", "geoffjentry")
install.packages("ROAuth")

library(devtools)
library(ROAuth)
library(twitteR)

Regards,
Sunny Singha


> On 15-Feb-2016, at 6:36 PM, SHIVI BHATIA <shivi.bha...@safexpress.com> wrote:
> 
> Hi Sandeep,
> 
> Here is my authorization code:
> 
> setup_twitter_oauth(consumer_key,consumer_secret,access_token,access_secret)
> .
> 
> Prior to this I have just added my consumer key and the other var after
> logging at https://apps.twitter.com. Does this help.
> 
> -Original Message-
> From: Sandeep Rana [mailto:sunnysingha.analyt...@gmail.com]
> Sent: Monday, February 15, 2016 5:52 PM
> To: SHIVI BHATIA <shivi.bha...@safexpress.com>
> Cc: r-help@r-project.org
> Subject: Re: [R] Error with Twitter Authorization for Sentiment Analysis
> 
> Shivi,
> Could you also share the piece of code to have a look at ?
> 
> Regards,
> Sunny Singha
> 
>> On 14-Feb-2016, at 3:45 PM, SHIVI BHATIA <shivi.bha...@safexpress.com>
> wrote:
>> 
>> Dear Team,
>> 
>> 
>> 
>> Every now and then I face issues while connecting to Twitter:
>> 
>> 
>> 
>> Error in check_twitter_oauth() : OAuth authentication error:
>> 
>> This most likely means that you have incorrectly called
>> setup_twitter_oauth()'
>> 
>> 
>> 
>> I have checked multiple github suggestion and statsexchange forum &
>> have followed all suggestion such as to update httpuv package and
>> calling out the library names in a certain manner however I am still
>> not successful.. Also apart from these there was also recommendation
>> on httr package to be called first though while calling the httr package I
> got this message:
>> 
>> 
>> 
>> Error in unloadNamespace(package) :
>> namespace 'httr' is imported by 'twitteR' so cannot be unloaded
>> 
>> 
>> Not sure on what is to be done here hence require help from the forum.
>> 
>> 
>> 
>> 
>> 
>> Thanks, Shivi
>> 
>> Mb: 9891002021
>> 
>> 
>> 
>> This e-mail is confidential. It may also be legally privileged. If you are
> not the addressee you may not copy, forward, disclose or use any part of it.
> If you have received this message in error, please delete it and all copies
> from your system and notify the sender immediately by return e-mail.
> Internet communications cannot be guaranteed to be timely, secure, error or
> virus-free. The sender does not accept liability for any errors or
> omissions.
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> 
> This e-mail is confidential. It may also be legally privileged. If you are 
> not the addressee you may not copy, forward, disclose or use any part of it. 
> If you have received this message in error, please delete it and all copies 
> from your system and notify the sender immediately by return e-mail. Internet 
> communications cannot be guaranteed to be timely, secure, error or 
> virus-free. The sender does not accept liability for any errors or omissions.
> 


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Error with Twitter Authorization for Sentiment Analysis

2016-02-15 Thread Sandeep Rana
Shivi,
Could you also share the piece of code to have a look at ?

Regards,
Sunny Singha

> On 14-Feb-2016, at 3:45 PM, SHIVI BHATIA  wrote:
> 
> Dear Team,
> 
> 
> 
> Every now and then I face issues while connecting to Twitter:
> 
> 
> 
> Error in check_twitter_oauth() : OAuth authentication error:
> 
> This most likely means that you have incorrectly called
> setup_twitter_oauth()'
> 
> 
> 
> I have checked multiple github suggestion and statsexchange forum & have
> followed all suggestion such as to update httpuv package and calling out the
> library names in a certain manner however I am still not successful.. Also
> apart from these there was also recommendation on httr package to be called
> first though while calling the httr package I got this message:
> 
> 
> 
> Error in unloadNamespace(package) : 
>  namespace 'httr' is imported by 'twitteR' so cannot be unloaded
> 
> 
> Not sure on what is to be done here hence require help from the forum. 
> 
> 
> 
> 
> 
> Thanks, Shivi
> 
> Mb: 9891002021
> 
> 
> 
> This e-mail is confidential. It may also be legally privileged. If you are 
> not the addressee you may not copy, forward, disclose or use any part of it. 
> If you have received this message in error, please delete it and all copies 
> from your system and notify the sender immediately by return e-mail. Internet 
> communications cannot be guaranteed to be timely, secure, error or 
> virus-free. The sender does not accept liability for any errors or omissions.
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] XGBoost continuos outcome case --- reg:linear in R

2016-02-08 Thread Sandeep Rana
Hi,
While learning how to implement XGBoost in R I came across below case and want 
to know how to go about it.

Outcome variable: continous
independent features: mix of categorical and continuous 
nrow(train_set): 8523

Since, XGBoost natively supports only numeric features, I applied one hot 
encoding on the training data set:

target <- train_set$Outlet_sales
sparsed_train_set <- sparse.model.matrix(~.-1, data=train_set)

nrow(sparsed_train_set) : 4526 #As expected, the row count is reduced.

Note: The target variable is continuous and has as many rows as in train_set 
i.e 8523, before one hot encoding is applied.

# To build mode:
bst <- xgboost(data = sparsed_train_set, label = target, max.depth = 4,
   eta = 1, nthread = 4, nround = 50, objective=reg:linear)

# Above execution would fail as 

My questions:
- How should I handle above disparity between sparsed training data and label  
while building the model ?
- How should I use XGBoost to perform regression where outcome is continuous ? 
Most of the web portals refers to the cases related to classification.
  If any could lead me to the source explaining this. I have gone through the 
documentation but not much cleared in this case.

Regards,
Sandeep S. Rana















[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] rfImpute() error-- while missing imputation --

2016-02-07 Thread Sandeep Rana
Hi,
While executing rfImpute() in order to impute missing values in the data set I 
receive below error :

 |  Out-of-bag   |
Tree |  MSE  %Var(y) |
 800 | 2.979e+04 1.02 |
Error in prox[miss, -miss, drop = FALSE] %*% xf[, j][-miss] : 
  requires numeric/complex matrix/vector arguments

Has anyone experienced it aware of the cause? Below is the command I used to :
 x_tr_imp <- rfImpute(x_train[,-c(1,7)], x_train$Outlet_Sales, iter=5, 800)

Regards,
Sandeep S. Rana
sunnysingha.analyt...@gmail.com 
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] rfImpute() error-- while missing imputation --

2016-02-07 Thread Sandeep Rana
Oh! It was a typo. ntree=800 was to be specified. Thanks Bret.
> .On 07-Feb-2016, at 8:58 PM, Bert Gunter <bgunter.4...@gmail.com> wrote:
> 
> 5800  **not 5, 800** , no commas and no spaces.
> 
> Please read an R tutorial or two to learn how to properly work with R
> if this is not merely a typo.
> 
> -- Bert
> 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 Sun, Feb 7, 2016 at 7:19 AM, Sandeep Rana
> <sunnysingha.analyt...@gmail.com> wrote:
>> Hi,
>> While executing rfImpute() in order to impute missing values in the data set 
>> I receive below error :
>> 
>> |  Out-of-bag   |
>> Tree |  MSE  %Var(y) |
>> 800 | 2.979e+04 1.02 |
>> Error in prox[miss, -miss, drop = FALSE] %*% xf[, j][-miss] :
>>  requires numeric/complex matrix/vector arguments
>> 
>> Has anyone experienced it aware of the cause? Below is the command I used to 
>> :
>> x_tr_imp <- rfImpute(x_train[,-c(1,7)], x_train$Outlet_Sales, iter=5, 800)
>> 
>> Regards,
>> Sandeep S. Rana
>> sunnysingha.analyt...@gmail.com <mailto:sunnysingha.analyt...@gmail.com>
>>[[alternative HTML version deleted]]
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R editor for Mac

2016-01-20 Thread Sandeep Rana
Christopher,
Download TextWrangler from App store. I’m using it and its very convenient.

Regards,
Sunny


> On 20-Jan-2016, at 11:52 PM, Christofer Bogaso  
> wrote:
> 
> Hi,
> 
> Could you please suggest a good R editor for Mac OS X (10.7.5)
> Previously my operating system was Windows and there I used Notepad++,
> I really had very nice experience with it. However I dont see any Mac
> version is available for Mac.
> 
> Appreciate your positive feedback.
> 
> Thanks and regards,
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] featurised matrix factorisation in R

2016-01-17 Thread Sandeep Rana
Thanks Berend,
Through NMF we would be able to capture relationship between users and items 
and discover latent factors/topics of those users items. 
I want to combine the above with effect of user features(e.g: gender, age, 
location, time… etc.) and item features (e.g.: item_category, price, location, 
etc….) hence, the name featurised 
matrix factorisation. I didn’t find yet reference to package that takes in user 
and item features too.

Regards,
Sunny

> On 16-Jan-2016, at 9:06 PM, Berend Hasselman <b...@xs4all.nl> wrote:
> 
> 
>> On 16 Jan 2016, at 12:22, Sandeep Rana <sunnysingha.analyt...@gmail.com> 
>> wrote:
>> 
>> Hi,
>> I want to perform non-negative featurised Matrix factorisation in ‘R’. Is 
>> there any ‘R' package or documentation that explains on this ?
>> 
> 
> Well I don't know about the "featurised" but googling on (you didn't do that?)
> 
> non-negative featurised Matrix factorisation R
> 
> found this:  https://cran.r-project.org/web/packages/NMF/index.html
> 
> Berend
> 
>> Regards,
>> Sunny
>>  [[alternative HTML version deleted]]
>> 
> 
> 
> No html please.
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] featurised matrix factorisation in R

2016-01-16 Thread Sandeep Rana
Hi,
I want to perform non-negative featurised Matrix factorisation in ‘R’. Is there 
any ‘R' package or documentation that explains on this ?

Regards,
Sunny
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.