Re: [R] importing data

2007-05-04 Thread John Kane

--- [EMAIL PROTECTED] wrote:

 
 Hello,
  
 I need to import a data set.
 I have never imported data files with R. I have
 always worked on simulated data.
 I have looked at R Data Import/Export manual.
  
 It is a bit peculiar because my data base is already
 an R object called japan.

Then you do not want to import it.If you already have
an R.object then you'e done. It is already 'imported.
You just need to work with it, probaly as a data.frame

 I guess it is not yet a data set, and I don't know
 how to manipulate variables from it.
 When I type japan, here is an extract of what I
 get.
-
  
 LDP NFP SKG JCP gender education age180  75 
 80   0   male 1  75275  80  50  20
 female 1  643   100  25 100   0   male  
   2  56475  50  25  50   male 2  525   
 75  50  50   0   male 4  52
 I have saved the following objet in a file called
 japan.RData. Then I have tried the following
 instructions :
 read.table(file=japan.RData,header = FALSE, sep =
 )
  
 I get the following result : 
V11 \037�\bWarning message:readTableHeader
a
 trouv� une ligne finale incompl�te dans
 'japan.RData' 
 which means probably has found the last lign
 incomplete, I am not too sure...
  

I don't know that the error messages mean but it is
likely that they mean you already did it , go away

 What can I do ? I want to get variables such LDP,
 NFP, SKG, JCP, gender, education, and age. How can I
 do that ?
 Thank you very much.

Do an ls() and find out what objects you have. If you
have a Japan then you can do Japan$LPD or Japan[,1] or
an attach(Japan) and then refer to LPD.  Each approach
has its advantages. 

See http://www.r-project.org/ for some basic
information on the subject.

__
R-help@stat.math.ethz.ch 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] Importing data from clipboard on Mac OSX

2006-08-27 Thread Rob J Goedman
Hi Rense,

Not sure how robust this is, but maybe to get you started:

In R console:

  a - 1:10

Copy that line to or part of it to the clipboard.

  system(osascript -e 'set y to the clipboard' -e 'tell application  
\R.app\ to cmd y')

If course you could use this in an R function. I would opt for using  
a file to read in the data.

As this is Mac specific, maybe a better list is R-SIG-Mac.

Rob


On Aug 26, 2006, at 4:00 PM, Rense Nieuwenhuis wrote:

 Dear R users,

 I am trying to get data from the clipboard into R on MacOSX. I tried
 the following, but got an error message:

 read.delim(clipboard)
 Error in file(file, r) : unable to open connection
 In addition: Warning message:
 unable to contact X11 display

 Obviously, I'm not running R using X11. I'm wondering, can I import
 data from the clipboard on MacosX?

 Thanks in advance,

 Rense Nieuwenhuis

 version
 _
 platform   powerpc-apple-darwin8.6.0
 arch   powerpc
 os darwin8.6.0
 system powerpc, darwin8.6.0
 status
 major  2
 minor  3.0
 year   2006
 month  04
 day24
 svn rev37909
 language   R
 version.string Version 2.3.0 (2006-04-24)

 __
 R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] importing data from BUGS format to R?

2006-02-24 Thread Martyn Plummer
On Fri, 2006-02-24 at 08:48 +0100, Uwe Ligges wrote:
 Gabor Grothendieck wrote:
  Just source the file:
  
  source(mywinbugsfile.R)
  head(y)
 
 
 ... and don't forget to transpose the matrix afterwards, if this was 
 BUGS code.
 
 Uwe Ligges

If this were a WinBUGS data file (or initial values file), the whole
expression would be wrapped in a call to list(). In this case, you would
need to assign the output from source(), or use the dget() function,
e.g. for the EPILEPSY example:

 mydata - dget(epildata.txt)
 names(mydata)
[1] NTyTrt  Base Age  V4
 mydata$T
[1] 4

But, as Uwe points out, arrays will need to be reorganized, as WinBUGS
fills matrices by row rather than column.

 head(mydata$y) #wrong!
 [,1] [,2] [,3] [,4]
[1,]5997
[2,]3   1146
[3,]3007
[4,]3041
[5,]3531
[6,]5002

