[R] Loading data into R

2013-01-26 Thread Christofer Bogaso
Hello again,

I generally use Clipboard to load data into R from Excel using the
read.delim() function. In most cases, my data after loading looks like
below:

myData - structure(list(V1 = structure(c(3L, 2L, 1L, 1L, 2L), .Label = c(,
2, a), class = factor), V2 = structure(c(4L, 3L, 1L, 2L,
1L), .Label = c(, 34, 4, b), class = factor), V3 = structure(c(3L,
1L, 1L, 1L, 2L), .Label = c(, 4, c), class = factor),
V4 = structure(c(3L, 1L, 1L, 2L, 1L), .Label = c(, 4,
d), class = factor), V5 = structure(c(4L, 3L, 1L, 1L,
2L), .Label = c(, 4, 7, f), class = factor)), .Names = c(V1,
V2, V3, V4, V5), class = data.frame, row.names = c(NA,
-5L))


 myData
  V1 V2 V3 V4 V5
1  a  b  c  d  f
2  2  47
3
434 4
5  2 4 4


Now I want to put this data in a Matrix class with all elements are
character. So tried this :

 as.character(myData)
[1] c(3, 2, 1, 1, 2) c(4, 3, 1, 2, 1) c(3, 1, 1, 1, 2) c(3, 1,
1, 2, 1) c(4, 3, 1, 1, 2)


This looks funny and does not conform the original data. Can somebody
point me what would be right way to put it into Matrix?

Thanks and regards,

__
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] Loading data into R

2013-01-26 Thread Duncan Murdoch

On 13-01-26 3:00 PM, Christofer Bogaso wrote:

Hello again,

I generally use Clipboard to load data into R from Excel using the
read.delim() function. In most cases, my data after loading looks like
below:

myData - structure(list(V1 = structure(c(3L, 2L, 1L, 1L, 2L), .Label = c(,
2, a), class = factor), V2 = structure(c(4L, 3L, 1L, 2L,
1L), .Label = c(, 34, 4, b), class = factor), V3 = structure(c(3L,
1L, 1L, 1L, 2L), .Label = c(, 4, c), class = factor),
 V4 = structure(c(3L, 1L, 1L, 2L, 1L), .Label = c(, 4,
 d), class = factor), V5 = structure(c(4L, 3L, 1L, 1L,
 2L), .Label = c(, 4, 7, f), class = factor)), .Names = c(V1,
V2, V3, V4, V5), class = data.frame, row.names = c(NA,
-5L))



myData

   V1 V2 V3 V4 V5
1  a  b  c  d  f
2  2  47
3
434 4
5  2 4 4


Now I want to put this data in a Matrix class with all elements are
character. So tried this :


as.character(myData)

[1] c(3, 2, 1, 1, 2) c(4, 3, 1, 2, 1) c(3, 1, 1, 1, 2) c(3, 1,
1, 2, 1) c(4, 3, 1, 1, 2)


This looks funny and does not conform the original data. Can somebody
point me what would be right way to put it into Matrix?


Use as.matrix(myData).

Duncan Murdoch

__
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] Loading data into R

2013-01-26 Thread arun
Hi,
myData[]-lapply(myData,as.character)
 as.matrix(myData)
# V1  V2   V3  V4  V5 
#[1,] a b  c d f
#[2,] 2 4      7
#[3,]           
#[4,]   34   4  
#[5,] 2    4   4


str(as.matrix(myData))
# chr [1:5, 1:5] a 2   2 b 4  34  ...
 #- attr(*, dimnames)=List of 2
  #..$ : NULL
  #..$ : chr [1:5] V1 V2 V3 V4 ...
A.K.



- Original Message -
From: Christofer Bogaso bogaso.christo...@gmail.com
To: r-help r-help@r-project.org
Cc: 
Sent: Saturday, January 26, 2013 3:00 PM
Subject: [R] Loading data into R

Hello again,

I generally use Clipboard to load data into R from Excel using the
read.delim() function. In most cases, my data after loading looks like
below:

myData - structure(list(V1 = structure(c(3L, 2L, 1L, 1L, 2L), .Label = c(,
2, a), class = factor), V2 = structure(c(4L, 3L, 1L, 2L,
1L), .Label = c(, 34, 4, b), class = factor), V3 = structure(c(3L,
1L, 1L, 1L, 2L), .Label = c(, 4, c), class = factor),
    V4 = structure(c(3L, 1L, 1L, 2L, 1L), .Label = c(, 4,
    d), class = factor), V5 = structure(c(4L, 3L, 1L, 1L,
    2L), .Label = c(, 4, 7, f), class = factor)), .Names = c(V1,
V2, V3, V4, V5), class = data.frame, row.names = c(NA,
-5L))


 myData
  V1 V2 V3 V4 V5
1  a  b  c  d  f
2  2  4        7
3
4    34     4
5  2     4     4


Now I want to put this data in a Matrix class with all elements are
character. So tried this :

 as.character(myData)
