[R] How to process each element in 3 minute interval using a for loop in R?

2014-07-09 Thread Takatsugu Kobayashi
Hi R-users,

This should be a simple question: How can I delay each loop process in some
minutes? The reason for this is I need to avoid too much traffic to get
longitudes and latitudes of 2000 addresses using google API.

I am searching for solutions with keywords like interval, minutes, delay,
but no directly relevant clues have come up yet.

Many thanks in advance.

Best,

Taka

[[alternative HTML version deleted]]

__
R-help@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.


[R] Request for help regarding RWeka

2013-12-31 Thread Takatsugu Kobayashi
Hi Rusers,

I am having a hard time understanding/finding a solution to this error
message of RWeka.
I just want to use Xmeans clustering command but when I typed XMeans then
I get the following message:

Error value[[3L]](cond) :

  Required Weka package 'XMeans' is not installed.

So I tried to install XMeans with WPM (I thought this was a solution like
install.packages()), but when I WPM() then I got this error message:

 WPM(list-packages, installed)

 Error .jcall(java/lang/System, V, setOut, out) :

  java.lang.NoClassDefFoundError: Could not initialize class
org.bounce.net.DefaultAuthenticator

I am not a Java user and have no idea how to solve this issue to use Weka
via R.
That would be appreciated if anyone could help!

Best,

Takatsugu

[[alternative HTML version deleted]]

__
R-help@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.


[R] Any way to pre-set the number of observations for each cluster with kmeans?

2013-12-29 Thread Takatsugu Kobayashi
Hi Rusers,

This is a simple question, but I cannot find an answer to it yet.
I am currently running kmeans with a constraint that each cluster has at
least an N observations. I look at Kmeans and thought nstart is the one,
but it didn't work.

Could you please let me know if there are other packages that will do this?

Thank you so much.

Best,

Taak

[[alternative HTML version deleted]]

__
R-help@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.


[R] Efficient way to convert covariance to Euclidian distance matrix

2013-10-31 Thread Takatsugu Kobayashi
Hi RUsers,

I am struggling to come up with an efficient vectorized way to convert
20Kx20K covariance matrix to a Euclidian distance matrix as a surrogate for
dissimilarity matrix. Hopefully I can apply multidimensional scaling for
mapping these 20K points (commercial products).

I understand that Distance(ij) = sigma(i) + sigma(j) - 2cov(ij). Without
replying on a slow loop, I appreciate if anyone can help me out with a
better idea - guess lapply?

Thank you very much.

Taka

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Efficient way to convert covariance to Euclidian distance matrix

2013-10-31 Thread Takatsugu Kobayashi
Thanks all.
I will get real and try to reduce the size of covariance matrix.

Taka




On Fri, Nov 1, 2013 at 8:01 AM, Rolf Turner r.tur...@auckland.ac.nz wrote:

 On 10/31/13 23:14, Takatsugu Kobayashi wrote:

 Hi RUsers,

 I am struggling to come up with an efficient vectorized way to convert
 20Kx20K covariance matrix to a Euclidian distance matrix as a surrogate
 for
 dissimilarity matrix. Hopefully I can apply multidimensional scaling for
 mapping these 20K points (commercial products).

 I understand that Distance(ij) = sigma(i) + sigma(j) - 2cov(ij). Without
 replying on a slow loop, I appreciate if anyone can help me out with a
 better idea - guess lapply?


 As S. Ellison has pointed out, you probably want sigma^2 rather than sigma.

 My suspicion is that with a 20K x 20K covariance matrix:

 * nothing will work

 * even if it did, the results would be meaningless numerical noise.

 I.e.  Get real.

 That being said, for a *reasonable* size of covariance matrix, the
 following might
 do what you want:

 DM - outer(diag(CM),diag(CM),+) - 2*CM

 where CM is the covariance matrix.  And then you might want to do

 DM - sqrt(DM)

 to get back to the original units (as S. Ellison indicated).

 cheers,

 Rolf Turner


[[alternative HTML version deleted]]

__
R-help@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.


[R] Help for string opeation

2012-06-29 Thread Takatsugu Kobayashi
Hi R users,

I appreciate if you could give me some hint/help on this string operation.