I wrote a function called bugs2jags, which you will find in the coda
package, for converting WinBUGS data files into the data format used by
JAGS which is, by no coincidence, the format used by the R function
dump().

 library(coda)
Loading required package: lattice
 bugs2jags(epildata.txt,epildata.R) #Creates file epildata.R
 source(epildata.R)
 ls()
[1] Age  Base NTTrt  V4   y

This creates objects in your work space, and sorts out the arrays

 head(y) #right
 [,1] [,2] [,3] [,4]
[1,]5333
[2,]3533
[3,]2405
[4,]4414
[5,]7   189   21
[6,]5287

Martyn

 
  
  On 2/23/06, Jeffrey Moore [EMAIL PROTECTED] wrote:
  
 For those who use WinBUGS (or for those who are just familar with this
 format), I have a text file that looks like this (which is how R would
 export data if you used the structure function):
 
 y= structure(.Data= c(-6.93310E+01, 4.32870E+01, -6.96600E+01, 4.35730E+01,
 -6.90150E+01, 4.35870E+01, -5.81060E+01, 4.52890E+01, -6.65590E+01,
 4.34600E+01, -6.61850E+01, 4.35000E+01, -6.54130E+01, 4.31940E+01,
 -6.42790E+01, 4.34780E+01, -6.35520E+01, 4.38070E+01, -6.32980E+01,
 4.39520E+01, -6.25690E+01, 4.41760E+01, -6.20810E+01, 4.40800E+01,
 -6.14280E+01, 4.46210E+01, -6.10530E+01, 4.48050E+01, -6.00300E+01,
 4.50480E+01, -5.88110E+01, 4.50280E+01, -5.83660E+01, 4.50400E+01,
 -5.83140E+01, 4.48780E+01, -5.87330E+01, 4.50340E+01, -5.87430E+01,
 4.51630E+01, -5.88170E+01, 4.54030E+01, -5.89380E+01, 4.53260E+01,
 -5.89110E+01, 4.55260E+01, NA, NA, -5.91250E+01, 4.56070E+01,
 -5.90140E+01, 4.59690E+01, -5.89830E+01, 4.64640E+01, -5.89240E+01,
 4.66300E+01, -5.93770E+01, 4.66810E+01, -5.90010E+01, 4.65640E+01,
 -5.91230E+01, 4.67780E+01, -5.92350E+01, 4.7E+01, -5.92310E+01,
 4.68350E+01, NA, NA, -5.88530E+01, 4.68560E+01, NA, NA,
 NA, NA, NA, NA, -5.83550E+01, 4.65300E+01, -5.83270E+01,
 4.64970E+01, -5.86210E+01, 4.65320E+01, NA, NA, -5.82720E+01,
 4.65060E+01, -5.81480E+01, 4.64490E+01, -5.83350E+01, 4.63650E+01, NA,
 NA, -5.84800E+01, 4.63340E+01, -5.83980E+01, 4.63040E+01, -5.83390E+01,
 4.62030E+01, -5.82170E+01, 4.62620E+01, NA, NA, -5.80420E+01,
 4.61940E+01, -5.80360E+01, 4.57280E+01, -5.80590E+01, 4.55420E+01,
 -5.83010E+01, 4.54730E+01, -5.83710E+01, 4.55010E+01, -5.86540E+01,
 4.52870E+01, -5.87020E+01, 4.51740E+01, -5.87400E+01, 4.52620E+01,
 -5.88330E+01, 4.53190E+01, -5.89740E+01, 4.53410E+01, NA, NA,
 -5.85240E+01, 4.54970E+01, -5.81710E+01, 4.56200E+01, -5.79070E+01,
 4.58370E+01, NA, NA, -5.73610E+01, 4.62660E+01, -5.71820E+01,
 4.60770E+01, -5.70540E+01, 4.59920E+01, NA, NA, NA, NA,
 -5.58460E+01, 4.51830E+01, -5.53690E+01, 4.52890E+01, -5.49260E+01,
 4.53340E+01, -5.40070E+01, 4.53670E+01, -5.35510E+01, 4.54510E+01, NA,
 NA, -5.15130E+01, 4.63060E+01, -5.15000E+01, 4.63280E+01, -5.08410E+01,
 4.67780E+01, -4.99400E+01, 4.69670E+01, -4.88440E+01, 4.72810E+01,
 -4.87250E+01, 4.76880E+01, -4.70460E+01, 4.87420E+01, -5.17870E+01,
 4.83990E+01, -4.68830E+01, 4.97030E+01, -4.73700E+01, 5.03350E+01,
 -4.75990E+01, 5.10690E+01, -5.15050E+01, 5.05110E+01, -4.80640E+01,
 5.19200E+01, -4.83890E+01, 5.27580E+01, NA, NA, -4.85200E+01,
 5.41250E+01, -4.87630E+01, 5.53650E+01, NA, NA, -4.84790E+01,
 5.70560E+01, -4.82690E+01, 5.77990E+01, -4.77870E+01, 5.87570E+01,
 -4.74070E+01, 5.96700E+01, -4.76990E+01, 6.02020E+01, -4.82110E+01,
 6.03410E+01, -4.90240E+01, 6.05510E+01, -4.89050E+01, 6.06780E+01,
 -4.80660E+01, 6.05380E+01, -4.61030E+01, 6.01290E+01, NA, NA,
 -4.59880E+01, 6.02070E+01, -4.55240E+01, 5.99680E+01, -4.59540E+01,
 5.97650E+01, -4.58830E+01, 5.98200E+01, -4.64730E+01, 6.00690E+01,
 -4.64660E+01, 6.00730E+01, -4.59630E+01, 5.99330E+01, -4.63940E+01,
 6.01380E+01, -4.64370E+01, 6.02270E+01, -4.67750E+01, 6.04410E+01,
 -4.68020E+01, 6.04700E+01, -4.57440E+01, 5.97720E+01, -4.48480E+01,
 5.96590E+01, -4.50540E+01, 5.97830E+01), .Dim=c(120, 2))
 
 I would like to read this into R as an 120x2 

