Matthew Johnson | 31 Jul 07:48 2015
Picon

setting up R -- VM Fusion, WIndows7

Hi,

As i need R to speak to Bloomberg (and big only runs on windows), i'm
running windows 7 via VM Fusion on my mac.

I think i am having permission problems, as i cannot use install.packages,
and cannot change .libPaths via either a .Rprofile, or Profile.site.

I've posted more detail in this super-user question --
http://superuser.com/questions/948083/how-to-set-environment-variables-in-vm-fusion-windows-7

Throwing it over to this list as well, as I've spent about half the time i
had allowed for my project on (not getting) set up.

I realise this is a very niche problem - hoping that someone else has had a
similar problem, and can offer pointers.

best

mj

	[[alternative HTML version deleted]]

prabir das | 31 Jul 06:46 2015
Picon

dataframe for netcdf data

I am trying to analyse time-series .netcdf (3D lat,long and time domain)
climate data. I want to apply the SPEI package (calculation of standardized
precipitation evapotranspiration index) on it. But unable to arrange my data
in the required data frame. As I am a beginner in R, it will be very much
helpful if someone provide me the details of the code to be written before
executing the package.

The details of SPEI proggrame is as follows:

spei(data, scale, kernel = list(type = 'rectangular', shift = 0),
distribution = 'log-Logistic', fit = 'ub-pwm', na.rm = FALSE,
ref.start=NULL, ref.end=NULL, x=FALSE, params=NULL, ...)

Thanks in advance.

Prabir

	[[alternative HTML version deleted]]

April Smith | 31 Jul 02:20 2015
Picon

Looping help

I have never looped before and know I need to.  I am unsure how to proceed:

   - Action I need done: d(Data[1,2:399], q=0, boot=TRUE,
   boot.arg=list(num.iter=1000))
   - I need this to happen to all rows, I need All[1,2:399] to increase to
   All[2:399], etc.
   - But I also need the results from q increasing from 0 to 0.25, 0.5, 1,
   2, 4,8,16,32,64 before the loop moves on to the next row.
   - For each iteration I will receive two values: D and st.err.  I need
   this put into a matrix

I feel like this should be pretty simple to learn, but I have never looped
before.

I am hoping to get more of a tutorial on how to write loop code, then to
just be given the loop code.

Thanks,
April

	[[alternative HTML version deleted]]

Luca Gagliardone | 30 Jul 21:56 2015
Picon

Problem with package plm

Hi!

I am trying yo run a regression using the plm package.
I tried in two different ways, that should give the same result, but
eventually do not; and i cannot understand the reason.

- The first way:
Accellerator.model <- read.delim("~/Desktop/Tesi/Accellerator model.txt")
data <- Accellerator.model
Panel <- plm.data(Accellerator.model,index=c("ID","Year"))
y <- data$Net.Cap.Inv
p  <- data$Oil.Price
rev <- data$Revenue
ebi <- data$EBITDA
tas <- data$Tot.Assets
fas <- data$Non.current
tas1 <- data$tas1
rev1 <- data$rev1
rev2 <- data$rev2
fas1 <- data$fas1
cap1 <- data$cap1
# FIXED 1
fixed <- plm(y~fas1+rev+rev1+p,data=pdata,model="within")
summary(fixed)
Oneway (individual) effect Within Model

Call:
plm(formula = y ~ fas1 + rev + rev1 + p, data = pdata, model = "within")

Unbalanced Panel: n=19, T=6-19, N=282
(Continue reading)

Jianling Fan | 30 Jul 21:51 2015
Picon

About nls.

Hello,

I am trying to do a nls regression with R.  but I always get a error
as "Error in numericDeriv(form[[3L]], names(ind), env) :  Missing
value or an infinity produced when evaluating the model".  I googled
it and found someone said it is because of the improper start value. I
tried many times but can not solve it. Does anyone can help me?

thanks a lot !

my code is:

fit1<-nls2(lnd~log(1/(den1/R1+den2+den3+den4+den5/R5)-1)/c+log(d50),
              start=c(R1=0.9, R5=23, c=-1.1, d50=10), data=SWrt)

data (SWrt) is:

  Depth      lnd   den1 den2 den3 den4   den5
1     20 2.995732 0.4190 0.00 0.00 0.00   0.00
2     40 3.688879 0.6725 0.00 0.00 0.00   0.00
3     60 4.094345 0.8780 0.00 0.00 0.00   0.00
4     80 4.382027 0.9660 0.00 0.00 0.00   0.00
5    100 4.605170 0.9990 0.00 0.00 0.00   0.00
6     15 2.708050 0.0000 0.38 0.00 0.00   0.00
7     30 3.401197 0.0000 0.48 0.00 0.00   0.00
8     45 3.806662 0.0000 0.85 0.00 0.00   0.00
9     60 4.094345 0.0000 0.88 0.00 0.00   0.00
10   120 4.787492 0.0000 1.00 0.00 0.00   0.00
11    15 2.708050 0.0000 0.00 0.48 0.00   0.00
12    30 3.401197 0.0000 0.00 0.89 0.00   0.00
(Continue reading)

Anshuk Pal Chaudhuri | 30 Jul 17:45 2015