Suppose I have a list of string objects in varying sizes like

[[1]]
[1] A [2] B [3] C

[[2]]
[1] D [2] E

[[3]]
[1] F

Then I would like to create a vector that contains all elements like

[1] A B C D E F

I tried do.call + rbind but no luck yet.

Is there a function to do this operation or should I use append in the loop?

Thanks in advance!

Taka

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] text matching

2011-09-20 Thread Takatsugu Kobayashi
Hi,

The str_locate function instringr package may do what you are looking for.
Hope this link will help...

http://en.wikibooks.org/wiki/R_Programming/Text_Processing

Taka


On Mon, Sep 19, 2011 at 7:15 PM, SNV Krishna kris...@primps.com.sg wrote:
 Hi All,

 I have a character vector by name tickers

 head(tickers,10)

            V1
 1  ADARSHPL.BO
 2        AGR.V
 3          AGU
 4       AGU.TO
 5     AIMCO.BO
 6  ALUFLUOR.BO
 7        AMZ.V
 8          AVD
 9  ANILPROD.BO
 10    ARIES.BO

 I would like to extract all elements that has .BO in it. I tried

 grep(\.BO,tickers)
 Error: '\.' is an unrecognized escape in character string starting \.

 grep(.BO,tickers)
 [1] 1

 Could any one please guide me on this. Many thanks for the help

 Best Regards,

 Krishna

        [[alternative HTML version deleted]]

 __
 R-help@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.


__
R-help@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.


[R] customer segmentation using a large data with many zeros

2011-06-29 Thread Takatsugu Kobayashi
Hi,

I am looking for clustering techniques that are tolerant to large
datasets (500,000 unique customers with transaction records).

I basically would like to conduct customer segmentation based on their
transaction history - what they bought, how often they visited stores,
demographics etc. And transaction part of the data is binary: 1 if
they bought, let's say, fruits etc.

Now the problem is that

1. transaction part includes lots of zeros
2. not every variables are continuous

Polychoric correlations might be useful for the second part, but I am
not sure how to go about the first one.
I appreciate if anyone could give me advice.

Thanks!!

Taka

__
R-help@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.


[R] [RExcel] please help me to set up RExcel via a remote server

2011-06-17 Thread Takatsugu Kobayashi
Hi RUsers,

I am currently tying to use RExcel via R installed in my remote server
(CentOS 5.5).
Could you please help me set up a R remote server?

All I know about the server is its IPAddress.
Apologies for my fundamental question.

Thank you so much!


Taka

__
R-help@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.


Re: [R] lme4 package

2008-06-28 Thread Takatsugu Kobayashi
Hi,

Could someone explain what this message mean? I was playing with lme4
pacakge but I could not run any models...


Error in printMer(object) :
no slot of name dims for this object of class table
In addition: Warning message:
In printMer(object) :
trying to get slot dims from an object (class table) that is not an
S4 object

__
R-help@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.


Re: [R] local variance estimation using gam or locfit

2008-02-11 Thread Takatsugu Kobayashi
Hi,

I appreciate if any one could give me clues about the following problem.

I have a map data, x, y, z, and d, where (x,y) is the coordinate of a 
point and d is a distance from the urban center (0,0), and z is 
population density.  Then I would like to calculate local standard 
deviations of these points.  Let me say hypothetically,

x - rnorm(100)
y - rnorm(100)
z - runif(100)
d - sqrt(x^2+y^2)*runif(100,1,1.5)

mod - gam(z~s(x,y,by=d))

std.res.loc - residuals/loc.std

So, I would like to calculate loc.std.  Is there any function available 
for this? Or should I manually compute it?

I am reading Generalized Additive Model: Introduction to R by Dr. Wood.

Thank you very much.

Tk

__
R-help@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.


Re: [R] how to get points from SpatialPolygonsDataFrame

2008-02-03 Thread Takatsugu Kobayashi
try

tmp- slot(ex_1.7.selected, 'polygons')
sub.tmp - slot(tmp[[1]],'Polygons')
[EMAIL PROTECTED]

will get you there.

taka