Re: [R] importing data from BUGS format to R?

2006-02-23 Thread Gabor Grothendieck
Just source the file:

source(mywinbugsfile.R)
head(y)


On 2/23/06, Jeffrey Moore [EMAIL PROTECTED] wrote:
 For those who use WinBUGS (or for those who are just familar with this
 format), I have a text file that looks like this (which is how R would
 export data if you used the structure function):

 y= structure(.Data= c(-6.93310E+01, 4.32870E+01, -6.96600E+01, 4.35730E+01,
 -6.90150E+01, 4.35870E+01, -5.81060E+01, 4.52890E+01, -6.65590E+01,
 4.34600E+01, -6.61850E+01, 4.35000E+01, -6.54130E+01, 4.31940E+01,
 -6.42790E+01, 4.34780E+01, -6.35520E+01, 4.38070E+01, -6.32980E+01,
 4.39520E+01, -6.25690E+01, 4.41760E+01, -6.20810E+01, 4.40800E+01,
 -6.14280E+01, 4.46210E+01, -6.10530E+01, 4.48050E+01, -6.00300E+01,
 4.50480E+01, -5.88110E+01, 4.50280E+01, -5.83660E+01, 4.50400E+01,
 -5.83140E+01, 4.48780E+01, -5.87330E+01, 4.50340E+01, -5.87430E+01,
 4.51630E+01, -5.88170E+01, 4.54030E+01, -5.89380E+01, 4.53260E+01,
 -5.89110E+01, 4.55260E+01, NA, NA, -5.91250E+01, 4.56070E+01,
 -5.90140E+01, 4.59690E+01, -5.89830E+01, 4.64640E+01, -5.89240E+01,
 4.66300E+01, -5.93770E+01, 4.66810E+01, -5.90010E+01, 4.65640E+01,
 -5.91230E+01, 4.67780E+01, -5.92350E+01, 4.7E+01, -5.92310E+01,
 4.68350E+01, NA, NA, -5.88530E+01, 4.68560E+01, NA, NA,
 NA, NA, NA, NA, -5.83550E+01, 4.65300E+01, -5.83270E+01,
 4.64970E+01, -5.86210E+01, 4.65320E+01, NA, NA, -5.82720E+01,
 4.65060E+01, -5.81480E+01, 4.64490E+01, -5.83350E+01, 4.63650E+01, NA,
 NA, -5.84800E+01, 4.63340E+01, -5.83980E+01, 4.63040E+01, -5.83390E+01,
 4.62030E+01, -5.82170E+01, 4.62620E+01, NA, NA, -5.80420E+01,
 4.61940E+01, -5.80360E+01, 4.57280E+01, -5.80590E+01, 4.55420E+01,
 -5.83010E+01, 4.54730E+01, -5.83710E+01, 4.55010E+01, -5.86540E+01,
 4.52870E+01, -5.87020E+01, 4.51740E+01, -5.87400E+01, 4.52620E+01,
 -5.88330E+01, 4.53190E+01, -5.89740E+01, 4.53410E+01, NA, NA,
 -5.85240E+01, 4.54970E+01, -5.81710E+01, 4.56200E+01, -5.79070E+01,
 4.58370E+01, NA, NA, -5.73610E+01, 4.62660E+01, -5.71820E+01,
 4.60770E+01, -5.70540E+01, 4.59920E+01, NA, NA, NA, NA,
 -5.58460E+01, 4.51830E+01, -5.53690E+01, 4.52890E+01, -5.49260E+01,
 4.53340E+01, -5.40070E+01, 4.53670E+01, -5.35510E+01, 4.54510E+01, NA,
 NA, -5.15130E+01, 4.63060E+01, -5.15000E+01, 4.63280E+01, -5.08410E+01,
 4.67780E+01, -4.99400E+01, 4.69670E+01, -4.88440E+01, 4.72810E+01,
 -4.87250E+01, 4.76880E+01, -4.70460E+01, 4.87420E+01, -5.17870E+01,
 4.83990E+01, -4.68830E+01, 4.97030E+01, -4.73700E+01, 5.03350E+01,
 -4.75990E+01, 5.10690E+01, -5.15050E+01, 5.05110E+01, -4.80640E+01,
 5.19200E+01, -4.83890E+01, 5.27580E+01, NA, NA, -4.85200E+01,
 5.41250E+01, -4.87630E+01, 5.53650E+01, NA, NA, -4.84790E+01,
 5.70560E+01, -4.82690E+01, 5.77990E+01, -4.77870E+01, 5.87570E+01,
 -4.74070E+01, 5.96700E+01, -4.76990E+01, 6.02020E+01, -4.82110E+01,
 6.03410E+01, -4.90240E+01, 6.05510E+01, -4.89050E+01, 6.06780E+01,
 -4.80660E+01, 6.05380E+01, -4.61030E+01, 6.01290E+01, NA, NA,
 -4.59880E+01, 6.02070E+01, -4.55240E+01, 5.99680E+01, -4.59540E+01,
 5.97650E+01, -4.58830E+01, 5.98200E+01, -4.64730E+01, 6.00690E+01,
 -4.64660E+01, 6.00730E+01, -4.59630E+01, 5.99330E+01, -4.63940E+01,
 6.01380E+01, -4.64370E+01, 6.02270E+01, -4.67750E+01, 6.04410E+01,
 -4.68020E+01, 6.04700E+01, -4.57440E+01, 5.97720E+01, -4.48480E+01,
 5.96590E+01, -4.50540E+01, 5.97830E+01), .Dim=c(120, 2))

 I would like to read this into R as an 120x2 array (matrix or data frame).
 How would I do so?

 I know I can just copy/paste all the values bound by c( ), and then just do
 something like this:

 y - matrix(c(pasted values), nrow=120, ncol = 2)

 But, I get errors messages when I try to copy/paste the whole dataset
 because I reach line limits in the R console, such that certain values get
 split, and then R doesn't know what to do with something like 0E+01, -.
 So, I can instead try to copy/paste in a piecemeal fashion (which I've done,
 and it works fine), but I'm sure there's a better way.

 Thanks
 Jeff

 **
 Jeffrey Moore, Ph.D.
 Postdoctoral Research Scientist
 Duke Center for Marine Conservation
 Duke University Marine Laboratory
 135 Duke Marine Lab Road
 Beaufort, NC 28516
 Phone: (252) 504-7653
 Fax: (252) 504-7689
 Email: [EMAIL PROTECTED]
 *


