Jenny Jiang | 29 Jul 03:47 2014
Picon
Picon

outputting R loop to a csv file

Hello,

My name is Jenny Jiang and I am a Finance Honours research student from the University of New South Wales.
Currently my research project involves the calculating of some network centrality measures in R by using
a loop, however I am having some trouble outputting my loop results to a desired CSV format.

Basically what I am doing is that for each firm year, I will need to calculate four different measures based
on director id and connected director id and output these to the CSV file. I have provided in the attachment
the code that I used for the R loop and CSV outputting (main-6.R). Using an example CSV file (data example
2), the output result I get is as shown in measure1.csv. As shown in the output file, the results are really
messy, where for each firm year, all director ids and each type of measure for all directors are displayed
in one cell. However, the desired format of output that I would like is as shown in output data template.xlsx.

As a result, I was just wondering if you could be able to help me to get the desired format that I would like,
which would be much easier to enable me to do further research on this.

I cannot be more than appreciated.

Best regards

Jenny
Hello,

My name is Jenny Jiang and I am a Finance Honours research student from the University of New South Wales.
Currently my research project involves the calculating of some network centrality measures in R by using
a loop, however I am having some trouble outputting my loop results to a desired CSV format.

Basically what I am doing is that for each firm year, I will need to calculate four different measures based
(Continue reading)

Vishal Chari | 29 Jul 05:05 2014
Picon

Error in validObject(.Object) : while running rqpd package

Hi 

I have installed rqpd on r 2.15.1 win 7 os. 
after loading rqpd package i get following output

Loading required package: quantreg
Loading required package: SparseM

Attaching package: ‘SparseM’

The following object(s) are masked from ‘package:base’:

    backsolve

Loading required package: MatrixModels
Loading required package: Matrix
Loading required package: lattice

Attaching package: ‘Matrix’

The following object(s) are masked from ‘package:SparseM’:

    det

Loading required package: Formula
Warning messages:
1: package ‘quantreg’ was built under R version 2.15.3 
2: package ‘SparseM’ was built under R version 2.15.3 
3: package ‘MatrixModels’ was built under R version 2.15.3 
4: package ‘lattice’ was built under R version 2.15.3 
(Continue reading)

Shi, Tao | 29 Jul 02:48 2014
Picon

interactive labeling/highlighting on multiple xy scatter plots

hi list,

I'm comparing the changes of ~100 analytes in multiple treatment conditions.  I plotted them in several
different xy scattter plots.  It would be nice if I mouse over one point on one scatter plot, the label of
the analyte on that scatter plot AS WELL AS on all other scatter plots will be automatically shown.  I know
brushing in rggobi does this, but its interface is not good and it needs R or ggobi to run (I want send the
results to the collaborators and let them to play with it without the need of installing R or ggobi on their
machine).  rCharts is nice but so far it can only create one scatter plot at a time. 

Any good suggestions?

Many thanks!

Tao

Worthington, Thomas A | 28 Jul 23:40 2014

Split PVClust plot

Dear All 

I'm using PVClust to perform hierarchical clustering, for the output plot I can control most of the
graphical I need, however the plot is large and I would like to split it vertically into two panels one above
the other. Is there a way to plot only part of a PVClust plot, I tried to convert it to a dendrogram with 

result2  = as.dendrogram(result)

however I get the error message "no applicable method for 'as.dendrogram' applied to an object of class
"pvclust". I also wondered whether it would be possible to convert to a phylogenetic tree and use the
functions in the 'ape' package?

Any suggestion on how to split up a PVclust plot would be greatly appreciated  (code for the plot below)

Thanks
Tom 

result <- pvclust(df.1, method.dist="uncentered", method.hclust="average",nboot=10)
par(mar=c(0,0,0,0))
par(oma=c(0,0,0,0))
plot(result, print.pv =FALSE, col.pv=c("red","",""), print.num=FALSE, float = 0.02, font=1, 
	axes=T, cex =0.85, main="", sub="", xlab="", ylab= "", labels=NULL, hang=-1)
pvrect(result, alpha=0.95)

ottorino | 28 Jul 15:46 2014
Picon

Is dataset "headsize" from MVA or HSAUR2 packages missing or am I missing something ?

Dear R-helpers,
I've started the study of 

An introductionto applied multivariate analysis with R (Everitt and
Hothorn)

After loading the library, which depends on HSAUR2, it seems that the
dataset "headsize" is not available (as well as "measure" and "exam")

Datasets from the same book are nevertheless available, such as
"heptathlon", "pottery", "USairpollution"

