Error in reading SAS dataset in R 3.0.1 - r

I am trying to read SAS dataset in R 3.0.1.
I have downloaded Hmisc package required to use sas.get function. But I am getting note as below:
Hmisc library by Frank E Harrell Jr
Type library(help='Hmisc'), ?Overview, or ?Hmisc.Overview')
to see overall documentation.
NOTE:Hmisc no longer redefines [.factor to drop unused levels when
subsetting. To get the old behavior of Hmisc type dropUnusedLevels().
Attaching package: ‘Hmisc’
Then I am using the following command:
sas.get(library = "C:\\SAS_dataset", member = "test", formats = FALSE, sasprog = sasprog)
Then the R goes in infinite loop and does not give output. Finally when i press "Esc", it terminates by giving an warning message saying
Warning message:
running command '"C:/program files/SAS/SAS 9.1/sas.exe" "C:\Users\TEJASW~1.ABH\AppData\Local\Temp\RtmpML87zC\SaS13c41642d38.3.sas" -log "_temp_.log"' had status 10708
I tried to find the reason for the same, but all in vain.
I don't understand the reason for this. Is it due to some note given by Hmisc package or something else?
Also I noted that I am facing this problem for latest version i.e. 3.0.1 only. Whereas I was able to read the SAS dataset with the same commands in version 2.15.1.
Can any one help me to solve this problem.
Thanks in advance.
Regards,
Tejasweeni

If you have SAS, you can always export your data to a CSV file and read in R using read.table() or read.csv(). I think this is often the best solution.

Related

Does anyone know what this error message (from the 'readxl' package in R) means?

I'm trying to open an Excel worksheet in R using the 'readxl' package function 'read_excel'.
library(readxl)
Test <- read_excel("Test.xlsx",sheet = "Sheet1")
I've used the exact same bit of code on the exact same excel workbook many times over the past year, and it has never caused a problem. This time, though, I get:
Error: object ‘data_frame’ is not exported by 'namespace:vctrs'
I've tried calling the file different things, moving it to different locations, opening different files etc. but am now always getting this error with the read_excel function. I can usually work out what to do in response to an error message by searching for the relevant string in Google. However, I've tried searching for this error message, and haven't found anything that looks helpful yet. If anyone has any ideas, these would be much appreciated!
It looks like data_frame is relatively new to vctrs. You may need to update your vctrs package. You may have accidentally rolled back to an earlier version?
Seems it was added here:
vctrs 0.3.3 2020-08-27

R Package tm.plugin.webmining does not work with R 3.1.0 (but does with R 2.1.5)

I am using R 3.1.0, along with the tm.plugin.webmining package (within RStudio). Packages are installed fine (along with all dependencies) and I can load the library.
When I try to run a basic test however:
yahoocorpus<-WebCorpus(YahooNewsSource("Microsoft"))
I get:
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) :
object '.Source' not found
This does not occur if I point RStudio to R 2.1.5
I have looked online but not found any resolution of the issue (though somebody did suggest a hack of the source code). It would be great to understand exactly what is causing the problem (and what has changed between versions to make this happen (I also tried 3.0.1, and that also does not work)
Thanks again,
Alan
I think that function WebCorpus does not exist in last version of TM package. Check the doc here!
You have 3 possibilities : DirSource, VectorSource, or DataframeSource.
You can check the source on R with:
{r}
library(tm)
getSources()
Which should give you :
[1] "DataframeSource" "DirSource" "URISource" "VectorSource" "XMLSource"
Cyrille

Using functions from a package in R

I am using a R package Cat
In the help file an example for function data uses dataset head
data(head)
I have my own dataset and I want to try this function data within the package CAT on my dataset A
when I try
library(cat)
A = read.table("C:/A.csv",header=TRUE,sep=",")
data(A)
I get a warning
"Warning message: In data(A) : data set ‘A’ not found*
How do I use specific functions that are part of R packages on my dataset and not the examples in those packages>
As #cenka pointed out, when you are loading your own data, you do not need to use the data() function. That is only for loading data from packages. If you want to use functions from a specific package after you install it, be sure to call library(cat) to actually load the library into your current R session.

Does ggplot2 work with the current version of R (v 2.15.1)?

I am attempting to run the R code from this question
and I get the following error:
Error in rename(x, .base_to_ggplot, warn_missing = FALSE) :
could not find function "revalue"
I wonder whether it's an incompatibility between the R version I'm using and ggplot2 (v. 0.9.3.1). Is anybody aware of this problem, or is my issue something else?
Yes, ggplot2 works with the current version of R (3.0.1)
revalue is not a function in ggplot2, it's a function in plyr as pointed out in the comments.
A simple google search function revalue R will reveal this. Many packages depend on one another - so when you see an error like the one above, you need to use google/some other resource to find which package the missing function is from.

How to specify the package when looking up a help reference page for a function?

How does one look up the help manual page for a function and specify the package in R? For example, count appears in both seqinr and plyr. If I want to look up count in plyr, what's the command? I've tried a few obvious (but wrong) guesses such as "?plyr::count"
EDIT:
When I do ?count, I get the following message:
Help on topic 'count' was found in the following packages:
Package Library
plyr /Library/Frameworks/R.framework/Versions/2.15/Resources/library
seqinr /Library/Frameworks/R.framework/Versions/2.15/Resources/library
When I do ?plyr::count, I get:
No documentation for 'plyr::count' in specified packages and libraries:
you could try '??plyr::count'
When I do ?plyr:::count, I get:
No documentation for 'plyr:::count' in specified packages and libraries:
you could try '??plyr:::count'
Adding two question marks also gets me a no documentation found error as well. Looking up help for non-ambiguous funcitons is working fine (e.g. ?plot)
This is with R 2.15.0 on OSX running in emacs + ESS.
Use the package= argument to help:
help("count", package="plyr")
The correct way to do this is:
?plyr::count
?plyr:::count
See ?"?" for details - both examples are shown.
Both work for me with both packages loaded and even without the package loaded. That begs the question if you have the packages installed?
You were close, you need three : :::
?seqinr:::count # for seqinr
?plyr:::count # for plyr

Resources