Jarek Jasiewicz wrote:
 Milton Cezar Ribeiro wrote:
   
 Dear all,

 I need to get all points for each polygons and save these points in a 
 data.frame. I tryed to use the slot() function, but I can´t access the 
 coords. 

 grd - GridTopology(c(1,1), c(1,1), c(10,10))
 polys - as.SpatialPolygons.GridTopology(grd)
 centroids - coordinates(polys)
 x - centroids[,1]
 y - centroids[,2]
 z - 1.4 + 0.1*x + 0.2*y + 0.002*x*x
 ex_1.7 - SpatialPolygonsDataFrame(polys, data=data.frame(x=x, y=y, z=z, 
 row.names=sapply(slot(polys, polygons), function(i) slot(i, ID
 ex_1.7.selected-ex_1.7[1,]
 slot(ex_1.7.selected,coords)

 Any idea?

 Kind regards,

 Miltinho



  para armazenamento!

  [[alternative HTML version deleted]]

   
 

 __
 R-help@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.
   
 
 probably as.data.frame(spPointsDataFrame) will help
 look maptools package
 Jarek

 __
 R-help@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.


__
R-help@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.


Re: [R] maptools no such file

2008-01-27 Thread Takatsugu Kobayashi
can you open your shapefile using reaPolyShape in sp?

[EMAIL PROTECTED] wrote:
 Hello,

 I'm having problems reading a shapefile with read.shape (maptools). I'm 
 absolutely sure my file is there, but I get no such file. The wd is ok, 
 since read.table for example does find the file.

   
 getwd()
 
 [1] D:/somedirectory/R scripts
   
 read.table(cities.shp)
 
 Error in read.table(cities.shp) : empty beginning of file
 In addition: Warning message:
 In read.table(cities.shp) :
   incomplete final line found by readTableHeader on 'cities.shp'
   
 read.shape(cities.shp)
 
 Error in getinfo.shape(filen) : No such file

 Any thoughts?

 Thanks
 Pieter

 --
 This message was sent on behalf of [EMAIL PROTECTED] at openSubscriber.com
 http://www.opensubscriber.com/messages/r-help@r-project.org/topic.html

 __
 R-help@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.


__
R-help@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.


Re: [R] Memory management

2007-09-15 Thread Takatsugu Kobayashi
Hi,

I apologize again for posting something not suitable on this list.

Basically, it sounds like I should go put this large dataset into a 
database... The dataset I have had trouble with is the transportation 
network of Chicago Consolidated Metropolitan Statistical Area. The 
number of samples is about 7,200 points; and every points have outbound 
and inbound traffic flows: volumes, times, distances, etc. So a quick 
approximation of the number of rows would be
49,000,000 rows (and 249 columns).

This is a text file. I could work with a portion of the data at a time 
like nearest neighbors or pairs of points.

I used read.table('filename',header=F).. I should probably use some bits 
of data at a time instead of putting all at a time...

I am learning RSQLite and RMySQL. As Mr. Wan suggests, I will learn C a 
bit more.

Thank you very much.

TK

im holtman wrote:
 When you say you can not import 4.8GB, is this the size of the text
 file that you are reading in?  If so, what is the structure of the
 file?  How are you reading in the file ('read.table', 'scan', etc).

 Do you really need all the data or can you work with a portion at a
 time?  If so, then consider putting the data in a database and
 retrieving the data as needed.  If all the data is in an object, how
 big to you think this object will be? (# rows, # columns, mode of the
 data).

 So you need to provide some more information as to the problem that
 you are trying to solve.

 On 9/15/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
   
 Hi,

 Let me apologize for this simple question.

 I use 64 bit R on my Fedora Core 6 Linux workstation. A 64 bit R has
 saved a lot of time. I am sure this is a lot to do with my memory
 limit, but I cannot import 4.8GB. My workstation has a 8GB RAM, Athlon
 X2 5600, and 1200W PSU. This PC configuration is the best I could get.

 I know a bit of C and Perl. Should I use C or Perl to manage this large
 dataset? or should I even go to 16GB RAM.

 Sorry for this silly question. But I appreciate if anyone could give me
 advice.

 Thank you very much.

 TK

 __
 R-help@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.

 




__
R-help@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.