Am I missing something obvious here ?

Thanks in advance

--

-- 
Ottorino-Luca Pantani, Università di Firenze
Dip.to di Scienze delle Produzioni Agroalimentari e  
dell'Ambiente (DISPAA)
P.zle Cascine 28 50144 Firenze Italia
Debian 7.0 wheezy -- GNOME 3.4.2
GNU Emacs 24.4.1 (i486-pc-linux-gnu, GTK+ Version 2.24.10)
ESS version 12.04-4 -- R 3.1.0

______________________________________________
R-help <at> r-project.org mailing list
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.
(Continue reading)

Kulupp | 28 Jul 15:07 2014
Picon

Calculate depth from regular xyz grid for any coordinate within the grid

Dear R-experts,

I have a regular grid dataframe (here: the first 50 rows) :

# data frame (regular grid) with x, y (UTM-coordinates) and z (depth)
# x=UTM coordinates (easting, zone 32)
# y=UTM coordinates (northing, zone 32)
# z=river-depth (meters)
df <- data.frame(x=c(3454240, 3454240, 3454240, 3454240, 3454240, 
3454250, 3454250, 3454250, 3454250, 3454250, 3454250, 3454250, 3454250, 
3454250, 3454250, 3454250,
                      3454250, 3454250, 3454260, 3454260, 3454260, 
3454260, 3454260, 3454260, 3454260, 3454260, 3454260, 3454260, 3454260, 
3454260, 3454260, 3454260,
                      3454260, 3454260, 3454260, 3454260, 3454260, 
3454260, 3454260, 3454260, 3454270, 3454270, 3454270, 3454270, 3454270, 
3454270, 3454270, 3454270,
                      3454270, 3454270),
                  y=c(5970610, 5970620, 5970630, 5970640, 5970650, 
5970610, 5970620, 5970630, 5970640, 5970650, 5970660, 5970670, 5970680, 
5970690, 5970700, 5970710,
                      5970720, 5970730, 5970610, 5970620, 5970630, 
5970640, 5970650, 5970660, 5970670, 5970680, 5970690, 5970700, 5970710, 
5970720, 5970730, 5970740,
                      5970750, 5970760, 5970770, 5970780, 5970790, 
5970800, 5970810, 5970820, 5970610, 5970620, 5970630, 5970640, 5970650, 
5970660, 5970670, 5970680,
                      5970690, 5970700),
                  z= c(-1.5621, -1.5758, -1.5911, -1.6079, -1.6247, 
-1.5704, -1.5840, -1.5976, -1.6113, -1.6249, -1.6385, -1.6521, -1.6658, 
(Continue reading)

Pavneet Arora | 28 Jul 12:19 2014

using foumula to calculate a column in dataframe

Hello All,
I need to calculate a column (Vupper) using a formula, but I am not sure 
how to. It will be easier to explain with an example. 

Again this is my dataset:
dput(nd)
structure(list(week = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 
29, 30), value = c(9.45, 7.99, 9.29, 11.66, 12.16, 10.18, 8.04, 
11.46, 9.2, 10.34, 9.03, 11.47, 10.51, 9.4, 10.08, 9.37, 10.62, 
10.31, 10, 13, 10.9, 9.33, 12.29, 11.5, 10.6, 11.08, 10.38, 11.62, 
11.31, 10.52), cusum = c(-0.550000000000001, -2.56, -3.27, -1.61, 
0.549999999999999, 0.729999999999999, -1.23, 0.229999999999999, 
-0.570000000000002, -0.230000000000002, -1.2, 0.269999999999998, 
0.779999999999998, 0.179999999999998, 0.259999999999998, 
-0.370000000000003, 
0.249999999999996, 0.559999999999997, 0.559999999999997, 3.56, 
4.46, 3.79, 6.08, 7.58, 8.18, 9.26, 9.64, 11.26, 12.57, 13.09
)), .Names = c("week", "value", "cusum"), row.names = c(NA, -30L
), class = "data.frame")

I have some constants in my data. These are:
sigma =1, h = 5, k = 0.5

The formula requires me to start from the bottom row (30th in this case). 
The formula for the last row will be row 30th Cusi value (13.09) + h(5) * 
sigma(1) = giving me the value of 18.1

Then the formula for the 29th row for Vupper uses the value of 30th Vupper 
(18.1) + k(0.5) * sigma(1) = giving me the value of 18.6
(Continue reading)

Pavneet Arora | 28 Jul 11:08 2014

Differencing between 2 previous values

Hello All,

I am trying to do a simple thing of calculating the absolute difference 
between 2 previous values. Since my original data consists of 30 rows, 
this column where I am storing my absolute difference values only consists 
of 29 rows (called the ?differ?)! And I am having troubling cbind ing the 
2 columns. Is there any way I can make the first  row of ?differ? column 
as NA?

So my data looks like following
dput(data)
tructure(list(week = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 
29, 30), value = c(9.45, 7.99, 9.29, 11.66, 12.16, 10.18, 8.04, 
11.46, 9.2, 10.34, 9.03, 11.47, 10.51, 9.4, 10.08, 9.37, 10.62, 
10.31, 10, 13, 10.9, 9.33, 12.29, 11.5, 10.6, 11.08, 10.38, 11.62, 
11.31, 10.52)), .Names = c("week", "value"), row.names = c(NA, 
-30L), class = "data.frame")