Itinerary Ticket Parser

Dear All,

I have seeing a lot of apis', (like worldmate or new product called sift from easilydo) which is used for
parsing email and different itinerary tickets. Is there any packages in R which does that?

Regards,
Anshuk Pal Chaudhuri

	[[alternative HTML version deleted]]

Evan Kransdorf | 30 Jul 22:31 2015
Picon

Shiny help with verbatimTextOutput

Hello,

I am working with Shiny and want to use it to show user-entered input from
a check box.  However, when using verbatimTextOutput with no options
selected in the check box I get "character(0)" as the output. Is there any
way to make this so it displays nothing instead?
Thanks

#Begin R code
#ui.R

checkboxGroupInput("string", label = h5("test"), choices = list("opt1" = 1,
"opt2" = 2)),

h5("User input goes here"),verbatimTextOutput("o"),

#server.R

output$o <- renderPrint({ paste(string) })

	[[alternative HTML version deleted]]

sbihorel | 30 Jul 17:37 2015

Using latticeExtra as.layer function with different number of plot panels

Hi,

When the as.layer function is used to overaly 2 lattice plots, there 
seems to be an assumption that the data used in both plots will generate 
the same number of panels (and, I believe, in the same order). In case 
the data used in the plot within the as.layer call is incomplete , data 
may be plotted on the "wrong" panel, and data seem to get re-used on the 
last panel(s). See what happens in the example code below when the 
records with state.region=="South" are dropped...

Is there a trick to overlay panel based upon the conditioning variable 
value rather than the panel order?

require(lattice)
require(latticeExtra)
state2 <- state <- data.frame(state.x77,state.region)
state2$Income <- sample(state2$Income)
state3 <- state2[which(state2$state.region!="South"),]
foo <- xyplot(Income~Population|state.region,data=state,main='foo')
foo

bar <- update(foo,main='bar') + 
as.layer(xyplot(Income~Population|state.region,data=state2,col='red'))
bar

bar2 <- update(foo,main='bar2') + 
as.layer(xyplot(Income~Population|state.region,data=state3,col='red'))
bar2

Thank you
(Continue reading)

John Kane | 30 Jul 17:23 2015

ggplot2 - geom_text() with date as x-axis

I am trying to annotate a graph using geom_text() and I seem to be misunderstanding how to use a date in the
co-ordinates---or, at least, I think that is the problem. Code is below.

Can anyone give me a suggestion of where I am going wrong?

Thanks,
John

John Kane
Kingston ON Canada
###===========================================
ibrary(ggplot2)
library(lubridate)
ins  <-  structure(list(td = structure(c(1437804720, 1437824100, 1437836220, 
1437851580, 1437863460, 1437878640, 1437890640, 1437904800, 1437918240, 
1437926100, 1437941340, 1437951240), tzone = "UTC", class = c("POSIXct", 
"POSIXt")), glucose = c(328L, 390L, 358L, 387L, 440L, 328L, 365L, 
450L, 467L, 477L, 408L, 457L), dose = c(NA, 0.5, NA, NA, 0.5, 
NA, NA, 0.5, NA, NA, NA, 0.5)), .Names = c("td", "glucose", "dose"
), row.names = c(NA, -12L), class = "data.frame")

anon  <- na.omit(ins)  # extract shots 

texdat =  ymd_hm("2015-07-26 20:09")

glucose  <-  ggplot(ins, aes(td, glucose)) + geom_point(colour = "red") + geom_line(colour = "blue")
p1  <-  glucose + annotate("text", x = texdat, y = 500, label = anon[ ,3 ], cex = 3) 
p1

# Now the problem
(Continue reading)

John Kane | 30 Jul 16:07 2015

Re: Mixed Date Formats

That's what I get for reading without a cup of tea beside me. I looked at 5 and my eye just slide over the last
entries. 

I change my assessment : this looks bad. (Tea at hand).

So, presumably Farnoosh may not be able to guarantee the formats for 3 & 4 either unless they are
unambiguously dated.

John Kane
Kingston ON Canada

> -----Original Message-----
> From: sarah.goslee <at> gmail.com
> Sent: Thu, 30 Jul 2015 09:19:55 -0400
> To: jrkrideau <at> inbox.com
> Subject: Re: [R] Mixed Date Formats
> 
> On Thu, Jul 30, 2015 at 9:14 AM, John Kane <jrkrideau <at> inbox.com> wrote:
>> This does not look good. But not too bad
>> 
>> Can we assume that the original data is in D-M-Y in all cases. The
>> values at 3 & 4 in the sample data are ambigous, in that someone may be
>> using the American dating system of M-D-Y.  Given the rest of the data
>> it seems unlikely but possible.
> 
> Take a look at 5 and 7:
>>   5  1375 31/12/2011 # dd/mm/yyyy
>>   7  3423 01/22/2011 # mm/dd/yyyy
> 
> They're unambiguously different.
(Continue reading)

MyList | 30 Jul 16:00 2015
Picon

Need help

Dear All,

What are inner and outer matrix multiplication. Kindly guide me where to look for this Wikipedia was not
much help.

Thanks in Advance,
Harmeet

Gmane