[[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] importing data from BUGS format to R?

2006-02-23 Thread Uwe Ligges
Gabor Grothendieck wrote:
 Just source the file:
 
 source(mywinbugsfile.R)
 head(y)


... and don't forget to transpose the matrix afterwards, if this was 
BUGS code.

Uwe Ligges



 
 On 2/23/06, Jeffrey Moore [EMAIL PROTECTED] wrote:
 
For those who use WinBUGS (or for those who are just familar with this
format), I have a text file that looks like this (which is how R would
export data if you used the structure function):

y= structure(.Data= c(-6.93310E+01, 4.32870E+01, -6.96600E+01, 4.35730E+01,
-6.90150E+01, 4.35870E+01, -5.81060E+01, 4.52890E+01, -6.65590E+01,
4.34600E+01, -6.61850E+01, 4.35000E+01, -6.54130E+01, 4.31940E+01,
-6.42790E+01, 4.34780E+01, -6.35520E+01, 4.38070E+01, -6.32980E+01,
4.39520E+01, -6.25690E+01, 4.41760E+01, -6.20810E+01, 4.40800E+01,
-6.14280E+01, 4.46210E+01, -6.10530E+01, 4.48050E+01, -6.00300E+01,
4.50480E+01, -5.88110E+01, 4.50280E+01, -5.83660E+01, 4.50400E+01,
-5.83140E+01, 4.48780E+01, -5.87330E+01, 4.50340E+01, -5.87430E+01,
4.51630E+01, -5.88170E+01, 4.54030E+01, -5.89380E+01, 4.53260E+01,
-5.89110E+01, 4.55260E+01, NA, NA, -5.91250E+01, 4.56070E+01,
-5.90140E+01, 4.59690E+01, -5.89830E+01, 4.64640E+01, -5.89240E+01,
4.66300E+01, -5.93770E+01, 4.66810E+01, -5.90010E+01, 4.65640E+01,
-5.91230E+01, 4.67780E+01, -5.92350E+01, 4.7E+01, -5.92310E+01,
4.68350E+01, NA, NA, -5.88530E+01, 4.68560E+01, NA, NA,
NA, NA, NA, NA, -5.83550E+01, 4.65300E+01, -5.83270E+01,
4.64970E+01, -5.86210E+01, 4.65320E+01, NA, NA, -5.82720E+01,
4.65060E+01, -5.81480E+01, 4.64490E+01, -5.83350E+01, 4.63650E+01, NA,
NA, -5.84800E+01, 4.63340E+01, -5.83980E+01, 4.63040E+01, -5.83390E+01,
4.62030E+01, -5.82170E+01, 4.62620E+01, NA, NA, -5.80420E+01,
4.61940E+01, -5.80360E+01, 4.57280E+01, -5.80590E+01, 4.55420E+01,
-5.83010E+01, 4.54730E+01, -5.83710E+01, 4.55010E+01, -5.86540E+01,
4.52870E+01, -5.87020E+01, 4.51740E+01, -5.87400E+01, 4.52620E+01,
-5.88330E+01, 4.53190E+01, -5.89740E+01, 4.53410E+01, NA, NA,
-5.85240E+01, 4.54970E+01, -5.81710E+01, 4.56200E+01, -5.79070E+01,
4.58370E+01, NA, NA, -5.73610E+01, 4.62660E+01, -5.71820E+01,
4.60770E+01, -5.70540E+01, 4.59920E+01, NA, NA, NA, NA,
-5.58460E+01, 4.51830E+01, -5.53690E+01, 4.52890E+01, -5.49260E+01,
4.53340E+01, -5.40070E+01, 4.53670E+01, -5.35510E+01, 4.54510E+01, NA,
NA, -5.15130E+01, 4.63060E+01, -5.15000E+01, 4.63280E+01, -5.08410E+01,
4.67780E+01, -4.99400E+01, 4.69670E+01, -4.88440E+01, 4.72810E+01,
-4.87250E+01, 4.76880E+01, -4.70460E+01, 4.87420E+01, -5.17870E+01,
4.83990E+01, -4.68830E+01, 4.97030E+01, -4.73700E+01, 5.03350E+01,
-4.75990E+01, 5.10690E+01, -5.15050E+01, 5.05110E+01, -4.80640E+01,
5.19200E+01, -4.83890E+01, 5.27580E+01, NA, NA, -4.85200E+01,
5.41250E+01, -4.87630E+01, 5.53650E+01, NA, NA, -4.84790E+01,
5.70560E+01, -4.82690E+01, 5.77990E+01, -4.77870E+01, 5.87570E+01,
-4.74070E+01, 5.96700E+01, -4.76990E+01, 6.02020E+01, -4.82110E+01,
6.03410E+01, -4.90240E+01, 6.05510E+01, -4.89050E+01, 6.06780E+01,
-4.80660E+01, 6.05380E+01, -4.61030E+01, 6.01290E+01, NA, NA,
-4.59880E+01, 6.02070E+01, -4.55240E+01, 5.99680E+01, -4.59540E+01,
5.97650E+01, -4.58830E+01, 5.98200E+01, -4.64730E+01, 6.00690E+01,
-4.64660E+01, 6.00730E+01, -4.59630E+01, 5.99330E+01, -4.63940E+01,
6.01380E+01, -4.64370E+01, 6.02270E+01, -4.67750E+01, 6.04410E+01,
-4.68020E+01, 6.04700E+01, -4.57440E+01, 5.97720E+01, -4.48480E+01,
5.96590E+01, -4.50540E+01, 5.97830E+01), .Dim=c(120, 2))

I would like to read this into R as an 120x2 array (matrix or data frame).
How would I do so?

I know I can just copy/paste all the values bound by c( ), and then just do
something like this:

y - matrix(c(pasted values), nrow=120, ncol = 2)

But, I get errors messages when I try to copy/paste the whole dataset
because I reach line limits in the R console, such that certain values get
split, and then R doesn't know what to do with something like 0E+01, -.
So, I can instead try to copy/paste in a piecemeal fashion (which I've done,
and it works fine), but I'm sure there's a better way.

Thanks
Jeff

**
Jeffrey Moore, Ph.D.
Postdoctoral Research Scientist
Duke Center for Marine Conservation
Duke University Marine Laboratory
135 Duke Marine Lab Road
Beaufort, NC 28516
Phone: (252) 504-7653
Fax: (252) 504-7689
Email: [EMAIL PROTECTED]
*


   [[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch 

Re: [R] Importing data into R

2005-04-07 Thread Ales Ziberna
I don't know if it does what you want, however you might try package RExcel.
However it is not on  CRAN. You can find it on
http://sunsite.univie.ac.at/rcom/download/.
I belive it might be obsolete and replaced by R (D)COM Server V1.35
(previously you needed this package to use RExcel) which you can find on
http://cran.planetmirror.com/contrib/extra/dcom/RSrv135.html (description) 
or http://cran.planetmirror.com/contrib/extra/dcom/RSrv135.exe (add-on).

I hope this helps!
Ales Ziberna

- Original Message - 
From: Dave Evens [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Thursday, April 07, 2005 4:47 PM
Subject: [R] Importing data into R



I have a highly formated Excel with multiple tabs. Is
it currently possible to read this data into R without
changing the format of the Excel file?
Also, is it possible to write back to the same Excel
file or at least create a new Excel file with the same
formatting as before with modified data which has been
processed in R.
Thanks in advance for any help that you can provide.
Dave
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] importing data

2004-10-13 Thread Prof Brian Ripley
On Wed, 13 Oct 2004, Andreas Betz wrote:

  I am newcomer to R and I am loborating on this problem:
 
 How do I import data from a CD into R for further evaluation. 
 Using code newgotcha - read.table(e:\\asciiwin\\gotcha.dat) 
 returmns a list containing an additional column with indices. The
 command plot (gotcha) gives the expected plot. However, the line
 hist(gotcha) returns the message Error in hist.default(newgotcha) : `x'
 must be numeric.

Um, you read `newgotcha' so what did you expect plot (gotcha) to do?

 How can I get the data in an accessible from  into R.

Please read `An Introduction to R' and note the difference between
read.table() and read.table(header=TRUE).

If that is not sufficient, please read the R Data Import/Export manual.

 Any suggestions are appreciated.
 
 Andreas
 
 Andreas Betz
 [EMAIL PROTECTED]
   [[alternative HTML version deleted]]
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Please do, and don't send HTML mail and do read the introductory
documentation.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] importing data in excel

2004-08-30 Thread Thomas Petzoldt
Uwe Ligges wrote:
Gerardo Prieto Blanco wrote:
Hello, I need to care excel data to be used
in R,..., how do I make it?
Thank you and greetings, Gerardo Prieto

Please read the R Data Import/Export manual!
Uwe Ligges
Hello Gerardo,
I completely agree with Uwe, and the following simple example may help:
1.) Create a rectangular area in Excel like this:
no  treat   val
1   a   1
2   a   5
3   b   3
4   b   3
5   b   2
2.) Mark and Copy these cells including the first row
= the data are now in the so-called Windows Clipboard
3.) Switch to R and provide the following command (by typing it!, not by
copy and paste, because the clipboard already contains the data):
dat - read.table(clipboard, header=TRUE)
Now, the data are in dat and you can inspect them using:
dat
or better
str(dat)
Hints: depending on your configuration some additional options may be
necessary in read.table, e.g. sep=\t (if your data contain empty
cells) or dec=, (on some non-English languages, e.g. German).
Furthermore there are many other ways to import data, see the manual.
Thomas P.
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] importing data in excel

2004-08-30 Thread ronggui wong
if under  windows ,the command works well,but under linux ,it does NOT,as 
linux can keep couples of file in clipboar.so i want to know how to do 
similar thing under linux.anyone knows?

the erroe msg is as follow:
 dat-read.table('clipboard',header=T)
Error in file(file, r) : unable to open connection
In addition: Warning message:
cannot open file `clipboard'


 2004  30  15:21Thomas Petzoldt 
 Uwe Ligges wrote:
  Gerardo Prieto Blanco wrote:
  Hello, I need to care excel data to be used
  in R,..., how do I make it?
  Thank you and greetings, Gerardo Prieto
 
  Please read the R Data Import/Export manual!
 
  Uwe Ligges

 Hello Gerardo,

 I completely agree with Uwe, and the following simple example may help:

 1.) Create a rectangular area in Excel like this:

 notreat   val
 1 a   1
 2 a   5
 3 b   3
 4 b   3
 5 b   2

 2.) Mark and Copy these cells including the first row
 = the data are now in the so-called Windows Clipboard

 3.) Switch to R and provide the following command (by typing it!, not by

 copy and paste, because the clipboard already contains the data):
  dat - read.table(clipboard, header=TRUE)

 Now, the data are in dat and you can inspect them using:
  dat

 or better

  str(dat)

 Hints: depending on your configuration some additional options may be
 necessary in read.table, e.g. sep=\t (if your data contain empty
 cells) or dec=, (on some non-English languages, e.g. German).
 Furthermore there are many other ways to import data, see the manual.

 Thomas P.

 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] importing data in excel