[1] c(3, 2, 1, 1, 2) c(4, 3, 1, 2, 1) c(3, 1, 1, 1, 2) c(3, 1,
1, 2, 1) c(4, 3, 1, 1, 2)


This looks funny and does not conform the original data. Can somebody
point me what would be right way to put it into Matrix?

Thanks and regards,

__
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] Loading Data to R

2008-02-11 Thread Gregory Warnes
On Microsoft Windows systems, it may be more convenient to install  
and use the XLSReadWRite packge.  For non-windows systems, the  
gdata package provides this function, but requires perl to be present.

-Greg
(Maintainer of gdata)



On Feb 9, 2008, at 1:09PM , Henrique Dallazuanna wrote:

 You need library(gdata) before

 On 08/02/2008, Wensui Liu [EMAIL PROTECTED] wrote:
 # READ DATA FROM XLS FILE #

 xls - read.xls(file = C:/projects/Rintro/Part01/export.xls,  
 sheet = 3,
 type = data.frame, from = 1, colNames = TRUE)

 On Feb 8, 2008 3:49 PM, Christine Lynn [EMAIL PROTECTED]  
 wrote:
 This is the most basic question ever...I haven't used R in a  
 couple years
 since college so I forget and haven't been able to find what I'm  
 looking for
 in any of the manuals.

 I just need to figure out how to load a dataset into the program  
 from excel!

 Thanks!

 CL

 [[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.




 --
 ===
 WenSui Liu
 ChoicePoint Precision Marketing
 Phone: 678-893-9457
 Email : [EMAIL PROTECTED]
 Blog   : statcompute.spaces.live.com

 __
 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.



 -- 
 Henrique Dallazuanna
 Curitiba-Paraná-Brasil
 25° 25' 40 S 49° 16' 22 O

 __
 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] Loading Data to R

2008-02-09 Thread John Kane
Have a look at the R Data Import/Export manual on the
R website.  

My simple-minded approach is simply to save the data
as a csv file and read it in using read.table or
read.csv

--- Christine Lynn [EMAIL PROTECTED] wrote:

 This is the most basic question ever...I haven't
 used R in a couple years
 since college so I forget and haven't been able to
 find what I'm looking for
 in any of the manuals.
 
 I just need to figure out how to load a dataset into
 the program from excel!
 
 Thanks!
 
 CL
 
   [[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.


Re: [R] Loading Data to R

2008-02-09 Thread Henrique Dallazuanna
You need library(gdata) before

On 08/02/2008, Wensui Liu [EMAIL PROTECTED] wrote:
 # READ DATA FROM XLS FILE #

 xls - read.xls(file = C:/projects/Rintro/Part01/export.xls, sheet = 3,
 type = data.frame, from = 1, colNames = TRUE)

 On Feb 8, 2008 3:49 PM, Christine Lynn [EMAIL PROTECTED] wrote:
  This is the most basic question ever...I haven't used R in a couple years
  since college so I forget and haven't been able to find what I'm looking for
  in any of the manuals.
 
  I just need to figure out how to load a dataset into the program from excel!
 
  Thanks!
 
  CL
 
  [[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.
 



 --
 ===
 WenSui Liu
 ChoicePoint Precision Marketing
 Phone: 678-893-9457
 Email : [EMAIL PROTECTED]
 Blog   : statcompute.spaces.live.com

 __
 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.



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

__
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] Loading Data to R

2008-02-08 Thread Christine Lynn
This is the most basic question ever...I haven't used R in a couple years
since college so I forget and haven't been able to find what I'm looking for
in any of the manuals.

I just need to figure out how to load a dataset into the program from excel!

Thanks!

CL

[[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] Loading Data to R

2008-02-08 Thread Wensui Liu
# READ DATA FROM XLS FILE #

xls - read.xls(file = C:/projects/Rintro/Part01/export.xls, sheet = 3,
type = data.frame, from = 1, colNames = TRUE)

On Feb 8, 2008 3:49 PM, Christine Lynn [EMAIL PROTECTED] wrote:
 This is the most basic question ever...I haven't used R in a couple years
 since college so I forget and haven't been able to find what I'm looking for
 in any of the manuals.

 I just need to figure out how to load a dataset into the program from excel!

 Thanks!

 CL

 [[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.




-- 
===
WenSui Liu
ChoicePoint Precision Marketing
Phone: 678-893-9457
Email : [EMAIL PROTECTED]
Blog   : statcompute.spaces.live.com

__
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] Loading Data to R

2008-02-08 Thread Gabor Csardi
It is a good idea to start with RSiteSearch(Excel)

G.

On Fri, Feb 08, 2008 at 03:49:29PM -0500, Christine Lynn wrote:
 This is the most basic question ever...I haven't used R in a couple years
 since college so I forget and haven't been able to find what I'm looking for
 in any of the manuals.
 
 I just need to figure out how to load a dataset into the program from excel!
 
 Thanks!
 
 CL
 
   [[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.

-- 
Csardi Gabor [EMAIL PROTECTED]UNIL DGM

__
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.