This is how I calculate my ?diff? column:
differ <- abs(diff(data$value))
Which gives me the following results:
[1] 1.46 1.30 2.37 0.50 1.98 2.14 3.42 2.26 1.14 1.31 2.44 0.96
[13] 1.11 0.68 0.71 1.25 0.31 0.31 3.00 2.10 1.57 2.96 0.79 0.90
[25] 0.48 0.70 1.24 0.31 0.79

As you can see this only contains 29 rows, so when I try to cbind it to my 
current data, I have an error. 
cbind(differ,data)
Error in data.frame(..., check.names = FALSE) : 
(Continue reading)

Anna Zakrisson Braeunlich | 28 Jul 08:38 2014
Picon
Picon

lattice, latticeExtra: Adding moving averages to double y plot

Hi lattice users,

I would like to add 5-year moving averages to my double y-plot. I have three factors needs to be plotted with
moving averages in the same plot. One of these reads off y-axis 1 and two from y-axis 2. I have tried to use the
rollmean function from the zoo-packages, but I fail in insering this into lattice (I am not an experienced
lattice user). I want to keep the data points in the plot.
Find below dummy data and the script as well as annotations further describing my question.

thank you in advance!
Anna Zakrisson

mydata<- data.frame(
  Year = 1980:2009,
  Type = factor(rep(c("stuff1", "stuff2", "stuff3"), each = 10*3)),
  Value = rnorm(90, mean = seq(90),
                sd = rep(c(6, 7, 3), each = 10)))

library(Lattice)
library(LatticeExtra)

stuff1data <- mydata[(mydata$Type) %in% c("stuff1"), ]
stuff12_3data <- mydata[(mydata$Type) %in% c("stuff2", "stuff3"), ]

# make moving averages function using zoo and rollmean:
library(zoo)
library(plyr)

f <- function(d)
{
  require(zoo)
(Continue reading)

Elizabeth Barrett-Cheetham | 28 Jul 06:46 2014
Picon

Is there a package for EFA with multiple groups?

Hello R users,

I’m hoping to run an exploratory and confirmatory factor analysis on a
psychology survey instrument. The data has been collected from
multiple groups, and it’s likely that the data is hierarchical/has 2nd
order factors.

It appears that the lavaan package allows me to run a multiple group
hierarchical confirmatory factor analysis. Yet, I can’t locate a
package that can run the equivalent exploratory analysis.

Could anyone please direct me to an appropriate package?

Many thanks,

Elizabeth

______________________________________________
R-help <at> r-project.org mailing list
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.
super | 28 Jul 05:33 2014

A quesion about Shiny

I now have two win7s in  a local area network called A and B.
A now can run shiny app, and it shows that it listen  192.168.1.100:6271. And A can visite the app in A's own
chrome using 192.168.1.100:6271.
Then I want to B to visite A's shiny app. I type  192.168.1.100:6271 in chrome, but it doesn't work.
B also has a IP like 192.168.1. 102.
I know little about web, but i can turn on my IIS in A, then B can visite 192.168.1.100£¬
but for a application, i don't know what to do.
Is my question clear ? Sorry for my pool english.

	[[alternative HTML version deleted]]

I now have two win7s in  a local area network called A and B.
A now can run shiny app, and it shows that it listen  192.168.1.100:6271. And A can visite the app in A's own
chrome using 192.168.1.100:6271.
Then I want to B to visite A's shiny app. I type  192.168.1.100:6271 in chrome, but it doesn't work.
B also has a IP like 192.168.1. 102.
I know little about web, but i can turn on my IIS in A, then B can visite 192.168.1.100£¬
but for a application, i don't know what to do.
Is my question clear ? Sorry for my pool english.

	[[alternative HTML version deleted]]


Gmane