2004-08-29 Thread Uwe Ligges
Gerardo Prieto Blanco wrote:
Hello, I need to care excel data to be used
in R,..., how do I make it?
Thank you and greetings, Gerardo Prieto
Please read the R Data Import/Export manual!
Uwe Ligges

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Importing data into R

2003-08-21 Thread Prof Brian Ripley
On Thu, 21 Aug 2003, Gavrilov, Pavel M wrote:

 Hello.  I have been working with GeoDA, and have created a spatial weights
 file for my data.  I am now looking to use R to run regressions on this
 data.  However, I don't know and can't figure out how to get my data into R
 to run these regressions.
 
 I have the data in many formats, from a .dbf file to an Excel spreadsheet,
 but I'm not sure how to go about importing it into R.  Could you help me out
 please?  Thanks.

R comes with a `Data Import/Export Manual'.  Have you read it yet?

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Importing data into R

2003-08-21 Thread Torsten Hothorn
On Thu, 21 Aug 2003, Gavrilov, Pavel M wrote:

 Hello.  I have been working with GeoDA, and have created a spatial weights
 file for my data.  I am now looking to use R to run regressions on this
 data.  However, I don't know and can't figure out how to get my data into R
 to run these regressions.
 
 I have the data in many formats, from a .dbf file to an Excel spreadsheet,
 but I'm not sure how to go about importing it into R.  Could you help me out
 please?  Thanks.
 

The manual for such problems available from

http://cran.r-project.org/doc/manuals/R-data.pdf

Torsten

 Sincerely,
 
 Pavel Gavrilov
 [EMAIL PROTECTED]
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 


__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Importing data into R

2003-08-21 Thread Jonathan Baron
On 08/21/03 12:15, Gavrilov, Pavel M wrote:
I have the data in many formats, from a .dbf file to an Excel spreadsheet,
but I'm not sure how to go about importing it into R.  Could you help me out
please?  Thanks.

In the documents that come with R is one called R Data
Import/Export.  You might take a look at that.  If you can't
find it, I have it on the web at
http://finzi.psych.upenn.edu/R/doc/manual/R-data.html
but really it should come with your distribution.

-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page:http://www.sas.upenn.edu/~baron
R page:   http://finzi.psych.upenn.edu/
Deleting mail that says Approved Thank you! Your application Your details

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Importing data into R

2003-08-21 Thread Roger Bivand
On Thu, 21 Aug 2003, Gavrilov, Pavel M wrote:

 Hello.  I have been working with GeoDA, and have created a spatial weights
 file for my data.  I am now looking to use R to run regressions on this
 data.  However, I don't know and can't figure out how to get my data into R
 to run these regressions.

GeoDa spatial weights files may be read into R using the read.gal() and 
read.gwt2nb() functions in the contributed package spdep. These 
functions have been improved by the authors of GeoDa to play well with its 
output. read.geoda() in spdep is a wrapper for read.csv().

 
 I have the data in many formats, from a .dbf file to an Excel spreadsheet,
 but I'm not sure how to go about importing it into R.  Could you help me out
 please?  Thanks.
 
These more general questions are handled - as many have pointed out - in 
the data import/export manual: 

http://cran.r-project.org/doc/manuals/R-data.pdf


 Sincerely,
 
 Pavel Gavrilov
 [EMAIL PROTECTED]
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Importing Data

2003-08-14 Thread TyagiAnupam
These functions are in the library foreign. You may not have loaded the 
library. Load it first, before using the functions. I tried the following on 
R1.7.1 on Windows; the functions are available.

library(foreign)
help(read.xport)
help(read.table)



In a message dated 8/6/03 11:48:56 AM Eastern Daylight Time, 
[EMAIL PROTECTED] writes:

 Im trying to import data from an excel sheet or a sas file to R...im not 
 succeeding. Apparently the function read.xport for reading a SAS file doesnt 
 
 exist. What do i have to type in EXACTLY to read from an excel sheet(i guess 
 
 i would be using read.table?)?
 
 Thanks in advance for an answer
 
[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Importing Data

2003-08-14 Thread Uwe Ligges
Hadassa Brunschwig wrote:

Im trying to import data from an excel sheet or a sas file to R...im not 
succeeding. Apparently the function read.xport for reading a SAS file 
doesnt exist. What do i have to type in EXACTLY to read from an excel 
sheet(i guess i would be using read.table?)?
- read.xport() is in package foreign, so use library(foreign) before 
using the function.

Please read the manual R Data Import / Export.
You cannot read from Excel with read.table() directly, but there are at 
least three other ways, in particular by using RODBC or exporting / 
importing through in ASCII format.

Uwe Ligges

Thanks in advance for an answer

Dassy

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help